Mesa (main): microsoft/spirv_to_dxil: Fix push_constants type declaration
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jun 3 10:54:46 UTC 2022
Module: Mesa
Branch: main
Commit: 6783a8845566a9fdffa938d5b99127f7a3af0edf
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6783a8845566a9fdffa938d5b99127f7a3af0edf
Author: Boris Brezillon <boris.brezillon at collabora.com>
Date: Wed May 25 10:05:26 2022 +0200
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 <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16703>
---
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,
More information about the mesa-commit
mailing list