mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-21 09:50:36 +02:00
zink: make spirv_builder_emit_*op compatible with spec constants
This way we can use those builder functions to emit spec constant operations. Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24839>
This commit is contained in:
parent
82eed326f4
commit
bec1955446
1 changed files with 37 additions and 30 deletions
|
|
@ -553,12 +553,13 @@ SpvId
|
|||
spirv_builder_emit_unop(struct spirv_builder *b, SpvOp op, SpvId result_type,
|
||||
SpvId operand)
|
||||
{
|
||||
struct spirv_buffer *buf = op == SpvOpSpecConstant ? &b->types_const_defs : &b->instructions;
|
||||
SpvId result = spirv_builder_new_id(b);
|
||||
spirv_buffer_prepare(&b->instructions, b->mem_ctx, 4);
|
||||
spirv_buffer_emit_word(&b->instructions, op | (4 << 16));
|
||||
spirv_buffer_emit_word(&b->instructions, result_type);
|
||||
spirv_buffer_emit_word(&b->instructions, result);
|
||||
spirv_buffer_emit_word(&b->instructions, operand);
|
||||
spirv_buffer_prepare(buf, b->mem_ctx, 4);
|
||||
spirv_buffer_emit_word(buf, op | (4 << 16));
|
||||
spirv_buffer_emit_word(buf, result_type);
|
||||
spirv_buffer_emit_word(buf, result);
|
||||
spirv_buffer_emit_word(buf, operand);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -580,14 +581,16 @@ SpvId
|
|||
spirv_builder_emit_triop(struct spirv_builder *b, SpvOp op, SpvId result_type,
|
||||
SpvId operand0, SpvId operand1, SpvId operand2)
|
||||
{
|
||||
struct spirv_buffer *buf = op == SpvOpSpecConstantOp ? &b->types_const_defs : &b->instructions;
|
||||
|
||||
SpvId result = spirv_builder_new_id(b);
|
||||
spirv_buffer_prepare(&b->instructions, b->mem_ctx, 6);
|
||||
spirv_buffer_emit_word(&b->instructions, op | (6 << 16));
|
||||
spirv_buffer_emit_word(&b->instructions, result_type);
|
||||
spirv_buffer_emit_word(&b->instructions, result);
|
||||
spirv_buffer_emit_word(&b->instructions, operand0);
|
||||
spirv_buffer_emit_word(&b->instructions, operand1);
|
||||
spirv_buffer_emit_word(&b->instructions, operand2);
|
||||
spirv_buffer_prepare(buf, b->mem_ctx, 6);
|
||||
spirv_buffer_emit_word(buf, op | (6 << 16));
|
||||
spirv_buffer_emit_word(buf, result_type);
|
||||
spirv_buffer_emit_word(buf, result);
|
||||
spirv_buffer_emit_word(buf, operand0);
|
||||
spirv_buffer_emit_word(buf, operand1);
|
||||
spirv_buffer_emit_word(buf, operand2);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -595,15 +598,17 @@ SpvId
|
|||
spirv_builder_emit_quadop(struct spirv_builder *b, SpvOp op, SpvId result_type,
|
||||
SpvId operand0, SpvId operand1, SpvId operand2, SpvId operand3)
|
||||
{
|
||||
struct spirv_buffer *buf = op == SpvOpSpecConstantOp ? &b->types_const_defs : &b->instructions;
|
||||
|
||||
SpvId result = spirv_builder_new_id(b);
|
||||
spirv_buffer_prepare(&b->instructions, b->mem_ctx, 7);
|
||||
spirv_buffer_emit_word(&b->instructions, op | (7 << 16));
|
||||
spirv_buffer_emit_word(&b->instructions, result_type);
|
||||
spirv_buffer_emit_word(&b->instructions, result);
|
||||
spirv_buffer_emit_word(&b->instructions, operand0);
|
||||
spirv_buffer_emit_word(&b->instructions, operand1);
|
||||
spirv_buffer_emit_word(&b->instructions, operand2);
|
||||
spirv_buffer_emit_word(&b->instructions, operand3);
|
||||
spirv_buffer_prepare(buf, b->mem_ctx, 7);
|
||||
spirv_buffer_emit_word(buf, op | (7 << 16));
|
||||
spirv_buffer_emit_word(buf, result_type);
|
||||
spirv_buffer_emit_word(buf, result);
|
||||
spirv_buffer_emit_word(buf, operand0);
|
||||
spirv_buffer_emit_word(buf, operand1);
|
||||
spirv_buffer_emit_word(buf, operand2);
|
||||
spirv_buffer_emit_word(buf, operand3);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -612,17 +617,19 @@ spirv_builder_emit_hexop(struct spirv_builder *b, SpvOp op, SpvId result_type,
|
|||
SpvId operand0, SpvId operand1, SpvId operand2, SpvId operand3,
|
||||
SpvId operand4, SpvId operand5)
|
||||
{
|
||||
struct spirv_buffer *buf = op == SpvOpSpecConstantOp ? &b->types_const_defs : &b->instructions;
|
||||
|
||||
SpvId result = spirv_builder_new_id(b);
|
||||
spirv_buffer_prepare(&b->instructions, b->mem_ctx, 9);
|
||||
spirv_buffer_emit_word(&b->instructions, op | (9 << 16));
|
||||
spirv_buffer_emit_word(&b->instructions, result_type);
|
||||
spirv_buffer_emit_word(&b->instructions, result);
|
||||
spirv_buffer_emit_word(&b->instructions, operand0);
|
||||
spirv_buffer_emit_word(&b->instructions, operand1);
|
||||
spirv_buffer_emit_word(&b->instructions, operand2);
|
||||
spirv_buffer_emit_word(&b->instructions, operand3);
|
||||
spirv_buffer_emit_word(&b->instructions, operand4);
|
||||
spirv_buffer_emit_word(&b->instructions, operand5);
|
||||
spirv_buffer_prepare(buf, b->mem_ctx, 9);
|
||||
spirv_buffer_emit_word(buf, op | (9 << 16));
|
||||
spirv_buffer_emit_word(buf, result_type);
|
||||
spirv_buffer_emit_word(buf, result);
|
||||
spirv_buffer_emit_word(buf, operand0);
|
||||
spirv_buffer_emit_word(buf, operand1);
|
||||
spirv_buffer_emit_word(buf, operand2);
|
||||
spirv_buffer_emit_word(buf, operand3);
|
||||
spirv_buffer_emit_word(buf, operand4);
|
||||
spirv_buffer_emit_word(buf, operand5);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue