Add test for operation semantics, fix one bug it found.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21798 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-05-30 23:31:38 +00:00
parent 69762564de
commit 2327da4784
2 changed files with 10 additions and 8 deletions

View file

@ -26,6 +26,7 @@ comment.frag
300BuiltIns.frag 300BuiltIns.frag
300layout.vert 300layout.vert
300layout.frag 300layout.frag
300operations.frag
330.frag 330.frag
330comp.frag 330comp.frag
constErrors.frag constErrors.frag

View file

@ -1119,11 +1119,14 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
break; break;
} }
// Finish up handling the case where both operands are scalars. // Finish handling the case, for all ops, where both operands are scalars.
if (! left->isVector() && ! left->isMatrix() && if (left->isScalar() && right->isScalar())
! right->isVector() && ! right->isMatrix())
return true; return true;
// Finish handling the case, for all ops, where there are two vectors of different sizes
if (left->isVector() && right->isVector() && left->getVectorSize() != right->getVectorSize())
return false;
// //
// We now have a mix of scalars, vectors, or matrices, for non-relational operations. // We now have a mix of scalars, vectors, or matrices, for non-relational operations.
// //
@ -1156,11 +1159,9 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
return false; return false;
op = EOpMatrixTimesMatrix; op = EOpMatrixTimesMatrix;
setType(TType(basicType, EvqTemporary, 0, right->getMatrixCols(), left->getMatrixRows())); setType(TType(basicType, EvqTemporary, 0, right->getMatrixCols(), left->getMatrixRows()));
} else if (!left->isMatrix() && !right->isMatrix()) { } else if (! left->isMatrix() && ! right->isMatrix()) {
if (left->isVector() && right->isVector()) { if (left->isVector() && right->isVector()) {
if (left->getVectorSize() != right->getVectorSize()) ; // leave as component product
return false;
// leave as component product
} else if (left->isVector() || right->isVector()) { } else if (left->isVector() || right->isVector()) {
op = EOpVectorTimesScalar; op = EOpVectorTimesScalar;
if (right->isVector()) if (right->isVector())
@ -1172,7 +1173,7 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
} }
break; break;
case EOpMulAssign: case EOpMulAssign:
if (!left->isMatrix() && right->isMatrix()) { if (! left->isMatrix() && right->isMatrix()) {
if (left->isVector()) { if (left->isVector()) {
if (left->getVectorSize() != right->getMatrixRows() || left->getVectorSize() != right->getMatrixCols()) if (left->getVectorSize() != right->getMatrixRows() || left->getVectorSize() != right->getMatrixCols())
return false; return false;