Array of array: Implement the core functionality: types, constructors, operations.
There will be subsequent commits to refine semantics, esp. version-specific semantics,
as well as I/O functionality and restrictions.
Note: I'm getting white-space differences in the preprocessor test results,
which I'm not checking in. I think they need to be tagged as binary or something.
diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp
index 1d1dcaf..4b8c933 100755
--- a/SPIRV/GlslangToSpv.cpp
+++ b/SPIRV/GlslangToSpv.cpp
@@ -953,7 +953,7 @@
{
glslang::TIntermTyped* typedNode = node->getSequence()[0]->getAsTyped();
assert(typedNode);
- spv::Id length = builder.makeIntConstant(typedNode->getType().getArraySize());
+ spv::Id length = builder.makeIntConstant(typedNode->getType().getOuterArraySize());
builder.clearAccessChain();
builder.setAccessChainRValue(length);
@@ -1428,7 +1428,7 @@
spv::MissingFunctionality("Unsized array");
arraySize = 8;
} else
- arraySize = type.getArraySize();
+ arraySize = type.getOuterArraySize();
spvType = builder.makeArrayType(spvType, arraySize);
}
@@ -2637,15 +2637,11 @@
spv::Id typeId = convertGlslangToSpvType(glslangType);
if (glslangType.isArray()) {
- glslang::TType elementType;
- elementType.deepCopy(glslangType);
- elementType.dereference();
- for (int i = 0; i < glslangType.getArraySize(); ++i)
+ glslang::TType elementType(glslangType, 0);
+ for (int i = 0; i < glslangType.getOuterArraySize(); ++i)
spvConsts.push_back(createSpvConstant(elementType, consts, nextConst));
} else if (glslangType.isMatrix()) {
- glslang::TType vectorType;
- vectorType.shallowCopy(glslangType);
- vectorType.dereference();
+ glslang::TType vectorType(glslangType, 0);
for (int col = 0; col < glslangType.getMatrixCols(); ++col)
spvConsts.push_back(createSpvConstant(vectorType, consts, nextConst));
} else if (glslangType.getStruct()) {