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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19116>
spirv_builder_spec_const_uint(struct spirv_builder *b, int width)
{
assert(width <= 32);
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;