Title: [279426] trunk/Source/ThirdParty/ANGLE
Revision
279426
Author
[email protected]
Date
2021-06-30 11:33:36 -0700 (Wed, 30 Jun 2021)

Log Message

ASSERT in  webgl/1.0.x/conformance/glsl/misc/uninitialized-local-global-variables.html   IdGen ASSERT(*base != '_');
https://bugs.webkit.org/show_bug.cgi?id=227482

Patch by Kimmo Kinnunen <[email protected]> on 2021-06-30
Reviewed by Kenneth Russell.

Give unnamed structs normal "_<number>" name.
The original code thought it gave "ANGLE__unnamed<number>", but in reality it
gave "__unnamed<number>".
Since other constructs already create names of form "_<number>", it is unwarranted to
special case this particular case to give "_unnamed<number>" or "ANGLE_unnamed<number" or
"ANGLE_<number>".

* src/compiler/translator/TranslatorMetalDirect/SeparateCompoundStructDeclarations.cpp:
* src/tests/compiler_tests/MSLOutput_test.cpp:
(TEST_F):

Modified Paths

Diff

Modified: trunk/Source/ThirdParty/ANGLE/ChangeLog (279425 => 279426)


--- trunk/Source/ThirdParty/ANGLE/ChangeLog	2021-06-30 18:31:32 UTC (rev 279425)
+++ trunk/Source/ThirdParty/ANGLE/ChangeLog	2021-06-30 18:33:36 UTC (rev 279426)
@@ -1,3 +1,21 @@
+2021-06-30  Kimmo Kinnunen  <[email protected]>
+
+        ASSERT in  webgl/1.0.x/conformance/glsl/misc/uninitialized-local-global-variables.html   IdGen ASSERT(*base != '_');
+        https://bugs.webkit.org/show_bug.cgi?id=227482
+
+        Reviewed by Kenneth Russell.
+
+        Give unnamed structs normal "_<number>" name.
+        The original code thought it gave "ANGLE__unnamed<number>", but in reality it
+        gave "__unnamed<number>".
+        Since other constructs already create names of form "_<number>", it is unwarranted to
+        special case this particular case to give "_unnamed<number>" or "ANGLE_unnamed<number" or
+        "ANGLE_<number>".
+
+        * src/compiler/translator/TranslatorMetalDirect/SeparateCompoundStructDeclarations.cpp:
+        * src/tests/compiler_tests/MSLOutput_test.cpp:
+        (TEST_F):
+
 2021-06-29  Kimmo Kinnunen  <[email protected]>
 
         ANGLE Metal primitive restart range computation could index with size_t

Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/IdGen.cpp (279425 => 279426)


--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/IdGen.cpp	2021-06-30 18:31:32 UTC (rev 279425)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/IdGen.cpp	2021-06-30 18:33:36 UTC (rev 279426)
@@ -95,3 +95,9 @@
     return createNewName(baseNames.size(), baseNames.begin(),
                          [](const char *s) { return ImmutableString(s); });
 }
+
+Name IdGen::createNewName()
+{
+    // FIXME: This will be refactored later.
+    return createNewName<int>(0, nullptr, [](int) { return kEmptyImmutableString; });
+}

Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/IdGen.h (279425 => 279426)


--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/IdGen.h	2021-06-30 18:31:32 UTC (rev 279425)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/IdGen.h	2021-06-30 18:33:36 UTC (rev 279426)
@@ -26,6 +26,7 @@
     Name createNewName(std::initializer_list<ImmutableString> baseNames);
     Name createNewName(std::initializer_list<Name> baseNames);
     Name createNewName(std::initializer_list<const char *> baseNames);
+    Name createNewName();
 
   private:
     template <typename String, typename StringToImmutable>

Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/SeparateCompoundExpressions.cpp (279425 => 279426)


--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/SeparateCompoundExpressions.cpp	2021-06-30 18:31:32 UTC (rev 279425)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/SeparateCompoundExpressions.cpp	2021-06-30 18:33:36 UTC (rev 279426)
@@ -234,7 +234,7 @@
             return;
         }
         auto &bindingMap = getCurrBindingMap();
-        const Name name  = mIdGen.createNewName("");
+        const Name name = mIdGen.createNewName();
         auto *var =
             new TVariable(&mSymbolTable, name.rawName(), &newExpr.getType(), name.symbolType());
         auto *decl = new TIntermDeclaration(var, &newExpr);
@@ -398,7 +398,7 @@
 
         if (op == TOperator::EOpLogicalAnd || op == TOperator::EOpLogicalOr)
         {
-            const Name name = mIdGen.createNewName("");
+            const Name name = mIdGen.createNewName();
             auto *var = new TVariable(&mSymbolTable, name.rawName(), new TType(TBasicType::EbtBool),
                                       name.symbolType());
 
@@ -469,7 +469,7 @@
         TIntermTyped *then  = node.getTrueExpression();
         TIntermTyped *else_ = node.getFalseExpression();
 
-        const Name name = mIdGen.createNewName("");
+        const Name name = mIdGen.createNewName();
         auto *var =
             new TVariable(&mSymbolTable, name.rawName(), &node.getType(), name.symbolType());
 

Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/SeparateCompoundStructDeclarations.cpp (279425 => 279426)


--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/SeparateCompoundStructDeclarations.cpp	2021-06-30 18:31:32 UTC (rev 279425)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/SeparateCompoundStructDeclarations.cpp	2021-06-30 18:33:36 UTC (rev 279426)
@@ -42,7 +42,7 @@
             //Name unnamed inline structs
             if(structure->symbolType() == SymbolType::Empty)
             {
-                const TStructure * structDefn = new TStructure(mSymbolTable,  mIdGen.createNewName("__unnamed").rawName(), &(structure->fields()) , SymbolType::AngleInternal);
+                const TStructure *structDefn = new TStructure(mSymbolTable, mIdGen.createNewName().rawName(), &structure->fields(), SymbolType::AngleInternal);
                 structVar = new TVariable(mSymbolTable, ImmutableString(""),
                                          new TType(structDefn, true), SymbolType::Empty);
                 instanceType = new TType(structDefn, false);

Modified: trunk/Source/ThirdParty/ANGLE/src/tests/compiler_tests/MSLOutput_test.cpp (279425 => 279426)


--- trunk/Source/ThirdParty/ANGLE/src/tests/compiler_tests/MSLOutput_test.cpp	2021-06-30 18:31:32 UTC (rev 279425)
+++ trunk/Source/ThirdParty/ANGLE/src/tests/compiler_tests/MSLOutput_test.cpp	2021-06-30 18:33:36 UTC (rev 279426)
@@ -38,6 +38,8 @@
             gl_FragColor = anonStruct.v;
         })";
     compile(shaderString, SH_VARIABLES);
+    // FIXME: This success condition is expected to fail now.
+    // When WebKit build is able to run the tests, this should be changed to something else.
     ASSERT_TRUE(foundInCode(SH_MSL_METAL_OUTPUT, "__unnamed"));
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to