Fix bug where non-constant test in ?: on a constant results thought the result was const, when it is really a temporary.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@27291 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2014-07-10 23:49:21 +00:00
parent a63faa7907
commit d3c123a034
3 changed files with 55 additions and 0 deletions

View File

@ -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)

View File

@ -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
}

View File

@ -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);