diff --git a/Test/baseResults/reflection.vert.out b/Test/baseResults/reflection.vert.out index 55e0844b..422c049b 100644 --- a/Test/baseResults/reflection.vert.out +++ b/Test/baseResults/reflection.vert.out @@ -73,6 +73,7 @@ abl2.foo: offset 0, type 1406, size 1, index 11, binding -1 buf1.runtimeArray: offset 4, type 1406, size 4, index 12, binding -1 buf2.runtimeArray.c: offset 8, type 1406, size 1, index 13, binding -1 buf3.runtimeArray: offset 4, type 1406, size 0, index 14, binding -1 +buf4.runtimeArray.c: offset 8, type 1406, size 1, index 15, binding -1 anonMember1: offset 0, type 8b51, size 1, index 0, binding -1 uf1: offset -1, type 1406, size 1, index -1, binding -1 uf2: offset -1, type 1406, size 1, index -1, binding -1 diff --git a/glslang/MachineIndependent/reflection.cpp b/glslang/MachineIndependent/reflection.cpp index c3bdb7f4..50fb6027 100644 --- a/glslang/MachineIndependent/reflection.cpp +++ b/glslang/MachineIndependent/reflection.cpp @@ -181,7 +181,7 @@ public: switch (visitNode->getOp()) { case EOpIndexIndirect: // Visit all the indices of this array, and for each one add on the remaining dereferencing - for (int i = 0; i < visitNode->getLeft()->getType().getOuterArraySize(); ++i) { + for (int i = 0; i < std::max(visitNode->getLeft()->getType().getOuterArraySize(), 1); ++i) { TString newBaseName = name; if (baseType.getBasicType() != EbtBlock) newBaseName.append(TString("[") + String(i) + "]"); @@ -216,7 +216,7 @@ public: if (terminalType->isArray()) { // Visit all the indices of this array, and for each one, // fully explode the remaining aggregate to dereference - for (int i = 0; i < terminalType->getOuterArraySize(); ++i) { + for (int i = 0; i < std::max(terminalType->getOuterArraySize(), 1); ++i) { TString newBaseName = name; newBaseName.append(TString("[") + String(i) + "]"); TType derefType(*terminalType, 0);