From 3128a8cada2a3434ed27211a432fa8c0dd21f348 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Wed, 26 Oct 2022 00:02:15 +0200 Subject: [PATCH] zink: fix spirv_builder_spec_const_uint We need to create the type upfront otherwise the spir-v binary gets corrupted. Fixes: c305a2c9625 ("zink: move spec constant emission to the types/consts block") Signed-off-by: Karol Herbst Part-of: --- src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c b/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c index 0108826..cd9cae6 100644 --- a/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c +++ b/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c @@ -1547,10 +1547,11 @@ SpvId spirv_builder_spec_const_uint(struct spirv_builder *b, int width) { assert(width <= 32); + SpvId const_type = spirv_builder_type_uint(b, width); SpvId result = spirv_builder_new_id(b); spirv_buffer_prepare(&b->types_const_defs, b->mem_ctx, 4); spirv_buffer_emit_word(&b->types_const_defs, SpvOpSpecConstant | (4 << 16)); - spirv_buffer_emit_word(&b->types_const_defs, spirv_builder_type_uint(b, width)); + spirv_buffer_emit_word(&b->types_const_defs, const_type); spirv_buffer_emit_word(&b->types_const_defs, result); /* this is the default value for spec constants; * if any users need a different default, add a param to pass for it -- 2.7.4