vkd3d-shader/dxil: Implement DX intrinsic WaveActiveBallot.

This commit is contained in:
Conor McCarthy 2024-04-23 20:57:43 +10:00 committed by Alexandre Julliard
parent 62a512c4f8
commit 174a692a17
Notes: Alexandre Julliard 2024-05-06 22:37:06 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/827
3 changed files with 21 additions and 0 deletions

View File

@ -328,6 +328,7 @@ static const char * const shader_opcode_names[] =
[VKD3DSIH_UTOF ] = "utof", [VKD3DSIH_UTOF ] = "utof",
[VKD3DSIH_UTOU ] = "utou", [VKD3DSIH_UTOU ] = "utou",
[VKD3DSIH_WAVE_ACTIVE_ALL_EQUAL ] = "wave_active_all_equal", [VKD3DSIH_WAVE_ACTIVE_ALL_EQUAL ] = "wave_active_all_equal",
[VKD3DSIH_WAVE_ACTIVE_BALLOT ] = "wave_active_ballot",
[VKD3DSIH_WAVE_ALL_TRUE ] = "wave_all_true", [VKD3DSIH_WAVE_ALL_TRUE ] = "wave_all_true",
[VKD3DSIH_WAVE_ANY_TRUE ] = "wave_any_true", [VKD3DSIH_WAVE_ANY_TRUE ] = "wave_any_true",
[VKD3DSIH_XOR ] = "xor", [VKD3DSIH_XOR ] = "xor",

View File

@ -432,6 +432,7 @@ enum dx_intrinsic_opcode
DX_WAVE_ANY_TRUE = 113, DX_WAVE_ANY_TRUE = 113,
DX_WAVE_ALL_TRUE = 114, DX_WAVE_ALL_TRUE = 114,
DX_WAVE_ACTIVE_ALL_EQUAL = 115, DX_WAVE_ACTIVE_ALL_EQUAL = 115,
DX_WAVE_ACTIVE_BALLOT = 116,
DX_LEGACY_F32TOF16 = 130, DX_LEGACY_F32TOF16 = 130,
DX_LEGACY_F16TOF32 = 131, DX_LEGACY_F16TOF32 = 131,
DX_RAW_BUFFER_LOAD = 139, DX_RAW_BUFFER_LOAD = 139,
@ -5910,6 +5911,20 @@ static void sm6_parser_emit_dx_texture_store(struct sm6_parser *sm6, enum dx_int
dst_param_init_with_mask(dst_param, write_mask); dst_param_init_with_mask(dst_param, write_mask);
} }
static void sm6_parser_emit_dx_wave_active_ballot(struct sm6_parser *sm6, enum dx_intrinsic_opcode op,
const struct sm6_value **operands, struct function_emission_state *state)
{
struct vkd3d_shader_instruction *ins = state->ins;
struct vkd3d_shader_src_param *src_param;
vsir_instruction_init(ins, &sm6->p.location, VKD3DSIH_WAVE_ACTIVE_BALLOT);
if (!(src_param = instruction_src_params_alloc(ins, 1, sm6)))
return;
src_param_init_from_value(src_param, operands[0]);
instruction_dst_param_init_ssa_vector(ins, VKD3D_VEC4_SIZE, sm6);
}
static void sm6_parser_emit_dx_wave_builtin(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, static void sm6_parser_emit_dx_wave_builtin(struct sm6_parser *sm6, enum dx_intrinsic_opcode op,
const struct sm6_value **operands, struct function_emission_state *state) const struct sm6_value **operands, struct function_emission_state *state)
{ {
@ -5954,6 +5969,7 @@ struct sm6_dx_opcode_info
H -> handle H -> handle
D -> Dimensions D -> Dimensions
S -> splitdouble S -> splitdouble
V -> 4 x i32
v -> void v -> void
o -> overloaded o -> overloaded
R -> matches the return type R -> matches the return type
@ -6051,6 +6067,7 @@ static const struct sm6_dx_opcode_info sm6_dx_op_table[] =
[DX_UMAX ] = {"m", "RR", sm6_parser_emit_dx_binary}, [DX_UMAX ] = {"m", "RR", sm6_parser_emit_dx_binary},
[DX_UMIN ] = {"m", "RR", sm6_parser_emit_dx_binary}, [DX_UMIN ] = {"m", "RR", sm6_parser_emit_dx_binary},
[DX_WAVE_ACTIVE_ALL_EQUAL ] = {"1", "n", sm6_parser_emit_dx_unary}, [DX_WAVE_ACTIVE_ALL_EQUAL ] = {"1", "n", sm6_parser_emit_dx_unary},
[DX_WAVE_ACTIVE_BALLOT ] = {"V", "1", sm6_parser_emit_dx_wave_active_ballot},
[DX_WAVE_ALL_TRUE ] = {"1", "1", sm6_parser_emit_dx_unary}, [DX_WAVE_ALL_TRUE ] = {"1", "1", sm6_parser_emit_dx_unary},
[DX_WAVE_ANY_TRUE ] = {"1", "1", sm6_parser_emit_dx_unary}, [DX_WAVE_ANY_TRUE ] = {"1", "1", sm6_parser_emit_dx_unary},
[DX_WAVE_GET_LANE_COUNT ] = {"i", "", sm6_parser_emit_dx_wave_builtin}, [DX_WAVE_GET_LANE_COUNT ] = {"i", "", sm6_parser_emit_dx_wave_builtin},
@ -6102,6 +6119,8 @@ static bool sm6_parser_validate_operand_type(struct sm6_parser *sm6, const struc
return sm6_type_is_struct(type) && !strcmp(type->u.struc->name, "dx.types.Dimensions"); return sm6_type_is_struct(type) && !strcmp(type->u.struc->name, "dx.types.Dimensions");
case 'S': case 'S':
return sm6_type_is_struct(type) && !strcmp(type->u.struc->name, "dx.types.splitdouble"); return sm6_type_is_struct(type) && !strcmp(type->u.struc->name, "dx.types.splitdouble");
case 'V':
return sm6_type_is_struct(type) && !strcmp(type->u.struc->name, "dx.types.fouri32");
case 'v': case 'v':
return !type; return !type;
case 'o': case 'o':

View File

@ -528,6 +528,7 @@ enum vkd3d_shader_opcode
VKD3DSIH_UTOF, VKD3DSIH_UTOF,
VKD3DSIH_UTOU, VKD3DSIH_UTOU,
VKD3DSIH_WAVE_ACTIVE_ALL_EQUAL, VKD3DSIH_WAVE_ACTIVE_ALL_EQUAL,
VKD3DSIH_WAVE_ACTIVE_BALLOT,
VKD3DSIH_WAVE_ALL_TRUE, VKD3DSIH_WAVE_ALL_TRUE,
VKD3DSIH_WAVE_ANY_TRUE, VKD3DSIH_WAVE_ANY_TRUE,
VKD3DSIH_XOR, VKD3DSIH_XOR,