From 56f533b3a05141df907a608c504bb1cc3dcf8641 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 6 May 2015 12:54:02 -0700 Subject: [PATCH] nir/spirv: Handle boolean uniforms correctly --- 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 a4f13603dac..099bbaf42e1 100644 --- a/src/glsl/nir/spirv_to_nir.c +++ b/src/glsl/nir/spirv_to_nir.c @@ -573,7 +573,16 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode, nir_builder_instr_insert(&b->nb, &load->instr); val->type = src_type; - val->ssa = &load->dest.ssa; + + if (src->var->data.mode == nir_var_uniform && + glsl_get_base_type(src_type) == GLSL_TYPE_BOOL) { + /* Uniform boolean loads need to be fixed up since they're defined + * to be zero/nonzero rather than NIR_FALSE/NIR_TRUE. + */ + val->ssa = nir_ine(&b->nb, &load->dest.ssa, nir_imm_int(&b->nb, 0)); + } else { + val->ssa = &load->dest.ssa; + } break; } -- 2.30.2