mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-24 07:26:34 +00:00
Add OpName before OpModuleProcessed
The SPIR-V spec requires OpName comes before any OpModuleProcessed. Fixes a SPIR-V validation error on the generated PostVS shader if the original shader has any OpModuleProcessed.
This commit is contained in:
committed by
Baldur Karlsson
parent
2ec0096bc2
commit
9db805a1cd
@@ -314,11 +314,18 @@ void SPIRVEditor::SetName(uint32_t id, const char *name)
|
||||
|
||||
SPIRVOperation op(spv::OpName, uintName);
|
||||
|
||||
size_t offset = sections[SPIRVSection::Debug].endOffset;
|
||||
SPIRVIterator it;
|
||||
|
||||
spirv.insert(spirv.begin() + offset, op.begin(), op.end());
|
||||
RegisterOp(SPIRVIterator(spirv, offset));
|
||||
addWords(offset, op.size());
|
||||
// OpName must be before OpModuleProcessed.
|
||||
for(it = Begin(SPIRVSection::Debug); it < End(SPIRVSection::Debug); ++it)
|
||||
{
|
||||
if(it.opcode() == spv::OpModuleProcessed)
|
||||
break;
|
||||
}
|
||||
|
||||
spirv.insert(spirv.begin() + it.offs(), op.begin(), op.end());
|
||||
RegisterOp(SPIRVIterator(spirv, it.offs()));
|
||||
addWords(it.offs(), op.size());
|
||||
}
|
||||
|
||||
void SPIRVEditor::AddDecoration(const SPIRVOperation &op)
|
||||
|
||||
Reference in New Issue
Block a user