vkd3d-shader/dxil: Implement DX intrinsic Discard.

This commit is contained in:
Conor McCarthy 2024-03-20 14:54:18 +10:00 committed by Alexandre Julliard
parent 8d947ce868
commit 11ee92ed7e
Notes: Alexandre Julliard 2024-03-27 23:08:24 +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/736
3 changed files with 20 additions and 6 deletions

View File

@ -401,6 +401,7 @@ enum dx_intrinsic_opcode
DX_ATOMIC_BINOP = 78, DX_ATOMIC_BINOP = 78,
DX_ATOMIC_CMP_XCHG = 79, DX_ATOMIC_CMP_XCHG = 79,
DX_BARRIER = 80, DX_BARRIER = 80,
DX_DISCARD = 82,
DX_DERIV_COARSEX = 83, DX_DERIV_COARSEX = 83,
DX_DERIV_COARSEY = 84, DX_DERIV_COARSEY = 84,
DX_DERIV_FINEX = 85, DX_DERIV_FINEX = 85,
@ -4460,6 +4461,18 @@ static void sm6_parser_emit_dx_create_handle(struct sm6_parser *sm6, enum dx_int
ins->handler_idx = VKD3DSIH_NOP; ins->handler_idx = VKD3DSIH_NOP;
} }
static void sm6_parser_emit_dx_discard(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_DISCARD);
if ((src_param = instruction_src_params_alloc(ins, 1, sm6)))
src_param_init_from_value(src_param, operands[0]);
}
static void sm6_parser_emit_dx_fabs(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, 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) const struct sm6_value **operands, struct function_emission_state *state)
{ {
@ -5315,6 +5328,7 @@ static const struct sm6_dx_opcode_info sm6_dx_op_table[] =
[DX_DERIV_COARSEY ] = {"e", "R", sm6_parser_emit_dx_unary}, [DX_DERIV_COARSEY ] = {"e", "R", sm6_parser_emit_dx_unary},
[DX_DERIV_FINEX ] = {"e", "R", sm6_parser_emit_dx_unary}, [DX_DERIV_FINEX ] = {"e", "R", sm6_parser_emit_dx_unary},
[DX_DERIV_FINEY ] = {"e", "R", sm6_parser_emit_dx_unary}, [DX_DERIV_FINEY ] = {"e", "R", sm6_parser_emit_dx_unary},
[DX_DISCARD ] = {"v", "1", sm6_parser_emit_dx_discard},
[DX_EXP ] = {"g", "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_FABS ] = {"g", "R", sm6_parser_emit_dx_fabs},
[DX_FIRST_BIT_HI ] = {"i", "m", sm6_parser_emit_dx_unary}, [DX_FIRST_BIT_HI ] = {"i", "m", sm6_parser_emit_dx_unary},

View File

@ -9,14 +9,14 @@ float4 main() : sv_target
[test] [test]
uniform 0 float4 1 2 3 4 uniform 0 float4 1 2 3 4
todo(sm>=6 | glsl) draw quad todo(glsl) draw quad
probe all rgba (1, 2, 3, 4) probe all rgba (1, 2, 3, 4)
uniform 0 float4 9 8 7 6 uniform 0 float4 9 8 7 6
todo(sm>=6 | glsl) draw quad todo(glsl) draw quad
probe all rgba (9, 8, 7, 6) probe all rgba (9, 8, 7, 6)
uniform 0 float4 -1 8 7 6 uniform 0 float4 -1 8 7 6
todo(sm>=6 | glsl) draw quad todo(glsl) draw quad
probe all rgba (9, 8, 7, 6) probe all rgba (9, 8, 7, 6)
uniform 0 float4 9 0 7 6 uniform 0 float4 9 0 7 6
todo(sm>=6 | glsl) draw quad todo(glsl) draw quad
probe all rgba (9, 0, 7, 6) probe all rgba (9, 0, 7, 6)

View File

@ -9,8 +9,8 @@ float4 main() : sv_target
[test] [test]
uniform 0 float4 1 2 3 4 uniform 0 float4 1 2 3 4
todo(sm<4 | sm>=6 | glsl) draw quad todo(sm<4 | glsl) draw quad
probe all rgba (1, 2, 3, 4) probe all rgba (1, 2, 3, 4)
uniform 0 float4 9 8 7 6 uniform 0 float4 9 8 7 6
todo(sm<4 | sm>=6 | glsl) draw quad todo(sm<4 | glsl) draw quad
probe all rgba (1, 2, 3, 4) probe all rgba (1, 2, 3, 4)