Commit 61c47a95 by John Kessenich

Constant folding: Correct result type of non-square matrix folding.

This also made the function easier to read by identifying left and right operands more clearly.
parent ea0cb2eb
......@@ -229,7 +229,7 @@ spv::Dim TranslateDimensionality(const glslang::TSampler& sampler)
spv::Decoration TranslatePrecisionDecoration(const glslang::TType& type)
{
switch (type.getQualifier().precision) {
case glslang::EpqLow: return spv::DecorationRelaxedPrecision; // TODO: Map instead to 16-bit types?
case glslang::EpqLow: return spv::DecorationRelaxedPrecision;
case glslang::EpqMedium: return spv::DecorationRelaxedPrecision;
case glslang::EpqHigh: return spv::NoPrecision;
default:
......
......@@ -257,6 +257,19 @@ ERROR: node is still EOpNull!
0:120 1.000000
0:120 Constant:
0:120 3 (const int)
0:126 Function Definition: foo3( (global void)
0:126 Function Parameters:
0:128 Sequence
0:128 Sequence
0:128 move second child to first child (temp 3X2 matrix of float)
0:128 'r32' (temp 3X2 matrix of float)
0:128 Constant:
0:128 43.000000
0:128 64.000000
0:128 51.000000
0:128 76.000000
0:128 59.000000
0:128 88.000000
0:? Linker Objects
0:? 'a' (const int)
0:? 1 (const int)
......@@ -331,6 +344,18 @@ ERROR: node is still EOpNull!
0:? 4.000000
0:? 5.000000
0:? 'a4' (global 2-element array of float)
0:? 'mm2' (const 2X2 matrix of float)
0:? 1.000000
0:? 2.000000
0:? 3.000000
0:? 4.000000
0:? 'mm32' (const 3X2 matrix of float)
0:? 10.000000
0:? 11.000000
0:? 12.000000
0:? 13.000000
0:? 14.000000
0:? 15.000000
Linked fragment stage:
......@@ -584,6 +609,19 @@ ERROR: node is still EOpNull!
0:120 1.000000
0:120 Constant:
0:120 3 (const int)
0:126 Function Definition: foo3( (global void)
0:126 Function Parameters:
0:128 Sequence
0:128 Sequence
0:128 move second child to first child (temp 3X2 matrix of float)
0:128 'r32' (temp 3X2 matrix of float)
0:128 Constant:
0:128 43.000000
0:128 64.000000
0:128 51.000000
0:128 76.000000
0:128 59.000000
0:128 88.000000
0:? Linker Objects
0:? 'a' (const int)
0:? 1 (const int)
......@@ -658,4 +696,16 @@ ERROR: node is still EOpNull!
0:? 4.000000
0:? 5.000000
0:? 'a4' (global 2-element array of float)
0:? 'mm2' (const 2X2 matrix of float)
0:? 1.000000
0:? 2.000000
0:? 3.000000
0:? 4.000000
0:? 'mm32' (const 3X2 matrix of float)
0:? 10.000000
0:? 11.000000
0:? 12.000000
0:? 13.000000
0:? 14.000000
0:? 15.000000
......@@ -119,3 +119,11 @@ void foo2()
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
}
const mat2 mm2 = mat2(1.0, 2.0, 3.0, 4.0);
const mat3x2 mm32 = mat3x2(10.0, 11.0, 12.0, 13.0, 14.0, 15.0);
void foo3()
{
mat3x2 r32 = mm2 * mm32;
}
......@@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "SPIRV99.845"
#define GLSLANG_DATE "13-Dec-2015"
#define GLSLANG_REVISION "SPIRV99.849"
#define GLSLANG_DATE "16-Dec-2015"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment