diff --git a/renderdoc/driver/vulkan/vk_info.cpp b/renderdoc/driver/vulkan/vk_info.cpp index 485a92d75c..2b818687c8 100644 --- a/renderdoc/driver/vulkan/vk_info.cpp +++ b/renderdoc/driver/vulkan/vk_info.cpp @@ -844,6 +844,13 @@ void VulkanCreationInfo::Pipeline::Shader::ProcessStaticDescriptorAccess( if(bind.bindArraySize > 1) continue; + // VkShaderStageFlagBits and ShaderStageMask are identical bit-for-bit. + // this might be deliberate if the binding is never actually used dynamically, only + // statically used bindings must be declared + if((setLayoutInfos[bind.fixedBindSetOrSpace]->bindings[bind.fixedBindNumber].stageFlags & + (VkShaderStageFlags)MaskForStage(refl->stage)) == 0) + continue; + access.type = DescriptorType::ConstantBuffer; access.index = i; @@ -877,6 +884,13 @@ void VulkanCreationInfo::Pipeline::Shader::ProcessStaticDescriptorAccess( if(bind.bindArraySize > 1) continue; + // VkShaderStageFlagBits and ShaderStageMask are identical bit-for-bit. + // this might be deliberate if the binding is never actually used dynamically, only + // statically used bindings must be declared + if((setLayoutInfos[bind.fixedBindSetOrSpace]->bindings[bind.fixedBindNumber].stageFlags & + (VkShaderStageFlags)MaskForStage(refl->stage)) == 0) + continue; + access.type = DescriptorType::Sampler; access.index = i; access.byteSize = bind.fixedBindSetOrSpace; @@ -893,6 +907,13 @@ void VulkanCreationInfo::Pipeline::Shader::ProcessStaticDescriptorAccess( if(bind.bindArraySize > 1) continue; + // VkShaderStageFlagBits and ShaderStageMask are identical bit-for-bit. + // this might be deliberate if the binding is never actually used dynamically, only + // statically used bindings must be declared + if((setLayoutInfos[bind.fixedBindSetOrSpace]->bindings[bind.fixedBindNumber].stageFlags & + (VkShaderStageFlags)MaskForStage(refl->stage)) == 0) + continue; + access.type = refl->readOnlyResources[i].descriptorType; access.index = i; access.byteSize = bind.fixedBindSetOrSpace; @@ -909,6 +930,13 @@ void VulkanCreationInfo::Pipeline::Shader::ProcessStaticDescriptorAccess( if(bind.bindArraySize > 1) continue; + // VkShaderStageFlagBits and ShaderStageMask are identical bit-for-bit. + // this might be deliberate if the binding is never actually used dynamically, only + // statically used bindings must be declared + if((setLayoutInfos[bind.fixedBindSetOrSpace]->bindings[bind.fixedBindNumber].stageFlags & + (VkShaderStageFlags)MaskForStage(refl->stage)) == 0) + continue; + access.type = refl->readWriteResources[i].descriptorType; access.index = i; access.byteSize = bind.fixedBindSetOrSpace; diff --git a/renderdoc/driver/vulkan/vk_shader_feedback.cpp b/renderdoc/driver/vulkan/vk_shader_feedback.cpp index 39c128a81b..c1bece315c 100644 --- a/renderdoc/driver/vulkan/vk_shader_feedback.cpp +++ b/renderdoc/driver/vulkan/vk_shader_feedback.cpp @@ -1717,6 +1717,15 @@ bool VulkanReplay::FetchShaderFeedback(uint32_t eventId) return; } + // VkShaderStageFlagBits and ShaderStageMask are identical bit-for-bit. + if((descLayouts[bindset]->bindings[bind].stageFlags & + (VkShaderStageFlags)MaskForStage(key.stage)) == 0) + { + // this might be deliberate if the binding is never actually used dynamically, only + // statically used bindings must be declared + return; + } + if(descLayouts[bindset]->bindings[bind].variableSize) { auto it = m_pDriver->m_DescriptorSetState.find(descSet);