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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19116>
This commit is contained in:
Mike Blumenkrantz 2022-10-17 08:22:18 -04:00 committed by Marge Bot
parent 1e51383258
commit c305a2c962

View file

@ -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