vkd3d-shader/dxil: Implement DX intrinsic Coverage.

This commit is contained in:
Conor McCarthy 2024-04-04 14:29:57 +10:00 committed by Alexandre Julliard
parent c2a787181f
commit 127bcf90e4
Notes: Alexandre Julliard 2024-04-30 23:14:55 +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/814
2 changed files with 13 additions and 5 deletions

View File

@ -414,6 +414,7 @@ enum dx_intrinsic_opcode
DX_DERIV_COARSEY = 84, DX_DERIV_COARSEY = 84,
DX_DERIV_FINEX = 85, DX_DERIV_FINEX = 85,
DX_DERIV_FINEY = 86, DX_DERIV_FINEY = 86,
DX_COVERAGE = 91,
DX_THREAD_ID = 93, DX_THREAD_ID = 93,
DX_GROUP_ID = 94, DX_GROUP_ID = 94,
DX_THREAD_ID_IN_GROUP = 95, DX_THREAD_ID_IN_GROUP = 95,
@ -4817,6 +4818,12 @@ static void sm6_parser_emit_dx_input_register_mov(struct sm6_parser *sm6,
instruction_dst_param_init_ssa_scalar(ins, sm6); instruction_dst_param_init_ssa_scalar(ins, sm6);
} }
static void sm6_parser_emit_dx_coverage(struct sm6_parser *sm6, enum dx_intrinsic_opcode op,
const struct sm6_value **operands, struct function_emission_state *state)
{
sm6_parser_emit_dx_input_register_mov(sm6, state->ins, VKD3DSPR_COVERAGE, VKD3D_DATA_UINT);
}
static const struct sm6_descriptor_info *sm6_parser_get_descriptor(struct sm6_parser *sm6, static const struct sm6_descriptor_info *sm6_parser_get_descriptor(struct sm6_parser *sm6,
enum vkd3d_shader_descriptor_type type, unsigned int id, const struct sm6_value *address) enum vkd3d_shader_descriptor_type type, unsigned int id, const struct sm6_value *address)
{ {
@ -5935,6 +5942,7 @@ static const struct sm6_dx_opcode_info sm6_dx_op_table[] =
[DX_CBUFFER_LOAD_LEGACY ] = {"o", "Hi", sm6_parser_emit_dx_cbuffer_load}, [DX_CBUFFER_LOAD_LEGACY ] = {"o", "Hi", sm6_parser_emit_dx_cbuffer_load},
[DX_COS ] = {"g", "R", sm6_parser_emit_dx_sincos}, [DX_COS ] = {"g", "R", sm6_parser_emit_dx_sincos},
[DX_COUNT_BITS ] = {"i", "m", sm6_parser_emit_dx_unary}, [DX_COUNT_BITS ] = {"i", "m", sm6_parser_emit_dx_unary},
[DX_COVERAGE ] = {"i", "", sm6_parser_emit_dx_coverage},
[DX_CREATE_HANDLE ] = {"H", "ccib", sm6_parser_emit_dx_create_handle}, [DX_CREATE_HANDLE ] = {"H", "ccib", sm6_parser_emit_dx_create_handle},
[DX_DERIV_COARSEX ] = {"e", "R", sm6_parser_emit_dx_unary}, [DX_DERIV_COARSEX ] = {"e", "R", sm6_parser_emit_dx_unary},
[DX_DERIV_COARSEY ] = {"e", "R", sm6_parser_emit_dx_unary}, [DX_DERIV_COARSEY ] = {"e", "R", sm6_parser_emit_dx_unary},

View File

@ -24,15 +24,15 @@ float4 main(float4 position : SV_Position, uint coverage : SV_Coverage) : SV_Tar
[test] [test]
sample mask 0x01 sample mask 0x01
todo draw quad todo(sm<6) draw quad
probe all rgba (0.0, 0.25, 0.0, 0.25) probe all rgba (0.0, 0.25, 0.0, 0.25)
probe uav 1 all rui (0x01) probe uav 1 all rui (0x01)
sample mask 0x03 sample mask 0x03
todo draw quad todo(sm<6) draw quad
probe all rgba (0.0, 0.5, 0.0, 0.5) probe all rgba (0.0, 0.5, 0.0, 0.5)
probe uav 1 all rui (0x03) probe uav 1 all rui (0x03)
sample mask 0x07 sample mask 0x07
todo draw quad todo(sm<6) draw quad
probe all rgba (0.0, 0.75, 0.0, 0.75) probe all rgba (0.0, 0.75, 0.0, 0.75)
probe uav 1 all rui (0x07) probe uav 1 all rui (0x07)
@ -47,10 +47,10 @@ size (2d, 4, 4)
[test] [test]
clear rtv 0 0.0 0.0 0.0 0.0 clear rtv 0 0.0 0.0 0.0 0.0
sample mask 0x09 sample mask 0x09
todo draw quad todo(sm<6) draw quad
probe all rgba (0.0, 0.5, 0.0, 0.5) probe all rgba (0.0, 0.5, 0.0, 0.5)
probe uav 1 all rui (0x09) probe uav 1 all rui (0x09)
sample mask 0x0f sample mask 0x0f
todo draw quad todo(sm<6) draw quad
probe all rgba (0.0, 1.0, 0.0, 1.0) probe all rgba (0.0, 1.0, 0.0, 1.0)
probe uav 1 all rui (0x0f) probe uav 1 all rui (0x0f)