summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_builder.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/nir/nir_builder.h')
-rw-r--r--src/compiler/nir/nir_builder.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h
index e9c409b8d12..3dc7c25ec28 100644
--- a/src/compiler/nir/nir_builder.h
+++ b/src/compiler/nir/nir_builder.h
@@ -75,6 +75,20 @@ nir_builder_cf_insert(nir_builder *build, nir_cf_node *cf)
}
static inline nir_ssa_def *
+nir_ssa_undef(nir_builder *build, unsigned num_components, unsigned bit_size)
+{
+ nir_ssa_undef_instr *undef =
+ nir_ssa_undef_instr_create(build->shader, num_components);
+ undef->def.bit_size = bit_size;
+ if (!undef)
+ return NULL;
+
+ nir_instr_insert(nir_before_cf_list(&build->impl->body), &undef->instr);
+
+ return &undef->def;
+}
+
+static inline nir_ssa_def *
nir_build_imm(nir_builder *build, unsigned num_components, nir_const_value value)
{
nir_load_const_instr *load_const =