vkd3d-shader/hlsl: Implement output SV_Coverage.

This commit is contained in:
Elizabeth Figura 2024-06-18 23:52:38 -05:00 committed by Henri Verbeet
parent 71a3d55e8c
commit 59f770214a
Notes: Henri Verbeet 2024-07-11 00:41:24 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/924
3 changed files with 14 additions and 8 deletions

View File

@ -2762,6 +2762,7 @@ bool hlsl_sm4_register_from_semantic(struct hlsl_ctx *ctx, const struct hlsl_sem
{"depth", true, VKD3D_SHADER_TYPE_PIXEL, VKD3DSPR_DEPTHOUT, false},
{"sv_depth", true, VKD3D_SHADER_TYPE_PIXEL, VKD3DSPR_DEPTHOUT, false},
{"sv_target", true, VKD3D_SHADER_TYPE_PIXEL, VKD3DSPR_OUTPUT, true},
{"sv_coverage", true, VKD3D_SHADER_TYPE_PIXEL, VKD3DSPR_SAMPLEMASK, false},
};
for (i = 0; i < ARRAY_SIZE(register_table); ++i)
@ -2817,6 +2818,7 @@ bool hlsl_sm4_usage_from_semantic(struct hlsl_ctx *ctx, const struct hlsl_semant
{"depth", true, VKD3D_SHADER_TYPE_PIXEL, D3D_NAME_DEPTH},
{"sv_target", true, VKD3D_SHADER_TYPE_PIXEL, D3D_NAME_TARGET},
{"sv_depth", true, VKD3D_SHADER_TYPE_PIXEL, D3D_NAME_DEPTH},
{"sv_coverage", true, VKD3D_SHADER_TYPE_PIXEL, D3D_NAME_COVERAGE},
{"sv_position", false, VKD3D_SHADER_TYPE_VERTEX, D3D_NAME_UNDEFINED},
{"sv_vertexid", false, VKD3D_SHADER_TYPE_VERTEX, D3D_NAME_VERTEX_ID},

View File

@ -5,7 +5,7 @@ shader model >= 4.1
format r32g32b32a32 float
size (2dms, 4, 640, 480)
[pixel shader todo]
[pixel shader]
float4 main(out uint sample_mask : SV_Coverage) : SV_Target
{
sample_mask = 0x5;
@ -13,11 +13,12 @@ float4 main(out uint sample_mask : SV_Coverage) : SV_Target
}
[test]
todo(sm<6) draw quad
clear rtv 0 0.0 0.0 0.0 0.0
todo(glsl) draw quad
probe (0, 0) rgba (0.5, 0.5, 0.5, 0.5)
sample mask 0x0b
clear rtv 0 0.0 0.0 0.0 0.0
todo(sm<6) draw quad
todo(glsl) draw quad
probe (0, 0) rgba (0.25, 0.25, 0.25, 0.25)

View File

@ -2059,12 +2059,14 @@ static void test_signature_reflection(void)
"void main(\n"
" in float2 a : apple,\n"
" out float4 b : sv_target2,\n"
" out float c : sv_depth,\n"
" out uint c : sv_coverage,\n"
" in float4 d : position,\n"
" in float4 e : sv_position)\n"
" in float4 e : sv_position,\n"
" out float f : sv_depth)\n"
"{\n"
" b = d;\n"
" c = 0;\n"
" f = 1;\n"
"}";
static const D3D12_SIGNATURE_PARAMETER_DESC ps1_inputs[] =
@ -2076,8 +2078,9 @@ static void test_signature_reflection(void)
static const D3D12_SIGNATURE_PARAMETER_DESC ps1_outputs[] =
{
{"sv_target", 2, 2, D3D_NAME_TARGET, D3D_REGISTER_COMPONENT_FLOAT32, 0xf},
{"sv_depth", 0, ~0u, D3D_NAME_DEPTH, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0xe},
{"sv_target", 2, 2, D3D_NAME_TARGET, D3D_REGISTER_COMPONENT_FLOAT32, 0xf},
{"sv_coverage", 0, ~0u, D3D_NAME_COVERAGE, D3D_REGISTER_COMPONENT_UINT32, 0x1, 0xe},
{"sv_depth", 0, ~0u, D3D_NAME_DEPTH, D3D_REGISTER_COMPONENT_FLOAT32, 0x1, 0xe},
};
static const char ps2_source[] =
@ -2123,7 +2126,7 @@ static void test_signature_reflection(void)
{vs1_source, "vs_4_0", true, vs1_inputs, ARRAY_SIZE(vs1_inputs), vs1_outputs, ARRAY_SIZE(vs1_outputs)},
{vs2_source, "vs_4_0", false, vs2_inputs, ARRAY_SIZE(vs2_inputs), vs2_outputs, ARRAY_SIZE(vs2_outputs)},
{vs2_source, "vs_4_0", true, vs2_inputs, ARRAY_SIZE(vs2_inputs), vs2_legacy_outputs, ARRAY_SIZE(vs2_legacy_outputs)},
{ps1_source, "ps_4_0", false, ps1_inputs, ARRAY_SIZE(ps1_inputs), ps1_outputs, ARRAY_SIZE(ps1_outputs)},
{ps1_source, "ps_4_1", false, ps1_inputs, ARRAY_SIZE(ps1_inputs), ps1_outputs, ARRAY_SIZE(ps1_outputs)},
{ps2_source, "ps_4_0", true, ps2_inputs, ARRAY_SIZE(ps2_inputs), ps2_outputs, ARRAY_SIZE(ps2_outputs)},
{cs1_source, "cs_5_0", false, NULL, 0, NULL, 0},
};