diff --git a/Test/baseResults/constFold.frag.out b/Test/baseResults/constFold.frag.out index 33cfcbafedbe74f9a6c70b3b814844caba1c1c8b..2a48c421e82aa3ab8ee85ebc74d1b16c03835691 100644 --- a/Test/baseResults/constFold.frag.out +++ b/Test/baseResults/constFold.frag.out @@ -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) diff --git a/Test/constFold.frag b/Test/constFold.frag old mode 100644 new mode 100755 index 730607885cc087eb376979998d35d071545a084c..daecaa2af7bb52e9bebdac1f9c1837910fcace3d --- a/Test/constFold.frag +++ b/Test/constFold.frag @@ -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; diff --git a/glslang/Include/revision.h b/glslang/Include/revision.h index 91ea3e60848ea826b83b49b1b5e7722ad7e96a2c..bdae4fff546eeee20edf08f0a2f13f9cc64a6c9d 100644 --- a/glslang/Include/revision.h +++ b/glslang/Include/revision.h @@ -1,3 +1,3 @@ // This header is generated by the make-revision script. -#define GLSLANG_PATCH_LEVEL 2787 +#define GLSLANG_PATCH_LEVEL 2793 diff --git a/glslang/MachineIndependent/Constant.cpp b/glslang/MachineIndependent/Constant.cpp index d447bff3667ffaeea7c17204033e4e26bc2d0d1f..26bdced9a0054d657d852fc3df3d107c17ae2e3c 100755 --- a/glslang/MachineIndependent/Constant.cpp +++ b/glslang/MachineIndependent/Constant.cpp @@ -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)