Commit 90e44375 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Add a parameter for SetRenderTarget viewport setup.

parent 1f261160
......@@ -1005,7 +1005,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetRenderTarget(LPDIRECT3DDEVICE8 ifa
{
hr = IWineD3DDevice_SetDepthStencilSurface(This->WineD3DDevice, pZSurface ? pZSurface->wineD3DSurface : NULL);
if (SUCCEEDED(hr) && pSurface)
hr = IWineD3DDevice_SetRenderTarget(This->WineD3DDevice, 0, pSurface->wineD3DSurface);
hr = IWineD3DDevice_SetRenderTarget(This->WineD3DDevice, 0, pSurface->wineD3DSurface, TRUE);
if (FAILED(hr)) IWineD3DDevice_SetDepthStencilSurface(This->WineD3DDevice, original_ds);
}
if (original_ds) IWineD3DSurface_Release(original_ds);
......
......@@ -1042,7 +1042,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetRenderTarget(LPDIRECT3DDEVICE9EX
}
wined3d_mutex_lock();
hr = IWineD3DDevice_SetRenderTarget(This->WineD3DDevice, RenderTargetIndex, pSurface ? pSurface->wineD3DSurface : NULL);
hr = IWineD3DDevice_SetRenderTarget(This->WineD3DDevice, RenderTargetIndex, pSurface ? pSurface->wineD3DSurface : NULL, TRUE);
wined3d_mutex_unlock();
return hr;
......
......@@ -348,7 +348,8 @@ IDirect3DDeviceImpl_7_Release(IDirect3DDevice7 *iface)
* vanish soon.
*/
IWineD3DDevice_SetRenderTarget(This->wineD3DDevice, 0,
This->ddraw->d3d_target->WineD3DSurface);
This->ddraw->d3d_target->WineD3DSurface,
FALSE);
/* This->target is the offscreen target.
* This->ddraw->d3d_target is the target used by DDraw
*/
......@@ -1984,7 +1985,8 @@ IDirect3DDeviceImpl_7_SetRenderTarget(IDirect3DDevice7 *iface,
hr = IWineD3DDevice_SetRenderTarget(This->wineD3DDevice,
0,
Target ? Target->WineD3DSurface : NULL);
Target ? Target->WineD3DSurface : NULL,
FALSE);
if(hr != D3D_OK)
{
LeaveCriticalSection(&ddraw_cs);
......
......@@ -865,7 +865,6 @@ 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,
......@@ -875,17 +874,8 @@ IDirect3DImpl_7_CreateDevice(IDirect3D7 *iface,
/* Render to the back buffer */
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);
target->WineD3DSurface,
TRUE);
object->OffScreenTarget = TRUE;
}
else
......
......@@ -6184,9 +6184,9 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, WINED
context_release(context);
}
static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface, DWORD RenderTargetIndex, IWineD3DSurface *pRenderTarget) {
static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface, DWORD RenderTargetIndex, IWineD3DSurface *pRenderTarget,
BOOL set_viewport) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
int dxVersion = ( (IWineD3DImpl *) This->wineD3D)->dxVersion;
TRACE("(%p) : Setting rendertarget %d to %p\n", This, RenderTargetIndex, pRenderTarget);
......@@ -6220,7 +6220,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface,
This->render_targets[RenderTargetIndex] = pRenderTarget;
/* Render target 0 is special */
if(RenderTargetIndex == 0 && dxVersion > 7) {
if(RenderTargetIndex == 0 && set_viewport) {
/* Finally, reset the viewport and scissor rect as the MSDN states.
* Tests show that stateblock recording is ignored, the change goes
* directly into the primary stateblock.
......
......@@ -3205,7 +3205,8 @@ interface IWineD3DDevice : IWineD3DBase
);
HRESULT SetRenderTarget(
[in] DWORD render_target_idx,
[in] IWineD3DSurface *render_target
[in] IWineD3DSurface *render_target,
[in] BOOL set_viewport
);
HRESULT GetRenderTarget(
[in] DWORD render_target_idx,
......
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