vkd3d-shader/dxil: Handle hyperbolic trigonometric functions in sm6_parser_emit_dx_unary().

This commit is contained in:
Conor McCarthy 2024-01-22 15:28:44 +10:00 committed by Alexandre Julliard
parent c2f6985454
commit 625e289574
Notes: Alexandre Julliard 2024-02-07 23:26:46 +01: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/618
5 changed files with 30 additions and 6 deletions

View File

@ -171,10 +171,13 @@ static const char * const shader_opcode_names[] =
[VKD3DSIH_GATHER4_S ] = "gather4_s", [VKD3DSIH_GATHER4_S ] = "gather4_s",
[VKD3DSIH_GEO ] = "ge", [VKD3DSIH_GEO ] = "ge",
[VKD3DSIH_GEU ] = "ge_unord", [VKD3DSIH_GEU ] = "ge_unord",
[VKD3DSIH_HCOS ] = "hcos",
[VKD3DSIH_HS_CONTROL_POINT_PHASE ] = "hs_control_point_phase", [VKD3DSIH_HS_CONTROL_POINT_PHASE ] = "hs_control_point_phase",
[VKD3DSIH_HS_DECLS ] = "hs_decls", [VKD3DSIH_HS_DECLS ] = "hs_decls",
[VKD3DSIH_HS_FORK_PHASE ] = "hs_fork_phase", [VKD3DSIH_HS_FORK_PHASE ] = "hs_fork_phase",
[VKD3DSIH_HS_JOIN_PHASE ] = "hs_join_phase", [VKD3DSIH_HS_JOIN_PHASE ] = "hs_join_phase",
[VKD3DSIH_HSIN ] = "hsin",
[VKD3DSIH_HTAN ] = "htan",
[VKD3DSIH_IADD ] = "iadd", [VKD3DSIH_IADD ] = "iadd",
[VKD3DSIH_IBFE ] = "ibfe", [VKD3DSIH_IBFE ] = "ibfe",
[VKD3DSIH_IDIV ] = "idiv", [VKD3DSIH_IDIV ] = "idiv",

View File

@ -342,6 +342,9 @@ enum dx_intrinsic_opcode
DX_ACOS = 15, DX_ACOS = 15,
DX_ASIN = 16, DX_ASIN = 16,
DX_ATAN = 17, DX_ATAN = 17,
DX_HCOS = 18,
DX_HSIN = 19,
DX_HTAN = 20,
DX_EXP = 21, DX_EXP = 21,
DX_FRC = 22, DX_FRC = 22,
DX_LOG = 23, DX_LOG = 23,
@ -3690,6 +3693,12 @@ static enum vkd3d_shader_opcode map_dx_unary_op(enum dx_intrinsic_opcode op)
return VKD3DSIH_ASIN; return VKD3DSIH_ASIN;
case DX_ATAN: case DX_ATAN:
return VKD3DSIH_ATAN; return VKD3DSIH_ATAN;
case DX_HCOS:
return VKD3DSIH_HCOS;
case DX_HSIN:
return VKD3DSIH_HSIN;
case DX_HTAN:
return VKD3DSIH_HTAN;
case DX_EXP: case DX_EXP:
return VKD3DSIH_EXP; return VKD3DSIH_EXP;
case DX_FRC: case DX_FRC:
@ -4263,6 +4272,9 @@ static const struct sm6_dx_opcode_info sm6_dx_op_table[] =
[DX_FMIN ] = {"g", "RR", sm6_parser_emit_dx_binary}, [DX_FMIN ] = {"g", "RR", sm6_parser_emit_dx_binary},
[DX_FRC ] = {"g", "R", sm6_parser_emit_dx_unary}, [DX_FRC ] = {"g", "R", sm6_parser_emit_dx_unary},
[DX_IBFE ] = {"m", "iiR", sm6_parser_emit_dx_tertiary}, [DX_IBFE ] = {"m", "iiR", sm6_parser_emit_dx_tertiary},
[DX_HCOS ] = {"g", "R", sm6_parser_emit_dx_unary},
[DX_HSIN ] = {"g", "R", sm6_parser_emit_dx_unary},
[DX_HTAN ] = {"g", "R", sm6_parser_emit_dx_unary},
[DX_IMAX ] = {"m", "RR", sm6_parser_emit_dx_binary}, [DX_IMAX ] = {"m", "RR", sm6_parser_emit_dx_binary},
[DX_IMIN ] = {"m", "RR", sm6_parser_emit_dx_binary}, [DX_IMIN ] = {"m", "RR", sm6_parser_emit_dx_binary},
[DX_ISFINITE ] = {"1", "g", sm6_parser_emit_dx_unary}, [DX_ISFINITE ] = {"1", "g", sm6_parser_emit_dx_unary},

View File

@ -7008,6 +7008,9 @@ static enum GLSLstd450 spirv_compiler_map_ext_glsl_instruction(
{VKD3DSIH_FIRSTBIT_LO, GLSLstd450FindILsb}, {VKD3DSIH_FIRSTBIT_LO, GLSLstd450FindILsb},
{VKD3DSIH_FIRSTBIT_SHI, GLSLstd450FindSMsb}, {VKD3DSIH_FIRSTBIT_SHI, GLSLstd450FindSMsb},
{VKD3DSIH_FRC, GLSLstd450Fract}, {VKD3DSIH_FRC, GLSLstd450Fract},
{VKD3DSIH_HCOS, GLSLstd450Cosh},
{VKD3DSIH_HSIN, GLSLstd450Sinh},
{VKD3DSIH_HTAN, GLSLstd450Tanh},
{VKD3DSIH_IMAX, GLSLstd450SMax}, {VKD3DSIH_IMAX, GLSLstd450SMax},
{VKD3DSIH_IMIN, GLSLstd450SMin}, {VKD3DSIH_IMIN, GLSLstd450SMin},
{VKD3DSIH_LOG, GLSLstd450Log2}, {VKD3DSIH_LOG, GLSLstd450Log2},
@ -9587,6 +9590,9 @@ static int spirv_compiler_handle_instruction(struct spirv_compiler *compiler,
case VKD3DSIH_ACOS: case VKD3DSIH_ACOS:
case VKD3DSIH_ASIN: case VKD3DSIH_ASIN:
case VKD3DSIH_ATAN: case VKD3DSIH_ATAN:
case VKD3DSIH_HCOS:
case VKD3DSIH_HSIN:
case VKD3DSIH_HTAN:
case VKD3DSIH_DFMA: case VKD3DSIH_DFMA:
case VKD3DSIH_DMAX: case VKD3DSIH_DMAX:
case VKD3DSIH_DMIN: case VKD3DSIH_DMIN:

View File

@ -366,10 +366,13 @@ enum vkd3d_shader_opcode
VKD3DSIH_GATHER4_S, VKD3DSIH_GATHER4_S,
VKD3DSIH_GEO, VKD3DSIH_GEO,
VKD3DSIH_GEU, VKD3DSIH_GEU,
VKD3DSIH_HCOS,
VKD3DSIH_HS_CONTROL_POINT_PHASE, VKD3DSIH_HS_CONTROL_POINT_PHASE,
VKD3DSIH_HS_DECLS, VKD3DSIH_HS_DECLS,
VKD3DSIH_HS_FORK_PHASE, VKD3DSIH_HS_FORK_PHASE,
VKD3DSIH_HS_JOIN_PHASE, VKD3DSIH_HS_JOIN_PHASE,
VKD3DSIH_HSIN,
VKD3DSIH_HTAN,
VKD3DSIH_IADD, VKD3DSIH_IADD,
VKD3DSIH_IBFE, VKD3DSIH_IBFE,
VKD3DSIH_IDIV, VKD3DSIH_IDIV,

View File

@ -86,10 +86,10 @@ float4 main() : sv_target
[test] [test]
uniform 0 float4 -6.28318531 -0.88137359 0.88137359 6.28318531 uniform 0 float4 -6.28318531 -0.88137359 0.88137359 6.28318531
todo draw quad todo(sm<6) draw quad
probe all rgba (-267.744894, -1.0, 1.0, 267.744894) 2 probe all rgba (-267.744894, -1.0, 1.0, 267.744894) 2
uniform 0 float4 -0.0 0.0 -90.0 90.0 uniform 0 float4 -0.0 0.0 -90.0 90.0
todo draw quad todo(sm<6) draw quad
% mingw does not support "inf" for scanf(), but numbers beyond FLOAT_MAX consistently result in inf. % mingw does not support "inf" for scanf(), but numbers beyond FLOAT_MAX consistently result in inf.
probe all rgba (0.0, 0.0, -1.0e39, 1.0e39) 1 probe all rgba (0.0, 0.0, -1.0e39, 1.0e39) 1
@ -104,10 +104,10 @@ float4 main() : sv_target
[test] [test]
uniform 0 float4 -1.76274717 -1.3169579 1.3169579 1.76274717 uniform 0 float4 -1.76274717 -1.3169579 1.3169579 1.76274717
todo draw quad todo(sm<6) draw quad
probe all rgba (3.0, 2.0, 2.0, 3.0) 2 probe all rgba (3.0, 2.0, 2.0, 3.0) 2
uniform 0 float4 -0.0 0.0 -90.0 90.0 uniform 0 float4 -0.0 0.0 -90.0 90.0
todo draw quad todo(sm<6) draw quad
probe all rgba (1.0, 1.0, 1.0e39, 1.0e39) 1 probe all rgba (1.0, 1.0, 1.0e39, 1.0e39) 1
@ -121,8 +121,8 @@ float4 main() : sv_target
[test] [test]
uniform 0 float4 -1.57079633 -0.54930614 0.54930614 1.57079633 uniform 0 float4 -1.57079633 -0.54930614 0.54930614 1.57079633
todo draw quad todo(sm<6) draw quad
probe all rgba (-0.91715234, -0.5, 0.5, 0.91715234) 2 probe all rgba (-0.91715234, -0.5, 0.5, 0.91715234) 2
uniform 0 float4 -10.0 -0.0 0.0 10.0 uniform 0 float4 -10.0 -0.0 0.0 10.0
todo draw quad todo(sm<6) draw quad
probe all rgba (-1.0, 0.0, 0.0, 1.0) 1 probe all rgba (-1.0, 0.0, 0.0, 1.0) 1