Merge pull request #1571 from dj2/result
Handle potentially uninitialized result
This commit is contained in:
commit
7274bbc27c
@ -2775,7 +2775,9 @@ spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol*
|
|||||||
// can still have a mapping to a SPIR-V Id.
|
// can still have a mapping to a SPIR-V Id.
|
||||||
// This includes specialization constants.
|
// This includes specialization constants.
|
||||||
if (node->getQualifier().isConstant()) {
|
if (node->getQualifier().isConstant()) {
|
||||||
return createSpvConstant(*node);
|
spv::Id result = createSpvConstant(*node);
|
||||||
|
if (result != spv::NoResult)
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now, handle actual variables
|
// Now, handle actual variables
|
||||||
@ -7302,6 +7304,9 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TIntermTyped& n
|
|||||||
} else if (auto* const_union_array = &sn->getConstArray()) {
|
} else if (auto* const_union_array = &sn->getConstArray()) {
|
||||||
int nextConst = 0;
|
int nextConst = 0;
|
||||||
result = createSpvConstantFromConstUnionArray(sn->getType(), *const_union_array, nextConst, true);
|
result = createSpvConstantFromConstUnionArray(sn->getType(), *const_union_array, nextConst, true);
|
||||||
|
} else {
|
||||||
|
logger->missingFunctionality("Invalid initializer for spec onstant.");
|
||||||
|
return spv::NoResult;
|
||||||
}
|
}
|
||||||
builder.addName(result, sn->getName().c_str());
|
builder.addName(result, sn->getName().c_str());
|
||||||
return result;
|
return result;
|
||||||
@ -7310,7 +7315,6 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TIntermTyped& n
|
|||||||
// Neither a front-end constant node, nor a specialization constant node with constant union array or
|
// Neither a front-end constant node, nor a specialization constant node with constant union array or
|
||||||
// constant sub tree as initializer.
|
// constant sub tree as initializer.
|
||||||
logger->missingFunctionality("Neither a front-end constant nor a spec constant.");
|
logger->missingFunctionality("Neither a front-end constant nor a spec constant.");
|
||||||
exit(1);
|
|
||||||
return spv::NoResult;
|
return spv::NoResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user