vkd3d-shader/spirv: Support bool TEMP registers.

This commit is contained in:
Giovanni Mascellani 2024-01-17 13:31:45 +01:00 committed by Alexandre Julliard
parent 49f0fd42b8
commit eb723a8d2b
Notes: Alexandre Julliard 2024-02-06 23:42:19 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Conor McCarthy (@cmccarthy)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/607

View File

@ -3844,8 +3844,21 @@ static uint32_t spirv_compiler_emit_load_scalar(struct spirv_compiler *compiler,
if (component_type != reg_info->component_type)
{
type_id = vkd3d_spirv_get_type_id(builder, component_type, 1);
val_id = vkd3d_spirv_build_op_bitcast(builder, type_id, val_id);
if (component_type == VKD3D_SHADER_COMPONENT_BOOL)
{
if (reg_info->component_type != VKD3D_SHADER_COMPONENT_UINT)
{
type_id = vkd3d_spirv_get_type_id(builder, VKD3D_SHADER_COMPONENT_UINT, 1);
val_id = vkd3d_spirv_build_op_bitcast(builder, type_id, val_id);
}
val_id = spirv_compiler_emit_int_to_bool(compiler, VKD3D_SHADER_CONDITIONAL_OP_NZ,
VKD3D_DATA_UINT, 1, val_id);
}
else
{
type_id = vkd3d_spirv_get_type_id(builder, component_type, 1);
val_id = vkd3d_spirv_build_op_bitcast(builder, type_id, val_id);
}
}
return val_id;
@ -4032,8 +4045,21 @@ static uint32_t spirv_compiler_emit_load_reg(struct spirv_compiler *compiler,
if (component_type != reg_info.component_type)
{
type_id = vkd3d_spirv_get_type_id(builder, component_type, component_count);
val_id = vkd3d_spirv_build_op_bitcast(builder, type_id, val_id);
if (component_type == VKD3D_SHADER_COMPONENT_BOOL)
{
if (reg_info.component_type != VKD3D_SHADER_COMPONENT_UINT)
{
type_id = vkd3d_spirv_get_type_id(builder, VKD3D_SHADER_COMPONENT_UINT, component_count);
val_id = vkd3d_spirv_build_op_bitcast(builder, type_id, val_id);
}
val_id = spirv_compiler_emit_int_to_bool(compiler, VKD3D_SHADER_CONDITIONAL_OP_NZ,
VKD3D_DATA_UINT, component_count, val_id);
}
else
{
type_id = vkd3d_spirv_get_type_id(builder, component_type, component_count);
val_id = vkd3d_spirv_build_op_bitcast(builder, type_id, val_id);
}
}
return val_id;
@ -4227,6 +4253,9 @@ static void spirv_compiler_emit_store_reg(struct spirv_compiler *compiler,
{
if (data_type_is_64_bit(reg->data_type))
src_write_mask = vsir_write_mask_32_from_64(write_mask);
if (component_type == VKD3D_SHADER_COMPONENT_BOOL)
val_id = spirv_compiler_emit_bool_to_int(compiler,
vsir_write_mask_component_count(src_write_mask), val_id, false);
type_id = vkd3d_spirv_get_type_id(builder, reg_info.component_type,
vsir_write_mask_component_count(src_write_mask));
val_id = vkd3d_spirv_build_op_bitcast(builder, type_id, val_id);