mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-21 06:51:35 +00:00
Fix ExecutionMode's crashing drivers with compute based mesh output.
The OpExecutionMode entries were being left in place, but pointing to functions which are no longer entry points. This caused the GPU driver to crash (probably trying to look it up).
This commit is contained in:
committed by
Baldur Karlsson
parent
9548e6ecba
commit
71da697812
@@ -659,6 +659,40 @@ static void ConvertToMeshOutputCompute(const ShaderReflection &refl, const SPIRV
|
||||
for(SPIRVIterator end = editor.EndEntries(); it < end; ++it)
|
||||
editor.Remove(it);
|
||||
|
||||
// Strip away any execution modes from the original shaders
|
||||
for(it = editor.BeginEntries(); it < editor.BeginDebug(); ++it)
|
||||
{
|
||||
if(it.opcode() == spv::OpExecutionMode)
|
||||
{
|
||||
SPIRVId modeEntryID = SPIRVId(it.word(1));
|
||||
|
||||
// We only need to be cautious about what we are stripping for the entry
|
||||
// that we are actually translating, the rest aren't used anyways.
|
||||
if(modeEntryID == entryID)
|
||||
{
|
||||
// Lets check to make sure we don't blindly strip away execution modes that
|
||||
// might actually have an impact on the behaviour of the shader.
|
||||
spv::ExecutionMode execMode = spv::ExecutionMode(it.word(2));
|
||||
switch(execMode)
|
||||
{
|
||||
case spv::ExecutionModeXfb: break;
|
||||
default: RDCERR("Unexpected execution mode");
|
||||
}
|
||||
}
|
||||
|
||||
editor.PreModify(it);
|
||||
|
||||
SPIRVOperation op(it);
|
||||
|
||||
// invalid to have a nop here, but it will be stripped out later
|
||||
op.nopRemove(1);
|
||||
op[0] = SPV_NOP;
|
||||
|
||||
editor.PostModify(it);
|
||||
}
|
||||
}
|
||||
|
||||
// Add our compute shader execution mode
|
||||
editor.AddOperation(
|
||||
it, SPIRVOperation(spv::OpExecutionMode, {wrapperEntry, spv::ExecutionModeLocalSize,
|
||||
MeshOutputDispatchWidth, 1, 1}));
|
||||
|
||||
Reference in New Issue
Block a user