From fbe975e738d827276ab9a980bbd220c83da7043b Mon Sep 17 00:00:00 2001 From: James Glanville Date: Thu, 11 May 2023 13:29:10 +0100 Subject: pvr: Fix seg fault on unused ds attachment Fixes: dEQP-VK.renderpass.suballocation.formats.r16g16_sint.input .dont_care.dont_care.self_dep_clear Signed-off-by: James Glanville Reviewed-by: Frank Binns Part-of: --- src/imagination/vulkan/pvr_cmd_buffer.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') 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; -- cgit v1.2.1