pvr: Fix vtxin special var allocation count
authorJames Glanville <james.glanville@imgtec.com>
Fri, 28 Apr 2023 08:21:50 +0000 (09:21 +0100)
committerMarge Bot <emma+marge@anholt.net>
Tue, 2 May 2023 08:51:42 +0000 (08:51 +0000)
When pvr_graphics_pipeline_alloc_vertex_special_vars() was
allocating vtxin regs for special vars, it wasn't returning back
the updated amount of allocated regs so when the PDS was filling
them in, it would try to write out of bounds.

Signed-off-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/22750>

src/imagination/vulkan/pvr_pipeline.c

index 9c3b957..39af8a4 100644 (file)
@@ -1863,6 +1863,7 @@ static void pvr_graphics_pipeline_alloc_vertex_special_vars(
    layout.instance_id_offset = (int16_t)next_free_reg;
    next_free_reg++;
 
+   *num_vertex_input_regs = next_free_reg;
    *special_vars_layout_out = layout;
 }