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,