From 5312c8659228d5808f9788f511d179081a971c23 Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 16 Nov 2021 16:27:17 +0000 Subject: [PATCH] Remove unused execution modes when removing entry points --- renderdoc/driver/vulkan/vk_postvs.cpp | 11 +++++++++++ renderdoc/driver/vulkan/vk_shaderdebug.cpp | 13 +++++++++++++ 2 files changed, 24 insertions(+) diff --git a/renderdoc/driver/vulkan/vk_postvs.cpp b/renderdoc/driver/vulkan/vk_postvs.cpp index c7683201f..a2c1ca49e 100644 --- a/renderdoc/driver/vulkan/vk_postvs.cpp +++ b/renderdoc/driver/vulkan/vk_postvs.cpp @@ -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) diff --git a/renderdoc/driver/vulkan/vk_shaderdebug.cpp b/renderdoc/driver/vulkan/vk_shaderdebug.cpp index 330ec8cb3..9348462dc 100644 --- a/renderdoc/driver/vulkan/vk_shaderdebug.cpp +++ b/renderdoc/driver/vulkan/vk_shaderdebug.cpp @@ -3007,6 +3007,19 @@ static void CreatePSInputFetcher(rdcarray &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);