Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3d9/d3d9_private.h | 2 ++ dlls/d3d9/device.c | 24 ++++++++++++++++++++++-- dlls/d3d9/tests/visual.c | 22 ++++++++++++++++++++++ dlls/d3d9/vertexdeclaration.c | 2 +- 4 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h index 3fe0376e5c1..50b18b1ed36 100644 --- a/dlls/d3d9/d3d9_private.h +++ b/dlls/d3d9/d3d9_private.h @@ -256,6 +256,8 @@ struct d3d9_vertex_declaration IDirect3DDevice9Ex *parent_device; };
+HRESULT convert_to_wined3d_declaration(const D3DVERTEXELEMENT9 *d3d9_elements, + struct wined3d_vertex_element **wined3d_elements, UINT *element_count) DECLSPEC_HIDDEN; HRESULT d3d9_vertex_declaration_create(struct d3d9_device *device, const D3DVERTEXELEMENT9 *elements, struct d3d9_vertex_declaration **declaration) DECLSPEC_HIDDEN; struct d3d9_vertex_declaration *unsafe_impl_from_IDirect3DVertexDeclaration9( diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 6cc3f180b09..8ff83f148d6 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -2730,23 +2730,43 @@ static void d3d9_generate_auto_mipmaps(struct d3d9_device *device) static void d3d9_device_upload_sysmem_vertex_buffers(struct d3d9_device *device, int base_vertex, unsigned int start_vertex, unsigned int vertex_count) { + struct wined3d_vertex_declaration *wined3d_decl; struct wined3d_box box = {0, 0, 0, 1, 0, 1}; + unsigned int i, offset, stride, map, count; + struct wined3d_vertex_element *elements; struct d3d9_vertexbuffer *d3d9_buffer; struct wined3d_resource *dst_resource; - unsigned int i, offset, stride, map; + struct d3d9_vertex_declaration *decl; struct wined3d_buffer *dst_buffer; struct wined3d_resource_desc desc; HRESULT hr;
if (!device->sysmem_vb) return; + wined3d_decl = wined3d_device_get_vertex_declaration(device->wined3d_device); + if (!wined3d_decl) + return;
if (base_vertex >= 0 || start_vertex >= -base_vertex) start_vertex += base_vertex; else FIXME("System memory vertex data offset is negative.\n");
- map = device->sysmem_vb; + decl = wined3d_vertex_declaration_get_parent(wined3d_decl); + if (!decl->elements) + { + map = 1; + } + else + { + map = 0; + if (FAILED(convert_to_wined3d_declaration(decl->elements, &elements, &count))) + return; + for (i = 0; i < count; ++i) + map |= 1u << elements[i].input_slot; + heap_free(elements); + } + map &= device->sysmem_vb; while (map) { i = wined3d_bit_scan(&map); diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 13cf6c72833..ce8b589f1a6 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -24580,6 +24580,28 @@ static void test_sysmem_draw(void) colour = getPixelColor(device, 320, 240); ok(color_match(colour, 0x00443322, 1), "Got unexpected colour 0x%08x.\n", colour);
+ hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_DIFFUSE); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9_SetStreamSource(device, 0, vb, 0, sizeof(*quad)); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9_SetIndices(device, ib); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + + IDirect3DVertexBuffer9_Release(vb_s1); + + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x77777777, 0.0f, 0); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + + hr = IDirect3DDevice9_BeginScene(device); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9_DrawIndexedPrimitive(device, D3DPT_TRIANGLESTRIP, 0, 0, 4, 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); + + colour = getPixelColor(device, 320, 240); + ok(color_match(colour, 0x00007f7f, 1), "Got unexpected colour 0x%08x.\n", colour); + hr = IDirect3DDevice9_CreateTexture(device, 2, 2, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &texture, NULL); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); memset(&lr, 0, sizeof(lr)); diff --git a/dlls/d3d9/vertexdeclaration.c b/dlls/d3d9/vertexdeclaration.c index b6445255238..5f07207a482 100644 --- a/dlls/d3d9/vertexdeclaration.c +++ b/dlls/d3d9/vertexdeclaration.c @@ -320,7 +320,7 @@ static const struct wined3d_parent_ops d3d9_vertexdeclaration_wined3d_parent_ops d3d9_vertexdeclaration_wined3d_object_destroyed, };
-static HRESULT convert_to_wined3d_declaration(const D3DVERTEXELEMENT9 *d3d9_elements, +HRESULT convert_to_wined3d_declaration(const D3DVERTEXELEMENT9 *d3d9_elements, struct wined3d_vertex_element **wined3d_elements, UINT *element_count) { const D3DVERTEXELEMENT9* element;
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46371 Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3d8/d3d8_private.h | 2 ++ dlls/d3d8/device.c | 27 +++++++++++++++++++++++++-- dlls/d3d8/tests/visual.c | 23 ++++++++++++++++++++++- dlls/d3d8/vertexdeclaration.c | 2 +- 4 files changed, 50 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index 7c44f07c5ea..f3cab96f9d8 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -255,6 +255,8 @@ struct d3d8_vertex_declaration DWORD shader_handle; };
+UINT convert_to_wined3d_declaration(const DWORD *d3d8_elements, DWORD *d3d8_elements_size, + struct wined3d_vertex_element **wined3d_elements) DECLSPEC_HIDDEN; void d3d8_vertex_declaration_destroy(struct d3d8_vertex_declaration *declaration) DECLSPEC_HIDDEN; HRESULT d3d8_vertex_declaration_init(struct d3d8_vertex_declaration *declaration, struct d3d8_device *device, const DWORD *elements, DWORD shader_handle) DECLSPEC_HIDDEN; diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index d367f4200cc..963f4e740d5 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -2269,15 +2269,38 @@ static HRESULT WINAPI d3d8_device_GetCurrentTexturePalette(IDirect3DDevice8 *ifa static void d3d8_device_upload_sysmem_vertex_buffers(struct d3d8_device *device, unsigned int start_vertex, unsigned int vertex_count) { + struct wined3d_vertex_declaration *wined3d_decl; struct wined3d_box box = {0, 0, 0, 1, 0, 1}; + unsigned int i, offset, stride, map, count; + struct wined3d_vertex_element *elements; struct d3d8_vertexbuffer *d3d8_buffer; struct wined3d_resource *dst_resource; - unsigned int i, offset, stride, map; + struct d3d8_vertex_declaration *decl; struct wined3d_buffer *dst_buffer; struct wined3d_resource_desc desc; HRESULT hr;
- map = device->sysmem_vb; + if (!device->sysmem_vb) + return; + wined3d_decl = wined3d_device_get_vertex_declaration(device->wined3d_device); + if (!wined3d_decl) + return; + decl = wined3d_vertex_declaration_get_parent(wined3d_decl); + if (!decl->elements) + { + map = 1; + } + else + { + map = 0; + count = convert_to_wined3d_declaration(decl->elements, &decl->elements_size, &elements); + if (!count) + return; + for (i = 0; i < count; ++i) + map |= 1u << elements[i].input_slot; + heap_free(elements); + } + map &= device->sysmem_vb; while (map) { i = wined3d_bit_scan(&map); diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index 749062220d2..51ec3ba1c25 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -10698,6 +10698,28 @@ static void test_sysmem_draw(void) colour = getPixelColor(device, 320, 240); ok(color_match(colour, 0x00443322, 1), "Got unexpected colour 0x%08x.\n", colour);
+ hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZ | D3DFVF_DIFFUSE); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice8_SetStreamSource(device, 0, vb, sizeof(*quad)); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice8_SetIndices(device, ib, 0); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + + IDirect3DVertexBuffer8_Release(vb_s1); + + hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x77777777, 0.0f, 0); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + + hr = IDirect3DDevice8_BeginScene(device); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice8_DrawIndexedPrimitive(device, D3DPT_TRIANGLESTRIP, 0, 4, 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); + + colour = getPixelColor(device, 320, 240); + ok(color_match(colour, 0x00007f7f, 1), "Got unexpected colour 0x%08x.\n", colour); + hr = IDirect3DDevice8_CreateTexture(device, 2, 2, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &texture); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); memset(&lr, 0, sizeof(lr)); @@ -10727,7 +10749,6 @@ static void test_sysmem_draw(void) ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
IDirect3DTexture8_Release(texture); - IDirect3DVertexBuffer8_Release(vb_s1); IDirect3DVertexBuffer8_Release(vb_s0); IDirect3DDevice8_DeleteVertexShader(device, vs); IDirect3DIndexBuffer8_Release(ib); diff --git a/dlls/d3d8/vertexdeclaration.c b/dlls/d3d8/vertexdeclaration.c index 709e04bace4..3c05101cb7f 100644 --- a/dlls/d3d8/vertexdeclaration.c +++ b/dlls/d3d8/vertexdeclaration.c @@ -249,7 +249,7 @@ wined3d_usage_lookup[] = };
/* TODO: find out where rhw (or positionT) is for declaration8 */ -static UINT convert_to_wined3d_declaration(const DWORD *d3d8_elements, DWORD *d3d8_elements_size, +UINT convert_to_wined3d_declaration(const DWORD *d3d8_elements, DWORD *d3d8_elements_size, struct wined3d_vertex_element **wined3d_elements) { struct wined3d_vertex_element *element;
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=48004
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: Matteo Bruni mbruni@codeweavers.com --- dlls/d3d8/tests/device.c | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 39a2359be41..4dbe1687d89 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -1327,6 +1327,7 @@ static void test_reset(void) IDirect3D8 *d3d8; RECT winrect, client_rect; D3DVIEWPORT8 vp; + ULONG refcount; D3DCAPS8 caps; DWORD shader; DWORD value; @@ -1695,6 +1696,46 @@ static void test_reset(void) skip("Volume textures not supported.\n"); }
+ /* Test with DEFAULT pool resources bound but otherwise not referenced. */ + hr = IDirect3DDevice8_CreateVertexBuffer(device1, 16, 0, + D3DFVF_XYZ, D3DPOOL_DEFAULT, &vb); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice8_SetStreamSource(device1, 0, vb, 16); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + refcount = IDirect3DVertexBuffer8_Release(vb); + ok(!refcount, "Unexpected refcount %u.\n", refcount); + hr = IDirect3DDevice8_CreateIndexBuffer(device1, 16, 0, + D3DFMT_INDEX16, D3DPOOL_DEFAULT, &ib); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice8_SetIndices(device1, ib, 0); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + refcount = IDirect3DIndexBuffer8_Release(ib); + ok(!refcount, "Unexpected refcount %u.\n", refcount); + hr = IDirect3DDevice8_CreateTexture(device1, 16, 16, 0, 0, + D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &texture); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice8_SetTexture(device1, i, (IDirect3DBaseTexture8 *)texture); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + + hr = IDirect3DDevice8_Reset(device1, &d3dpp); + ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice8_TestCooperativeLevel(device1); + ok(hr == D3DERR_DEVICENOTRESET, "Got unexpected hr %#x.\n", hr); + + /* Crashes on Windows. */ + if (0) + { + hr = IDirect3DDevice8_GetIndices(device1, &ib, &i); + todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + } + refcount = IDirect3DTexture8_Release(texture); + ok(!refcount, "Unexpected refcount %u.\n", refcount); + + hr = IDirect3DDevice8_Reset(device1, &d3dpp); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice8_TestCooperativeLevel(device1); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + /* Scratch, sysmem and managed pool resources are fine. */ hr = IDirect3DDevice8_CreateTexture(device1, 16, 16, 1, 0, D3DFMT_R5G6B5, D3DPOOL_SCRATCH, &texture); ok(SUCCEEDED(hr), "CreateTexture failed, 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=48005
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
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3d9/tests/d3d9ex.c | 44 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index 132ce037880..81dd5912b23 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -922,13 +922,16 @@ static void test_reset(void)
DWORD height, orig_height = GetSystemMetrics(SM_CYSCREEN); DWORD width, orig_width = GetSystemMetrics(SM_CXSCREEN); + UINT i, adapter_mode_count, offset, stride; + IDirect3DVertexBuffer9 *vb, *cur_vb; + IDirect3DIndexBuffer9 *ib, *cur_ib; IDirect3DVertexShader9 *shader; IDirect3DSwapChain9 *swapchain; D3DDISPLAYMODE d3ddm, d3ddm2; D3DPRESENT_PARAMETERS d3dpp; IDirect3DDevice9Ex *device; IDirect3DSurface9 *surface; - UINT i, adapter_mode_count; + IDirect3DTexture9 *texture; DEVMODEW devmode; IDirect3D9 *d3d9; D3DVIEWPORT9 vp; @@ -1303,6 +1306,45 @@ static void test_reset(void) skip("Volume textures not supported.\n"); }
+ /* Test with resources bound but otherwise not referenced. */ + hr = IDirect3DDevice9Ex_CreateVertexBuffer(device, 16, 0, + D3DFVF_XYZ, D3DPOOL_DEFAULT, &vb, NULL); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9Ex_SetStreamSource(device, 0, vb, 0, 16); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + refcount = IDirect3DVertexBuffer9_Release(vb); + ok(!refcount, "Unexpected refcount %u.\n", refcount); + hr = IDirect3DDevice9Ex_CreateIndexBuffer(device, 16, 0, + D3DFMT_INDEX16, D3DPOOL_DEFAULT, &ib, NULL); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9Ex_SetIndices(device, ib); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + refcount = IDirect3DIndexBuffer9_Release(ib); + ok(!refcount, "Unexpected refcount %u.\n", refcount); + hr = IDirect3DDevice9Ex_CreateTexture(device, 16, 16, 0, 0, + D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &texture, NULL); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9Ex_SetTexture(device, i, (IDirect3DBaseTexture9 *)texture); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + + hr = IDirect3DDevice9Ex_Reset(device, &d3dpp); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + + hr = IDirect3DDevice9Ex_GetIndices(device, &cur_ib); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + ok(cur_ib == ib, "Unexpected index buffer %p.\n", cur_ib); + refcount = IDirect3DIndexBuffer9_Release(ib); + ok(!refcount, "Unexpected refcount %u.\n", refcount); + hr = IDirect3DDevice9Ex_GetStreamSource(device, 0, &cur_vb, &offset, &stride); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + ok(cur_vb == vb, "Unexpected index buffer %p.\n", cur_ib); + ok(!offset, "Unexpected offset %u.\n", offset); + ok(stride == 16, "Unexpected stride %u.\n", stride); + refcount = IDirect3DVertexBuffer9_Release(vb); + ok(!refcount, "Unexpected refcount %u.\n", refcount); + refcount = IDirect3DTexture9_Release(texture); + ok(!refcount, "Unexpected refcount %u.\n", refcount); + /* Scratch and sysmem pools are fine too. */ hr = IDirect3DDevice9Ex_CreateOffscreenPlainSurface(device, 16, 16, D3DFMT_R5G6B5, D3DPOOL_SCRATCH, &surface, NULL);
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=48006
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
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3d9/tests/device.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 17e3b5d6eb4..7d8b4fdfcd4 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -4085,8 +4085,12 @@ static void test_wndproc(void) flush_events();
/* Releasing a device in lost state breaks follow-up tests on native. */ - hr = reset_device(device, &device_desc); - ok(SUCCEEDED(hr), "Failed to reset device, hr %#x, i=%u.\n", hr, i); + hr = IDirect3DDevice9_TestCooperativeLevel(device); + if (hr == D3DERR_DEVICENOTRESET) + { + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x, i=%u.\n", hr, i); + }
filter_messages = focus_window;
@@ -4184,7 +4188,8 @@ static void test_wndproc(void) "Received WM_WINDOWPOSCHANGED but did not expect it, i=%u.\n", i); expect_messages = NULL;
- filter_messages = focus_window; + /* On Windows 10 style change messages are delivered both on reset and + * on release. */ hr = IDirect3DDevice9_TestCooperativeLevel(device); ok(hr == D3DERR_DEVICENOTRESET, "Got unexpected hr %#x.\n", hr);
@@ -4194,6 +4199,7 @@ static void test_wndproc(void) ref = IDirect3DDevice9_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u, i=%u.\n", ref, i);
+ filter_messages = focus_window; device_desc.device_window = device_window; if (!(device = create_device(d3d9, focus_window, &device_desc))) { @@ -4828,11 +4834,13 @@ static void test_window_style(void)
style = GetWindowLongA(device_window, GWL_STYLE); expected_style = device_style | tests[i].style; - todo_wine ok(style == expected_style, "Expected device window style %#x, got %#x, i=%u.\n", + todo_wine ok(style == expected_style || broken(style == (expected_style & 0xff000000)), + "Expected device window style %#x, got %#x, i=%u.\n", expected_style, style, i); style = GetWindowLongA(device_window, GWL_EXSTYLE); expected_style = device_exstyle | tests[i].exstyle; - todo_wine ok(style == expected_style, "Expected device window extended style %#x, got %#x, i=%u.\n", + todo_wine ok(style == expected_style || broken(style == (expected_style & 0xff)), + "Expected device window extended style %#x, got %#x, i=%u.\n", expected_style, style, i);
style = GetWindowLongA(focus_window, GWL_STYLE); @@ -4850,7 +4858,8 @@ static void test_window_style(void) ok(EqualRect(&r, &fullscreen_rect), "Expected %s, got %s, i=%u.\n", wine_dbgstr_rect(&fullscreen_rect), wine_dbgstr_rect(&r), i); GetClientRect(device_window, &r2); - todo_wine ok(!EqualRect(&r, &r2), "Client rect and window rect are equal.\n"); + todo_wine ok(!EqualRect(&r, &r2) || broken(!(style & WS_THICKFRAME)), + "Client rect and window rect are equal, i=%u.\n", i); GetWindowRect(focus_window, &r); ok(EqualRect(&r, &focus_rect), "Expected %s, got %s, i=%u.\n", wine_dbgstr_rect(&focus_rect), wine_dbgstr_rect(&r), i);
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=48007
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
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=48003
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)
=== 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)
On Wed, 20 Feb 2019 at 21:11, Matteo Bruni mbruni@codeweavers.com wrote:
dlls/d3d9/d3d9_private.h | 2 ++ dlls/d3d9/device.c | 24 ++++++++++++++++++++++-- dlls/d3d9/tests/visual.c | 22 ++++++++++++++++++++++ dlls/d3d9/vertexdeclaration.c | 2 +- 4 files changed, 47 insertions(+), 3 deletions(-)
Why do we care? (I've read the bug report, but assume I haven't.) One of the reasons for being slightly sceptical about the "Wine-Bug:" tags is that we want that kind of information in the source itself instead of having to dig through bug reports.
On Thu, 2019-02-21 at 21:41 +0330, Henri Verbeet wrote:
On Wed, 20 Feb 2019 at 21:11, Matteo Bruni mbruni@codeweavers.com wrote:
dlls/d3d9/d3d9_private.h | 2 ++ dlls/d3d9/device.c | 24 ++++++++++++++++++++++-- dlls/d3d9/tests/visual.c | 22 ++++++++++++++++++++++ dlls/d3d9/vertexdeclaration.c | 2 +- 4 files changed, 47 insertions(+), 3 deletions(-)
Why do we care? (I've read the bug report, but assume I haven't.) One of the reasons for being slightly sceptical about the "Wine-Bug:" tags is that we want that kind of information in the source itself instead of having to dig through bug reports.
I can add a comment in the code explaining that this isn't just an optimization, sure. I thought that the test would be enough but I guess I can see, some time from now, having to look up the patch introducing the code to figure out what's going on is not great.
I could add a comment to the new test too, although I don't think it could be more specific than something like "Applications in the wild do release vertex buffers without unbinding them, make sure things don't break in this case".