mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
nir/spirv: Handle boolean uniforms correctly
This commit is contained in:
parent
64bc58a88e
commit
56f533b3a0
1 changed files with 10 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue