mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-12-15 08:03:30 -08:00
vkd3d-shader/dxil: Allow returning signed types from vsir_data_type_from_dxil().
We have a number of vsir operations which should take a signed type, but which the DXIL parser currently emits unsigned types for. For example, ISHR. In the SPIR-V backend, we translate ISHR to OpShiftRightArithmetic, which is specified as filling the most-significant bits of the result with the sign bit of the "Base" operand. For an unsigned type, that would technically be 0. In practice, implementations like radv/Mesa seem to fill with the most-significant bit of the "Base" operand for unsigned types, but arguably that could be considered a bug. Alternatively, the wording in the specification is just unfortunate; SPIR-V does generally take the position that signedness of operands should be irrelevant for almost all operations. Either way, it seems best to avoid using OpShiftRightArithmetic with unsigned types. For a target like MSL, allowing ISHR to take an unsigned source operand is just inconvenient; we'd have to introduce bitcasts to achieve the desired behaviour, instead of simply using msl_binop().
This commit is contained in:
Notes:
Henri Verbeet
2025-09-16 16:19:58 +02:00
Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1727
@@ -716,6 +716,7 @@ enum vsir_data_type
|
||||
VSIR_DATA_F32,
|
||||
VSIR_DATA_F64,
|
||||
|
||||
VSIR_DATA_I8,
|
||||
VSIR_DATA_I16,
|
||||
VSIR_DATA_I32,
|
||||
VSIR_DATA_I64,
|
||||
@@ -740,8 +741,13 @@ const char *vsir_data_type_get_name(enum vsir_data_type t, const char *error);
|
||||
|
||||
static inline bool data_type_is_integer(enum vsir_data_type data_type)
|
||||
{
|
||||
return data_type == VSIR_DATA_I16 || data_type == VSIR_DATA_I32 || data_type == VSIR_DATA_I64
|
||||
|| data_type == VSIR_DATA_U8 || data_type == VSIR_DATA_U16 || data_type == VSIR_DATA_U32
|
||||
return data_type == VSIR_DATA_I8
|
||||
|| data_type == VSIR_DATA_I16
|
||||
|| data_type == VSIR_DATA_I32
|
||||
|| data_type == VSIR_DATA_I64
|
||||
|| data_type == VSIR_DATA_U8
|
||||
|| data_type == VSIR_DATA_U16
|
||||
|| data_type == VSIR_DATA_U32
|
||||
|| data_type == VSIR_DATA_U64;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user