GLSL reflection: Fix #985: reflect runtime sized arrays having no constant index.

This commit is contained in:
John Kessenich 2017-07-28 17:33:58 -06:00
parent a353bf1f20
commit a58cc9ffdf
2 changed files with 3 additions and 2 deletions

View File

@ -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

View File

@ -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);