Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3d9/buffer.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d9/buffer.c b/dlls/d3d9/buffer.c index dcd7e287264..43321b3202b 100644 --- a/dlls/d3d9/buffer.c +++ b/dlls/d3d9/buffer.c @@ -59,9 +59,10 @@ static ULONG WINAPI d3d9_vertexbuffer_AddRef(IDirect3DVertexBuffer9 *iface) { IDirect3DDevice9Ex_AddRef(buffer->parent_device); wined3d_mutex_lock(); - wined3d_buffer_incref(buffer->wined3d_buffer); if (buffer->draw_buffer) wined3d_buffer_incref(buffer->draw_buffer); + else + wined3d_buffer_incref(buffer->wined3d_buffer); wined3d_mutex_unlock(); }
@@ -81,9 +82,10 @@ static ULONG WINAPI d3d9_vertexbuffer_Release(IDirect3DVertexBuffer9 *iface) IDirect3DDevice9Ex *device = buffer->parent_device;
wined3d_mutex_lock(); - wined3d_buffer_decref(buffer->wined3d_buffer); if (draw_buffer) wined3d_buffer_decref(draw_buffer); + else + wined3d_buffer_decref(buffer->wined3d_buffer); wined3d_mutex_unlock();
/* Release the device last, as it may cause the device to be destroyed. */ @@ -270,6 +272,9 @@ static const IDirect3DVertexBuffer9Vtbl d3d9_vertexbuffer_vtbl = static void STDMETHODCALLTYPE d3d9_vertexbuffer_wined3d_object_destroyed(void *parent) { struct d3d9_vertexbuffer *buffer = parent; + + if (buffer->draw_buffer) + wined3d_buffer_decref(buffer->wined3d_buffer); d3d9_resource_cleanup(&buffer->resource); heap_free(buffer); } @@ -387,9 +392,10 @@ static ULONG WINAPI d3d9_indexbuffer_AddRef(IDirect3DIndexBuffer9 *iface) { IDirect3DDevice9Ex_AddRef(buffer->parent_device); wined3d_mutex_lock(); - wined3d_buffer_incref(buffer->wined3d_buffer); if (buffer->draw_buffer) wined3d_buffer_incref(buffer->draw_buffer); + else + wined3d_buffer_incref(buffer->wined3d_buffer); wined3d_mutex_unlock(); }
@@ -409,9 +415,10 @@ static ULONG WINAPI d3d9_indexbuffer_Release(IDirect3DIndexBuffer9 *iface) IDirect3DDevice9Ex *device = buffer->parent_device;
wined3d_mutex_lock(); - wined3d_buffer_decref(buffer->wined3d_buffer); if (draw_buffer) wined3d_buffer_decref(draw_buffer); + else + wined3d_buffer_decref(buffer->wined3d_buffer); wined3d_mutex_unlock();
/* Release the device last, as it may cause the device to be destroyed. */ @@ -596,6 +603,9 @@ static const IDirect3DIndexBuffer9Vtbl d3d9_indexbuffer_vtbl = static void STDMETHODCALLTYPE d3d9_indexbuffer_wined3d_object_destroyed(void *parent) { struct d3d9_indexbuffer *buffer = parent; + + if (buffer->draw_buffer) + wined3d_buffer_decref(buffer->wined3d_buffer); d3d9_resource_cleanup(&buffer->resource); heap_free(buffer); }
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46371 Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3d8/buffer.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d8/buffer.c b/dlls/d3d8/buffer.c index 8aec654052c..822730ff6dc 100644 --- a/dlls/d3d8/buffer.c +++ b/dlls/d3d8/buffer.c @@ -57,9 +57,10 @@ static ULONG WINAPI d3d8_vertexbuffer_AddRef(IDirect3DVertexBuffer8 *iface) { IDirect3DDevice8_AddRef(buffer->parent_device); wined3d_mutex_lock(); - wined3d_buffer_incref(buffer->wined3d_buffer); if (buffer->draw_buffer) wined3d_buffer_incref(buffer->draw_buffer); + else + wined3d_buffer_incref(buffer->wined3d_buffer); wined3d_mutex_unlock(); }
@@ -79,9 +80,10 @@ static ULONG WINAPI d3d8_vertexbuffer_Release(IDirect3DVertexBuffer8 *iface) IDirect3DDevice8 *device = buffer->parent_device;
wined3d_mutex_lock(); - wined3d_buffer_decref(buffer->wined3d_buffer); if (draw_buffer) wined3d_buffer_decref(draw_buffer); + else + wined3d_buffer_decref(buffer->wined3d_buffer); wined3d_mutex_unlock();
/* Release the device last, as it may cause the device to be destroyed. */ @@ -269,6 +271,9 @@ static const IDirect3DVertexBuffer8Vtbl Direct3DVertexBuffer8_Vtbl = static void STDMETHODCALLTYPE d3d8_vertexbuffer_wined3d_object_destroyed(void *parent) { struct d3d8_vertexbuffer *buffer = parent; + + if (buffer->draw_buffer) + wined3d_buffer_decref(buffer->wined3d_buffer); d3d8_resource_cleanup(&buffer->resource); heap_free(buffer); } @@ -380,9 +385,10 @@ static ULONG WINAPI d3d8_indexbuffer_AddRef(IDirect3DIndexBuffer8 *iface) { IDirect3DDevice8_AddRef(buffer->parent_device); wined3d_mutex_lock(); - wined3d_buffer_incref(buffer->wined3d_buffer); if (buffer->draw_buffer) wined3d_buffer_incref(buffer->draw_buffer); + else + wined3d_buffer_incref(buffer->wined3d_buffer); wined3d_mutex_unlock(); }
@@ -402,9 +408,10 @@ static ULONG WINAPI d3d8_indexbuffer_Release(IDirect3DIndexBuffer8 *iface) IDirect3DDevice8 *device = buffer->parent_device;
wined3d_mutex_lock(); - wined3d_buffer_decref(buffer->wined3d_buffer); if (draw_buffer) wined3d_buffer_decref(draw_buffer); + else + wined3d_buffer_decref(buffer->wined3d_buffer); wined3d_mutex_unlock();
/* Release the device last, as it may cause the device to be destroyed. */ @@ -591,6 +598,9 @@ static const IDirect3DIndexBuffer8Vtbl d3d8_indexbuffer_vtbl = static void STDMETHODCALLTYPE d3d8_indexbuffer_wined3d_object_destroyed(void *parent) { struct d3d8_indexbuffer *buffer = parent; + + if (buffer->draw_buffer) + wined3d_buffer_decref(buffer->wined3d_buffer); d3d8_resource_cleanup(&buffer->resource); heap_free(buffer); }
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=48351
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
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3d9/tests/visual.c | 52 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 52d67c81991..69cd4418bd2 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -24518,8 +24518,9 @@ static void test_color_vertex(void)
static void test_sysmem_draw(void) { - IDirect3DVertexBuffer9 *vb, *vb_s0, *vb_s1, *dst_vb; + IDirect3DVertexBuffer9 *vb, *vb_s0, *vb_s1, *dst_vb, *get_vb; IDirect3DVertexDeclaration9 *vertex_declaration; + unsigned int i, offset, stride; IDirect3DTexture9 *texture; IDirect3DIndexBuffer9 *ib; IDirect3DDevice9 *device; @@ -24527,7 +24528,6 @@ static void test_sysmem_draw(void) D3DLOCKED_RECT lr; IDirect3D9 *d3d; D3DCOLOR colour; - unsigned int i; ULONG refcount; HWND window; HRESULT hr; @@ -24713,6 +24713,53 @@ static void test_sysmem_draw(void) colour = getPixelColor(device, 320, 240); ok(color_match(colour, 0x00443322, 1), "Got unexpected colour 0x%08x.\n", colour);
+ /* Test that releasing but not unbinding a vertex buffer doesn't break. */ + 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); + + refcount = IDirect3DVertexBuffer9_Release(vb_s1); + ok(!refcount, "Unexpected refcount %u.\n", refcount); + hr = IDirect3DDevice9_GetStreamSource(device, 1, &get_vb, &offset, &stride); + ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr); + ok(get_vb == vb_s1, "Got unexpected vertex buffer %p.\n", get_vb); + refcount = IDirect3DVertexBuffer9_Release(get_vb); + ok(!refcount, "Unexpected refcount %u.\n", refcount); + + 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_SetVertexDeclaration(device, vertex_declaration); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9_SetStreamSource(device, 0, vb_s0, 0, sizeof(*quad_s0)); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + + 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)); @@ -24742,7 +24789,6 @@ static void test_sysmem_draw(void) ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
IDirect3DTexture9_Release(texture); - IDirect3DVertexBuffer9_Release(vb_s1); IDirect3DVertexBuffer9_Release(vb_s0); IDirect3DVertexDeclaration9_Release(vertex_declaration); IDirect3DIndexBuffer9_Release(ib);
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=48352
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
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3d8/tests/visual.c | 52 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-)
diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index c405f8245ee..377f8e083d7 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -10473,16 +10473,16 @@ static void test_color_vertex(void)
static void test_sysmem_draw(void) { - IDirect3DVertexBuffer8 *vb, *vb_s0, *vb_s1, *dst_vb; + IDirect3DVertexBuffer8 *vb, *vb_s0, *vb_s1, *dst_vb, *get_vb; D3DPRESENT_PARAMETERS present_parameters = {0}; IDirect3DTexture8 *texture; IDirect3DIndexBuffer8 *ib; IDirect3DDevice8 *device; + unsigned int i, stride; struct vec4 *dst_data; D3DLOCKED_RECT lr; IDirect3D8 *d3d; D3DCOLOR colour; - unsigned int i; ULONG refcount; HWND window; HRESULT hr; @@ -10698,6 +10698,53 @@ static void test_sysmem_draw(void) colour = getPixelColor(device, 320, 240); ok(color_match(colour, 0x00443322, 1), "Got unexpected colour 0x%08x.\n", colour);
+ /* Test that releasing but not unbinding a vertex buffer doesn't break. */ + 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); + + refcount = IDirect3DVertexBuffer8_Release(vb_s1); + ok(!refcount, "Unexpected refcount %u.\n", refcount); + hr = IDirect3DDevice8_GetStreamSource(device, 1, &get_vb, &stride); + ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr); + ok(get_vb == vb_s1, "Got unexpected vertex buffer %p.\n", get_vb); + refcount = IDirect3DVertexBuffer8_Release(get_vb); + ok(!refcount, "Unexpected refcount %u.\n", refcount); + + 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_SetVertexShader(device, vs); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice8_SetStreamSource(device, 0, vb_s0, sizeof(*quad_s0)); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + + 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 +10774,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);
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=48353
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
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v2: Add a couple of small comments. v3: Split the test out to a separate patch, remove comment again since it doesn't apply anymore.
dlls/d3d9/d3d9_private.h | 2 ++ dlls/d3d9/device.c | 24 ++++++++++++++++++++++-- dlls/d3d9/vertexdeclaration.c | 2 +- 3 files changed, 25 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/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;
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=48354
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)
On Wed, 27 Feb 2019 at 21:01, Matteo Bruni mbruni@codeweavers.com wrote:
- decl = wined3d_vertex_declaration_get_parent(wined3d_decl);
- if (!decl->elements)
- {
map = 1;
- }
Can that happen in d3d9?
- 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);
- }
You don't need to convert the elements for that, the d3d9 elements have a "Stream" field too. If you wanted to be efficient about it, you could create the declaration's stream map on declaration creation.
On Thu, Feb 28, 2019 at 1:22 PM Henri Verbeet hverbeet@gmail.com wrote:
On Wed, 27 Feb 2019 at 21:01, Matteo Bruni mbruni@codeweavers.com wrote:
- decl = wined3d_vertex_declaration_get_parent(wined3d_decl);
- if (!decl->elements)
- {
map = 1;
- }
Can that happen in d3d9?
No, that's an effect of writing the d3d8 patch first and then copying it to d3d9 :/
- 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);
- }
You don't need to convert the elements for that, the d3d9 elements have a "Stream" field too. If you wanted to be efficient about it, you could create the declaration's stream map on declaration creation.
Same here. Actually, creating the stream map at declaration creation time makes things much simpler on d3d8. Thanks!
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v2: Add a couple of small comments. v3: Split the test out to a separate patch, remove comment again since it doesn't apply anymore.
dlls/d3d8/d3d8_private.h | 2 ++ dlls/d3d8/device.c | 29 +++++++++++++++++++++++++++-- dlls/d3d8/vertexdeclaration.c | 2 +- 3 files changed, 30 insertions(+), 3 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..140df07a033 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -2269,15 +2269,40 @@ 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/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=48355
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)
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=48350
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)