Signed-off-by: Zebediah Figura z.figura12@gmail.com --- This is not particularly pretty, but there seems to me to be too much logic in wined3d regarding these states to be worth duplicating.
dlls/d3d9/device.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 5ef0c9cdf66..76fddc59f18 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -522,6 +522,17 @@ void d3dcaps_from_wined3dcaps(D3DCAPS9 *caps, const struct wined3d_caps *wined3d } }
+static void device_reset_viewport_state(struct d3d9_device *device) +{ + struct wined3d_viewport vp; + RECT rect; + + wined3d_device_get_viewports(device->wined3d_device, NULL, &vp); + wined3d_stateblock_set_viewport(device->state, &vp); + wined3d_device_get_scissor_rects(device->wined3d_device, NULL, &rect); + wined3d_stateblock_set_scissor_rect(device->state, &rect); +} + static HRESULT WINAPI d3d9_device_QueryInterface(IDirect3DDevice9Ex *iface, REFIID riid, void **out) { TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); @@ -1011,6 +1022,7 @@ static HRESULT d3d9_device_reset(struct d3d9_device *device, !!swapchain_desc.enable_auto_depth_stencil); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ZENABLE, !!swapchain_desc.enable_auto_depth_stencil); + device_reset_viewport_state(device); }
if (FAILED(hr = d3d9_device_get_swapchains(device))) @@ -1902,7 +1914,11 @@ static HRESULT WINAPI d3d9_device_SetRenderTarget(IDirect3DDevice9Ex *iface, DWO hr = wined3d_device_set_rendertarget_view(device->wined3d_device, idx, rtv, TRUE); d3d9_surface_release_rendertarget_view(surface_impl, rtv); if (SUCCEEDED(hr)) + { + if (!idx) + device_reset_viewport_state(device); device->render_targets[idx] = surface_impl; + } wined3d_mutex_unlock();
return hr; @@ -4636,6 +4652,7 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine !!swapchain_desc->enable_auto_depth_stencil); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ZENABLE, !!swapchain_desc->enable_auto_depth_stencil); + device_reset_viewport_state(device);
if (FAILED(hr = d3d9_device_get_swapchains(device))) {
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d8/device.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 17d8a726c75..e85fd72d020 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -530,6 +530,17 @@ static void *d3d8_get_object(struct d3d8_handle_table *t, DWORD handle, enum d3d return entry->object; }
+static void device_reset_viewport_state(struct d3d8_device *device) +{ + struct wined3d_viewport vp; + RECT rect; + + wined3d_device_get_viewports(device->wined3d_device, NULL, &vp); + wined3d_stateblock_set_viewport(device->state, &vp); + wined3d_device_get_scissor_rects(device->wined3d_device, NULL, &rect); + wined3d_stateblock_set_scissor_rect(device->state, &rect); +} + static HRESULT WINAPI d3d8_device_QueryInterface(IDirect3DDevice8 *iface, REFIID riid, void **out) { TRACE("iface %p, riid %s, out %p.\n", @@ -928,6 +939,7 @@ static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface, wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_POINTSIZE_MIN, 0); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ZENABLE, !!swapchain_desc.enable_auto_depth_stencil); + device_reset_viewport_state(device); device->device_state = D3D8_DEVICE_STATE_OK; } else @@ -1473,8 +1485,13 @@ static HRESULT WINAPI d3d8_device_SetRenderTarget(IDirect3DDevice8 *iface, if (SUCCEEDED(hr)) { rtv = render_target ? d3d8_surface_acquire_rendertarget_view(rt_impl) : NULL; - if (render_target && FAILED(hr = wined3d_device_set_rendertarget_view(device->wined3d_device, 0, rtv, TRUE))) - wined3d_device_set_depth_stencil_view(device->wined3d_device, original_dsv); + if (render_target) + { + if (SUCCEEDED(hr = wined3d_device_set_rendertarget_view(device->wined3d_device, 0, rtv, TRUE))) + device_reset_viewport_state(device); + else + wined3d_device_set_depth_stencil_view(device->wined3d_device, original_dsv); + } d3d8_surface_release_rendertarget_view(rt_impl, rtv); }
@@ -3719,6 +3736,7 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ZENABLE, !!swapchain_desc.enable_auto_depth_stencil); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_POINTSIZE_MIN, 0); + device_reset_viewport_state(device); wined3d_mutex_unlock();
present_parameters_from_wined3d_swapchain_desc(parameters,
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ddraw/device.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index 4ad1fdb7f57..93f85e99ebf 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -6961,6 +6961,17 @@ enum wined3d_depth_buffer_type d3d_device_update_depth_stencil(struct d3d_device return WINED3D_ZB_TRUE; }
+static void device_reset_viewport_state(struct d3d_device *device) +{ + struct wined3d_viewport vp; + RECT rect; + + wined3d_device_get_viewports(device->wined3d_device, NULL, &vp); + wined3d_stateblock_set_viewport(device->state, &vp); + wined3d_device_get_scissor_rects(device->wined3d_device, NULL, &rect); + wined3d_stateblock_set_scissor_rect(device->state, &rect); +} + static HRESULT d3d_device_init(struct d3d_device *device, struct ddraw *ddraw, struct ddraw_surface *target, IUnknown *rt_iface, UINT version, IUnknown *outer_unknown) { @@ -7039,6 +7050,7 @@ static HRESULT d3d_device_init(struct d3d_device *device, struct ddraw *ddraw, IDirect3DDevice3_SetRenderState(&device->IDirect3DDevice3_iface, D3DRENDERSTATE_TEXTUREMAPBLEND, D3DTBLEND_MODULATE); } + device_reset_viewport_state(ddraw); return D3D_OK; }
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=60451
Your paranoid android.
=== debian10 (32 bit report) ===
ddraw: Unhandled exception: page fault on write access to 0x0000b538 in 32-bit code (0x7e4bfc83). Unhandled exception: page fault on write access to 0x0000b577 in 32-bit code (0x7e4bfc83). Unhandled exception: page fault on write access to 0x0000b5b2 in 32-bit code (0x7e4bfc83). Unhandled exception: page fault on write access to 0x0000b538 in 32-bit code (0x7e4bfc83). Unhandled exception: page fault on write access to 0x0000b538 in 32-bit code (0x7e4bfc83). Unhandled exception: page fault on write access to 0x0000b538 in 32-bit code (0x7e4bfc83).
Report errors: ddraw:d3d crashed (c0000005) ddraw:ddraw1 crashed (c0000005) ddraw:ddraw2 crashed (c0000005) ddraw:ddraw4 crashed (c0000005) ddraw:ddraw7 crashed (c0000005) ddraw:visual crashed (c0000005)
=== debian10 (32 bit Chinese:China report) ===
d3d8: device.c:3225: Test failed: Expected message 0x5 for window 0, but didn't receive it. device.c:3228: Test failed: Got unexpected WINDOWPOS hwnd=00000000, insertAfter=00000000, x=0, y=0, cx=0, cy=0, flags=0
d3d9: device.c:4277: Test failed: Expected message 0x5 for window 0, but didn't receive it, i=0. device.c:4282: Test failed: Got unexpected WINDOWPOS hwnd=00000000, insertAfter=00000000, x=0, y=0, cx=0, cy=0, flags=0
ddraw: Unhandled exception: page fault on write access to 0x0000b538 in 32-bit code (0x7e739c83). Unhandled exception: page fault on write access to 0x0000b538 in 32-bit code (0x7e739c83). Unhandled exception: page fault on write access to 0x0000b538 in 32-bit code (0x7e739c83). Unhandled exception: page fault on write access to 0x3f3ef274 in 32-bit code (0x7e739c83). Unhandled exception: page fault on write access to 0x3f3ef274 in 32-bit code (0x7e739c83). Unhandled exception: page fault on write access to 0x0000b538 in 32-bit code (0x7e739c83).
Report errors: ddraw:d3d crashed (c0000005) ddraw:ddraw1 crashed (c0000005) ddraw:ddraw2 crashed (c0000005) ddraw:ddraw4 crashed (c0000005) ddraw:ddraw7 crashed (c0000005) ddraw:visual crashed (c0000005)
=== debian10 (32 bit WoW report) ===
ddraw: Unhandled exception: page fault on write access to 0x0000b538 in 32-bit code (0x7e4bfc83). Unhandled exception: page fault on write access to 0x0000b538 in 32-bit code (0x7e4bfc83). Unhandled exception: page fault on write access to 0x0000b538 in 32-bit code (0x7e4bfc83). Unhandled exception: page fault on write access to 0x0000b538 in 32-bit code (0x7e4bfc83). Unhandled exception: page fault on write access to 0x0000b538 in 32-bit code (0x7e4bfc83). Unhandled exception: page fault on write access to 0x0000b538 in 32-bit code (0x7e4bfc83).
Report errors: ddraw:d3d crashed (c0000005) ddraw:ddraw1 crashed (c0000005) ddraw:ddraw2 crashed (c0000005) ddraw:ddraw4 crashed (c0000005) ddraw:ddraw7 crashed (c0000005) ddraw:visual crashed (c0000005)
=== debian10 (64 bit WoW report) ===
d3d8: device.c:3225: Test failed: Expected message 0x5 for window 0, but didn't receive it. device.c:3228: Test failed: Got unexpected WINDOWPOS hwnd=00000000, insertAfter=00000000, x=0, y=0, cx=0, cy=0, flags=0
d3d9: d3d9ex.c:3214: Test failed: Expected message 0x5 for window 0, but didn't receive it, i=0. d3d9ex.c:3219: Test failed: Got unexpected WINDOWPOS hwnd=00000000, x=0, y=0, cx=0, cy=0, flags=0 device.c:4277: Test failed: Expected message 0x5 for window 0, but didn't receive it, i=0. device.c:4282: Test failed: Got unexpected WINDOWPOS hwnd=00000000, insertAfter=00000000, x=0, y=0, cx=0, cy=0, flags=0
ddraw: Unhandled exception: page fault on write access to 0x0000b538 in 32-bit code (0x7e4bfc83). Unhandled exception: page fault on write access to 0x0000b538 in 32-bit code (0x7e4bfc83). Unhandled exception: page fault on write access to 0x97974acc in 32-bit code (0x7e4bfc83). Unhandled exception: page fault on write access to 0x0000b538 in 32-bit code (0x7e4bfc83). Unhandled exception: page fault on write access to 0x0000b538 in 32-bit code (0x7e4bfc83). Unhandled exception: page fault on write access to 0x0000b538 in 32-bit code (0x7e4bfc83).
Report errors: ddraw:d3d crashed (c0000005) ddraw:ddraw1 crashed (c0000005) ddraw:ddraw2 crashed (c0000005) ddraw:ddraw4 crashed (c0000005) ddraw:ddraw7 crashed (c0000005) ddraw:visual crashed (c0000005)
On Tue, 19 Nov 2019 at 04:38, Zebediah Figura z.figura12@gmail.com wrote:
+static void device_reset_viewport_state(struct d3d_device *device)
...
- device_reset_viewport_state(ddraw);
That doesn't work.