vkd3d-shader/dxil: Implement DX intrinsics WaveGetLaneCount and WaveGetLaneIndex.

This commit is contained in:
Conor McCarthy 2024-04-18 10:35:07 +10:00 committed by Alexandre Julliard
parent 766913f911
commit 6a56b4e5d8
Notes: Alexandre Julliard 2024-05-02 22:40:21 +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/800
3 changed files with 34 additions and 0 deletions

View File

@ -1161,6 +1161,14 @@ static void shader_print_register(struct vkd3d_d3d_asm_compiler *compiler, const
vkd3d_string_buffer_printf(buffer, "sr"); vkd3d_string_buffer_printf(buffer, "sr");
break; break;
case VKD3DSPR_WAVELANECOUNT:
vkd3d_string_buffer_printf(buffer, "vWaveLaneCount");
break;
case VKD3DSPR_WAVELANEINDEX:
vkd3d_string_buffer_printf(buffer, "vWaveLaneIndex");
break;
default: default:
vkd3d_string_buffer_printf(buffer, "%s<unhandled register type %#x>%s", vkd3d_string_buffer_printf(buffer, "%s<unhandled register type %#x>%s",
compiler->colours.error, reg->type, compiler->colours.reset); compiler->colours.error, reg->type, compiler->colours.reset);

View File

@ -427,6 +427,8 @@ enum dx_intrinsic_opcode
DX_STORE_PATCH_CONSTANT = 106, DX_STORE_PATCH_CONSTANT = 106,
DX_OUTPUT_CONTROL_POINT_ID = 107, DX_OUTPUT_CONTROL_POINT_ID = 107,
DX_PRIMITIVE_ID = 108, DX_PRIMITIVE_ID = 108,
DX_WAVE_GET_LANE_INDEX = 111,
DX_WAVE_GET_LANE_COUNT = 112,
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,
@ -5899,6 +5901,26 @@ 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_builtin(struct sm6_parser *sm6, enum dx_intrinsic_opcode op,
const struct sm6_value **operands, struct function_emission_state *state)
{
enum vkd3d_shader_register_type type;
switch (op)
{
case DX_WAVE_GET_LANE_COUNT:
type = VKD3DSPR_WAVELANECOUNT;
break;
case DX_WAVE_GET_LANE_INDEX:
type = VKD3DSPR_WAVELANEINDEX;
break;
default:
vkd3d_unreachable();
}
sm6_parser_emit_dx_input_register_mov(sm6, state->ins, type, VKD3D_DATA_UINT);
}
struct sm6_dx_opcode_info struct sm6_dx_opcode_info
{ {
const char *ret_type; const char *ret_type;
@ -6018,6 +6040,8 @@ static const struct sm6_dx_opcode_info sm6_dx_op_table[] =
[DX_UMAD ] = {"m", "RRR", sm6_parser_emit_dx_ma}, [DX_UMAD ] = {"m", "RRR", sm6_parser_emit_dx_ma},
[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_GET_LANE_COUNT ] = {"i", "", sm6_parser_emit_dx_wave_builtin},
[DX_WAVE_GET_LANE_INDEX ] = {"i", "", sm6_parser_emit_dx_wave_builtin},
}; };
static bool sm6_parser_validate_operand_type(struct sm6_parser *sm6, const struct sm6_value *value, char info_type, static bool sm6_parser_validate_operand_type(struct sm6_parser *sm6, const struct sm6_value *value, char info_type,

View File

@ -590,6 +590,8 @@ enum vkd3d_shader_register_type
VKD3DSPR_OUTSTENCILREF, VKD3DSPR_OUTSTENCILREF,
VKD3DSPR_UNDEF, VKD3DSPR_UNDEF,
VKD3DSPR_SSA, VKD3DSPR_SSA,
VKD3DSPR_WAVELANECOUNT,
VKD3DSPR_WAVELANEINDEX,
VKD3DSPR_COUNT, VKD3DSPR_COUNT,