From 164b3ca164fc5063013c16d07ddff0c705f5f49f Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 13 Nov 2015 16:25:24 -0800 Subject: [PATCH] nir/builder: Add a nir_ssa_undef helper --- src/glsl/nir/nir_builder.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/glsl/nir/nir_builder.h b/src/glsl/nir/nir_builder.h index bf45d0373c0..205aa067b0b 100644 --- a/src/glsl/nir/nir_builder.h +++ b/src/glsl/nir/nir_builder.h @@ -58,6 +58,20 @@ nir_builder_cf_insert(nir_builder *build, nir_cf_node *cf) nir_cf_node_insert(build->cursor, cf); } +static inline nir_ssa_def * +nir_ssa_undef(nir_builder *build, unsigned num_components) +{ + nir_ssa_undef_instr *undef = + nir_ssa_undef_instr_create(build->shader, num_components); + if (!undef) + return NULL; + + nir_instr_insert(nir_before_block(nir_start_block(build->impl)), + &undef->instr); + + return &undef->def; +} + static inline nir_ssa_def * nir_build_imm(nir_builder *build, unsigned num_components, nir_const_value value) { -- 2.30.2