From b587fb6208c319105112afe0ab35107d367a1a6b Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Thu, 15 Feb 2018 12:22:25 -0700 Subject: [PATCH] GLSL: Fix #1247. Remove extraneous *= matrix test. --- Test/baseResults/matrix2.frag.out | 6 ++++++ Test/baseResults/matrixError.vert.out | 8 +++++++- Test/matrix2.frag | 1 + Test/matrixError.vert | 2 ++ glslang/MachineIndependent/Intermediate.cpp | 2 +- 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Test/baseResults/matrix2.frag.out b/Test/baseResults/matrix2.frag.out index 880f75ad..3e3b3f06 100644 --- a/Test/baseResults/matrix2.frag.out +++ b/Test/baseResults/matrix2.frag.out @@ -158,6 +158,9 @@ Shader version: 150 0:49 'FragColor' ( out 4-component vector of float) 0:49 Constant: 0:49 3 (const int) +0:50 matrix mult second child into first child ( temp 3X4 matrix of float) +0:50 'm34' ( temp 3X4 matrix of float) +0:50 'colorTransform' ( uniform 3X3 matrix of float) 0:? Linker Objects 0:? 'colorTransform' ( uniform 3X3 matrix of float) 0:? 'Color' ( smooth in 3-component vector of float) @@ -331,6 +334,9 @@ Shader version: 150 0:49 'FragColor' ( out 4-component vector of float) 0:49 Constant: 0:49 3 (const int) +0:50 matrix mult second child into first child ( temp 3X4 matrix of float) +0:50 'm34' ( temp 3X4 matrix of float) +0:50 'colorTransform' ( uniform 3X3 matrix of float) 0:? Linker Objects 0:? 'colorTransform' ( uniform 3X3 matrix of float) 0:? 'Color' ( smooth in 3-component vector of float) diff --git a/Test/baseResults/matrixError.vert.out b/Test/baseResults/matrixError.vert.out index f818892a..0a0d1e40 100644 --- a/Test/baseResults/matrixError.vert.out +++ b/Test/baseResults/matrixError.vert.out @@ -6,7 +6,9 @@ ERROR: 0:18: 'assign' : cannot convert from ' temp 2-component vector of float' ERROR: 0:19: 'xy' : does not apply to this type: temp 2X3 matrix of float ERROR: 0:21: '[' : matrix index out of range '2' ERROR: 0:21: '[' : vector index out of range '4' -ERROR: 7 compilation errors. No code generated. +ERROR: 0:22: 'assign' : cannot convert from ' temp 2X3 matrix of float' to ' temp 2X3 matrix of float' +ERROR: 0:23: 'assign' : cannot convert from ' uniform 3X2 matrix of float' to ' temp 2X3 matrix of float' +ERROR: 9 compilation errors. No code generated. Shader version: 120 @@ -32,6 +34,8 @@ ERROR: node is still EOpNull! 0:21 2 (const int) 0:21 Constant: 0:21 4 (const int) +0:22 'm23' ( temp 2X3 matrix of float) +0:23 'm23' ( temp 2X3 matrix of float) 0:? Linker Objects 0:? 'v3' ( in 3-component vector of float) 0:? 'm32' ( uniform 3X2 matrix of float) @@ -64,6 +68,8 @@ ERROR: node is still EOpNull! 0:21 2 (const int) 0:21 Constant: 0:21 4 (const int) +0:22 'm23' ( temp 2X3 matrix of float) +0:23 'm23' ( temp 2X3 matrix of float) 0:? Linker Objects 0:? 'v3' ( in 3-component vector of float) 0:? 'm32' ( uniform 3X2 matrix of float) diff --git a/Test/matrix2.frag b/Test/matrix2.frag index eb2c53c2..df658044 100644 --- a/Test/matrix2.frag +++ b/Test/matrix2.frag @@ -47,4 +47,5 @@ void main() FragColor *= inv4; FragColor = vec4(FragColor * matrixCompMult(un34, un34), FragColor.w); + m34 *= colorTransform; } diff --git a/Test/matrixError.vert b/Test/matrixError.vert index 3c8cc11f..0ad145b2 100644 --- a/Test/matrixError.vert +++ b/Test/matrixError.vert @@ -19,4 +19,6 @@ void main() m23.xy; // ERROR, can't use . gl_Position = vec4(m23 * m32 * v3, m24[2][4]); // ERROR, 2 and 4 are out of range + m23 *= m23; // ERROR, right side needs to be square + m23 *= m32; // ERROR, left columns must match right rows } diff --git a/glslang/MachineIndependent/Intermediate.cpp b/glslang/MachineIndependent/Intermediate.cpp index 287745b2..d32f9363 100644 --- a/glslang/MachineIndependent/Intermediate.cpp +++ b/glslang/MachineIndependent/Intermediate.cpp @@ -2706,7 +2706,7 @@ bool TIntermediate::promoteBinary(TIntermBinary& node) node.setOp(op = EOpMatrixTimesScalarAssign); } } else if (left->isMatrix() && right->isMatrix()) { - if (left->getMatrixCols() != left->getMatrixRows() || left->getMatrixCols() != right->getMatrixCols() || left->getMatrixCols() != right->getMatrixRows()) + if (left->getMatrixCols() != right->getMatrixCols() || left->getMatrixCols() != right->getMatrixRows()) return false; node.setOp(op = EOpMatrixTimesMatrixAssign); } else if (!left->isMatrix() && !right->isMatrix()) {