Misc. constant-folding fixes: Check % for 0, mat(mat) constructor, index range checking (within constant objects). Also, rationalize addConst*() methods.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23973 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
6d7fe63d76
commit
0876a58203
9 changed files with 245 additions and 114 deletions
|
|
@ -166,7 +166,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
|
|||
|
||||
case EbtInt:
|
||||
if (rightUnionArray[i] == 0) {
|
||||
newConstArray[i].setIConst(0xEFFFFFFF);
|
||||
newConstArray[i].setIConst(0x7FFFFFFF);
|
||||
} else
|
||||
newConstArray[i].setIConst(unionArray[i].getIConst() / rightUnionArray[i].getIConst());
|
||||
break;
|
||||
|
|
@ -207,8 +207,12 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
|
|||
break;
|
||||
|
||||
case EOpMod:
|
||||
for (int i = 0; i < objectSize; i++)
|
||||
newConstArray[i] = unionArray[i] % rightUnionArray[i];
|
||||
for (int i = 0; i < objectSize; i++) {
|
||||
if (rightUnionArray[i] == 0)
|
||||
newConstArray[i] = unionArray[i];
|
||||
else
|
||||
newConstArray[i] = unionArray[i] % rightUnionArray[i];
|
||||
}
|
||||
break;
|
||||
|
||||
case EOpRightShift:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue