From 187698e636a0c593ba3d96a07393cbb20096f584 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 8 Sep 2025 13:04:30 +0100 Subject: [PATCH] Re-bind descriptor buffers when using EXT shader objects --- renderdoc/driver/vulkan/vk_state.cpp | 25 ++++++++++++++++--------- renderdoc/driver/vulkan/vk_state.h | 3 +++ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/renderdoc/driver/vulkan/vk_state.cpp b/renderdoc/driver/vulkan/vk_state.cpp index ffe6b5613..77fffe448 100644 --- a/renderdoc/driver/vulkan/vk_state.cpp +++ b/renderdoc/driver/vulkan/vk_state.cpp @@ -332,16 +332,8 @@ bool VulkanRenderState::IsConditionalRenderingEnabled() return conditionalRendering.buffer != ResourceId() && !conditionalRendering.forceDisable; } -void VulkanRenderState::BindPipeline(WrappedVulkan *vk, VkCommandBuffer cmd, - PipelineBinding binding, bool subpass0) +void VulkanRenderState::BindDescriptorBuffers(WrappedVulkan *vk, VkCommandBuffer cmd) { - // subpass0 is a patched version of the pipeline created against subpass 0, in case for old style - // renderpasses we need to use a pipeline that was previously in subpass 1 against our loadrp with - // only one subpass. It's not needed for dynamic rendering, we can always use the original - // pipeline - if(subpass0 && dynamicRendering.active) - subpass0 = false; - if(!descBufs.empty()) { VkDescriptorBufferBindingPushDescriptorBufferHandleEXT push; @@ -387,6 +379,19 @@ void VulkanRenderState::BindPipeline(WrappedVulkan *vk, VkCommandBuffer cmd, ObjDisp(cmd)->CmdBindDescriptorBuffersEXT(Unwrap(cmd), bufferCount, bind.data()); } +} + +void VulkanRenderState::BindPipeline(WrappedVulkan *vk, VkCommandBuffer cmd, + PipelineBinding binding, bool subpass0) +{ + // subpass0 is a patched version of the pipeline created against subpass 0, in case for old style + // renderpasses we need to use a pipeline that was previously in subpass 1 against our loadrp with + // only one subpass. It's not needed for dynamic rendering, we can always use the original + // pipeline + if(subpass0 && dynamicRendering.active) + subpass0 = false; + + BindDescriptorBuffers(vk, cmd); if(binding == BindGraphics || binding == BindInitial) { @@ -492,6 +497,8 @@ void VulkanRenderState::BindPipeline(WrappedVulkan *vk, VkCommandBuffer cmd, void VulkanRenderState::BindShaderObjects(WrappedVulkan *vk, VkCommandBuffer cmd, PipelineBinding binding) { + BindDescriptorBuffers(vk, cmd); + if(binding == BindGraphics || binding == BindInitial) { if(graphics.shaderObject) diff --git a/renderdoc/driver/vulkan/vk_state.h b/renderdoc/driver/vulkan/vk_state.h index a1c97b272..9d907a23a 100644 --- a/renderdoc/driver/vulkan/vk_state.h +++ b/renderdoc/driver/vulkan/vk_state.h @@ -96,6 +96,9 @@ struct VulkanRenderState void BeginRenderPassAndApplyState(WrappedVulkan *vk, VkCommandBuffer cmd, PipelineBinding binding, bool obeySuspending); void BindPipeline(WrappedVulkan *vk, VkCommandBuffer cmd, PipelineBinding binding, bool subpass0); + + void BindDescriptorBuffers(WrappedVulkan *vk, VkCommandBuffer cmd); + void BindShaderObjects(WrappedVulkan *vk, VkCommandBuffer cmd, PipelineBinding binding); void BindDynamicState(WrappedVulkan *vk, VkCommandBuffer cmd);