SPV: Protect getStorageClass() with a test that the thing is pointer.
This commit is contained in:
parent
33661450c7
commit
e00e72ded1
6 changed files with 128 additions and 5 deletions
|
|
@ -599,9 +599,11 @@ void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol)
|
|||
builder.setAccessChainLValue(id);
|
||||
} else {
|
||||
// finish off the entry-point SPV instruction by adding the Input/Output <id>
|
||||
spv::StorageClass sc = builder.getStorageClass(id);
|
||||
if (sc == spv::StorageClassInput || sc == spv::StorageClassOutput)
|
||||
entryPoint->addIdOperand(id);
|
||||
if (builder.isPointer(id)) {
|
||||
spv::StorageClass sc = builder.getStorageClass(id);
|
||||
if (sc == spv::StorageClassInput || sc == spv::StorageClassOutput)
|
||||
entryPoint->addIdOperand(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -293,7 +293,12 @@ public:
|
|||
|
||||
Instruction* getInstruction(Id id) const { return idToInstruction[id]; }
|
||||
spv::Id getTypeId(Id resultId) const { return idToInstruction[resultId]->getTypeId(); }
|
||||
StorageClass getStorageClass(Id typeId) const { return (StorageClass)idToInstruction[typeId]->getImmediateOperand(0); }
|
||||
StorageClass getStorageClass(Id typeId) const
|
||||
{
|
||||
assert(idToInstruction[typeId]->getOpCode() == spv::OpTypePointer);
|
||||
return (StorageClass)idToInstruction[typeId]->getImmediateOperand(0);
|
||||
}
|
||||
|
||||
void dump(std::vector<unsigned int>& out) const
|
||||
{
|
||||
for (int f = 0; f < (int)functions.size(); ++f)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue