From 3d2ffb394a191d0bc4f1e76d293facb0506ad2a0 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 17 Nov 2020 18:17:41 -0500 Subject: [PATCH] zink: add spirv_builder function for hexops these are functions with 6 operands Reviewed-by: Erik Faye-Lund Part-of: --- .../drivers/zink/nir_to_spirv/spirv_builder.c | 19 +++++++++++++++++++ .../drivers/zink/nir_to_spirv/spirv_builder.h | 5 +++++ 2 files changed, 24 insertions(+) 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 1254f4cd19b..6410799e4c2 100644 --- a/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c +++ b/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c @@ -488,6 +488,25 @@ spirv_builder_emit_quadop(struct spirv_builder *b, SpvOp op, SpvId result_type, return result; } +SpvId +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) +{ + 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); + return result; +} + SpvId spirv_builder_emit_composite_extract(struct spirv_builder *b, SpvId result_type, SpvId composite, const uint32_t indexes[], diff --git a/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.h b/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.h index 6f0281212a7..193efb290b5 100644 --- a/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.h +++ b/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.h @@ -193,6 +193,11 @@ 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_hexop(struct spirv_builder *b, SpvOp op, SpvId result_type, + SpvId operand0, SpvId operand1, SpvId operand2, SpvId operand3, + SpvId operand4, SpvId operand5); + SpvId spirv_builder_emit_composite_extract(struct spirv_builder *b, SpvId result_type, SpvId composite, const uint32_t indexes[],