pvr: Fix dynamic desc offset storage

The index at which the dynamic descriptor offsets were being
stored was incorrect, leading to some offsets not being stored and
thus `0` being applied as the offset to the descriptors instead.

dEQP test fixed:
  dEQP-VK.binding_model.shader_access.{primary,secondary}_cmd_buf
    .uniform_buffer_dynamic
    .{vertex,fragment,compute,vertex_fragment}
    .multiple_discontiguous_descriptor_sets
    .*_descriptor.offset_view_{,non}zero_dynamic_nonzero

Fixes: aa791961a8 ("pvr: Add support for dynamic buffers descriptors")
Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25320>
This commit is contained in:
Karmjit Mahil 2023-09-19 13:35:50 +01:00 committed by Marge Bot
parent bf17e4fe33
commit feafb8a256

View File

@ -2612,12 +2612,12 @@ void pvr_CmdBindDescriptorSets(VkCommandBuffer commandBuffer,
if (dynamicOffsetCount > 0) {
PVR_FROM_HANDLE(pvr_pipeline_layout, pipeline_layout, _layout);
uint32_t starting_idx = 0;
uint32_t set_offset = 0;
for (uint32_t set = 0; set < firstSet; set++)
starting_idx += pipeline_layout->set_layout[set]->dynamic_buffer_count;
set_offset += pipeline_layout->set_layout[set]->dynamic_buffer_count;
assert(starting_idx + dynamicOffsetCount <=
assert(set_offset + dynamicOffsetCount <=
ARRAY_SIZE(descriptor_state->dynamic_offsets));
/* From the Vulkan 1.3.238 spec. :
@ -2627,8 +2627,8 @@ void pvr_CmdBindDescriptorSets(VkCommandBuffer commandBuffer,
* element in each dynamic descriptor type binding in each set."
*
*/
for (uint32_t i = starting_idx; i < dynamicOffsetCount; i++)
descriptor_state->dynamic_offsets[i] = pDynamicOffsets[i];
for (uint32_t i = 0; i < dynamicOffsetCount; i++)
descriptor_state->dynamic_offsets[set_offset + i] = pDynamicOffsets[i];
}
}