diff options
author | Jason Ekstrand <[email protected]> | 2016-03-25 10:40:45 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-03-25 14:04:05 -0700 |
commit | ab31951bef17a46d4fb38c42be46dd5955463801 (patch) | |
tree | ba188f9fc960da5d89787f7db20bcf3ee4f5b21b /src/compiler | |
parent | d2eee52a6554217b21b93ab9d8ab39abee331dd8 (diff) |
nir/spirv: Use the nir_ssa_undef helper from nir_builder
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/nir/spirv/spirv_to_nir.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/compiler/nir/spirv/spirv_to_nir.c b/src/compiler/nir/spirv/spirv_to_nir.c index cbc87d1f740..663f41fa876 100644 --- a/src/compiler/nir/spirv/spirv_to_nir.c +++ b/src/compiler/nir/spirv/spirv_to_nir.c @@ -38,11 +38,8 @@ vtn_undef_ssa_value(struct vtn_builder *b, const struct glsl_type *type) if (glsl_type_is_vector_or_scalar(type)) { unsigned num_components = glsl_get_vector_elements(val->type); - nir_ssa_undef_instr *undef = - nir_ssa_undef_instr_create(b->shader, num_components); - - nir_instr_insert_before_cf_list(&b->impl->body, &undef->instr); - val->def = &undef->def; + unsigned bit_size = glsl_get_bit_size(glsl_get_base_type(val->type)); + val->def = nir_ssa_undef(&b->nb, num_components, bit_size); } else { unsigned elems = glsl_get_length(val->type); val->elems = ralloc_array(b, struct vtn_ssa_value *, elems); @@ -1863,13 +1860,11 @@ vtn_vector_shuffle(struct vtn_builder *b, unsigned num_components, { nir_alu_instr *vec = create_vec(b->shader, num_components, src0->bit_size); - nir_ssa_undef_instr *undef = nir_ssa_undef_instr_create(b->shader, 1); - nir_builder_instr_insert(&b->nb, &undef->instr); - for (unsigned i = 0; i < num_components; i++) { uint32_t index = indices[i]; if (index == 0xffffffff) { - vec->src[i].src = nir_src_for_ssa(&undef->def); + vec->src[i].src = + nir_src_for_ssa(nir_ssa_undef(&b->nb, 1, src0->bit_size)); } else if (index < src0->num_components) { vec->src[i].src = nir_src_for_ssa(src0); vec->src[i].swizzle[0] = index; |