From: Zebediah Figura zfigura@codeweavers.com
This is obviously questionable, as it requires reaching into Wine internals in tests (beyond simply detecting whether Wine is in use).
However, we are at a point where, for d3d10 and above, the Vulkan backend works well enough in general to see real use, and at this point I think avoiding regressions is quite important. It is currently difficult to run tests with it when the results contain so much noise, and I think we need to solve this problem, by actually marking which tests work on each backend.
We could in theory expose the renderer through some adapter string, but I believe in the past applications have been sensitive about the contents of adapter strings, so this wouldn't work.
Fixing either renderer to reach and maintain parity is not feasible. The GL renderer is not going away, but regrettably GL as an API is abandoned by Khronos, and important features we need in order to implement some Direct3D features will probably never be introduced into GL. Moreover, the amount of effort that would be required to reach parity is not small, and itself would all need to be verified manually. --- dlls/d3d10core/tests/d3d10core.c | 99 +++++++++++++++++++++----------- 1 file changed, 66 insertions(+), 33 deletions(-)
diff --git a/dlls/d3d10core/tests/d3d10core.c b/dlls/d3d10core/tests/d3d10core.c index 83188247156..31901ad333d 100644 --- a/dlls/d3d10core/tests/d3d10core.c +++ b/dlls/d3d10core/tests/d3d10core.c @@ -24,6 +24,7 @@ #include "initguid.h" #include "d3d11_4.h" #include "wine/heap.h" +#include "wine/wined3d.h" #include "wine/test.h"
#define BITS_NNAN 0xffc00000 @@ -33,6 +34,7 @@ #define BITS_N1_0 0xbf800000 #define BITS_1_0 0x3f800000
+static bool damavand; static unsigned int use_adapter_idx; static BOOL enable_debug_layer; static BOOL use_warp_adapter; @@ -1991,7 +1993,7 @@ static void test_create_texture2d(void) unsigned int i; HRESULT hr;
- static const struct + const struct { DXGI_FORMAT format; UINT array_size; @@ -2081,7 +2083,7 @@ static void test_create_texture2d(void) {DXGI_FORMAT_D32_FLOAT, 1, D3D10_BIND_RENDER_TARGET, 0, FALSE, FALSE}, {DXGI_FORMAT_D32_FLOAT, 1, D3D10_BIND_DEPTH_STENCIL, 0, TRUE, FALSE}, {DXGI_FORMAT_R9G9B9E5_SHAREDEXP, 1, D3D10_BIND_SHADER_RESOURCE, 0, TRUE, FALSE}, - {DXGI_FORMAT_R9G9B9E5_SHAREDEXP, 1, D3D10_BIND_RENDER_TARGET, 0, FALSE, FALSE}, + {DXGI_FORMAT_R9G9B9E5_SHAREDEXP, 1, D3D10_BIND_RENDER_TARGET, 0, FALSE, damavand}, {DXGI_FORMAT_R9G9B9E5_SHAREDEXP, 1, D3D10_BIND_DEPTH_STENCIL, 0, FALSE, FALSE}, };
@@ -2339,7 +2341,7 @@ static void test_create_texture3d(void) unsigned int i; HRESULT hr;
- static const struct + const struct { DXGI_FORMAT format; D3D10_BIND_FLAG bind_flags; @@ -2358,7 +2360,7 @@ static void test_create_texture3d(void) {DXGI_FORMAT_D24_UNORM_S8_UINT, D3D10_BIND_RENDER_TARGET, FALSE, FALSE}, {DXGI_FORMAT_D32_FLOAT, D3D10_BIND_RENDER_TARGET, FALSE, FALSE}, {DXGI_FORMAT_R9G9B9E5_SHAREDEXP, D3D10_BIND_SHADER_RESOURCE, TRUE, FALSE}, - {DXGI_FORMAT_R9G9B9E5_SHAREDEXP, D3D10_BIND_RENDER_TARGET, FALSE, FALSE}, + {DXGI_FORMAT_R9G9B9E5_SHAREDEXP, D3D10_BIND_RENDER_TARGET, FALSE, damavand}, {DXGI_FORMAT_R9G9B9E5_SHAREDEXP, D3D10_BIND_DEPTH_STENCIL, FALSE, FALSE}, };
@@ -4917,12 +4919,12 @@ static void test_pipeline_statistics_query(void) ok(data.IAVertices == 4, "Got unexpected IAVertices count: %u.\n", (unsigned int)data.IAVertices); ok(data.IAPrimitives == 2, "Got unexpected IAPrimitives count: %u.\n", (unsigned int)data.IAPrimitives); ok(data.VSInvocations == 4, "Got unexpected VSInvocations count: %u.\n", (unsigned int)data.VSInvocations); - ok(!data.GSInvocations, "Got unexpected GSInvocations count: %u.\n", (unsigned int)data.GSInvocations); + todo_wine_if (damavand) ok(!data.GSInvocations, "Got unexpected GSInvocations count: %u.\n", (unsigned int)data.GSInvocations); ok(!data.GSPrimitives, "Got unexpected GSPrimitives count: %u.\n", (unsigned int)data.GSPrimitives); ok(data.CInvocations == 2, "Got unexpected CInvocations count: %u.\n", (unsigned int)data.CInvocations); ok(data.CPrimitives == 2, "Got unexpected CPrimitives count: %u.\n", (unsigned int)data.CPrimitives); - todo_wine - ok(!data.PSInvocations, "Got unexpected PSInvocations count: %u.\n", (unsigned int)data.PSInvocations); + todo_wine_if (!damavand) + ok(!data.PSInvocations, "Got unexpected PSInvocations count: %u.\n", (unsigned int)data.PSInvocations); }
hr = ID3D10Device_CreatePixelShader(device, ps_code, sizeof(ps_code), &ps); @@ -4936,7 +4938,7 @@ static void test_pipeline_statistics_query(void) ok(data.IAVertices == 4, "Got unexpected IAVertices count: %u.\n", (unsigned int)data.IAVertices); ok(data.IAPrimitives == 2, "Got unexpected IAPrimitives count: %u.\n", (unsigned int)data.IAPrimitives); ok(data.VSInvocations == 4, "Got unexpected VSInvocations count: %u.\n", (unsigned int)data.VSInvocations); - ok(!data.GSInvocations, "Got unexpected GSInvocations count: %u.\n", (unsigned int)data.GSInvocations); + todo_wine_if (damavand) ok(!data.GSInvocations, "Got unexpected GSInvocations count: %u.\n", (unsigned int)data.GSInvocations); ok(!data.GSPrimitives, "Got unexpected GSPrimitives count: %u.\n", (unsigned int)data.GSPrimitives); ok(data.CInvocations == 2, "Got unexpected CInvocations count: %u.\n", (unsigned int)data.CInvocations); ok(data.CPrimitives == 2, "Got unexpected CPrimitives count: %u.\n", (unsigned int)data.CPrimitives); @@ -5122,7 +5124,7 @@ static void test_so_statistics_query(void) get_query_data(query, &data, sizeof(data)); ok(!data.NumPrimitivesWritten, "Got unexpected NumPrimitivesWritten: %u.\n", (unsigned int)data.NumPrimitivesWritten); - todo_wine + todo_wine_if (!damavand) ok(!data.PrimitivesStorageNeeded, "Got unexpected PrimitivesStorageNeeded: %u.\n", (unsigned int)data.PrimitivesStorageNeeded);
@@ -5132,7 +5134,7 @@ static void test_so_statistics_query(void) get_query_data(query, &data, sizeof(data)); ok(!data.NumPrimitivesWritten, "Got unexpected NumPrimitivesWritten: %u.\n", (unsigned int)data.NumPrimitivesWritten); - todo_wine + todo_wine_if (!damavand) ok(!data.PrimitivesStorageNeeded, "Got unexpected PrimitivesStorageNeeded: %u.\n", (unsigned int)data.PrimitivesStorageNeeded);
@@ -9456,7 +9458,7 @@ static void test_instanced_draw(void) get_texture_readback(render_target, 0, &rb); for (i = 0; i < ARRAY_SIZE(expected_results); ++i) { - todo_wine_if(i == 8) + todo_wine_if (i == 8 && !damavand) check_readback_data_color(&rb, &expected_results[i].rect, expected_results[i].instance_id, 0); } release_resource_readback(&rb); @@ -11553,7 +11555,7 @@ static void test_clear_depth_stencil_view(void) todo_wine check_texture_color(depth_texture, 0x00ffffff, 0);
ID3D10Device_ClearDepthStencilView(device, dsv, D3D10_CLEAR_STENCIL, 0.0f, 0xff); - check_texture_color(depth_texture, 0xffffffff, 0); + todo_wine_if (damavand) check_texture_color(depth_texture, 0xffffffff, 0);
ID3D10Texture2D_Release(depth_texture); ID3D10DepthStencilView_Release(dsv); @@ -14184,7 +14186,7 @@ static void test_unbind_shader_resource_view(void) ID3D10Device_PSSetShaderResources(device, 1, 1, &srv2); ID3D10Device_ClearRenderTargetView(device, test_context.backbuffer_rtv, white); draw_quad(&test_context); - todo_wine check_texture_color(test_context.backbuffer, 0x00000000, 1); + todo_wine_if (!damavand) check_texture_color(test_context.backbuffer, 0x00000000, 1);
ID3D10PixelShader_Release(ps); ID3D10ShaderResourceView_Release(srv); @@ -15990,7 +15992,7 @@ static void test_stream_output_vs(void) for (j = 0; j < tests[i].expected_data_size; ++j) { float expected_value = tests[i].expected_data[j]; - todo_wine_if(tests[i].todo) + todo_wine_if (tests[i].todo && !damavand) ok(compare_float(result[j], expected_value, 2), "Test %u: Got %.8e, expected %.8e at %u.\n", i, result[j], expected_value, j); @@ -16106,6 +16108,8 @@ static void test_depth_bias(void)
for (format_idx = 0; format_idx < ARRAY_SIZE(formats); ++format_idx) { + winetest_push_context("Format %#x", formats[format_idx]); + format = formats[format_idx];
ID3D10Texture2D_GetDesc(test_context.backbuffer, &texture_desc); @@ -16154,6 +16158,8 @@ static void test_depth_bias(void)
for (k = 0; k < ARRAY_SIZE(bias_clamp_tests); ++k) { + winetest_push_context("z %f, bias %d, clamp %f", quads[i].z, bias_tests[j], bias_clamp_tests[k]); + rasterizer_desc.DepthBiasClamp = bias_clamp_tests[k]; ID3D10Device_CreateRasterizerState(device, &rasterizer_desc, &rs); ok(SUCCEEDED(hr), "Failed to create rasterizer state, hr %#lx.\n", hr); @@ -16175,7 +16181,8 @@ static void test_depth_bias(void) depth = min(max(0.0f, quads[i].z + bias), 1.0f);
get_texture_readback(texture, 0, &rb); - check_readback_data_u24(&rb, NULL, shift, depth * 16777215.0f + 0.5f, 1); + todo_wine_if (damavand) + check_readback_data_u24(&rb, NULL, shift, depth * 16777215.0f + 0.5f, 1); release_resource_readback(&rb); break; case DXGI_FORMAT_D16_UNORM: @@ -16191,6 +16198,8 @@ static void test_depth_bias(void) break; } ID3D10RasterizerState_Release(rs); + + winetest_pop_context(); } } } @@ -16199,6 +16208,8 @@ static void test_depth_bias(void) rasterizer_desc.DepthBias = 0; for (i = 0; i < ARRAY_SIZE(quad_slopes); ++i) { + winetest_push_context("slope %f", quad_slopes[i]); + for (j = 0; j < ARRAY_SIZE(vertices); ++j) vertices[j].z = j == 1 || j == 3 ? 0.0f : quad_slopes[i]; ID3D10Device_UpdateSubresource(device, (ID3D10Resource *)test_context.vb, @@ -16237,6 +16248,9 @@ static void test_depth_bias(void) for (k = 0; k < ARRAY_SIZE(bias_clamp_tests); ++k) { BOOL all_match = TRUE; + + winetest_push_context("scale %f, clamp %f", slope_scaled_bias_tests[j], bias_clamp_tests[k]); + rasterizer_desc.DepthBiasClamp = bias_clamp_tests[k]; ID3D10Device_CreateRasterizerState(device, &rasterizer_desc, &rs); ok(SUCCEEDED(hr), "Failed to create rasterizer state, hr %#lx.\n", hr); @@ -16263,10 +16277,10 @@ static void test_depth_bias(void) u32_value = *u32 >> shift; expected_value = depth * 16777215.0f + 0.5f; all_match = compare_uint(u32_value, expected_value, 3); - ok(all_match, - "Got value %#x (%.8e), expected %#x (%.8e).\n", - u32_value, u32_value / 16777215.0f, - expected_value, expected_value / 16777215.0f); + todo_wine_if (damavand && expected_value != 0.0f) + ok(all_match, "Got value %#x (%.8e), expected %#x (%.8e).\n", + u32_value, u32_value / 16777215.0f, + expected_value, expected_value / 16777215.0f); break; case DXGI_FORMAT_D16_UNORM: u16 = get_readback_data(&rb, 0, y, sizeof(*u16)); @@ -16282,12 +16296,18 @@ static void test_depth_bias(void) } release_resource_readback(&rb); ID3D10RasterizerState_Release(rs); + + winetest_pop_context(); } } + + winetest_pop_context(); }
ID3D10Texture2D_Release(texture); ID3D10DepthStencilView_Release(dsv); + + winetest_pop_context(); }
heap_free(depth_values); @@ -17499,8 +17519,9 @@ static void test_generate_mips(void)
get_resource_readback(resource, 1, &rb); color = get_readback_color(&rb, 8, 8); - ok(compare_color(color, 0x7fbcbcbc, 1) || broken(compare_color(color, 0x7f7f7f7f, 1)), /* AMD */ - "Unexpected color %08x.\n", color); + todo_wine_if (damavand) + ok(compare_color(color, 0x7fbcbcbc, 1) || broken(compare_color(color, 0x7f7f7f7f, 1)), /* AMD */ + "Unexpected color %08x.\n", color); release_resource_readback(&rb);
ID3D10ShaderResourceView_Release(srv); @@ -17648,11 +17669,11 @@ static void test_alpha_to_coverage(void) SetRect(&rect, 0, 0, 200, 200); check_readback_data_color(&rb, &rect, expected_color, 1); SetRect(&rect, 200, 0, 640, 200); - todo_wine - check_readback_data_color(&rb, &rect, 0xffffffff, 1); + todo_wine_if (!damavand) + check_readback_data_color(&rb, &rect, 0xffffffff, 1); SetRect(&rect, 0, 200, 640, 480); - todo_wine - check_readback_data_color(&rb, &rect, 0xffffffff, 1); + todo_wine_if (!damavand) + check_readback_data_color(&rb, &rect, 0xffffffff, 1); release_resource_readback(&rb);
if (i > 0) @@ -17675,11 +17696,11 @@ static void test_alpha_to_coverage(void) SetRect(&rect, 0, 0, 200, 200); check_readback_data_color(&rb, &rect, 0xffff0000, 1); SetRect(&rect, 200, 0, 640, 200); - todo_wine - check_readback_data_color(&rb, &rect, 0xffffffff, 1); + todo_wine_if (!damavand) + check_readback_data_color(&rb, &rect, 0xffffffff, 1); SetRect(&rect, 0, 200, 640, 480); - todo_wine - check_readback_data_color(&rb, &rect, 0xffffffff, 1); + todo_wine_if (!damavand) + check_readback_data_color(&rb, &rect, 0xffffffff, 1); release_resource_readback(&rb);
ID3D10Texture2D_Release(render_targets[0]); @@ -18275,7 +18296,7 @@ static void test_multisample_resolve(void)
/* Found broken on AMD Radeon HD 6310 */ if (!broken(is_amd_device(device) && tests[i].format == DXGI_FORMAT_R8G8B8A8_UNORM_SRGB)) - todo_wine_if(tests[i].todo) check_texture_color(texture, tests[i].expected_color, 2); + todo_wine_if(tests[i].todo && !damavand) check_texture_color(texture, tests[i].expected_color, 2);
ID3D10RenderTargetView_Release(rtv); ID3D10Texture2D_Release(ms_texture); @@ -19313,8 +19334,9 @@ static void test_rtv_depth_slice(void) unsigned int x = 320, y = 60 + i * 480 / 4;
colour = get_readback_color(&rb, x, y); - todo_wine ok(colour == colours[i].output, "Got unexpected colour 0x%08x at (%u, %u), expected 0x%08x.\n", - colour, x, y, colours[i].output); + todo_wine_if (!damavand) + ok(colour == colours[i].output, "Got unexpected colour 0x%08x at (%u, %u), expected 0x%08x.\n", + colour, x, y, colours[i].output); } release_resource_readback(&rb);
@@ -19565,7 +19587,8 @@ static void test_vertex_formats(void) ID3D10Device_PSSetShader(device, test_context.ps); ID3D10Device_Draw(device, 4, 0);
- check_texture_vec4(rt, &tests[i].expect, 1); + todo_wine_if (damavand && tests[i].format == DXGI_FORMAT_B8G8R8X8_UNORM) + check_texture_vec4(rt, &tests[i].expect, 1);
ID3D10InputLayout_Release(input_layout);
@@ -19647,8 +19670,18 @@ static void test_layered_rtv_mismatch(void) START_TEST(d3d10core) { unsigned int argc, i; + HMODULE wined3d; char **argv;
+ if ((wined3d = GetModuleHandleA("wined3d.dll"))) + { + enum wined3d_renderer (CDECL *p_wined3d_get_renderer)(void); + + if ((p_wined3d_get_renderer = (void *)GetProcAddress(wined3d, "wined3d_get_renderer")) + && p_wined3d_get_renderer() == WINED3D_RENDERER_VULKAN) + damavand = true; + } + use_mt = !getenv("WINETEST_NO_MT_D3D"); /* Some host drivers (MacOS, Mesa radeonsi) never unmap memory even when * requested. When using the chunk allocator, running the tests with more