Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d8/device.c | 8 ++++++-- dlls/d3d8/tests/visual.c | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index b2a6e48da090..9e82b1e72763 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -2271,8 +2271,10 @@ static void d3d8_device_upload_sysmem_vertex_buffers(struct d3d8_device *device, { struct wined3d_box box = {0, 0, 0, 1, 0, 1}; struct d3d8_vertexbuffer *d3d8_buffer; + struct wined3d_resource *dst_resource; unsigned int i, offset, stride, map; struct wined3d_buffer *dst_buffer; + struct wined3d_resource_desc desc; HRESULT hr;
map = device->sysmem_vb; @@ -2284,10 +2286,12 @@ static void d3d8_device_upload_sysmem_vertex_buffers(struct d3d8_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"); d3d8_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(d3d8_buffer->wined3d_buffer), 0, &box, 0))) ERR("Failed to update buffer.\n"); } diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index 43b286b0373b..cc5992281f34 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -10687,7 +10687,7 @@ static void test_sysmem_draw(void)
hr = IDirect3DDevice8_BeginScene(device); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); - hr = IDirect3DDevice8_DrawIndexedPrimitive(device, D3DPT_TRIANGLESTRIP, 0, 4, 0, 2); + hr = IDirect3DDevice8_DrawIndexedPrimitive(device, D3DPT_TRIANGLESTRIP, 0, 5, 0, 2); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice8_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=46343
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)
=== 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)