From: Józef Kucia jkucia@codeweavers.com
Fixes a regression introduced by commit b18a53a5b44b651cde8e05200c75eacf54f49926.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46362 Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d9/device.c | 15 +++++++++++++++ dlls/d3d9/tests/device.c | 16 ++++++++++++++++ 2 files changed, 31 insertions(+)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 17f6565cbb1f..c1418e99118b 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -875,6 +875,8 @@ static UINT WINAPI d3d9_device_GetNumberOfSwapChains(IDirect3DDevice9Ex *iface)
static HRESULT CDECL reset_enum_callback(struct wined3d_resource *resource) { + struct d3d9_vertexbuffer *vertex_buffer; + struct d3d9_indexbuffer *index_buffer; struct wined3d_resource_desc desc; IDirect3DBaseTexture9 *texture; struct d3d9_surface *surface; @@ -886,6 +888,19 @@ static HRESULT CDECL reset_enum_callback(struct wined3d_resource *resource)
if (desc.resource_type != WINED3D_RTYPE_TEXTURE_2D) { + if (desc.bind_flags & WINED3D_BIND_VERTEX_BUFFER) + { + vertex_buffer = wined3d_resource_get_parent(resource); + if (vertex_buffer && vertex_buffer->draw_buffer) + return D3D_OK; + } + if (desc.bind_flags & WINED3D_BIND_INDEX_BUFFER) + { + index_buffer = wined3d_resource_get_parent(resource); + if (index_buffer && index_buffer->draw_buffer) + return D3D_OK; + } + WARN("Resource %p in pool D3DPOOL_DEFAULT blocks the Reset call.\n", resource); return D3DERR_INVALIDCALL; } diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 6edf2b35b30d..bc8d7088d36e 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -1827,6 +1827,8 @@ static void test_reset(void) IDirect3DDevice9 *device2 = NULL; IDirect3DSwapChain9 *swapchain; struct device_desc device_desc; + IDirect3DVertexBuffer9 *vb; + IDirect3DIndexBuffer9 *ib; DEVMODEW devmode; IDirect3D9 *d3d; D3DCAPS9 caps; @@ -2198,6 +2200,20 @@ static void test_reset(void) ok(hr == D3D_OK, "IDirect3DDevice9_TestCooperativeLevel after a successful reset returned %#x\n", hr); IDirect3DSurface9_Release(surface);
+ hr = IDirect3DDevice9_CreateVertexBuffer(device1, 16, 0, + D3DFVF_XYZ, D3DPOOL_SYSTEMMEM, &vb, NULL); + ok(hr == D3D_OK, "Failed to create vertex buffer, hr %#x.\n", hr); + hr = IDirect3DDevice9_Reset(device1, &d3dpp); + ok(hr == D3D_OK, "Failed to reset device, hr %#x.\n", hr); + IDirect3DVertexBuffer9_Release(vb); + + hr = IDirect3DDevice9_CreateIndexBuffer(device1, 16, 0, + D3DFMT_INDEX16, D3DPOOL_SYSTEMMEM, &ib, NULL); + ok(hr == D3D_OK, "Failed to create index buffer, hr %#x.\n", hr); + hr = IDirect3DDevice9_Reset(device1, &d3dpp); + ok(hr == D3D_OK, "Failed to reset device, hr %#x.\n", hr); + IDirect3DIndexBuffer9_Release(ib); + /* The depth stencil should get reset to the auto depth stencil when present. */ hr = IDirect3DDevice9_SetDepthStencilSurface(device1, NULL); ok(hr == D3D_OK, "SetDepthStencilSurface failed with 0x%08x\n", hr);
From: Józef Kucia jkucia@codeweavers.com
Fixes a regression introduced by commit 75b7ff60562880b6e7b646a8fa84486670162d00.
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d8/device.c | 15 +++++++++++++++ dlls/d3d8/tests/device.c | 18 +++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 11ee0b2c82ff..b4d445d63d38 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -826,6 +826,8 @@ static HRESULT WINAPI d3d8_device_CreateAdditionalSwapChain(IDirect3DDevice8 *if
static HRESULT CDECL reset_enum_callback(struct wined3d_resource *resource) { + struct d3d8_vertexbuffer *vertex_buffer; + struct d3d8_indexbuffer *index_buffer; struct wined3d_resource_desc desc; IDirect3DBaseTexture8 *texture; struct d3d8_surface *surface; @@ -837,6 +839,19 @@ static HRESULT CDECL reset_enum_callback(struct wined3d_resource *resource)
if (desc.resource_type != WINED3D_RTYPE_TEXTURE_2D) { + if (desc.bind_flags & WINED3D_BIND_VERTEX_BUFFER) + { + vertex_buffer = wined3d_resource_get_parent(resource); + if (vertex_buffer && vertex_buffer->draw_buffer) + return D3D_OK; + } + if (desc.bind_flags & WINED3D_BIND_INDEX_BUFFER) + { + index_buffer = wined3d_resource_get_parent(resource); + if (index_buffer && index_buffer->draw_buffer) + return D3D_OK; + } + WARN("Resource %p in pool D3DPOOL_DEFAULT blocks the Reset call.\n", resource); return D3DERR_DEVICELOST; } diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 49d2a9818cc4..adfeca8eaf26 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -1312,6 +1312,8 @@ static void test_reset(void) D3DPRESENT_PARAMETERS d3dpp; IDirect3DSurface8 *surface; IDirect3DTexture8 *texture; + IDirect3DVertexBuffer8 *vb; + IDirect3DIndexBuffer8 *ib; UINT adapter_mode_count; D3DLOCKED_RECT lockrect; UINT mode_count = 0; @@ -1704,6 +1706,20 @@ static void test_reset(void) ok(SUCCEEDED(hr), "TestCooperativeLevel failed, hr %#x.\n", hr); IDirect3DTexture8_Release(texture);
+ hr = IDirect3DDevice8_CreateVertexBuffer(device1, 16, 0, + D3DFVF_XYZ, D3DPOOL_SYSTEMMEM, &vb); + ok(hr == D3D_OK, "Failed to create vertex buffer, hr %#x.\n", hr); + hr = IDirect3DDevice8_Reset(device1, &d3dpp); + ok(hr == D3D_OK, "Failed to reset device, hr %#x.\n", hr); + IDirect3DVertexBuffer8_Release(vb); + + hr = IDirect3DDevice8_CreateIndexBuffer(device1, 16, 0, + D3DFMT_INDEX16, D3DPOOL_SYSTEMMEM, &ib); + ok(hr == D3D_OK, "Failed to create index buffer, hr %#x.\n", hr); + hr = IDirect3DDevice8_Reset(device1, &d3dpp); + ok(hr == D3D_OK, "Failed to reset device, hr %#x.\n", hr); + IDirect3DIndexBuffer8_Release(ib); + /* The depth stencil should get reset to the auto depth stencil when present. */ hr = IDirect3DDevice8_SetRenderTarget(device1, NULL, NULL); ok(SUCCEEDED(hr), "SetRenderTarget failed, hr %#x.\n", hr); @@ -2878,7 +2894,7 @@ static void test_wndproc(void) && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight);
- /* I have to minimize and restore the focus window, otherwise native d3d9 fails + /* I have to minimize and restore the focus window, otherwise native d3d8 fails * device::reset with D3DERR_DEVICELOST. This does not happen when the window * restore is triggered by the user. */ expect_messages = reactivate_messages;
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=45944
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) 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)
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
From: Józef Kucia jkucia@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com ---
This doesn't fix the process vertices regression, but at least it avoids crashes in wined3d_device_process_vertices().
--- dlls/wined3d/device.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index c90cbdbe10fe..d03a982e747e 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3340,7 +3340,7 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, struct wined3d_resource *resource; struct wined3d_box box = {0}; struct wined3d_shader *vs; - unsigned int i; + unsigned int i, j; HRESULT hr; WORD map;
@@ -3375,7 +3375,20 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, box.left = src_start_idx * e->stride; box.right = box.left + vertex_count * e->stride; if (FAILED(wined3d_resource_map(resource, 0, &map_desc, &box, WINED3D_MAP_READ))) + { ERR("Failed to map resource.\n"); + for (j = 0, map = stream_info.use_map; map && j < i; map >>= 1, ++j) + { + if (!(map & 1)) + continue; + + e = &stream_info.elements[j]; + resource = &state->streams[e->stream_idx].buffer->resource; + if (FAILED(wined3d_resource_unmap(resource, 0))) + ERR("Failed to unmap resource.\n"); + } + return WINED3DERR_INVALIDCALL; + } e->data.buffer_object = 0; e->data.addr += (ULONG_PTR)map_desc.data; }
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=45945
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)
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
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=45943
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)