summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Iglesias Gonsálvez <[email protected]>2016-03-23 10:43:03 +0100
committerSamuel Iglesias Gonsálvez <[email protected]>2016-04-28 11:58:13 +0200
commit3a150683ce2f1245fc6f5a02f4a1c2197353962c (patch)
treee0b085887b32d61df5a1ebec86670fefe58648ab
parent76b8c5cc602eda19c91b842b02f84564c18e79a6 (diff)
nir/builder: Add bit_size info to nir_build_imm()
v2: - Group num_components and bit_size together (Jason) Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
-rw-r--r--src/compiler/nir/nir_builder.h13
-rw-r--r--src/compiler/nir/nir_lower_system_values.c2
-rw-r--r--src/compiler/nir/nir_lower_tex.c2
3 files changed, 9 insertions, 8 deletions
diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h
index e4e0895d3af..3e3bdcd3b8d 100644
--- a/src/compiler/nir/nir_builder.h
+++ b/src/compiler/nir/nir_builder.h
@@ -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 *
diff --git a/src/compiler/nir/nir_lower_system_values.c b/src/compiler/nir/nir_lower_system_values.c
index ae613e20992..b86049b061b 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, 32, local_size)),
local_id);
break;
}
diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c
index 16fee9a2ab1..ac2f92c32f2 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, 32, v);
}
static void