On 7/9/20 01:36, Stefan Dösinger wrote:
Am 08.07.2020 um 22:44 schrieb Paul Gofman <pgofman@codeweavers.com mailto:pgofman@codeweavers.com>:
- hr = IDirect3DVertexBuffer9_Lock(buffer, 0, size, (void
**)&quads, 0);
- ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- /* The data has been reset for the whole buffer. */
- for (i = 0; i < quad_count - 1; ++i)
- ok(memcmp(&quads[i], &quad1, sizeof(quad1)), "Quads match, i
%u.\n", i);
- ok(!memcmp(&quads[i], &quad2, sizeof(quad2)), "Quads do not
match, i %u.\n", i);
- for (i = 0; i < quad_count; ++i)
- quads[i] = quad1;
- hr = IDirect3DVertexBuffer9_Unlock(buffer);
- ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- hr = IDirect3DDevice9_SetStreamSource(device, 0, buffer2, 0,
sizeof(*quads->strip));
- ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
What happens if you draw something from 'buffer' between the Unlock and SetStreamSource?
That doesn't change anything on Windows. On Wine the result with my patch apparently depends on whether that draw is completed before the buffer is locked with MAP_DISCARD.
See test_vb_discard() in ddraw7.c, although I think Henri ported the test to d3d8/9 at some point. I couldn't find it on a quick search though.
That is a bit different case which is handled by WINED3D_BUFFER_DISCARD buffer flag in wined3d. If there are multiple discards not interleaved by buffer use only the first discard can actually discard the buffer data.
What happens if you bind the a to a stream that is not used by the vertex declaration?
That changes nothing on Windows for me but makes the buffer data discarded in Wine.
That is probably harder to bring in line as it would need to track which buffers are actually used in the pipeline, but I don't know anything which depends on that yet.