tests/hlsl: Add SV_Coverage tests.

This commit is contained in:
Conor McCarthy 2024-04-04 15:00:26 +10:00 committed by Alexandre Julliard
parent 36c76e1557
commit c2a787181f
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
8 changed files with 72 additions and 1 deletions

View File

@ -84,6 +84,7 @@ vkd3d_shader_tests = \
tests/hlsl/compute.shader_test \ tests/hlsl/compute.shader_test \
tests/hlsl/conditional.shader_test \ tests/hlsl/conditional.shader_test \
tests/hlsl/const.shader_test \ tests/hlsl/const.shader_test \
tests/hlsl/coverage.shader_test \
tests/hlsl/cross.shader_test \ tests/hlsl/cross.shader_test \
tests/hlsl/d3dcolor-to-ubyte4.shader_test \ tests/hlsl/d3dcolor-to-ubyte4.shader_test \
tests/hlsl/ddxddy.shader_test \ tests/hlsl/ddxddy.shader_test \

View File

@ -0,0 +1,56 @@
[require]
shader model >= 5.0
[rtv 0]
format r32g32b32a32 float
size (2dms, 4, 640, 480)
[uav 1]
format r32 uint
size (2d, 4, 4)
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
[pixel shader todo]
RWTexture2D<uint> u : register(u1);
float4 main(float4 position : SV_Position, uint coverage : SV_Coverage) : SV_Target
{
InterlockedOr(u[uint2(position.x, position.y)], coverage);
return float4(0.0, 1.0, 0.0, 1.0);
}
[test]
sample mask 0x01
todo draw quad
probe all rgba (0.0, 0.25, 0.0, 0.25)
probe uav 1 all rui (0x01)
sample mask 0x03
todo draw quad
probe all rgba (0.0, 0.5, 0.0, 0.5)
probe uav 1 all rui (0x03)
sample mask 0x07
todo draw quad
probe all rgba (0.0, 0.75, 0.0, 0.75)
probe uav 1 all rui (0x07)
[uav 1]
format r32 uint
size (2d, 4, 4)
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
[test]
clear rtv 0 0.0 0.0 0.0 0.0
sample mask 0x09
todo draw quad
probe all rgba (0.0, 0.5, 0.0, 0.5)
probe uav 1 all rui (0x09)
sample mask 0x0f
todo draw quad
probe all rgba (0.0, 1.0, 0.0, 1.0)
probe uav 1 all rui (0x0f)

View File

@ -1231,6 +1231,13 @@ static void parse_test_directive(struct shader_runner *runner, const char *line)
fatal_error("Unknown uniform type '%s'.\n", line); fatal_error("Unknown uniform type '%s'.\n", line);
} }
} }
else if (match_string(line, "sample mask", &line))
{
unsigned int sample_mask;
read_uint(&line, &sample_mask, false);
runner->sample_mask = sample_mask;
}
else else
{ {
fatal_error("Unknown test directive '%s'.\n", line); fatal_error("Unknown test directive '%s'.\n", line);

View File

@ -175,6 +175,8 @@ struct shader_runner
uint32_t *uniforms; uint32_t *uniforms;
size_t uniform_count, uniform_capacity; size_t uniform_count, uniform_capacity;
uint32_t sample_mask;
struct resource *resources[MAX_RESOURCES]; struct resource *resources[MAX_RESOURCES];
size_t resource_count; size_t resource_count;
uint32_t failed_resources[RESOURCE_TYPE_VERTEX_BUFFER + 1][VKD3D_BITMAP_SIZE(MAX_RESOURCES)]; uint32_t failed_resources[RESOURCE_TYPE_VERTEX_BUFFER + 1][VKD3D_BITMAP_SIZE(MAX_RESOURCES)];

View File

@ -803,6 +803,8 @@ static bool d3d11_runner_draw(struct shader_runner *r,
ID3D10Blob_Release(vs_code); ID3D10Blob_Release(vs_code);
if (r->sample_mask)
ID3D11DeviceContext_OMSetBlendState(context, NULL, NULL, r->sample_mask);
ID3D11DeviceContext_IASetPrimitiveTopology(context, primitive_topology); ID3D11DeviceContext_IASetPrimitiveTopology(context, primitive_topology);
ID3D11DeviceContext_VSSetShader(context, vs, NULL, 0); ID3D11DeviceContext_VSSetShader(context, vs, NULL, 0);
ID3D11DeviceContext_PSSetShader(context, ps, NULL, 0); ID3D11DeviceContext_PSSetShader(context, ps, NULL, 0);

View File

@ -590,7 +590,7 @@ static bool d3d12_runner_draw(struct shader_runner *r,
pso_desc.RasterizerState.FillMode = D3D12_FILL_MODE_SOLID; pso_desc.RasterizerState.FillMode = D3D12_FILL_MODE_SOLID;
pso_desc.RasterizerState.CullMode = D3D12_CULL_MODE_NONE; pso_desc.RasterizerState.CullMode = D3D12_CULL_MODE_NONE;
pso_desc.SampleDesc.Count = sample_count; pso_desc.SampleDesc.Count = sample_count;
pso_desc.SampleMask = ~(UINT)0; pso_desc.SampleMask = r->sample_mask ? r->sample_mask : ~(UINT)0;
pso_desc.pRootSignature = test_context->root_signature; pso_desc.pRootSignature = test_context->root_signature;
input_element_descs = calloc(runner->r.input_element_count, sizeof(*input_element_descs)); input_element_descs = calloc(runner->r.input_element_count, sizeof(*input_element_descs));

View File

@ -1119,6 +1119,8 @@ static bool gl_runner_draw(struct shader_runner *r,
} }
} }
/* TODO: sample count and mask. */
glViewport(0, 0, RENDER_TARGET_WIDTH, RENDER_TARGET_HEIGHT); glViewport(0, 0, RENDER_TARGET_WIDTH, RENDER_TARGET_HEIGHT);
glScissor(0, 0, RENDER_TARGET_WIDTH, RENDER_TARGET_HEIGHT); glScissor(0, 0, RENDER_TARGET_WIDTH, RENDER_TARGET_HEIGHT);
glDrawBuffers(rt_count, draw_buffers); glDrawBuffers(rt_count, draw_buffers);

View File

@ -845,6 +845,7 @@ static VkPipeline create_graphics_pipeline(struct vulkan_shader_runner *runner,
rs_desc.frontFace = VK_FRONT_FACE_CLOCKWISE; rs_desc.frontFace = VK_FRONT_FACE_CLOCKWISE;
rs_desc.lineWidth = 1.0f; rs_desc.lineWidth = 1.0f;
/* TODO: sample count and mask. */
ms_desc.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT; ms_desc.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT;
pipeline_desc.stageCount = stage_count; pipeline_desc.stageCount = stage_count;