Commit 742260d4 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

ddraw: Adjust the d3d viewport when changing the back buffer.

WineD3D sets up the viewport according to the front buffer, so this needs to be changed to the values of the render target passed when the d3d7 device is created and this device turns out not to be the known front or back buffer.
parent c87d5352
......@@ -306,6 +306,17 @@ IDirect3DDeviceImpl_7_Release(IDirect3DDevice7 *iface)
/* Restore the render targets */
if(This->OffScreenTarget)
{
WINED3DVIEWPORT vp;
vp.X = 0;
vp.Y = 0;
vp.Width = This->ddraw->d3d_target->surface_desc.dwWidth;
vp.Height = This->ddraw->d3d_target->surface_desc.dwHeight;
vp.MinZ = 0.0;
vp.MaxZ = 1.0;
IWineD3DDevice_SetViewport(This->wineD3DDevice,
&vp);
/* Set the device up to render to the front buffer since the back buffer will
* vanish soon.
*/
......
......@@ -844,6 +844,7 @@ IDirect3DImpl_7_CreateDevice(IDirect3D7 *iface,
if(!(target->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) &&
(This->d3d_target != target))
{
WINED3DVIEWPORT vp;
TRACE("(%p) Using %p as front buffer, %p as back buffer\n", This, This->d3d_target, target);
hr = IWineD3DDevice_SetFrontBackBuffers(This->wineD3DDevice,
This->d3d_target->WineD3DSurface,
......@@ -855,6 +856,15 @@ IDirect3DImpl_7_CreateDevice(IDirect3D7 *iface,
IWineD3DDevice_SetRenderTarget(This->wineD3DDevice, 0,
target->WineD3DSurface);
vp.X = 0;
vp.Y = 0;
vp.Width = target->surface_desc.dwWidth;
vp.Height = target->surface_desc.dwHeight;
vp.MinZ = 0.0;
vp.MaxZ = 1.0;
IWineD3DDevice_SetViewport(This->wineD3DDevice,
&vp);
object->OffScreenTarget = TRUE;
}
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment