vkd3d-shader/dxil: Implement DX intrinsic FAbs.

This commit is contained in:
Conor McCarthy 2023-06-14 23:32:00 +10:00 committed by Alexandre Julliard
parent 33694f08fc
commit 4599d3c1cf
Notes: Alexandre Julliard 2024-03-18 23:25:32 +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/718
5 changed files with 26 additions and 9 deletions

View File

@ -342,6 +342,7 @@ enum dx_intrinsic_opcode
{
DX_LOAD_INPUT = 4,
DX_STORE_OUTPUT = 5,
DX_FABS = 6,
DX_ISNAN = 8,
DX_ISINF = 9,
DX_ISFINITE = 10,
@ -4267,6 +4268,21 @@ static void sm6_parser_emit_dx_create_handle(struct sm6_parser *sm6, enum dx_int
ins->handler_idx = VKD3DSIH_NOP;
}
static void sm6_parser_emit_dx_fabs(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_MOV);
if (!(src_param = instruction_src_params_alloc(ins, 1, sm6)))
return;
src_param_init_from_value(src_param, operands[0]);
src_param->modifiers = VKD3DSPSM_ABS;
instruction_dst_param_init_ssa_scalar(ins, sm6);
}
static enum vkd3d_shader_opcode sm6_dx_map_ma_op(enum dx_intrinsic_opcode op, const struct sm6_type *type)
{
switch (op)
@ -5051,6 +5067,7 @@ static const struct sm6_dx_opcode_info sm6_dx_op_table[] =
[DX_DERIV_FINEX ] = {"e", "R", sm6_parser_emit_dx_unary},
[DX_DERIV_FINEY ] = {"e", "R", sm6_parser_emit_dx_unary},
[DX_EXP ] = {"g", "R", sm6_parser_emit_dx_unary},
[DX_FABS ] = {"g", "R", sm6_parser_emit_dx_fabs},
[DX_FIRST_BIT_HI ] = {"i", "m", sm6_parser_emit_dx_unary},
[DX_FIRST_BIT_LO ] = {"i", "m", sm6_parser_emit_dx_unary},
[DX_FIRST_BIT_SHI ] = {"i", "m", sm6_parser_emit_dx_unary},

View File

@ -8,8 +8,8 @@ float4 main() : sv_target
[test]
uniform 0 float4 0.1 0.7 0.0 0.0
todo(sm<4 | sm>=6) draw quad
todo(sm<4) draw quad
probe all rgba (0.1, 0.7, 0.4, 0.4)
uniform 0 float4 -0.7 0.1 0.0 0.0
todo(sm<4 | sm>=6) draw quad
todo(sm<4) draw quad
probe all rgba (0.7, 0.1, 1.2, 0.4)

View File

@ -8,10 +8,10 @@ float4 main() : sv_target
[test]
uniform 0 float4 -0.5 6.5 0.0 0.0
todo(sm<4 | sm>=6) draw quad
todo(sm<4) draw quad
probe all rgba (-0.5, 0.0, 0.0, 0.0) 4
uniform 0 float4 1.1 0.3 0.0 0.0
todo(sm<4 | sm>=6) draw quad
todo(sm<4) draw quad
probe all rgba (0.2, 0.0, 0.0, 0.0) 4
[pixel shader todo(sm<4)]
@ -24,8 +24,8 @@ float4 main() : sv_target
[test]
uniform 0 float4 -0.5 6.5 2.0 0.0
todo(sm<4 | sm>=6) draw quad
todo(sm<4) draw quad
probe all rgba (-0.5, 0.5, 0.0, 0.0) 4
uniform 0 float4 1.1 0.3 3.0 0.0
todo(sm<4 | sm>=6) draw quad
todo(sm<4) draw quad
probe all rgba (1.1, 0.3, 0.0, 0.0) 4

View File

@ -18,7 +18,7 @@ float4 main(float4 pos : sv_position) : sv_target
}
[test]
todo(sm<4 | sm>=6) draw quad
todo(sm<4) draw quad
probe (10, 10) rgba (8.0, 8.0, 8.0, 8.0)
probe (11, 10) rgba (8.0, 8.0, 8.0, 8.0)
probe (12, 10) rgba (10.0, 10.0, 10.0, 10.0)

View File

@ -47,7 +47,7 @@ float4 main() : SV_TARGET
[test]
uniform 0 float4 2.0 0.0 0.0 0.0
todo(sm>=6) draw quad
draw quad
probe all rgba (2.0, 2.0, 2.0, 2.0)
[pixel shader]
@ -60,7 +60,7 @@ float4 main() : SV_TARGET
[test]
uniform 0 float4 2.0 0.0 0.0 0.0
todo(sm>=6) draw quad
draw quad
probe all rgba (2.0, 2.0, 2.0, 2.0)
[pixel shader fail]