Mesa (main): zink: use the bigger of the variable type and interface type for bo sizing
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jun 24 01:34:54 UTC 2022
Module: Mesa
Branch: main
Commit: e38b2adb886c09dc8177eb454633e5ecc3143eb8
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e38b2adb886c09dc8177eb454633e5ecc3143eb8
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Thu Jun 23 15:49:43 2022 -0400
zink: use the bigger of the variable type and interface type for bo sizing
this avoids the scenario where the full bo size isn't accounted for because
no variable for the block has been created
cc: mesa-stable
affects:
KHR-GL33.shaders.uniform_block.random.all_per_block_buffers.3
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17217>
---
src/gallium/drivers/zink/zink_compiler.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c
index 147586d72b7..55601434b90 100644
--- a/src/gallium/drivers/zink/zink_compiler.c
+++ b/src/gallium/drivers/zink/zink_compiler.c
@@ -2074,7 +2074,10 @@ unbreak_bos(nir_shader *shader, struct zink_shader *zs, bool needs_size)
const struct glsl_type *type = glsl_without_array(var->type);
if (type_is_counter(type))
continue;
+ /* be conservative: use the bigger of the interface and variable types to ensure in-bounds access */
unsigned size = glsl_count_attribute_slots(glsl_type_is_array(var->type) ? var->type : type, false);
+ if (var->interface_type)
+ size = MAX2(size, glsl_count_attribute_slots(glsl_without_array(var->interface_type), false));
if (var->data.mode == nir_var_mem_ubo)
max_ubo_size = MAX2(max_ubo_size, size);
else
More information about the mesa-commit
mailing list