From: Jason Ekstrand Date: Wed, 23 Dec 2015 19:10:13 +0000 (-0800) Subject: nir/spirv: Do boolean fixup on block loads X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3ab1b7afa8fd59ada577573954830a409a667bc4;p=mesa.git nir/spirv: Do boolean fixup on block loads We used to do it for variable loads on things of type "uniform" but that never got ported to block loads. --- diff --git a/src/glsl/nir/spirv_to_nir.c b/src/glsl/nir/spirv_to_nir.c index 23c2c481153..1afa7eba5a9 100644 --- a/src/glsl/nir/spirv_to_nir.c +++ b/src/glsl/nir/spirv_to_nir.c @@ -1168,7 +1168,16 @@ _vtn_block_load(struct vtn_builder *b, nir_intrinsic_op op, nir_ssa_dest_init(&load->instr, &load->dest, load->num_components, NULL); nir_builder_instr_insert(&b->nb, &load->instr); - val->def = &load->dest.ssa; + + if (glsl_get_base_type(type->type) == GLSL_TYPE_BOOL) { + /* Loads of booleans from externally visible memory need to be + * fixed up since they're defined to be zero/nonzero rather than + * NIR_FALSE/NIR_TRUE. + */ + val->def = nir_ine(&b->nb, &load->dest.ssa, nir_imm_int(&b->nb, 0)); + } else { + val->def = &load->dest.ssa; + } } else { unsigned elems = glsl_get_length(type->type); val->elems = ralloc_array(b, struct vtn_ssa_value *, elems);