wined3d: Skip copying the depth stencil if it's discarded.

This gives a small performance improvement for applications that are
smart enough to set the D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL flag, or
to create depth stencils with Discard set to TRUE.
This commit is contained in:
Henri Verbeet 2008-09-22 14:52:52 +02:00 committed by Alexandre Julliard
parent 66654cf057
commit 9d192c6251
3 changed files with 16 additions and 3 deletions

View File

@ -6647,9 +6647,14 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDepthStencilSurface(IWineD3DDevice *
******************************************************/
if (This->stencilBufferTarget) {
ActivateContext(This, This->render_targets[0], CTXUSAGE_RESOURCELOAD);
surface_load_ds_location(This->stencilBufferTarget, SFLAG_DS_OFFSCREEN);
surface_modify_ds_location(This->stencilBufferTarget, SFLAG_DS_OFFSCREEN);
if (((IWineD3DSwapChainImpl *)This->swapchains[0])->presentParms.Flags & WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL
|| ((IWineD3DSurfaceImpl *)This->stencilBufferTarget)->Flags & SFLAG_DISCARD) {
surface_modify_ds_location(This->stencilBufferTarget, SFLAG_DS_DISCARDED);
} else {
ActivateContext(This, This->render_targets[0], CTXUSAGE_RESOURCELOAD);
surface_load_ds_location(This->stencilBufferTarget, SFLAG_DS_OFFSCREEN);
surface_modify_ds_location(This->stencilBufferTarget, SFLAG_DS_OFFSCREEN);
}
}
tmp = This->stencilBufferTarget;

View File

@ -259,6 +259,13 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
}
}
if (This->wineD3DDevice->stencilBufferTarget) {
if (This->presentParms.Flags & WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL
|| ((IWineD3DSurfaceImpl *)This->wineD3DDevice->stencilBufferTarget)->Flags & SFLAG_DISCARD) {
surface_modify_ds_location(This->wineD3DDevice->stencilBufferTarget, SFLAG_DS_DISCARDED);
}
}
if(This->presentParms.PresentationInterval != WINED3DPRESENT_INTERVAL_IMMEDIATE && GL_SUPPORT(SGI_VIDEO_SYNC)) {
retval = GL_EXTCALL(glXGetVideoSyncSGI(&sync));
if(retval != 0) {

View File

@ -1449,6 +1449,7 @@ void flip_surface(IWineD3DSurfaceImpl *front, IWineD3DSurfaceImpl *back);
#define SFLAG_DS_LOCATIONS (SFLAG_DS_ONSCREEN | \
SFLAG_DS_OFFSCREEN)
#define SFLAG_DS_DISCARDED SFLAG_DS_LOCATIONS
BOOL CalculateTexRect(IWineD3DSurfaceImpl *This, RECT *Rect, float glTexCoord[4]);