diff --git a/src/imagination/vulkan/pvr_cmd_buffer.c b/src/imagination/vulkan/pvr_cmd_buffer.c index 36e3c710c26..d004f54f5ef 100644 --- a/src/imagination/vulkan/pvr_cmd_buffer.c +++ b/src/imagination/vulkan/pvr_cmd_buffer.c @@ -7252,15 +7252,16 @@ static bool pvr_is_stencil_store_load_needed( hw_render_idx = state->current_sub_cmd->gfx.hw_render_idx; hw_render = &pass->hw_setup->renders[hw_render_idx]; + + if (hw_render->ds_attach_idx == VK_ATTACHMENT_UNUSED) + return false; + attachment = attachments[hw_render->ds_attach_idx]; if (!(vk_src_stage_mask & fragment_test_stages) && vk_dst_stage_mask & VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT) return false; - if (hw_render->ds_attach_idx == VK_ATTACHMENT_UNUSED) - return false; - for (uint32_t i = 0; i < memory_barrier_count; i++) { const uint32_t stencil_write_bit = VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;