Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d9/device.c | 8 ++++++-- dlls/d3d9/tests/visual.c | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 9ebaebab969d..8ade5beedb45 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -2712,8 +2712,10 @@ static void d3d9_device_upload_sysmem_vertex_buffers(struct d3d9_device *device, { struct wined3d_box box = {0, 0, 0, 1, 0, 1}; struct d3d9_vertexbuffer *d3d9_buffer; + struct wined3d_resource *dst_resource; unsigned int i, offset, stride, map; struct wined3d_buffer *dst_buffer; + struct wined3d_resource_desc desc; HRESULT hr;
if (!device->sysmem_vb) @@ -2733,10 +2735,12 @@ static void d3d9_device_upload_sysmem_vertex_buffers(struct d3d9_device *device, if (FAILED(hr = wined3d_device_get_stream_source(device->wined3d_device, i, &dst_buffer, &offset, &stride))) ERR("Failed to get stream source.\n"); d3d9_buffer = wined3d_buffer_get_parent(dst_buffer); + dst_resource = wined3d_buffer_get_resource(dst_buffer); + wined3d_resource_get_desc(dst_resource, &desc); box.left = offset + start_vertex * stride; - box.right = box.left + vertex_count * stride; + box.right = min(box.left + vertex_count * stride, desc.size); if (FAILED(hr = wined3d_device_copy_sub_resource_region(device->wined3d_device, - wined3d_buffer_get_resource(dst_buffer), 0, box.left, 0, 0, + dst_resource, 0, box.left, 0, 0, wined3d_buffer_get_resource(d3d9_buffer->wined3d_buffer), 0, &box, 0))) ERR("Failed to update buffer.\n"); } diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 9a62f873dce3..fb7c3e4ea4ab 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -24510,7 +24510,7 @@ static void test_sysmem_draw(void)
hr = IDirect3DDevice9_BeginScene(device); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); - hr = IDirect3DDevice9_DrawIndexedPrimitive(device, D3DPT_TRIANGLESTRIP, 4, 0, 4, 0, 2); + hr = IDirect3DDevice9_DrawIndexedPrimitive(device, D3DPT_TRIANGLESTRIP, 4, 0, 5, 0, 2); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_EndScene(device); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
Hi,
While running your changed tests on Windows, 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=46344
Your paranoid android.
=== debian9 (build log) ===
X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig)
=== debian9 (build log) ===
X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig)