zink: Fix BO size when it's not aligned to 16 bytes
glsl_get_explicit_size can return non-16 byte aligned sizes.
Therefore, make sure the sure the size isrounded up so that OOB does not happen.
Fixes: ea8a0654f5 ("zink: further improve bo sizing")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17460>
This commit is contained in:
@@ -2157,7 +2157,7 @@ unbreak_bos(nir_shader *shader, struct zink_shader *zs, bool needs_size)
|
||||
const struct glsl_type *interface_type = var->interface_type ? glsl_without_array(var->interface_type) : NULL;
|
||||
if (interface_type) {
|
||||
unsigned block_size = glsl_get_explicit_size(interface_type, true);
|
||||
block_size /= sizeof(float) * 4;
|
||||
block_size = DIV_ROUND_UP(block_size, sizeof(float) * 4);
|
||||
size = MAX2(size, block_size);
|
||||
}
|
||||
if (var->data.mode == nir_var_mem_ubo) {
|
||||
|
||||
Reference in New Issue
Block a user