From 3ab1b7afa8fd59ada577573954830a409a667bc4 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 23 Dec 2015 11:10:13 -0800 Subject: [PATCH] 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. --- src/glsl/nir/spirv_to_nir.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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); -- 2.30.2