Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/device.c | 2 +- dlls/wined3d/stateblock.c | 4 ++-- dlls/wined3d/wined3d.spec | 1 + dlls/wined3d/wined3d_private.h | 2 -- include/wine/wined3d.h | 1 + 5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 87db701d157..5983281f932 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4131,7 +4131,7 @@ HRESULT CDECL wined3d_device_end_stateblock(struct wined3d_device *device) return WINED3DERR_INVALIDCALL; }
- stateblock_init_contained_states(stateblock); + wined3d_stateblock_init_contained_states(stateblock);
wined3d_stateblock_decref(device->recording); device->recording = NULL; diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 898a4bc93d4..dc714914ec3 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -283,7 +283,7 @@ static void stateblock_savedstates_set_vertex(struct wined3d_saved_states *state memset(states->vs_consts_f, TRUE, sizeof(BOOL) * num_constants); }
-void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) +void CDECL wined3d_stateblock_init_contained_states(struct wined3d_stateblock *stateblock) { const struct wined3d_d3d_info *d3d_info = &stateblock->device->adapter->d3d_info; unsigned int i, j; @@ -2032,7 +2032,7 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, break; }
- stateblock_init_contained_states(stateblock); + wined3d_stateblock_init_contained_states(stateblock); wined3d_stateblock_capture(stateblock);
/* According to the tests, stream offset is not updated in the captured state if diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index ea04c85d385..29bcd759264 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -262,6 +262,7 @@ @ cdecl wined3d_stateblock_create(ptr long ptr) @ cdecl wined3d_stateblock_decref(ptr) @ cdecl wined3d_stateblock_incref(ptr) +@ cdecl wined3d_stateblock_init_contained_states(ptr) @ cdecl wined3d_stateblock_reset(ptr) @ cdecl wined3d_stateblock_set_base_vertex_index(ptr long) @ cdecl wined3d_stateblock_set_blend_factor(ptr ptr) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index f6d25aa6d88..8ebf377b114 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3974,8 +3974,6 @@ struct wined3d_stateblock unsigned int num_contained_sampler_states; };
-void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; - void wined3d_stateblock_state_init(struct wined3d_stateblock_state *state, const struct wined3d_device *device, DWORD flags) DECLSPEC_HIDDEN; void wined3d_stateblock_state_cleanup(struct wined3d_stateblock_state *state) DECLSPEC_HIDDEN; diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index fac9eef5be2..37e012b979d 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2667,6 +2667,7 @@ HRESULT __cdecl wined3d_stateblock_create(struct wined3d_device *device, enum wined3d_stateblock_type type, struct wined3d_stateblock **stateblock); ULONG __cdecl wined3d_stateblock_decref(struct wined3d_stateblock *stateblock); ULONG __cdecl wined3d_stateblock_incref(struct wined3d_stateblock *stateblock); +void __cdecl wined3d_stateblock_init_contained_states(struct wined3d_stateblock *stateblock); void __cdecl wined3d_stateblock_reset(struct wined3d_stateblock *stateblock); void __cdecl wined3d_stateblock_set_base_vertex_index(struct wined3d_stateblock *stateblock, INT base_index); void __cdecl wined3d_stateblock_set_blend_factor(struct wined3d_stateblock *stateblock,
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ddraw/device.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index ffa029321c1..faeb7ba1ff8 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -5642,7 +5642,7 @@ static HRESULT d3d_device7_BeginStateBlock(IDirect3DDevice7 *iface) WARN("Trying to begin a stateblock while recording, returning D3DERR_INBEGINSTATEBLOCK.\n"); return D3DERR_INBEGINSTATEBLOCK; } - if (SUCCEEDED(hr = wined3d_device_begin_stateblock(device->wined3d_device, &stateblock))) + if (SUCCEEDED(hr = wined3d_stateblock_create(device->wined3d_device, WINED3D_SBT_RECORDED, &stateblock))) device->update_state = device->recording = stateblock; wined3d_mutex_unlock();
@@ -5686,7 +5686,6 @@ static HRESULT d3d_device7_EndStateBlock(IDirect3DDevice7 *iface, DWORD *statebl { struct d3d_device *device = impl_from_IDirect3DDevice7(iface); struct wined3d_stateblock *wined3d_sb; - HRESULT hr; DWORD h;
TRACE("iface %p, stateblock %p.\n", iface, stateblock); @@ -5701,15 +5700,8 @@ static HRESULT d3d_device7_EndStateBlock(IDirect3DDevice7 *iface, DWORD *statebl WARN("Trying to end a stateblock, but no stateblock is being recorded.\n"); return D3DERR_NOTINBEGINSTATEBLOCK; } - hr = wined3d_device_end_stateblock(device->wined3d_device); - if (FAILED(hr)) - { - WARN("Failed to end stateblock, hr %#x.\n", hr); - wined3d_mutex_unlock(); - *stateblock = 0; - return hr_ddraw_from_wined3d(hr); - } wined3d_sb = device->recording; + wined3d_stateblock_init_contained_states(wined3d_sb); device->recording = NULL; device->update_state = device->state;
@@ -5726,7 +5718,7 @@ static HRESULT d3d_device7_EndStateBlock(IDirect3DDevice7 *iface, DWORD *statebl wined3d_mutex_unlock(); *stateblock = h + 1;
- return hr_ddraw_from_wined3d(hr); + return D3D_OK; }
static HRESULT WINAPI d3d_device7_EndStateBlock_FPUSetup(IDirect3DDevice7 *iface, DWORD *stateblock)
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d8/device.c | 20 +++++++++++++------- dlls/d3d8/tests/device.c | 8 -------- 2 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index e85fd72d020..564dc9d9d04 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -1902,7 +1902,14 @@ static HRESULT WINAPI d3d8_device_BeginStateBlock(IDirect3DDevice8 *iface) TRACE("iface %p.\n", iface);
wined3d_mutex_lock(); - if (SUCCEEDED(hr = wined3d_device_begin_stateblock(device->wined3d_device, &stateblock))) + if (device->recording) + { + wined3d_mutex_unlock(); + WARN("Trying to begin a stateblock while recording, returning D3DERR_INBEGINSTATEBLOCK.\n"); + return D3DERR_INVALIDCALL; + } + + if (SUCCEEDED(hr = wined3d_stateblock_create(device->wined3d_device, WINED3D_SBT_RECORDED, &stateblock))) device->update_state = device->recording = stateblock; wined3d_mutex_unlock();
@@ -1913,7 +1920,6 @@ static HRESULT WINAPI d3d8_device_EndStateBlock(IDirect3DDevice8 *iface, DWORD * { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct wined3d_stateblock *stateblock; - HRESULT hr;
TRACE("iface %p, token %p.\n", iface, token);
@@ -1921,14 +1927,14 @@ static HRESULT WINAPI d3d8_device_EndStateBlock(IDirect3DDevice8 *iface, DWORD * * of memory later and cause locking problems) */ wined3d_mutex_lock(); - hr = wined3d_device_end_stateblock(device->wined3d_device); - if (FAILED(hr)) + if (!device->recording) { - WARN("Failed to end the state block, %#x.\n", hr); wined3d_mutex_unlock(); - return hr; + WARN("Trying to end a stateblock, but no stateblock is being recorded.\n"); + return D3DERR_INVALIDCALL; } stateblock = device->recording; + wined3d_stateblock_init_contained_states(stateblock); device->recording = NULL; device->update_state = device->state;
@@ -1947,7 +1953,7 @@ static HRESULT WINAPI d3d8_device_EndStateBlock(IDirect3DDevice8 *iface, DWORD *
TRACE("Returning %#x (%p).\n", *token, stateblock);
- return hr; + return D3D_OK; }
static HRESULT WINAPI d3d8_device_ApplyStateBlock(IDirect3DDevice8 *iface, DWORD token) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 9fc06c3c9d6..f598ad4f458 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -9665,20 +9665,12 @@ static void test_draw_primitive(void)
hr = IDirect3DDevice8_GetStreamSource(device, 0, ¤t_vb, &stride); ok(SUCCEEDED(hr), "GetStreamSource failed, hr %#x.\n", hr); -todo_wine { ok(!current_vb, "Unexpected vb %p.\n", current_vb); ok(!stride, "Unexpected stride %u.\n", stride); -} - if (current_vb) - IDirect3DVertexBuffer8_Release(current_vb); hr = IDirect3DDevice8_GetIndices(device, ¤t_ib, &base_vertex_index); ok(SUCCEEDED(hr), "GetIndices failed, hr %#x.\n", hr); -todo_wine { ok(!current_ib, "Unexpected index buffer %p.\n", current_ib); ok(!base_vertex_index, "Unexpected base vertex index %u.\n", base_vertex_index); -} - if (current_ib) - IDirect3DIndexBuffer8_Release(current_ib);
hr = IDirect3DDevice8_CaptureStateBlock(device, stateblock); ok(SUCCEEDED(hr), "Capture failed, hr %#x.\n", hr);
Hi,
While running your changed tests, 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=60852
Your paranoid android.
=== w1064v1809_ar (32 bit report) ===
d3d8: device.c:1009: Test failed: The cursor handle is 00010019
=== w1064v1809_he (32 bit report) ===
d3d8: device.c:1122: Test failed: Didn't receive MOUSEMOVE 0 (50, 50).
=== debian10 (32 bit WoW report) ===
d3d8: visual.c:6623: Test failed: Expected color 0x00000000, got 0x000000ff, format D3DFMT_Q8W8V8U8, test 0, location 3x2. visual.c:6623: Test failed: Expected color 0x00000000, got 0x000000ff, format D3DFMT_Q8W8V8U8, test 2, location 3x2. visual.c:7464: Test failed: Got unexpected color 0x0000ff00 (case 0, 3, size 0). visual.c:7464: Test failed: Got unexpected color 0x0000ff00 (case 1, 3, size 0). visual.c:7464: Test failed: Got unexpected color 0x0000ff00 (case 2, 3, size 0). visual.c:7464: Test failed: Got unexpected color 0x0000ff00 (case 3, 3, size 0). visual.c:7464: Test failed: Got unexpected color 0x0000ff00 (case 4, 7, size 0). visual.c:7464: Test failed: Got unexpected color 0x0000ff00 (case 5, 7, size 0). visual.c:8798: Test failed: Test 0 shading has color1 000000ff, expected 0000ff00. visual.c:8798: Test failed: Test 6 shading has color1 000000ff, expected 0000ff00. visual.c:8798: Test failed: Test 10 shading has color1 000000ff, expected 0000ff00. visual.c:8798: Test failed: Test 11 shading has color1 000000ff, expected 0000ff00. visual.c:10304: Test failed: Expected unsynchronised map for flags 0x1000. visual.c:10304: Test failed: Expected unsynchronised map for flags 0x3000.
ddraw: ddraw2: Timeout ddraw4: Timeout ddraw7: Timeout ddrawmodes: Timeout dsurface: Timeout refcount: Timeout visual: Timeout
=== debian10 (build log) ===
0009:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 0009:err:winediag:nodrv_CreateWindow The explorer process failed to start. Task: WineTest did not produce the wow64 report
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d9/device.c | 17 ++++++++++++----- dlls/d3d9/tests/device.c | 8 -------- 2 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 76fddc59f18..0657cc2f766 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -2400,7 +2400,14 @@ static HRESULT WINAPI d3d9_device_BeginStateBlock(IDirect3DDevice9Ex *iface) TRACE("iface %p.\n", iface);
wined3d_mutex_lock(); - if (SUCCEEDED(hr = wined3d_device_begin_stateblock(device->wined3d_device, &stateblock))) + if (device->recording) + { + wined3d_mutex_unlock(); + WARN("Trying to begin a stateblock while recording, returning D3DERR_INBEGINSTATEBLOCK.\n"); + return D3DERR_INVALIDCALL; + } + + if (SUCCEEDED(hr = wined3d_stateblock_create(device->wined3d_device, WINED3D_SBT_RECORDED, &stateblock))) device->update_state = device->recording = stateblock; wined3d_mutex_unlock();
@@ -2417,14 +2424,14 @@ static HRESULT WINAPI d3d9_device_EndStateBlock(IDirect3DDevice9Ex *iface, IDire TRACE("iface %p, stateblock %p.\n", iface, stateblock);
wined3d_mutex_lock(); - hr = wined3d_device_end_stateblock(device->wined3d_device); - if (FAILED(hr)) + if (!device->recording) { wined3d_mutex_unlock(); - WARN("Failed to end the stateblock, hr %#x.\n", hr); - return hr; + WARN("Trying to end a stateblock, but no stateblock is being recorded.\n"); + return D3DERR_INVALIDCALL; } wined3d_stateblock = device->recording; + wined3d_stateblock_init_contained_states(wined3d_stateblock); device->recording = NULL; device->update_state = device->state; wined3d_mutex_unlock(); diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 75cddbb6db3..87d9897c115 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -3048,19 +3048,11 @@ static void test_draw_primitive(void)
hr = IDirect3DDevice9_GetStreamSource(device, 0, ¤t_vb, &offset, &stride); ok(SUCCEEDED(hr), "GetStreamSource failed, hr %#x.\n", hr); -todo_wine ok(!current_vb, "Unexpected vb %p.\n", current_vb); ok(!offset, "Unexpected offset %u.\n", offset); -todo_wine - ok(!stride, "Unexpected stride %u.\n", stride); - if (current_vb) - IDirect3DVertexBuffer9_Release(current_vb); hr = IDirect3DDevice9_GetIndices(device, ¤t_ib); ok(SUCCEEDED(hr), "GetIndices failed, hr %#x.\n", hr); -todo_wine ok(!current_ib, "Unexpected index buffer %p.\n", current_ib); - if (current_ib) - IDirect3DIndexBuffer9_Release(current_ib);
hr = IDirect3DStateBlock9_Capture(stateblock); ok(SUCCEEDED(hr), "Capture failed, hr %#x.\n", hr);
On Tue, 26 Nov 2019 at 05:21, Zebediah Figura z.figura12@gmail.com wrote:
-todo_wine
- ok(!stride, "Unexpected stride %u.\n", stride);
- if (current_vb)
IDirect3DVertexBuffer9_Release(current_vb);
Is removing the test there intentional?
On 11/26/19 8:48 AM, Henri Verbeet wrote:
On Tue, 26 Nov 2019 at 05:21, Zebediah Figura z.figura12@gmail.com wrote:
-todo_wine
- ok(!stride, "Unexpected stride %u.\n", stride);
- if (current_vb)
IDirect3DVertexBuffer9_Release(current_vb);
Is removing the test there intentional?
Nope, thanks for catching it. I've sent v2.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/device.c | 51 --------------------------------------- dlls/wined3d/wined3d.spec | 2 -- include/wine/wined3d.h | 2 -- 3 files changed, 55 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 5983281f932..f2d060184ba 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4091,57 +4091,6 @@ HRESULT CDECL wined3d_device_get_display_mode(const struct wined3d_device *devic return wined3d_swapchain_get_display_mode(swapchain, mode, rotation); }
-HRESULT CDECL wined3d_device_begin_stateblock(struct wined3d_device *device, - struct wined3d_stateblock **stateblock) -{ - struct wined3d_stateblock *object; - HRESULT hr; - - TRACE("device %p.\n", device); - - if (device->recording) - { - *stateblock = NULL; - return WINED3DERR_INVALIDCALL; - } - - hr = wined3d_stateblock_create(device, WINED3D_SBT_RECORDED, &object); - if (FAILED(hr)) - return hr; - - device->recording = object; - device->update_stateblock_state = &object->stateblock_state; - wined3d_stateblock_incref(object); - *stateblock = object; - - TRACE("Recording stateblock %p.\n", *stateblock); - - return WINED3D_OK; -} - -HRESULT CDECL wined3d_device_end_stateblock(struct wined3d_device *device) -{ - struct wined3d_stateblock *stateblock = device->recording; - - TRACE("device %p.\n", device); - - if (!device->recording) - { - WARN("Not recording.\n"); - return WINED3DERR_INVALIDCALL; - } - - wined3d_stateblock_init_contained_states(stateblock); - - wined3d_stateblock_decref(device->recording); - device->recording = NULL; - device->update_stateblock_state = &device->stateblock_state; - - TRACE("Ending stateblock %p.\n", stateblock); - - return WINED3D_OK; -} - HRESULT CDECL wined3d_device_begin_scene(struct wined3d_device *device) { /* At the moment we have no need for any functionality at the beginning diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 29bcd759264..9c05dd8e938 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -38,7 +38,6 @@
@ cdecl wined3d_device_acquire_focus_window(ptr ptr) @ cdecl wined3d_device_begin_scene(ptr) -@ cdecl wined3d_device_begin_stateblock(ptr ptr) @ cdecl wined3d_device_clear(ptr long ptr long ptr float long) @ cdecl wined3d_device_clear_rendertarget_view(ptr ptr ptr long ptr float long) @ cdecl wined3d_device_clear_unordered_access_view_uint(ptr ptr ptr) @@ -56,7 +55,6 @@ @ cdecl wined3d_device_draw_primitive_instanced(ptr long long long long) @ cdecl wined3d_device_draw_primitive_instanced_indirect(ptr ptr long) @ cdecl wined3d_device_end_scene(ptr) -@ cdecl wined3d_device_end_stateblock(ptr) @ cdecl wined3d_device_evict_managed_resources(ptr) @ cdecl wined3d_device_get_available_texture_mem(ptr) @ cdecl wined3d_device_get_base_vertex_index(ptr) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 37e012b979d..f455cdb979c 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2233,7 +2233,6 @@ ULONG __cdecl wined3d_buffer_incref(struct wined3d_buffer *buffer);
HRESULT __cdecl wined3d_device_acquire_focus_window(struct wined3d_device *device, HWND window); HRESULT __cdecl wined3d_device_begin_scene(struct wined3d_device *device); -HRESULT __cdecl wined3d_device_begin_stateblock(struct wined3d_device *device, struct wined3d_stateblock **stateblock); HRESULT __cdecl wined3d_device_clear(struct wined3d_device *device, DWORD rect_count, const RECT *rects, DWORD flags, const struct wined3d_color *color, float z, DWORD stencil); HRESULT __cdecl wined3d_device_clear_rendertarget_view(struct wined3d_device *device, @@ -2269,7 +2268,6 @@ void __cdecl wined3d_device_draw_primitive_instanced(struct wined3d_device *devi void __cdecl wined3d_device_draw_primitive_instanced_indirect(struct wined3d_device *device, struct wined3d_buffer *buffer, unsigned int offset); HRESULT __cdecl wined3d_device_end_scene(struct wined3d_device *device); -HRESULT __cdecl wined3d_device_end_stateblock(struct wined3d_device *device); void __cdecl wined3d_device_evict_managed_resources(struct wined3d_device *device); UINT __cdecl wined3d_device_get_available_texture_mem(const struct wined3d_device *device); INT __cdecl wined3d_device_get_base_vertex_index(const struct wined3d_device *device);