From c305a2c9625a91e8e4bbaca5b20b2eb7d69a74de Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 17 Oct 2022 08:22:18 -0400 Subject: [PATCH] zink: move spec constant emission to the types/consts block spec constants are used as constants, so emitting them in the instructions block can create mismatched ordering of the constant usage with other types Part-of: --- src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c | 8 +++++++- 1 file changed, 7 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 ff87ba79531..9bce3743056 100644 --- a/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c +++ b/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c @@ -1539,7 +1539,13 @@ SpvId spirv_builder_spec_const_uint(struct spirv_builder *b, int width) { assert(width <= 32); - return spirv_builder_emit_unop(b, SpvOpSpecConstant, spirv_builder_type_uint(b, width), 0); + 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, result); + spirv_buffer_emit_word(&b->types_const_defs, 0); + return result; } SpvId