From: Stefan Dösinger <stefan@codeweavers.com> On my 2025 hardware the required vertex count to satisfy the 100ms draw time goal grows beyond 65536 (some size around 150k is calculated) and the runtime refuses to create a buffer larger than that. While dwMaxVertexCount (ddraw1-4 only, removed in 7) is ignored, the API limit imposed by 16 bit indices is not. The test still passes with the smaller buffer. I'm marking it flaky anyhow. On Wine the calculated triangle count is also above 64k, but we don't enforce the limit and use a non-indexed draw here, so we can just use the higher limit for more reliability. --- dlls/ddraw/tests/ddraw4.c | 14 +++++++++++++- dlls/ddraw/tests/ddraw7.c | 12 +++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 1e9a964d86d..7f7e11e4560 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -16376,6 +16376,7 @@ static void test_map_synchronisation(void) IDirect3DVertexBuffer *buffer; IDirect3DViewport3 *viewport; D3DVERTEXBUFFERDESC vb_desc; + BOOL small_buffer = FALSE; IDirect3DDevice3 *device; BOOL unsynchronised, ret; IDirectDrawSurface4 *rt; @@ -16518,7 +16519,17 @@ static void test_map_synchronisation(void) for (i = 0; i < ARRAY_SIZE(tests); ++i) { hr = IDirect3D3_CreateVertexBuffer(d3d, &vb_desc, &buffer, 0, NULL); - ok(SUCCEEDED(hr), "Failed to create vertex buffer, hr %#lx.\n", hr); + ok(SUCCEEDED(hr) || hr == D3DERR_TOOMANYVERTICES, "Failed to create vertex buffer, hr %#lx.\n", hr); + /* D3DDEVICEDESC.dwMaxVertexCount is a thing (in ddraw4 and earlier), but ignored by runtime and + * drivers. The 64k limit is likely due to the 16 bit indices used by d3d <= 7. */ + if (hr == D3DERR_TOOMANYVERTICES && vb_desc.dwNumVertices >= 65535) + { + trace("Test draw needs more than 64k vertices, test results might be flaky.\n"); + small_buffer = TRUE; + vb_desc.dwNumVertices = 65534; + hr = IDirect3D3_CreateVertexBuffer(d3d, &vb_desc, &buffer, 0, NULL); + ok(SUCCEEDED(hr), "Failed to create vertex buffer, hr %#lx.\n", hr); + } hr = IDirect3DVertexBuffer_Lock(buffer, DDLOCK_DISCARDCONTENTS, (void **)&quads, NULL); ok(SUCCEEDED(hr), "Failed to lock vertex buffer, hr %#lx.\n", hr); for (j = 0; j < vb_desc.dwNumVertices / 4; ++j) @@ -16547,6 +16558,7 @@ static void test_map_synchronisation(void) colour = get_surface_color(rt, 320, 240); unsynchronised = compare_color(colour, 0x00ffff00, 1); + flaky_if(small_buffer && tests[i].unsynchronised) ok(tests[i].unsynchronised == unsynchronised, "Expected %s map for flags %#x.\n", tests[i].unsynchronised ? "unsynchronised" : "synchronised", tests[i].flags); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 7a3c96fa315..72d41c9c4b9 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -15937,6 +15937,7 @@ static void test_map_synchronisation(void) unsigned int colour, i, j, tri_count; IDirect3DVertexBuffer7 *buffer; D3DVERTEXBUFFERDESC vb_desc; + BOOL small_buffer = FALSE; IDirect3DDevice7 *device; BOOL unsynchronised, ret; IDirectDrawSurface7 *rt; @@ -16084,7 +16085,15 @@ static void test_map_synchronisation(void) for (i = 0; i < ARRAY_SIZE(tests); ++i) { hr = IDirect3D7_CreateVertexBuffer(d3d, &vb_desc, &buffer, 0); - ok(SUCCEEDED(hr), "Failed to create vertex buffer, hr %#lx.\n", hr); + ok(SUCCEEDED(hr) || hr == D3DERR_TOOMANYVERTICES, "Failed to create vertex buffer, hr %#lx.\n", hr); + if (hr == D3DERR_TOOMANYVERTICES && vb_desc.dwNumVertices >= 65535) + { + trace("Test draw needs more than 64k vertices, test results might be flaky.\n"); + small_buffer = TRUE; + vb_desc.dwNumVertices = 65534; + hr = IDirect3D7_CreateVertexBuffer(d3d, &vb_desc, &buffer, 0); + ok(SUCCEEDED(hr), "Failed to create vertex buffer, hr %#lx.\n", hr); + } hr = IDirect3DVertexBuffer7_Lock(buffer, DDLOCK_DISCARDCONTENTS, (void **)&quads, NULL); ok(SUCCEEDED(hr), "Failed to lock vertex buffer, hr %#lx.\n", hr); for (j = 0; j < vb_desc.dwNumVertices / 4; ++j) @@ -16113,6 +16122,7 @@ static void test_map_synchronisation(void) colour = get_surface_color(rt, 320, 240); unsynchronised = compare_color(colour, 0x00ffff00, 1); + flaky_if(small_buffer && tests[i].unsynchronised) ok(tests[i].unsynchronised == unsynchronised, "Expected %s map for flags %#x.\n", tests[i].unsynchronised ? "unsynchronised" : "synchronised", tests[i].flags); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10361