Commit 9d192c62 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

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.
parent 66654cf0
...@@ -6647,10 +6647,15 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDepthStencilSurface(IWineD3DDevice * ...@@ -6647,10 +6647,15 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDepthStencilSurface(IWineD3DDevice *
******************************************************/ ******************************************************/
if (This->stencilBufferTarget) { if (This->stencilBufferTarget) {
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); ActivateContext(This, This->render_targets[0], CTXUSAGE_RESOURCELOAD);
surface_load_ds_location(This->stencilBufferTarget, SFLAG_DS_OFFSCREEN); surface_load_ds_location(This->stencilBufferTarget, SFLAG_DS_OFFSCREEN);
surface_modify_ds_location(This->stencilBufferTarget, SFLAG_DS_OFFSCREEN); surface_modify_ds_location(This->stencilBufferTarget, SFLAG_DS_OFFSCREEN);
} }
}
tmp = This->stencilBufferTarget; tmp = This->stencilBufferTarget;
This->stencilBufferTarget = pNewZStencil; This->stencilBufferTarget = pNewZStencil;
......
...@@ -259,6 +259,13 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO ...@@ -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)) { if(This->presentParms.PresentationInterval != WINED3DPRESENT_INTERVAL_IMMEDIATE && GL_SUPPORT(SGI_VIDEO_SYNC)) {
retval = GL_EXTCALL(glXGetVideoSyncSGI(&sync)); retval = GL_EXTCALL(glXGetVideoSyncSGI(&sync));
if(retval != 0) { if(retval != 0) {
......
...@@ -1449,6 +1449,7 @@ void flip_surface(IWineD3DSurfaceImpl *front, IWineD3DSurfaceImpl *back); ...@@ -1449,6 +1449,7 @@ void flip_surface(IWineD3DSurfaceImpl *front, IWineD3DSurfaceImpl *back);
#define SFLAG_DS_LOCATIONS (SFLAG_DS_ONSCREEN | \ #define SFLAG_DS_LOCATIONS (SFLAG_DS_ONSCREEN | \
SFLAG_DS_OFFSCREEN) SFLAG_DS_OFFSCREEN)
#define SFLAG_DS_DISCARDED SFLAG_DS_LOCATIONS
BOOL CalculateTexRect(IWineD3DSurfaceImpl *This, RECT *Rect, float glTexCoord[4]); BOOL CalculateTexRect(IWineD3DSurfaceImpl *This, RECT *Rect, float glTexCoord[4]);
......
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