Merge branch 'HaydnTrigg-patch-1'

This commit is contained in:
John Kessenich 2018-07-02 16:04:31 -06:00
commit 513cc4cf87
4 changed files with 14 additions and 3 deletions

View File

@ -179,6 +179,10 @@ ERROR: node is still EOpNull!
0:83 2147483647 (const int)
0:84 Constant:
0:84 +1.#INF
0:84 Constant:
0:84 -1.#INF
0:84 Constant:
0:84 1.#IND
0:88 Constant:
0:88 2 (const uint)
0:88 3 (const uint)

2
Test/constFold.frag Normal file → Executable file
View File

@ -81,7 +81,7 @@ void foo()
a[0] = s.m[1].z; // 7.0
b % 0; // int
b / 0;
e / 0;
e / 0; -e / 0; 0.0 / 0.0;
const uint ua = 5;
const uvec2 ub = uvec2(6, 7);
const uint uc = 8;

View File

@ -1,3 +1,3 @@
// This header is generated by the make-revision script.
#define GLSLANG_PATCH_LEVEL 2787
#define GLSLANG_PATCH_LEVEL 2793

View File

@ -179,7 +179,14 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right
case EbtDouble:
case EbtFloat:
case EbtFloat16:
newConstArray[i].setDConst(leftUnionArray[i].getDConst() / rightUnionArray[i].getDConst());
if (rightUnionArray[i].getDConst() != 0.0)
newConstArray[i].setDConst(leftUnionArray[i].getDConst() / rightUnionArray[i].getDConst());
else if (leftUnionArray[i].getDConst() > 0.0)
newConstArray[i].setDConst((double)INFINITY);
else if (leftUnionArray[i].getDConst() < 0.0)
newConstArray[i].setDConst((double)-INFINITY);
else
newConstArray[i].setDConst((double)NAN);
break;
case EbtInt8:
if (rightUnionArray[i] == (signed char)0)