Module: Mesa
Branch: main
Commit: 98031749421ae328d5b38a3931b5b507ee0838b6
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=98031749421ae328d5b38a3931b5b507ee0838b6

Author: Mike Blumenkrantz <[email protected]>
Date:   Mon Jun 19 10:30:58 2023 -0400

zink: fix ubo array sizing in ntv

there are only 2 ubos that can be emitted, except the emitted ubos
can start at an offset based on the first-used ubo, which means this
has to support the full range of ubo indices

fixes oob access in game Beyond All Reason

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23729>

---

 src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c 
b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
index 86b4ae4c56a..42d7d42a054 100644
--- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
+++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
@@ -54,8 +54,8 @@ struct ntv_context {
    gl_shader_stage stage;
    const struct zink_shader_info *sinfo;
 
-   SpvId ubos[2][5]; //8, 16, 32, unused, 64
-   nir_variable *ubo_vars[2];
+   SpvId ubos[PIPE_MAX_CONSTANT_BUFFERS][5]; //8, 16, 32, unused, 64
+   nir_variable *ubo_vars[PIPE_MAX_CONSTANT_BUFFERS];
 
    SpvId ssbos[5]; //8, 16, 32, unused, 64
    nir_variable *ssbo_vars;

Reply via email to