Remove unused execution modes when removing entry points

This commit is contained in:
baldurk
2021-11-16 16:27:17 +00:00
parent c6a915f4b4
commit 5312c86592
2 changed files with 24 additions and 0 deletions
+11
View File
@@ -483,6 +483,17 @@ static void ConvertToMeshOutputCompute(const ShaderReflection &refl,
editor.Remove(it);
}
for(rdcspv::Iter it = editor.Begin(rdcspv::Section::ExecutionMode),
end = editor.End(rdcspv::Section::ExecutionMode);
it < end; ++it)
{
// this can also handle ExecutionModeId and we don't care about the difference
rdcspv::OpExecutionMode execMode(it);
if(execMode.entryPoint != entryID)
editor.Remove(it);
}
for(rdcspv::Iter it = editor.Begin(rdcspv::Section::DebugNames),
end2 = editor.End(rdcspv::Section::DebugNames);
it < end2; ++it)
@@ -3007,6 +3007,19 @@ static void CreatePSInputFetcher(rdcarray<uint32_t> &fragspv, uint32_t &structSt
it++;
}
it = editor.Begin(rdcspv::Section::ExecutionMode);
end = editor.End(rdcspv::Section::ExecutionMode);
while(it < end)
{
// this can also handle ExecutionModeId and we don't care about the difference
rdcspv::OpExecutionMode execMode(it);
// remove any execution modes not for our entry
if(execMode.entryPoint != entryID)
editor.Remove(it);
it++;
}
// remove any OpName that refers to deleted IDs - functions or results
it = editor.Begin(rdcspv::Section::DebugNames);
end = editor.End(rdcspv::Section::DebugNames);