nir/builder: Add bit_size info to nir_build_imm()
authorSamuel Iglesias Gonsálvez <siglesias@igalia.com>
Wed, 23 Mar 2016 09:43:03 +0000 (10:43 +0100)
committerSamuel Iglesias Gonsálvez <siglesias@igalia.com>
Thu, 28 Apr 2016 09:58:13 +0000 (11:58 +0200)
v2:
- Group num_components and bit_size together (Jason)

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir_builder.h
src/compiler/nir/nir_lower_system_values.c
src/compiler/nir/nir_lower_tex.c

index e4e0895d3af09eb2f4cf5593dca7c747d44175e5..3e3bdcd3b8daabe8ca2724b676a882cb9f2d811d 100644 (file)
@@ -88,10 +88,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,
+              unsigned bit_size, nir_const_value value)
 {
    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;
 
@@ -110,7 +111,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, 32, v);
 }
 
 static inline nir_ssa_def *
@@ -124,7 +125,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, 32, v);
 }
 
 static inline nir_ssa_def *
@@ -135,7 +136,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, 32, v);
 }
 
 static inline nir_ssa_def *
@@ -149,7 +150,7 @@ 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, 32, v);
 }
 
 static inline nir_ssa_def *
index ae613e20992497a0ba4e30cbfd46fda40fbe4cbb..b86049b061b775adfb2f0c4f1fdc4fbc7a09faa6 100644 (file)
@@ -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, 32, local_size)),
                               local_id);
          break;
       }
index 16fee9a2ab10fe2c0ae495967330eca6fc0a9866..ac2f92c32f2887c6c78eb303a969b2db5d9c841d 100644 (file)
@@ -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, 32, v);
 }
 
 static void