Mesa (main): zink: break out nir alu typing in ntv

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 10 02:49:39 UTC 2022


Module: Mesa
Branch: main
Commit: 941046be802b93e43c544bf4f60a828152db6716
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=941046be802b93e43c544bf4f60a828152db6716

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Wed May 18 12:34:43 2022 -0400

zink: break out nir alu typing in ntv

this is reusable

Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16669>

---

 src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
index af99987c8a3..2ea57ff6a30 100644
--- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
+++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
@@ -1746,11 +1746,8 @@ store_alu_result(struct ntv_context *ctx, nir_alu_instr *alu, SpvId result, bool
 }
 
 static SpvId
-get_dest_type(struct ntv_context *ctx, nir_dest *dest, nir_alu_type type)
+get_alu_type(struct ntv_context *ctx, nir_alu_type type, unsigned num_components, unsigned bit_size)
 {
-   unsigned num_components = nir_dest_num_components(*dest);
-   unsigned bit_size = nir_dest_bit_size(*dest);
-
    if (bit_size == 1)
       return get_bvec_type(ctx, num_components);
 
@@ -1780,6 +1777,14 @@ get_dest_type(struct ntv_context *ctx, nir_dest *dest, nir_alu_type type)
    }
 }
 
+static SpvId
+get_dest_type(struct ntv_context *ctx, nir_dest *dest, nir_alu_type type)
+{
+   unsigned num_components = nir_dest_num_components(*dest);
+   unsigned bit_size = nir_dest_bit_size(*dest);
+   return get_alu_type(ctx, type, num_components, bit_size);
+}
+
 static bool
 needs_derivative_control(nir_alu_instr *alu)
 {



More information about the mesa-commit mailing list