Don't report descriptor access for non-stage-visible descriptors

* If these are actually used it's an application error.
This commit is contained in:
baldurk
2024-04-10 18:58:52 +01:00
parent 12a17b12f4
commit fbed56ac55
2 changed files with 37 additions and 0 deletions
+28
View File
@@ -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;
@@ -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);