aboutsummaryrefslogtreecommitdiff
path: root/glslang/MachineIndependent/Intermediate.cpp
diff options
context:
space:
mode:
authorJohn Kessenich <cepheus@frii.com>2013-05-30 23:31:38 +0000
committerJohn Kessenich <cepheus@frii.com>2013-05-30 23:31:38 +0000
commit2327da47847675521a184353775f1cb840d1428b (patch)
tree9d74ec7bf1286e6424e3948c34aca5b548d29377 /glslang/MachineIndependent/Intermediate.cpp
parent69762564dee079fedc5e725899b0fa0a4f8430ac (diff)
downloadglslang-2327da47847675521a184353775f1cb840d1428b.tar.gz
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
Diffstat (limited to 'glslang/MachineIndependent/Intermediate.cpp')
-rw-r--r--glslang/MachineIndependent/Intermediate.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/glslang/MachineIndependent/Intermediate.cpp b/glslang/MachineIndependent/Intermediate.cpp
index 5ddd8e65..6c8e4843 100644
--- a/glslang/MachineIndependent/Intermediate.cpp
+++ b/glslang/MachineIndependent/Intermediate.cpp
@@ -1119,11 +1119,14 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
break;
}
- // Finish up handling the case where both operands are scalars.
- if (! left->isVector() && ! left->isMatrix() &&
- ! right->isVector() && ! right->isMatrix())
+ // Finish handling the case, for all ops, where both operands are scalars.
+ if (left->isScalar() && right->isScalar())
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.
//
@@ -1156,11 +1159,9 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
return false;
op = EOpMatrixTimesMatrix;
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->getVectorSize() != right->getVectorSize())
- return false;
- // leave as component product
+ ; // leave as component product
} else if (left->isVector() || right->isVector()) {
op = EOpVectorTimesScalar;
if (right->isVector())
@@ -1172,7 +1173,7 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
}
break;
case EOpMulAssign:
- if (!left->isMatrix() && right->isMatrix()) {
+ if (! left->isMatrix() && right->isMatrix()) {
if (left->isVector()) {
if (left->getVectorSize() != right->getMatrixRows() || left->getVectorSize() != right->getMatrixCols())
return false;