pvr: Fix `for` loop itarator usage
authorKarmjit Mahil <Karmjit.Mahil@imgtec.com>
Mon, 18 Sep 2023 14:36:29 +0000 (15:36 +0100)
committerMarge Bot <emma+marge@anholt.net>
Sun, 24 Sep 2023 13:44:19 +0000 (13:44 +0000)
The `i` iteration variable was being used instead of `k` when
appending new mappings, and getting the current source rect.

dEQP test fixed:
  dEQP-VK.pipeline.monolithic.image.suballocation.sampling_type
    .combined.view_type.3d.format.*.count_1.
    .{3x3x3,5x5x5,...(odd dimensions)}

Fixes: 060c3db4efd6 ("pvr: Complete pvr_generate_custom_mapping()")

Reported-by: James Glanville <james.glanville@imgtec.com>
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/25321>

src/imagination/vulkan/pvr_job_transfer.c

index 6bec19b..87baef3 100644 (file)
@@ -5043,7 +5043,7 @@ pvr_generate_custom_mapping(uint32_t src_stride,
             struct pvr_transfer_wa_source *src = &pass->sources[j];
 
             for (uint32_t k = 0; k < src->mapping_count; k++) {
-               VkRect2D *src_rect = &src->mappings[i].src_rect;
+               VkRect2D *src_rect = &src->mappings[k].src_rect;
                bool extend_height =
                   pvr_extend_height(src_rect,
                                     src_height,
@@ -5058,7 +5058,7 @@ pvr_generate_custom_mapping(uint32_t src_stride,
                   new_src->mappings[new_src->mapping_count] = src->mappings[k];
                   new_src->src_offset = src->src_offset;
 
-                  for (uint32_t l = i + 1; l < src->mapping_count; l++)
+                  for (uint32_t l = k + 1; l < src->mapping_count; l++)
                      src->mappings[l - 1] = src->mappings[l];
 
                   new_src->mapping_count++;