[Mesa-dev] [PATCH 02/13] nir/builder: Add bit_size info to nir_build_imm()

Samuel Iglesias Gonsálvez siglesias at igalia.com
Tue Apr 12 08:05:11 UTC 2016


Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
---
 src/compiler/nir/nir_builder.h             | 15 ++++++++-------
 src/compiler/nir/nir_lower_system_values.c |  2 +-
 src/compiler/nir/nir_lower_tex.c           |  2 +-
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h
index 38a1cf7..84fc9bf 100644
--- a/src/compiler/nir/nir_builder.h
+++ b/src/compiler/nir/nir_builder.h
@@ -89,10 +89,11 @@ nir_ssa_undef(nir_builder *build, unsigned num_components, unsigned bit_size)
 }
 
 static inline nir_ssa_def *
-nir_build_imm(nir_builder *build, unsigned num_components, nir_const_value value)
+nir_build_imm(nir_builder *build, unsigned num_components,
+              nir_const_value value, unsigned bit_size)
 {
    nir_load_const_instr *load_const =
-      nir_load_const_instr_create(build->shader, num_components, 32);
+      nir_load_const_instr_create(build->shader, num_components, bit_size);
    if (!load_const)
       return NULL;
 
@@ -111,7 +112,7 @@ nir_imm_float(nir_builder *build, float x)
    memset(&v, 0, sizeof(v));
    v.f32[0] = x;
 
-   return nir_build_imm(build, 1, v);
+   return nir_build_imm(build, 1, v, 32);
 }
 
 static inline nir_ssa_def *
@@ -125,7 +126,7 @@ nir_imm_vec4(nir_builder *build, float x, float y, float z, float w)
    v.f32[2] = z;
    v.f32[3] = w;
 
-   return nir_build_imm(build, 4, v);
+   return nir_build_imm(build, 4, v, 32);
 }
 
 static inline nir_ssa_def *
@@ -136,7 +137,7 @@ nir_imm_int(nir_builder *build, int x)
    memset(&v, 0, sizeof(v));
    v.i32[0] = x;
 
-   return nir_build_imm(build, 1, v);
+   return nir_build_imm(build, 1, v, 32);
 }
 
 static inline nir_ssa_def *
@@ -150,14 +151,14 @@ nir_imm_ivec4(nir_builder *build, int x, int y, int z, int w)
    v.i32[2] = z;
    v.i32[3] = w;
 
-   return nir_build_imm(build, 4, v);
+   return nir_build_imm(build, 4, v, 32);
 }
 
 static inline nir_ssa_def *
 nir_imm_uint(nir_builder *build, unsigned x)
 {
    nir_const_value v = { { .u32 = {x, 0, 0, 0} } };
-   return nir_build_imm(build, 1, v);
+   return nir_build_imm(build, 1, v, 32);
 }
 
 static inline nir_ssa_def *
diff --git a/src/compiler/nir/nir_lower_system_values.c b/src/compiler/nir/nir_lower_system_values.c
index 2d3ccd7..8362619 100644
--- a/src/compiler/nir/nir_lower_system_values.c
+++ b/src/compiler/nir/nir_lower_system_values.c
@@ -75,7 +75,7 @@ convert_block(nir_block *block, void *void_state)
             nir_load_system_value(b, nir_intrinsic_load_local_invocation_id, 0);
 
          sysval = nir_iadd(b, nir_imul(b, group_id,
-                                          nir_build_imm(b, 3, local_size)),
+                                          nir_build_imm(b, 3, local_size, 32)),
                               local_id);
          break;
       }
diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c
index 4999603..47a3786 100644
--- a/src/compiler/nir/nir_lower_tex.c
+++ b/src/compiler/nir/nir_lower_tex.c
@@ -232,7 +232,7 @@ get_zero_or_one(nir_builder *b, nir_alu_type type, uint8_t swizzle_val)
          v.u32[0] = v.u32[1] = v.u32[2] = v.u32[3] = 1;
    }
 
-   return nir_build_imm(b, 4, v);
+   return nir_build_imm(b, 4, v, 32);
 }
 
 static void
-- 
2.5.0



More information about the mesa-dev mailing list