d3d9: Reset the viewport and scissor rect for extended devices in d3d9_device_reset().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-02-06 19:33:23 -06:00 committed by Alexandre Julliard
parent e09a47c4b7
commit 542a13ad6c
2 changed files with 20 additions and 18 deletions

View File

@ -1039,6 +1039,24 @@ static HRESULT d3d9_device_reset(struct d3d9_device *device,
present_parameters->BackBufferCount = swapchain_desc.backbuffer_count;
device->device_state = D3D9_DEVICE_STATE_OK;
if (extended)
{
const struct wined3d_viewport *current = &wined3d_stateblock_get_state(device->state)->viewport;
struct wined3d_viewport vp;
RECT rect;
vp.x = 0;
vp.y = 0;
vp.width = swapchain_desc.backbuffer_width;
vp.height = swapchain_desc.backbuffer_height;
vp.min_z = current->min_z;
vp.max_z = current->max_z;
wined3d_stateblock_set_viewport(device->state, &vp);
SetRect(&rect, 0, 0, swapchain_desc.backbuffer_width, swapchain_desc.backbuffer_height);
wined3d_stateblock_set_scissor_rect(device->state, &rect);
}
}
rtv = wined3d_device_get_rendertarget_view(device->wined3d_device, 0);
@ -2158,7 +2176,7 @@ static HRESULT WINAPI d3d9_device_GetViewport(IDirect3DDevice9Ex *iface, D3DVIEW
TRACE("iface %p, viewport %p.\n", iface, viewport);
wined3d_mutex_lock();
wined3d_device_get_viewports(device->wined3d_device, NULL, &wined3d_viewport);
wined3d_viewport = wined3d_stateblock_get_state(device->state)->viewport;
wined3d_mutex_unlock();
viewport->X = wined3d_viewport.x;
@ -2737,7 +2755,7 @@ static HRESULT WINAPI d3d9_device_GetScissorRect(IDirect3DDevice9Ex *iface, RECT
TRACE("iface %p, rect %p.\n", iface, rect);
wined3d_mutex_lock();
wined3d_device_get_scissor_rects(device->wined3d_device, NULL, rect);
*rect = wined3d_stateblock_get_state(device->state)->scissor_rect;
wined3d_mutex_unlock();
return D3D_OK;

View File

@ -5576,24 +5576,8 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
device_load_logo(device, wined3d_settings.logo);
}
else if ((view = device->back_buffer_view))
{
struct wined3d_state *state = &device->state;
wined3d_device_set_rendertarget_view(device, 0, view, FALSE);
/* Note the min_z / max_z is not reset. */
state->viewports[0].x = 0;
state->viewports[0].y = 0;
state->viewports[0].width = view->width;
state->viewports[0].height = view->height;
state->viewport_count = 1;
wined3d_cs_emit_set_viewports(device->cs, 1, state->viewports);
SetRect(&state->scissor_rects[0], 0, 0, view->width, view->height);
state->scissor_rect_count = 1;
wined3d_cs_emit_set_scissor_rects(device->cs, 1, state->scissor_rects);
}
if (device->d3d_initialized && reset_state)
hr = device->adapter->adapter_ops->adapter_init_3d(device);