mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 18:00:10 +01:00
pvr: fix attachments segfault in pvr_is_stencil_store_load_needed()
pvr_is_stencil_store_load_needed() may be called on secondary command buffers,
which don't have any attachments. This wasn't being taken into account, meaning
a segfault could occur.
Fixes a segfault seen in:
dEQP-VK.renderpass.suballocation.attachment_allocation.input_output.39
Fixes: 54876512a1 ("pvr: Add mid fragment pipeline barrier if needed.")
Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25486>
This commit is contained in:
parent
852d004637
commit
e8f6d7b0d4
1 changed files with 9 additions and 3 deletions
|
|
@ -7553,7 +7553,7 @@ pvr_stencil_has_self_dependency(const struct pvr_cmd_buffer_state *const state)
|
|||
}
|
||||
|
||||
static bool pvr_is_stencil_store_load_needed(
|
||||
const struct pvr_cmd_buffer_state *const state,
|
||||
const struct pvr_cmd_buffer *const cmd_buffer,
|
||||
VkPipelineStageFlags2 vk_src_stage_mask,
|
||||
VkPipelineStageFlags2 vk_dst_stage_mask,
|
||||
uint32_t memory_barrier_count,
|
||||
|
|
@ -7561,6 +7561,7 @@ static bool pvr_is_stencil_store_load_needed(
|
|||
uint32_t image_barrier_count,
|
||||
const VkImageMemoryBarrier2 *const image_barriers)
|
||||
{
|
||||
const struct pvr_cmd_buffer_state *const state = &cmd_buffer->state;
|
||||
const uint32_t fragment_test_stages =
|
||||
VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT |
|
||||
VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT;
|
||||
|
|
@ -7580,7 +7581,12 @@ static bool pvr_is_stencil_store_load_needed(
|
|||
if (hw_render->ds_attach_idx == VK_ATTACHMENT_UNUSED)
|
||||
return false;
|
||||
|
||||
attachment = attachments[hw_render->ds_attach_idx];
|
||||
if (cmd_buffer->vk.level == VK_COMMAND_BUFFER_LEVEL_PRIMARY) {
|
||||
attachment = attachments[hw_render->ds_attach_idx];
|
||||
} else {
|
||||
assert(!attachments);
|
||||
attachment = NULL;
|
||||
}
|
||||
|
||||
if (!(vk_src_stage_mask & fragment_test_stages) &&
|
||||
vk_dst_stage_mask & VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT)
|
||||
|
|
@ -7797,7 +7803,7 @@ void pvr_CmdPipelineBarrier2(VkCommandBuffer commandBuffer,
|
|||
}
|
||||
|
||||
is_stencil_store_load_needed =
|
||||
pvr_is_stencil_store_load_needed(state,
|
||||
pvr_is_stencil_store_load_needed(cmd_buffer,
|
||||
vk_src_stage_mask,
|
||||
vk_dst_stage_mask,
|
||||
pDependencyInfo->memoryBarrierCount,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue