diff --git a/Test/baseResults/constFold.frag.out b/Test/baseResults/constFold.frag.out index 12a94fccc5d96b3a21010727d3006dae90e88527..06fc0200be72c22443758ba72cfc3b61b065a540 100644 --- a/Test/baseResults/constFold.frag.out +++ b/Test/baseResults/constFold.frag.out @@ -231,6 +231,32 @@ ERROR: node is still EOpNull! 0:118 'p' (int) 0:118 Constant: 0:118 -2147483647 (const int) +0:119 Sequence +0:119 move second child to first child (float) +0:119 'f' (float) +0:119 Constant: +0:119 1.444000 +0:120 move second child to first child (float) +0:120 'f' (float) +0:120 direct index (float) +0:120 Construct vec4 (4-component vector of float) +0:120 Test condition and select (float) +0:120 Condition +0:120 Compare Less Than (bool) +0:120 direct index (float) +0:120 'inv' (smooth in 4-component vector of float) +0:120 Constant: +0:120 0 (const int) +0:120 Constant: +0:120 2.400000 +0:120 true case +0:120 Constant: +0:120 -1.000000 +0:120 false case +0:120 Constant: +0:120 1.000000 +0:120 Constant: +0:120 3 (const int) 0:? Linker Objects 0:? 'a' (const int) 0:? 1 (const int) @@ -532,6 +558,32 @@ ERROR: node is still EOpNull! 0:118 'p' (int) 0:118 Constant: 0:118 -2147483647 (const int) +0:119 Sequence +0:119 move second child to first child (float) +0:119 'f' (float) +0:119 Constant: +0:119 1.444000 +0:120 move second child to first child (float) +0:120 'f' (float) +0:120 direct index (float) +0:120 Construct vec4 (4-component vector of float) +0:120 Test condition and select (float) +0:120 Condition +0:120 Compare Less Than (bool) +0:120 direct index (float) +0:120 'inv' (smooth in 4-component vector of float) +0:120 Constant: +0:120 0 (const int) +0:120 Constant: +0:120 2.400000 +0:120 true case +0:120 Constant: +0:120 -1.000000 +0:120 false case +0:120 Constant: +0:120 1.000000 +0:120 Constant: +0:120 3 (const int) 0:? Linker Objects 0:? 'a' (const int) 0:? 1 (const int) diff --git a/Test/constFold.frag b/Test/constFold.frag index aa8a94beaa7013093daf27608b0317233cb99ecc..ae0817a61c0a6bb390b4c95c075eb4b69c06a774 100644 --- a/Test/constFold.frag +++ b/Test/constFold.frag @@ -116,4 +116,6 @@ void foo2() p = -2147483647 / -1; p = -2147483648 / -1; p = 2147483647 / -1; + float f = vec4(7.8 < 2.4 ? -1.333 : 1.444).a; + f = vec4(inv.x < 2.4 ? -1.0 : 1.0).a; // not folded, ensuring no propagation } diff --git a/glslang/MachineIndependent/Intermediate.cpp b/glslang/MachineIndependent/Intermediate.cpp index 7a9514b1ed35cae5de858a2117ab31421f756f51..c3c06d4e988740730d29edb983344ee705b37550 100644 --- a/glslang/MachineIndependent/Intermediate.cpp +++ b/glslang/MachineIndependent/Intermediate.cpp @@ -784,6 +784,7 @@ TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* true // Make a selection node. // TIntermSelection* node = new TIntermSelection(cond, trueBlock, falseBlock, trueBlock->getType()); + node->getQualifier().storage = EvqTemporary; node->setLoc(loc); node->getQualifier().precision = std::max(trueBlock->getQualifier().precision, falseBlock->getQualifier().precision);