aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_builder.h
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2019-04-01 21:31:26 -0500
committerKarol Herbst <[email protected]>2019-04-14 22:25:56 +0200
commit9b1e4bab6bb3be7a5dad910b10a28db0a4bb8b5f (patch)
treec0a17e60f0f182dfcace2f4ac315a4074447049a /src/compiler/nir/nir_builder.h
parentdaaf777376303077f9fd4c72e602b8892fe1caaf (diff)
nir/builder: Add a nir_imm_zero helper
v2: replace nir_zero_vec with nir_imm_zero (Karol Herbst) Reviewed-by: Karol Herbst <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_builder.h')
-rw-r--r--src/compiler/nir/nir_builder.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h
index 66a028bac97..9ee58dafd21 100644
--- a/src/compiler/nir/nir_builder.h
+++ b/src/compiler/nir/nir_builder.h
@@ -209,6 +209,19 @@ nir_build_imm(nir_builder *build, unsigned num_components,
}
static inline nir_ssa_def *
+nir_imm_zero(nir_builder *build, unsigned num_components, unsigned bit_size)
+{
+ nir_load_const_instr *load_const =
+ nir_load_const_instr_create(build->shader, num_components, bit_size);
+
+ /* nir_load_const_instr_create uses rzalloc so it's already zero */
+
+ nir_builder_instr_insert(build, &load_const->instr);
+
+ return &load_const->def;
+}
+
+static inline nir_ssa_def *
nir_imm_bool(nir_builder *build, bool x)
{
nir_const_value v;