zink: add a quadop function in spirv_builder

this takes 4 operands like the unop/binop/triop functions we already have

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7486>
This commit is contained in:
Mike Blumenkrantz 2020-11-05 12:59:39 -05:00 committed by Marge Bot
parent 758e932ad2
commit 95e15f774d
2 changed files with 20 additions and 0 deletions

View file

@ -444,6 +444,22 @@ spirv_builder_emit_triop(struct spirv_builder *b, SpvOp op, SpvId result_type,
return result;
}
SpvId
spirv_builder_emit_quadop(struct spirv_builder *b, SpvOp op, SpvId result_type,
SpvId operand0, SpvId operand1, SpvId operand2, SpvId operand3)
{
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);
return result;
}
SpvId
spirv_builder_emit_composite_extract(struct spirv_builder *b, SpvId result_type,
SpvId composite, const uint32_t indexes[],

View file

@ -184,6 +184,10 @@ SpvId
spirv_builder_emit_triop(struct spirv_builder *b, SpvOp op, SpvId result_type,
SpvId operand0, SpvId operand1, SpvId operand2);
SpvId
spirv_builder_emit_quadop(struct spirv_builder *b, SpvOp op, SpvId result_type,
SpvId operand0, SpvId operand1, SpvId operand2, SpvId operand3);
SpvId
spirv_builder_emit_composite_extract(struct spirv_builder *b, SpvId result_type,
SpvId composite, const uint32_t indexes[],