From 6783a8845566a9fdffa938d5b99127f7a3af0edf Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Wed, 25 May 2022 10:05:26 +0200 Subject: [PATCH] microsoft/spirv_to_dxil: Fix push_constants type declaration We're not declaring an array of bytes but an array of uint32. Let's fix the element_count we pass to glsl_array_type(). Fixes: de1e941c5909 ("microsoft/spirv_to_dxil: Lower push constant loads to UBO loads") Reviewed-by: Reviewed-by: Jesse Natalie Part-of: --- src/microsoft/spirv_to_dxil/spirv_to_dxil.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/microsoft/spirv_to_dxil/spirv_to_dxil.c b/src/microsoft/spirv_to_dxil/spirv_to_dxil.c index dccb2cd88d4..4b5bd8a636a 100644 --- a/src/microsoft/spirv_to_dxil/spirv_to_dxil.c +++ b/src/microsoft/spirv_to_dxil/spirv_to_dxil.c @@ -159,9 +159,10 @@ static nir_variable * add_push_constant_var(nir_shader *nir, unsigned size, unsigned desc_set, unsigned binding) { /* Size must be a multiple of 16 as buffer load is loading 16 bytes at a time */ - size = ALIGN_POT(size, 16) / 16; + unsigned num_32bit_words = ALIGN_POT(size, 16) / 4; - const struct glsl_type *array_type = glsl_array_type(glsl_uint_type(), size, 4); + const struct glsl_type *array_type = + glsl_array_type(glsl_uint_type(), num_32bit_words, 4); const struct glsl_struct_field field = {array_type, "arr"}; nir_variable *var = nir_variable_create( nir, nir_var_mem_ubo,