Mesa (master): zink/spirv: drop temp-array for component-count

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 6 13:30:49 UTC 2019


Module: Mesa
Branch: master
Commit: 6630baecf13df823b038e5a4faad79abedd145fa
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6630baecf13df823b038e5a4faad79abedd145fa

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Wed Oct 30 15:33:14 2019 +0100

zink/spirv: drop temp-array for component-count

---

 src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 9 +++------
 1 file changed, 3 insertions(+), 6 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 8732bc8839f..b72c731dd85 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
@@ -1052,10 +1052,6 @@ emit_alu(struct ntv_context *ctx, nir_alu_instr *alu)
 static void
 emit_load_const(struct ntv_context *ctx, nir_load_const_instr *load_const)
 {
-   uint32_t values[NIR_MAX_VEC_COMPONENTS];
-   for (int i = 0; i < load_const->def.num_components; ++i)
-      values[i] = load_const->value[i].u32;
-
    unsigned bit_size = load_const->def.bit_size;
    unsigned num_components = load_const->def.num_components;
 
@@ -1063,14 +1059,15 @@ emit_load_const(struct ntv_context *ctx, nir_load_const_instr *load_const)
    if (num_components > 1) {
       SpvId components[num_components];
       for (int i = 0; i < num_components; i++)
-         components[i] = emit_uint_const(ctx, bit_size, values[i]);
+         components[i] = emit_uint_const(ctx, bit_size,
+                                         load_const->value[i].u32);
 
       SpvId type = get_uvec_type(ctx, bit_size, num_components);
       constant = spirv_builder_const_composite(&ctx->builder, type,
                                                components, num_components);
    } else {
       assert(num_components == 1);
-      constant = emit_uint_const(ctx, bit_size, values[0]);
+      constant = emit_uint_const(ctx, bit_size, load_const->value[0].u32);
    }
 
    store_ssa_def_uint(ctx, &load_const->def, constant);




More information about the mesa-commit mailing list