Our partial stub for CheckFormatSupport() is still quite inaccurate. For example, we might report SHADER_SAMPLE support for UINT formats. In the long term, wined3d should probably return the format support flags directly. Unfortunately, the current wined3d interface shared with d3d9 isn't well suited for returning fine-grained format support flags.
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d10core/tests/d3d10core.c | 20 ++++++++++++++++-- dlls/d3d11/device.c | 13 +++++++++--- dlls/d3d11/tests/d3d11.c | 35 ++++++++++++++++++++++++++++++-- 3 files changed, 61 insertions(+), 7 deletions(-)
diff --git a/dlls/d3d10core/tests/d3d10core.c b/dlls/d3d10core/tests/d3d10core.c index 32f943704af8..ecf1f3814726 100644 --- a/dlls/d3d10core/tests/d3d10core.c +++ b/dlls/d3d10core/tests/d3d10core.c @@ -13390,7 +13390,7 @@ static void check_format_support(const unsigned int *format_support, } }
-static void test_required_format_support(void) +static void test_format_support(void) { unsigned int format_support[DXGI_FORMAT_B4G4R4A4_UNORM + 1]; ID3D10Device *device; @@ -13425,6 +13425,22 @@ static void test_required_format_support(void) format, hr, format_support[format]); }
+ for (format = DXGI_FORMAT_UNKNOWN; format <= DXGI_FORMAT_B4G4R4A4_UNORM; ++format) + { + ok(!(format_support[format] & D3D10_FORMAT_SUPPORT_SHADER_GATHER), + "Unexpected SHADER_GATHER for format %#x.\n", format); + ok(!(format_support[format] & D3D11_FORMAT_SUPPORT_SHADER_GATHER_COMPARISON), + "Unexpected SHADER_GATHER_COMPARISON for format %#x.\n", format); + } + + ok(format_support[DXGI_FORMAT_R8G8B8A8_UNORM] & D3D10_FORMAT_SUPPORT_SHADER_SAMPLE, + "SHADER_SAMPLE is not supported for R8G8B8A8_UNORM.\n"); + todo_wine + ok(!(format_support[DXGI_FORMAT_R32G32B32A32_UINT] & D3D10_FORMAT_SUPPORT_SHADER_SAMPLE), + "SHADER_SAMPLE is supported for R32G32B32A32_UINT.\n"); + ok(format_support[DXGI_FORMAT_R32G32B32A32_UINT] & D3D10_FORMAT_SUPPORT_SHADER_LOAD, + "SHADER_LOAD is not supported for R32G32B32A32_UINT.\n"); + check_format_support(format_support, index_buffers, ARRAY_SIZE(index_buffers), D3D10_FORMAT_SUPPORT_IA_INDEX_BUFFER, "index buffer");
@@ -18057,7 +18073,7 @@ START_TEST(d3d10core) queue_test(test_index_buffer_offset); queue_test(test_face_culling); queue_test(test_line_antialiasing_blending); - queue_test(test_required_format_support); + queue_test(test_format_support); queue_test(test_ddy); queue_test(test_shader_input_registers_limits); queue_test(test_unbind_shader_resource_view); diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 751afc132112..31292e9ddff8 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -3378,6 +3378,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFormatSupport(ID3D11Device2 * struct d3d_device *device = impl_from_ID3D11Device2(iface); struct wined3d_device_creation_parameters params; enum wined3d_format_id wined3d_format; + D3D_FEATURE_LEVEL feature_level; struct wined3d *wined3d; unsigned int i;
@@ -3410,6 +3411,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFormatSupport(ID3D11Device2 * *format_support = 0;
wined3d_mutex_lock(); + feature_level = device->feature_level; wined3d = wined3d_device_get_wined3d(device->wined3d_device); wined3d_device_get_creation_parameters(device->wined3d_device, ¶ms); for (i = 0; i < ARRAY_SIZE(flag_mapping); ++i) @@ -3434,12 +3436,17 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFormatSupport(ID3D11Device2 * { *format_support |= D3D11_FORMAT_SUPPORT_SHADER_LOAD; *format_support |= D3D11_FORMAT_SUPPORT_SHADER_SAMPLE; - *format_support |= D3D11_FORMAT_SUPPORT_SHADER_GATHER; + + if (feature_level >= D3D_FEATURE_LEVEL_10_1) + *format_support |= D3D11_FORMAT_SUPPORT_SHADER_GATHER;
if (*format_support & D3D11_FORMAT_SUPPORT_DEPTH_STENCIL) { - *format_support |= D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON; - *format_support |= D3D11_FORMAT_SUPPORT_SHADER_GATHER_COMPARISON; + if (feature_level >= D3D_FEATURE_LEVEL_10_0) + *format_support |= D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON; + + if (feature_level >= D3D_FEATURE_LEVEL_10_1) + *format_support |= D3D11_FORMAT_SUPPORT_SHADER_GATHER_COMPARISON; } }
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 5b56a04c54bb..e8c2f649f80b 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -18425,7 +18425,7 @@ static void check_format_support(const unsigned int *format_support, D3D_FEATURE } }
-static void test_required_format_support(const D3D_FEATURE_LEVEL feature_level) +static void test_format_support(const D3D_FEATURE_LEVEL feature_level) { unsigned int format_support[DXGI_FORMAT_B4G4R4A4_UNORM + 1]; struct device_desc device_desc; @@ -18463,6 +18463,37 @@ static void test_required_format_support(const D3D_FEATURE_LEVEL feature_level) format, hr, format_support[format]); }
+ for (format = DXGI_FORMAT_UNKNOWN; format <= DXGI_FORMAT_B4G4R4A4_UNORM; ++format) + { + if (feature_level < D3D_FEATURE_LEVEL_10_0) + { + /* SHADER_SAMPLE_COMPARISON is never advertised as supported on feature level 9. */ + ok(!(format_support[format] & D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON), + "Unexpected SHADER_SAMPLE_COMPARISON for format %#x, feature level %#x.\n", + format, feature_level); + } + if (feature_level < D3D_FEATURE_LEVEL_10_1) + { + ok(!(format_support[format] & D3D11_FORMAT_SUPPORT_SHADER_GATHER), + "Unexpected SHADER_GATHER for format %#x, feature level %#x.\n", + format, feature_level); + ok(!(format_support[format] & D3D11_FORMAT_SUPPORT_SHADER_GATHER_COMPARISON), + "Unexpected SHADER_GATHER_COMPARISON for format %#x, feature level %#x.\n", + format, feature_level); + } + } + + ok(format_support[DXGI_FORMAT_R8G8B8A8_UNORM] & D3D11_FORMAT_SUPPORT_SHADER_SAMPLE, + "SHADER_SAMPLE is not supported for R8G8B8A8_UNORM.\n"); + todo_wine + ok(!(format_support[DXGI_FORMAT_R32G32B32A32_UINT] & D3D11_FORMAT_SUPPORT_SHADER_SAMPLE), + "SHADER_SAMPLE is supported for R32G32B32A32_UINT.\n"); + if (feature_level >= D3D_FEATURE_LEVEL_10_0) + { + ok(format_support[DXGI_FORMAT_R32G32B32A32_UINT] & D3D11_FORMAT_SUPPORT_SHADER_LOAD, + "SHADER_LOAD is not supported for R32G32B32A32_UINT.\n"); + } + check_format_support(format_support, feature_level, index_buffers, ARRAY_SIZE(index_buffers), D3D11_FORMAT_SUPPORT_IA_INDEX_BUFFER, "index buffer"); @@ -29365,7 +29396,7 @@ START_TEST(d3d11) queue_test(test_index_buffer_offset); queue_test(test_face_culling); queue_test(test_line_antialiasing_blending); - queue_for_each_feature_level(test_required_format_support); + queue_for_each_feature_level(test_format_support); queue_for_each_9_x_feature_level(test_fl9_draw); queue_test(test_ddy); queue_test(test_shader_input_registers_limits);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=51924
Your paranoid android.
=== debian9 (32 bit report) ===
d3d10core: d3d10core.c:4779: Test failed: Got unexpected CPrimitives count: 3.
d3d11: d3d11.c:6101: Test succeeded inside todo block: Got unexpected PrimitivesStorageNeeded: 0. d3d11.c:6111: Test succeeded inside todo block: Got unexpected PrimitivesStorageNeeded: 0. d3d11.c:17933: Test failed: Got {0xffffffff, 0x00000001, 0x00000000, 0x00000000}, expected {0x00000000, 0x00000001, 0x00000000, 0x00000000} at (0, 0), sub-resource 0.
=== debian9 (32 bit French report) ===
d3d10core: d3d10core.c:4962: Test succeeded inside todo block: Got unexpected PrimitivesStorageNeeded: 0. d3d10core.c:12590: Test failed: Got {-1.00787401e+000, 0.00000000e+000, 1.00000000e+000, 5.03937006e-001}, expected {-1.00000000e+000, 0.00000000e+000, 1.00000000e+000, 5.03937006e-001} at (0, 0), sub-resource 0.
d3d11: d3d11.c:16849: Test failed: Got {-1.00787401e+000, 0.00000000e+000, 1.00000000e+000, 5.03937006e-001}, expected {-1.00000000e+000, 0.00000000e+000, 1.00000000e+000, 5.03937006e-001} at (0, 0), sub-resource 0.
=== debian9 (32 bit Japanese:Japan report) ===
d3d11: d3d11.c:6101: Test succeeded inside todo block: Got unexpected PrimitivesStorageNeeded: 0.
=== debian9 (32 bit Chinese:China report) ===
d3d10core: d3d10core.c:12950: Test failed: Got {0x00000001, 0xffffffff, 0x00000000, 0x00000000}, expected {0x00000001, 0x00000000, 0x00000000, 0x00000000} at (0, 0), sub-resource 0.
d3d11: d3d11.c:16849: Test failed: Got {-1.00787401e+000, 0.00000000e+000, 1.00000000e+000, 5.03937006e-001}, expected {-1.00000000e+000, 0.00000000e+000, 1.00000000e+000, 5.03937006e-001} at (0, 0), sub-resource 0.
=== debian9 (64 bit WoW report) ===
d3d10core: d3d10core.c:12590: Test failed: Got {-1.00787401e+000, 0.00000000e+000, 1.00000000e+000, 5.03937006e-001}, expected {-1.00000000e+000, 0.00000000e+000, 1.00000000e+000, 5.03937006e-001} at (0, 0), sub-resource 0.
d3d11: d3d11.c:16849: Test failed: Got {-1.00787401e+000, 0.00000000e+000, 1.00000000e+000, 5.03937006e-001}, expected {-1.00000000e+000, 0.00000000e+000, 1.00000000e+000, 5.03937006e-001} at (0, 0), sub-resource 0.