Added constant folding for relational (e.g. lessThan) built-ins, relational built-ins for uints, and bitwise ops for mixed scalars and vectors.
Also, allow comments to precede "#version 100". git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23974 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
0876a58203
commit
77d908af8a
10 changed files with 151 additions and 9 deletions
|
|
@ -551,6 +551,12 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
|
|||
case EOpMax:
|
||||
case EOpMix:
|
||||
case EOpClamp:
|
||||
case EOpLessThan:
|
||||
case EOpGreaterThan:
|
||||
case EOpLessThanEqual:
|
||||
case EOpGreaterThanEqual:
|
||||
case EOpVectorEqual:
|
||||
case EOpVectorNotEqual:
|
||||
componentwise = true;
|
||||
objectSize = children[0]->getAsConstantUnion()->getType().getObjectSize();
|
||||
break;
|
||||
|
|
@ -638,6 +644,24 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
|
|||
newConstArray[comp].setUConst(std::min(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()),
|
||||
childConstUnions[2][arg2comp].getUConst()));
|
||||
break;
|
||||
case EOpLessThan:
|
||||
newConstArray[comp].setBConst(childConstUnions[0][arg0comp] < childConstUnions[1][arg1comp]);
|
||||
break;
|
||||
case EOpGreaterThan:
|
||||
newConstArray[comp].setBConst(childConstUnions[0][arg0comp] > childConstUnions[1][arg1comp]);
|
||||
break;
|
||||
case EOpLessThanEqual:
|
||||
newConstArray[comp].setBConst(! (childConstUnions[0][arg0comp] > childConstUnions[1][arg1comp]));
|
||||
break;
|
||||
case EOpGreaterThanEqual:
|
||||
newConstArray[comp].setBConst(! (childConstUnions[0][arg0comp] < childConstUnions[1][arg1comp]));
|
||||
break;
|
||||
case EOpVectorEqual:
|
||||
newConstArray[comp].setBConst(childConstUnions[0][arg0comp] == childConstUnions[1][arg1comp]);
|
||||
break;
|
||||
case EOpVectorNotEqual:
|
||||
newConstArray[comp].setBConst(childConstUnions[0][arg0comp] != childConstUnions[1][arg1comp]);
|
||||
break;
|
||||
case EOpMix:
|
||||
if (children[2]->getAsTyped()->getBasicType() == EbtBool)
|
||||
newConstArray[comp].setDConst(childConstUnions[2][arg2comp].getBConst() ? childConstUnions[1][arg1comp].getDConst() :
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue