Front-end precise: Propagate noContraction up the AST when dereferencing structs.
authorJohn Kessenich <cepheus@frii.com>
Wed, 4 May 2016 19:24:47 +0000 (13:24 -0600)
committerJohn Kessenich <cepheus@frii.com>
Wed, 4 May 2016 19:29:21 +0000 (13:29 -0600)
This should be the last commit in this sequence to form the base of the work
in pull request #222.

Test/baseResults/specExamples.vert.out
glslang/MachineIndependent/ParseHelper.cpp

index 5f798a7..7de02d3 100644 (file)
@@ -110,7 +110,7 @@ ERROR: node is still EOpNull!
 0:161              'c' (in 4-component vector of float)
 0:161              'd' (in 4-component vector of float)
 0:162      move second child to first child (temp 3-component vector of float)
-0:162        vector swizzle (temp 3-component vector of float)
+0:162        vector swizzle (noContraction temp 3-component vector of float)
 0:162          'v' (noContraction smooth out 4-component vector of float)
 0:162          Sequence
 0:162            Constant:
@@ -123,7 +123,7 @@ ERROR: node is still EOpNull!
 0:162          'r' (temp 3-component vector of float)
 0:162          's' (temp 3-component vector of float)
 0:163      move second child to first child (temp float)
-0:163        direct index (temp float)
+0:163        direct index (noContraction temp float)
 0:163          'v' (noContraction smooth out 4-component vector of float)
 0:163          Constant:
 0:163            3 (const int)
@@ -147,7 +147,7 @@ ERROR: node is still EOpNull!
 0:163              Constant:
 0:163                3 (const int)
 0:164      move second child to first child (temp float)
-0:164        direct index (temp float)
+0:164        direct index (noContraction temp float)
 0:164          'v' (noContraction smooth out 4-component vector of float)
 0:164          Constant:
 0:164            0 (const int)
@@ -169,7 +169,7 @@ ERROR: node is still EOpNull!
 0:164            Constant:
 0:164              0 (const int)
 0:166      move second child to first child (temp float)
-0:166        direct index (temp float)
+0:166        direct index (noContraction temp float)
 0:166          'v' (noContraction smooth out 4-component vector of float)
 0:166          Constant:
 0:166            0 (const int)
@@ -209,7 +209,7 @@ ERROR: node is still EOpNull!
 0:167            'd' (in 4-component vector of float)
 0:167            Constant:
 0:167              0 (const int)
-0:167        direct index (temp float)
+0:167        direct index (noContraction temp float)
 0:167          'v' (noContraction smooth out 4-component vector of float)
 0:167          Constant:
 0:167            0 (const int)
@@ -394,7 +394,7 @@ ERROR: node is still EOpNull!
 0:161              'c' (in 4-component vector of float)
 0:161              'd' (in 4-component vector of float)
 0:162      move second child to first child (temp 3-component vector of float)
-0:162        vector swizzle (temp 3-component vector of float)
+0:162        vector swizzle (noContraction temp 3-component vector of float)
 0:162          'v' (noContraction smooth out 4-component vector of float)
 0:162          Sequence
 0:162            Constant:
@@ -407,7 +407,7 @@ ERROR: node is still EOpNull!
 0:162          'r' (temp 3-component vector of float)
 0:162          's' (temp 3-component vector of float)
 0:163      move second child to first child (temp float)
-0:163        direct index (temp float)
+0:163        direct index (noContraction temp float)
 0:163          'v' (noContraction smooth out 4-component vector of float)
 0:163          Constant:
 0:163            3 (const int)
@@ -431,7 +431,7 @@ ERROR: node is still EOpNull!
 0:163              Constant:
 0:163                3 (const int)
 0:164      move second child to first child (temp float)
-0:164        direct index (temp float)
+0:164        direct index (noContraction temp float)
 0:164          'v' (noContraction smooth out 4-component vector of float)
 0:164          Constant:
 0:164            0 (const int)
@@ -453,7 +453,7 @@ ERROR: node is still EOpNull!
 0:164            Constant:
 0:164              0 (const int)
 0:166      move second child to first child (temp float)
-0:166        direct index (temp float)
+0:166        direct index (noContraction temp float)
 0:166          'v' (noContraction smooth out 4-component vector of float)
 0:166          Constant:
 0:166            0 (const int)
@@ -493,7 +493,7 @@ ERROR: node is still EOpNull!
 0:167            'd' (in 4-component vector of float)
 0:167            Constant:
 0:167              0 (const int)
-0:167        direct index (temp float)
+0:167        direct index (noContraction temp float)
 0:167          'v' (noContraction smooth out 4-component vector of float)
 0:167          Constant:
 0:167            0 (const int)
index 12b7fab..3373d2f 100644 (file)
@@ -781,7 +781,7 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm
 
     //
     // .length() can't be resolved until we later see the function-calling syntax.
-    // Save away the name in the AST for now.  Processing is compeleted in 
+    // Save away the name in the AST for now.  Processing is completed in 
     // handleLengthMethod().
     //
     if (field == "length") {
@@ -879,6 +879,10 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm
     } else
         error(loc, "does not apply to this type:", field.c_str(), base->getType().getCompleteString().c_str());
 
+    // Propagate noContraction up the dereference chain
+    if (base->getQualifier().noContraction)
+        result->getWritableType().getQualifier().noContraction = true;
+
     return result;
 }