diff options
author | Jason Ekstrand <[email protected]> | 2015-05-06 12:54:02 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-08-31 16:58:20 -0700 |
commit | ca51d926fd0a1080b114022b362cebb2107f2cbb (patch) | |
tree | 7e7a707151ea4ca098765091c05dc6e27d73835f | |
parent | b6562bbc300d75de71ef5ed03fd24bb6cbe8d51b (diff) |
nir/spirv: Handle boolean uniforms correctly
-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 4a12b2930b2..d1205f5ae07 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; } |