From c24dd2e7aa40bf868c26ea39f1dff1aa3c9ee303 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 4 Oct 2021 17:03:27 +0100 Subject: [PATCH] Use shader stage to properly disambiguate entry points on vulkan * It's possible to have two entry points in a SPIR-V module both named "main" as long as they have different stages. --- .../Windows/ConstantBufferPreviewer.cpp | 2 +- renderdoc/api/replay/renderdoc_replay.h | 4 ++- renderdoc/core/image_viewer.cpp | 5 ++-- renderdoc/core/replay_proxy.cpp | 18 +++++++------ renderdoc/core/replay_proxy.h | 2 +- renderdoc/driver/d3d11/d3d11_replay.cpp | 6 ++--- renderdoc/driver/d3d11/d3d11_replay.h | 4 +-- renderdoc/driver/d3d12/d3d12_replay.cpp | 6 ++--- renderdoc/driver/d3d12/d3d12_replay.h | 4 +-- renderdoc/driver/gl/gl_replay.cpp | 6 ++--- renderdoc/driver/gl/gl_replay.h | 4 +-- renderdoc/driver/shaders/spirv/spirv_debug.h | 2 +- .../shaders/spirv/spirv_debug_setup.cpp | 5 ++-- renderdoc/driver/vulkan/vk_info.cpp | 8 +++--- renderdoc/driver/vulkan/vk_info.h | 15 ++++++++--- renderdoc/driver/vulkan/vk_replay.cpp | 27 ++++++++++--------- renderdoc/driver/vulkan/vk_replay.h | 4 +-- .../driver/vulkan/vk_shader_feedback.cpp | 2 +- renderdoc/driver/vulkan/vk_shaderdebug.cpp | 10 +++---- renderdoc/replay/dummy_driver.cpp | 6 ++--- renderdoc/replay/dummy_driver.h | 4 +-- renderdoc/replay/replay_controller.cpp | 6 ++--- renderdoc/replay/replay_controller.h | 6 ++--- renderdoc/replay/replay_driver.h | 6 ++--- 24 files changed, 88 insertions(+), 74 deletions(-) diff --git a/qrenderdoc/Windows/ConstantBufferPreviewer.cpp b/qrenderdoc/Windows/ConstantBufferPreviewer.cpp index 8e518fa53..2bafb0bd9 100644 --- a/qrenderdoc/Windows/ConstantBufferPreviewer.cpp +++ b/qrenderdoc/Windows/ConstantBufferPreviewer.cpp @@ -161,7 +161,7 @@ void ConstantBufferPreviewer::OnEventChanged(uint32_t eventId) m_Ctx.Replay().AsyncInvoke( [this, prevShader, entryPoint, offset, size, wasEmpty](IReplayController *r) { rdcarray vars = r->GetCBufferVariableContents( - m_pipe, m_shader, entryPoint, m_slot, m_cbuffer, offset, size); + m_pipe, m_shader, m_stage, entryPoint, m_slot, m_cbuffer, offset, size); GUIInvoke::call(this, [this, prevShader, vars, wasEmpty] { RDTreeViewExpansionState &prevShaderExpansionState = diff --git a/renderdoc/api/replay/renderdoc_replay.h b/renderdoc/api/replay/renderdoc_replay.h index 133fa823f..735197d70 100644 --- a/renderdoc/api/replay/renderdoc_replay.h +++ b/renderdoc/api/replay/renderdoc_replay.h @@ -962,6 +962,7 @@ otherwise. :param ResourceId pipeline: The pipeline state object, if applicable, that this shader is bound to. :param ResourceId shader: The id of the shader to use for metadata. +:param ShaderStage stage: The shader stage to fetch variables from. :param str entryPoint: The entry point of the shader being used. In some APIs, this is ignored. :param int cbufslot: The index in the :data:`ShaderReflection.constantBlocks` list to look up. :param ResourceId buffer: The id of the buffer to use for data. If @@ -972,7 +973,8 @@ otherwise. :return: The shader variables with their contents. :rtype: List[ShaderVariable] )"); - virtual rdcarray GetCBufferVariableContents(ResourceId pipeline, ResourceId shader, + virtual rdcarray GetCBufferVariableContents(ResourceId pipeline, + ResourceId shader, ShaderStage stage, const rdcstr &entryPoint, uint32_t cbufslot, ResourceId buffer, uint64_t offset, uint64_t length) = 0; diff --git a/renderdoc/core/image_viewer.cpp b/renderdoc/core/image_viewer.cpp index b033180e4..79fb4b770 100644 --- a/renderdoc/core/image_viewer.cpp +++ b/renderdoc/core/image_viewer.cpp @@ -271,8 +271,9 @@ public: return desc; } rdcarray FetchCounters(const rdcarray &counters) { return {}; } - void FillCBufferVariables(ResourceId pipeline, ResourceId shader, rdcstr entryPoint, - uint32_t cbufSlot, rdcarray &outvars, const bytebuf &data) + void FillCBufferVariables(ResourceId pipeline, ResourceId shader, ShaderStage stage, + rdcstr entryPoint, uint32_t cbufSlot, rdcarray &outvars, + const bytebuf &data) { } void GetBufferData(ResourceId buff, uint64_t offset, uint64_t len, bytebuf &retData) {} diff --git a/renderdoc/core/replay_proxy.cpp b/renderdoc/core/replay_proxy.cpp index cb065cd6a..71bfc45ba 100644 --- a/renderdoc/core/replay_proxy.cpp +++ b/renderdoc/core/replay_proxy.cpp @@ -846,8 +846,9 @@ CounterDescription ReplayProxy::DescribeCounter(GPUCounter counterID) template void ReplayProxy::Proxied_FillCBufferVariables(ParamSerialiser ¶mser, ReturnSerialiser &retser, ResourceId pipeline, ResourceId shader, - rdcstr entryPoint, uint32_t cbufSlot, - rdcarray &outvars, const bytebuf &data) + ShaderStage stage, rdcstr entryPoint, + uint32_t cbufSlot, rdcarray &outvars, + const bytebuf &data) { const ReplayProxyPacket expectedPacket = eReplayProxy_FillCBufferVariables; ReplayProxyPacket packet = eReplayProxy_FillCBufferVariables; @@ -856,6 +857,7 @@ void ReplayProxy::Proxied_FillCBufferVariables(ParamSerialiser ¶mser, Return BEGIN_PARAMS(); SERIALISE_ELEMENT(pipeline); SERIALISE_ELEMENT(shader); + SERIALISE_ELEMENT(stage); SERIALISE_ELEMENT(entryPoint); SERIALISE_ELEMENT(cbufSlot); SERIALISE_ELEMENT(data); @@ -865,17 +867,17 @@ void ReplayProxy::Proxied_FillCBufferVariables(ParamSerialiser ¶mser, Return { REMOTE_EXECUTION(); if(paramser.IsReading() && !paramser.IsErrored() && !m_IsErrored) - m_Remote->FillCBufferVariables(pipeline, shader, entryPoint, cbufSlot, outvars, data); + m_Remote->FillCBufferVariables(pipeline, shader, stage, entryPoint, cbufSlot, outvars, data); } SERIALISE_RETURN(outvars); } -void ReplayProxy::FillCBufferVariables(ResourceId pipeline, ResourceId shader, rdcstr entryPoint, - uint32_t cbufSlot, rdcarray &outvars, - const bytebuf &data) +void ReplayProxy::FillCBufferVariables(ResourceId pipeline, ResourceId shader, ShaderStage stage, + rdcstr entryPoint, uint32_t cbufSlot, + rdcarray &outvars, const bytebuf &data) { - PROXY_FUNCTION(FillCBufferVariables, pipeline, shader, entryPoint, cbufSlot, outvars, data); + PROXY_FUNCTION(FillCBufferVariables, pipeline, shader, stage, entryPoint, cbufSlot, outvars, data); } template @@ -2900,7 +2902,7 @@ bool ReplayProxy::Tick(int type) { rdcarray vars; bytebuf data; - FillCBufferVariables(ResourceId(), ResourceId(), "", 0, vars, data); + FillCBufferVariables(ResourceId(), ResourceId(), ShaderStage::Count, "", 0, vars, data); break; } case eReplayProxy_InitPostVS: InitPostVSBuffers(0); break; diff --git a/renderdoc/core/replay_proxy.h b/renderdoc/core/replay_proxy.h index bfe6869fc..f5aa08e1f 100644 --- a/renderdoc/core/replay_proxy.h +++ b/renderdoc/core/replay_proxy.h @@ -482,7 +482,7 @@ public: const rdcarray &counterID); IMPLEMENT_FUNCTION_PROXIED(void, FillCBufferVariables, ResourceId pipeline, ResourceId shader, - rdcstr entryPoint, uint32_t cbufSlot, + ShaderStage stage, rdcstr entryPoint, uint32_t cbufSlot, rdcarray &outvars, const bytebuf &data); IMPLEMENT_FUNCTION_PROXIED(void, GetBufferData, ResourceId buff, uint64_t offset, uint64_t len, diff --git a/renderdoc/driver/d3d11/d3d11_replay.cpp b/renderdoc/driver/d3d11/d3d11_replay.cpp index 047ce12a8..bbd36789c 100644 --- a/renderdoc/driver/d3d11/d3d11_replay.cpp +++ b/renderdoc/driver/d3d11/d3d11_replay.cpp @@ -2881,9 +2881,9 @@ void D3D11Replay::RenderHighlightBox(float w, float h, float scale) } } -void D3D11Replay::FillCBufferVariables(ResourceId pipeline, ResourceId shader, rdcstr entryPoint, - uint32_t cbufSlot, rdcarray &outvars, - const bytebuf &data) +void D3D11Replay::FillCBufferVariables(ResourceId pipeline, ResourceId shader, ShaderStage stage, + rdcstr entryPoint, uint32_t cbufSlot, + rdcarray &outvars, const bytebuf &data) { auto it = WrappedShader::m_ShaderList.find(shader); diff --git a/renderdoc/driver/d3d11/d3d11_replay.h b/renderdoc/driver/d3d11/d3d11_replay.h index 9ae97ff0b..616c33d86 100644 --- a/renderdoc/driver/d3d11/d3d11_replay.h +++ b/renderdoc/driver/d3d11/d3d11_replay.h @@ -230,8 +230,8 @@ public: void RenderHighlightBox(float w, float h, float scale); - void FillCBufferVariables(ResourceId pipeline, ResourceId shader, rdcstr entryPoint, - uint32_t cbufSlot, rdcarray &outvars, + void FillCBufferVariables(ResourceId pipeline, ResourceId shader, ShaderStage stage, + rdcstr entryPoint, uint32_t cbufSlot, rdcarray &outvars, const bytebuf &data); rdcarray PixelHistory(rdcarray events, ResourceId target, uint32_t x, diff --git a/renderdoc/driver/d3d12/d3d12_replay.cpp b/renderdoc/driver/d3d12/d3d12_replay.cpp index 73afff3a6..df78b9909 100644 --- a/renderdoc/driver/d3d12/d3d12_replay.cpp +++ b/renderdoc/driver/d3d12/d3d12_replay.cpp @@ -2913,9 +2913,9 @@ void D3D12Replay::GetBufferData(ResourceId buff, uint64_t offset, uint64_t lengt GetDebugManager()->GetBufferData(buffer, offset, length, retData); } -void D3D12Replay::FillCBufferVariables(ResourceId pipeline, ResourceId shader, rdcstr entryPoint, - uint32_t cbufSlot, rdcarray &outvars, - const bytebuf &data) +void D3D12Replay::FillCBufferVariables(ResourceId pipeline, ResourceId shader, ShaderStage stage, + rdcstr entryPoint, uint32_t cbufSlot, + rdcarray &outvars, const bytebuf &data) { if(shader == ResourceId()) return; diff --git a/renderdoc/driver/d3d12/d3d12_replay.h b/renderdoc/driver/d3d12/d3d12_replay.h index 1405faa33..3f2ceb5b1 100644 --- a/renderdoc/driver/d3d12/d3d12_replay.h +++ b/renderdoc/driver/d3d12/d3d12_replay.h @@ -206,8 +206,8 @@ public: void RenderHighlightBox(float w, float h, float scale); - void FillCBufferVariables(ResourceId pipeline, ResourceId shader, rdcstr entryPoint, - uint32_t cbufSlot, rdcarray &outvars, + void FillCBufferVariables(ResourceId pipeline, ResourceId shader, ShaderStage stage, + rdcstr entryPoint, uint32_t cbufSlot, rdcarray &outvars, const bytebuf &data); rdcarray PixelHistory(rdcarray events, ResourceId target, uint32_t x, diff --git a/renderdoc/driver/gl/gl_replay.cpp b/renderdoc/driver/gl/gl_replay.cpp index 48ab7cd0d..7964c8363 100644 --- a/renderdoc/driver/gl/gl_replay.cpp +++ b/renderdoc/driver/gl/gl_replay.cpp @@ -2299,9 +2299,9 @@ void GLReplay::OpenGLFillCBufferVariables(ResourceId shader, GLuint prog, bool b } } -void GLReplay::FillCBufferVariables(ResourceId pipeline, ResourceId shader, rdcstr entryPoint, - uint32_t cbufSlot, rdcarray &outvars, - const bytebuf &data) +void GLReplay::FillCBufferVariables(ResourceId pipeline, ResourceId shader, ShaderStage stage, + rdcstr entryPoint, uint32_t cbufSlot, + rdcarray &outvars, const bytebuf &data) { WrappedOpenGL &drv = *m_pDriver; diff --git a/renderdoc/driver/gl/gl_replay.h b/renderdoc/driver/gl/gl_replay.h index 4a7d32efb..38eb445e7 100644 --- a/renderdoc/driver/gl/gl_replay.h +++ b/renderdoc/driver/gl/gl_replay.h @@ -220,8 +220,8 @@ public: void RenderHighlightBox(float w, float h, float scale); - void FillCBufferVariables(ResourceId pipeline, ResourceId shader, rdcstr entryPoint, - uint32_t cbufSlot, rdcarray &outvars, + void FillCBufferVariables(ResourceId pipeline, ResourceId shader, ShaderStage stage, + rdcstr entryPoint, uint32_t cbufSlot, rdcarray &outvars, const bytebuf &data); rdcarray PixelHistory(rdcarray events, ResourceId target, uint32_t x, diff --git a/renderdoc/driver/shaders/spirv/spirv_debug.h b/renderdoc/driver/shaders/spirv/spirv_debug.h index 517db10d0..4f158c25c 100644 --- a/renderdoc/driver/shaders/spirv/spirv_debug.h +++ b/renderdoc/driver/shaders/spirv/spirv_debug.h @@ -328,7 +328,7 @@ private: DenseIdMap strings; rdcarray memberNames; - std::map entryLookup; + std::map entryLookup; SparseIdMap idDeathOffset; diff --git a/renderdoc/driver/shaders/spirv/spirv_debug_setup.cpp b/renderdoc/driver/shaders/spirv/spirv_debug_setup.cpp index 1114c2296..fc7398fda 100644 --- a/renderdoc/driver/shaders/spirv/spirv_debug_setup.cpp +++ b/renderdoc/driver/shaders/spirv/spirv_debug_setup.cpp @@ -518,7 +518,7 @@ ShaderDebugTrace *Debugger::BeginDebug(DebugAPIWrapper *api, const ShaderStage s const std::map &instructionLines, const SPIRVPatchData &patchData, uint32_t activeIndex) { - Id entryId = entryLookup[entryPoint]; + Id entryId = entryLookup[ShaderEntryPoint(entryPoint, shaderStage)]; if(entryId == Id()) { @@ -2440,7 +2440,8 @@ void Debugger::RegisterOp(Iter it) { OpEntryPoint entryPoint(it); - entryLookup[entryPoint.name] = entryPoint.entryPoint; + entryLookup[ShaderEntryPoint(entryPoint.name, MakeShaderStage(entryPoint.executionModel))] = + entryPoint.entryPoint; } else if(opdata.op == Op::Function) { diff --git a/renderdoc/driver/vulkan/vk_info.cpp b/renderdoc/driver/vulkan/vk_info.cpp index a264f948b..db97b2890 100644 --- a/renderdoc/driver/vulkan/vk_info.cpp +++ b/renderdoc/driver/vulkan/vk_info.cpp @@ -375,11 +375,11 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan, shad.entryPoint = pCreateInfo->pStages[i].pName; shad.stage = ShaderStage(stageIndex); - ShaderModuleReflectionKey key(shad.entryPoint, ResourceId()); + ShaderModuleReflectionKey key(shad.stage, shad.entryPoint, ResourceId()); if(pCreateInfo->pStages[i].pSpecializationInfo) { - key = ShaderModuleReflectionKey(shad.entryPoint, id); + key = ShaderModuleReflectionKey(shad.stage, shad.entryPoint, id); const byte *data = (const byte *)pCreateInfo->pStages[i].pSpecializationInfo->pData; @@ -704,11 +704,11 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan, Vulk shad.module = shadid; shad.entryPoint = pCreateInfo->stage.pName; - ShaderModuleReflectionKey key(shad.entryPoint, ResourceId()); + ShaderModuleReflectionKey key(ShaderStage::Compute, shad.entryPoint, ResourceId()); if(pCreateInfo->stage.pSpecializationInfo) { - key = ShaderModuleReflectionKey(shad.entryPoint, id); + key = ShaderModuleReflectionKey(ShaderStage::Compute, shad.entryPoint, id); const byte *data = (const byte *)pCreateInfo->stage.pSpecializationInfo->pData; diff --git a/renderdoc/driver/vulkan/vk_info.h b/renderdoc/driver/vulkan/vk_info.h index b0e1da433..686fb2fb7 100644 --- a/renderdoc/driver/vulkan/vk_info.h +++ b/renderdoc/driver/vulkan/vk_info.h @@ -194,15 +194,22 @@ struct VulkanCreationInfo { struct ShaderModuleReflectionKey { - ShaderModuleReflectionKey(const rdcstr &e, ResourceId p) : entryPoint(e), specialisingPipe(p) {} + ShaderModuleReflectionKey(ShaderStage s, const rdcstr &e, ResourceId p) + : stage(s), entryPoint(e), specialisingPipe(p) + { + } bool operator<(const ShaderModuleReflectionKey &o) const { if(entryPoint != o.entryPoint) return entryPoint < o.entryPoint; + if(stage != o.stage) + return stage < o.stage; return specialisingPipe < o.specialisingPipe; } + // stage of the entry point + ShaderStage stage; // name of the entry point rdcstr entryPoint; // ID of the pipeline ONLY if it contains specialisation constant data @@ -607,15 +614,15 @@ struct VulkanCreationInfo void Init(VulkanResourceManager *resourceMan, VulkanCreationInfo &info, const VkShaderModuleCreateInfo *pCreateInfo); - ShaderModuleReflection &GetReflection(const rdcstr &entry, ResourceId pipe) + ShaderModuleReflection &GetReflection(ShaderStage stage, const rdcstr &entry, ResourceId pipe) { // look for one from this pipeline specifically, if it was specialised - auto it = m_Reflections.find({entry, pipe}); + auto it = m_Reflections.find({stage, entry, pipe}); if(it != m_Reflections.end()) return it->second; // if not, just return the non-specialised version - return m_Reflections[{entry, ResourceId()}]; + return m_Reflections[{stage, entry, ResourceId()}]; } rdcspv::Reflector spirv; diff --git a/renderdoc/driver/vulkan/vk_replay.cpp b/renderdoc/driver/vulkan/vk_replay.cpp index 33327f036..d04ad935e 100644 --- a/renderdoc/driver/vulkan/vk_replay.cpp +++ b/renderdoc/driver/vulkan/vk_replay.cpp @@ -457,11 +457,11 @@ ShaderReflection *VulkanReplay::GetShader(ResourceId pipeline, ResourceId shader // if this shader was never used in a pipeline the reflection won't be prepared. Do that now - // this will be ignored if it was already prepared. - shad->second.GetReflection(entry.name, pipeline) + shad->second.GetReflection(entry.stage, entry.name, pipeline) .Init(GetResourceManager(), shader, shad->second.spirv, entry.name, VkShaderStageFlagBits(1 << uint32_t(entry.stage)), {}); - return shad->second.GetReflection(entry.name, pipeline).refl; + return shad->second.GetReflection(entry.stage, entry.name, pipeline).refl; } rdcarray VulkanReplay::GetDisassemblyTargets(bool withPipeline) @@ -568,7 +568,7 @@ rdcstr VulkanReplay::DisassembleShader(ResourceId pipeline, const ShaderReflecti if(target == SPIRVDisassemblyTarget || target.empty()) { VulkanCreationInfo::ShaderModuleReflection &moduleRefl = - it->second.GetReflection(refl->entryPoint, pipeline); + it->second.GetReflection(refl->stage, refl->entryPoint, pipeline); moduleRefl.PopulateDisassembly(it->second.spirv); return moduleRefl.disassembly; @@ -587,8 +587,8 @@ rdcstr VulkanReplay::DisassembleShader(ResourceId pipeline, const ShaderReflecti VkPipeline pipe = m_pDriver->GetResourceManager()->GetCurrentHandle(pipeline); - VkShaderStageFlagBits stageBit = - VkShaderStageFlagBits(1 << it->second.GetReflection(refl->entryPoint, pipeline).stageIndex); + VkShaderStageFlagBits stageBit = VkShaderStageFlagBits( + 1 << it->second.GetReflection(refl->stage, refl->entryPoint, pipeline).stageIndex); size_t size; vt->GetShaderInfoAMD(Unwrap(dev), Unwrap(pipe), stageBit, VK_SHADER_INFO_TYPE_DISASSEMBLY_AMD, @@ -613,8 +613,8 @@ rdcstr VulkanReplay::DisassembleShader(ResourceId pipeline, const ShaderReflecti CachePipelineExecutables(pipeline); - VkShaderStageFlagBits stageBit = - VkShaderStageFlagBits(1 << it->second.GetReflection(refl->entryPoint, pipeline).stageIndex); + VkShaderStageFlagBits stageBit = VkShaderStageFlagBits( + 1 << it->second.GetReflection(refl->stage, refl->entryPoint, pipeline).stageIndex); const rdcarray &executables = m_PipelineExecutables[pipeline]; @@ -2026,9 +2026,9 @@ void VulkanReplay::SavePipelineState(uint32_t eventId) } } -void VulkanReplay::FillCBufferVariables(ResourceId pipeline, ResourceId shader, rdcstr entryPoint, - uint32_t cbufSlot, rdcarray &outvars, - const bytebuf &data) +void VulkanReplay::FillCBufferVariables(ResourceId pipeline, ResourceId shader, ShaderStage stage, + rdcstr entryPoint, uint32_t cbufSlot, + rdcarray &outvars, const bytebuf &data) { auto it = m_pDriver->m_CreationInfo.m_ShaderModule.find(shader); @@ -2038,8 +2038,8 @@ void VulkanReplay::FillCBufferVariables(ResourceId pipeline, ResourceId shader, return; } - ShaderReflection &refl = *it->second.GetReflection(entryPoint, pipeline).refl; - ShaderBindpointMapping &mapping = it->second.GetReflection(entryPoint, pipeline).mapping; + ShaderReflection &refl = *it->second.GetReflection(stage, entryPoint, pipeline).refl; + ShaderBindpointMapping &mapping = it->second.GetReflection(stage, entryPoint, pipeline).mapping; if(cbufSlot >= (uint32_t)refl.constantBlocks.count()) { @@ -2095,7 +2095,8 @@ void VulkanReplay::FillCBufferVariables(ResourceId pipeline, ResourceId shader, if(pipeIt != m_pDriver->m_CreationInfo.m_Pipeline.end()) { const rdcarray &specInfo = - pipeIt->second.shaders[it->second.GetReflection(entryPoint, pipeline).stageIndex].specialization; + pipeIt->second.shaders[it->second.GetReflection(stage, entryPoint, pipeline).stageIndex] + .specialization; FillSpecConstantVariables(refl.resourceId, c.variables, outvars, specInfo); } diff --git a/renderdoc/driver/vulkan/vk_replay.h b/renderdoc/driver/vulkan/vk_replay.h index 396d1b826..c16aa406e 100644 --- a/renderdoc/driver/vulkan/vk_replay.h +++ b/renderdoc/driver/vulkan/vk_replay.h @@ -389,8 +389,8 @@ public: void RenderHighlightBox(float w, float h, float scale); - void FillCBufferVariables(ResourceId pipeline, ResourceId shader, rdcstr entryPoint, - uint32_t cbufSlot, rdcarray &outvars, + void FillCBufferVariables(ResourceId pipeline, ResourceId shader, ShaderStage stage, + rdcstr entryPoint, uint32_t cbufSlot, rdcarray &outvars, const bytebuf &data); rdcarray PixelHistory(rdcarray events, ResourceId target, uint32_t x, diff --git a/renderdoc/driver/vulkan/vk_shader_feedback.cpp b/renderdoc/driver/vulkan/vk_shader_feedback.cpp index 2bda2fcad..2135e2924 100644 --- a/renderdoc/driver/vulkan/vk_shader_feedback.cpp +++ b/renderdoc/driver/vulkan/vk_shader_feedback.cpp @@ -1817,7 +1817,7 @@ void VulkanReplay::FetchShaderFeedback(uint32_t eventId) { VulkanCreationInfo::ShaderModule &mod = creationInfo.m_ShaderModule[sh.module]; VulkanCreationInfo::ShaderModuleReflection &modrefl = - mod.GetReflection(sh.entryPoint, pipe.pipeline); + mod.GetReflection(stage, sh.entryPoint, pipe.pipeline); modrefl.PopulateDisassembly(mod.spirv); const std::map instructionLines = modrefl.instructionLines; diff --git a/renderdoc/driver/vulkan/vk_shaderdebug.cpp b/renderdoc/driver/vulkan/vk_shaderdebug.cpp index f93f87bbd..71ebadb10 100644 --- a/renderdoc/driver/vulkan/vk_shaderdebug.cpp +++ b/renderdoc/driver/vulkan/vk_shaderdebug.cpp @@ -3741,7 +3741,7 @@ ShaderDebugTrace *VulkanReplay::DebugVertex(uint32_t eventId, uint32_t vertid, u const rdcarray &spec = pipe.shaders[0].specialization; VulkanCreationInfo::ShaderModuleReflection &shadRefl = - shader.GetReflection(entryPoint, state.graphics.pipeline); + shader.GetReflection(ShaderStage::Vertex, entryPoint, state.graphics.pipeline); if(!shadRefl.refl->debugInfo.debuggable) { @@ -3989,7 +3989,7 @@ ShaderDebugTrace *VulkanReplay::DebugPixel(uint32_t eventId, uint32_t x, uint32_ const rdcarray &spec = pipe.shaders[4].specialization; VulkanCreationInfo::ShaderModuleReflection &shadRefl = - shader.GetReflection(entryPoint, state.graphics.pipeline); + shader.GetReflection(ShaderStage::Pixel, entryPoint, state.graphics.pipeline); if(!shadRefl.refl->debugInfo.debuggable) { @@ -4015,8 +4015,8 @@ ShaderDebugTrace *VulkanReplay::DebugPixel(uint32_t eventId, uint32_t x, uint32_ if(pipe.shaders[3].module != ResourceId()) { VulkanCreationInfo::ShaderModuleReflection &gsRefl = - c.m_ShaderModule[pipe.shaders[3].module].GetReflection(pipe.shaders[3].entryPoint, - state.graphics.pipeline); + c.m_ShaderModule[pipe.shaders[3].module].GetReflection( + ShaderStage::Geometry, pipe.shaders[3].entryPoint, state.graphics.pipeline); // check to see if the shader outputs a primitive ID for(const SigParameter &e : gsRefl.refl->outputSignature) @@ -4670,7 +4670,7 @@ ShaderDebugTrace *VulkanReplay::DebugThread(uint32_t eventId, const rdcarray &spec = pipe.shaders[5].specialization; VulkanCreationInfo::ShaderModuleReflection &shadRefl = - shader.GetReflection(entryPoint, state.compute.pipeline); + shader.GetReflection(ShaderStage::Compute, entryPoint, state.compute.pipeline); if(!shadRefl.refl->debugInfo.debuggable) { diff --git a/renderdoc/replay/dummy_driver.cpp b/renderdoc/replay/dummy_driver.cpp index 1cb12e65e..aa707c278 100644 --- a/renderdoc/replay/dummy_driver.cpp +++ b/renderdoc/replay/dummy_driver.cpp @@ -236,9 +236,9 @@ rdcarray DummyDriver::FetchCounters(const rdcarray &c return {}; } -void DummyDriver::FillCBufferVariables(ResourceId pipeline, ResourceId shader, rdcstr entryPoint, - uint32_t cbufSlot, rdcarray &outvars, - const bytebuf &data) +void DummyDriver::FillCBufferVariables(ResourceId pipeline, ResourceId shader, ShaderStage stage, + rdcstr entryPoint, uint32_t cbufSlot, + rdcarray &outvars, const bytebuf &data) { outvars.clear(); } diff --git a/renderdoc/replay/dummy_driver.h b/renderdoc/replay/dummy_driver.h index 1f8cd1552..da976e28a 100644 --- a/renderdoc/replay/dummy_driver.h +++ b/renderdoc/replay/dummy_driver.h @@ -93,8 +93,8 @@ public: CounterDescription DescribeCounter(GPUCounter counterID); rdcarray FetchCounters(const rdcarray &counterID); - void FillCBufferVariables(ResourceId pipeline, ResourceId shader, rdcstr entryPoint, - uint32_t cbufSlot, rdcarray &outvars, + void FillCBufferVariables(ResourceId pipeline, ResourceId shader, ShaderStage stage, + rdcstr entryPoint, uint32_t cbufSlot, rdcarray &outvars, const bytebuf &data); rdcarray PixelHistory(rdcarray events, ResourceId target, uint32_t x, diff --git a/renderdoc/replay/replay_controller.cpp b/renderdoc/replay/replay_controller.cpp index a9eeb223a..126f83b1f 100644 --- a/renderdoc/replay/replay_controller.cpp +++ b/renderdoc/replay/replay_controller.cpp @@ -1674,8 +1674,8 @@ void ReplayController::FreeTrace(ShaderDebugTrace *trace) } rdcarray ReplayController::GetCBufferVariableContents( - ResourceId pipeline, ResourceId shader, const rdcstr &entryPoint, uint32_t cbufslot, - ResourceId buffer, uint64_t offset, uint64_t length) + ResourceId pipeline, ResourceId shader, ShaderStage stage, const rdcstr &entryPoint, + uint32_t cbufslot, ResourceId buffer, uint64_t offset, uint64_t length) { CHECK_REPLAY_THREAD(); @@ -1699,7 +1699,7 @@ rdcarray ReplayController::GetCBufferVariableContents( if(shader != ResourceId()) { - m_pDevice->FillCBufferVariables(pipeline, shader, entryPoint, cbufslot, v, data); + m_pDevice->FillCBufferVariables(pipeline, shader, stage, entryPoint, cbufslot, v, data); FatalErrorCheck(); } diff --git a/renderdoc/replay/replay_controller.h b/renderdoc/replay/replay_controller.h index 699f03ab3..bf6882ec8 100644 --- a/renderdoc/replay/replay_controller.h +++ b/renderdoc/replay/replay_controller.h @@ -202,9 +202,9 @@ public: bool SaveTexture(const TextureSave &saveData, const rdcstr &path); rdcarray GetCBufferVariableContents(ResourceId pipeline, ResourceId shader, - const rdcstr &entryPoint, uint32_t cbufslot, - ResourceId buffer, uint64_t offset, - uint64_t length); + ShaderStage stage, const rdcstr &entryPoint, + uint32_t cbufslot, ResourceId buffer, + uint64_t offset, uint64_t length); rdcarray GetSupportedWindowSystems(); diff --git a/renderdoc/replay/replay_driver.h b/renderdoc/replay/replay_driver.h index 65bfed4f3..5561e4ecd 100644 --- a/renderdoc/replay/replay_driver.h +++ b/renderdoc/replay/replay_driver.h @@ -190,9 +190,9 @@ public: virtual CounterDescription DescribeCounter(GPUCounter counterID) = 0; virtual rdcarray FetchCounters(const rdcarray &counterID) = 0; - virtual void FillCBufferVariables(ResourceId pipeline, ResourceId shader, rdcstr entryPoint, - uint32_t cbufSlot, rdcarray &outvars, - const bytebuf &data) = 0; + virtual void FillCBufferVariables(ResourceId pipeline, ResourceId shader, ShaderStage stage, + rdcstr entryPoint, uint32_t cbufSlot, + rdcarray &outvars, const bytebuf &data) = 0; virtual rdcarray PixelHistory(rdcarray events, ResourceId target, uint32_t x, uint32_t y, const Subresource &sub,