diff options
author | Jason Ekstrand <[email protected]> | 2015-12-23 11:10:13 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-12-23 13:49:56 -0800 |
commit | 3ab1b7afa8fd59ada577573954830a409a667bc4 (patch) | |
tree | 6a63fd926af0949a9f9df3c6d0646c6deb812e51 /src/glsl | |
parent | af74ce5a19315284f229277b44b84bede5be4d99 (diff) |
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.
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/nir/spirv_to_nir.c | 11 |
1 files changed, 10 insertions, 1 deletions
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); |