Implement GL_EXT_null_initializer

Adds null initializer syntax (empty braces)
Allows null initialization of shared variables
This commit is contained in:
John Kessenich
2020-06-11 08:30:03 -06:00
committed by Alan Baker
parent 6abdde3ce5
commit c739e03748
17 changed files with 2694 additions and 2355 deletions

View File

@@ -3652,13 +3652,14 @@ spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol*
spv::Id initializer = spv::NoResult;
if (node->getType().getQualifier().storage == glslang::EvqUniform &&
!node->getConstArray().empty()) {
int nextConst = 0;
initializer = createSpvConstantFromConstUnionArray(node->getType(),
node->getConstArray(),
nextConst,
false /* specConst */);
if (node->getType().getQualifier().storage == glslang::EvqUniform && !node->getConstArray().empty()) {
int nextConst = 0;
initializer = createSpvConstantFromConstUnionArray(node->getType(),
node->getConstArray(),
nextConst,
false /* specConst */);
} else if (node->getType().getQualifier().isNullInit()) {
initializer = builder.makeNullConstant(spvType);
}
return builder.createVariable(spv::NoPrecision, storageClass, spvType, name, initializer);