Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/spirv.c:
- }
+}
+static void spirv_compiler_emit_bool_cast(struct spirv_compiler *compiler,
const struct vkd3d_shader_instruction *instruction)
+{
- const struct vkd3d_shader_dst_param *dst = instruction->dst;
- const struct vkd3d_shader_src_param *src = instruction->src;
- uint32_t val_id;
- assert(src->reg.data_type == VKD3D_DATA_BOOL && dst->reg.data_type != VKD3D_DATA_BOOL);
- val_id = spirv_compiler_emit_load_src(compiler, src, dst->write_mask);
- if (dst->reg.data_type == VKD3D_DATA_FLOAT)
- {
val_id = spirv_compiler_emit_bool_to_float(compiler, 1, val_id, instruction->handler_idx == VKD3DSIH_ITOF);
I'm quite confused, you mean that `itof` on bools is used to indicate that `true` must be mapped to `-1.0` and something else (maybe `utof`?) is used to indicate that `true` must be mapped to `1.0`? That looks like a very peculiar operation, that I wouldn't overload on `itof`. What's the alternative op expected here?
Also, is there anything already that generates `itof` on bools? If not, like it seems to me, than that should be introduced before adding this code, so it is not dead.