Module: wine Branch: master Commit: 1424e7fd09f935ed5b2d64fe06a7e86ee8e4ae86 URL: http://source.winehq.org/git/wine.git/?a=commit;h=1424e7fd09f935ed5b2d64fe06...
Author: Stefan Dösinger stefan@codeweavers.com Date: Sun Jan 27 14:11:16 2008 +0100
wined3d: Make Clear aware of the depth stencil sharing.
---
dlls/wined3d/device.c | 21 +++++++++++++++++++++ dlls/wined3d/drawprim.c | 2 +- dlls/wined3d/wined3d_private.h | 2 ++ 3 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index f0bac3e..c159674 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4800,6 +4800,7 @@ HRESULT IWineD3DDeviceImpl_ClearSurface(IWineD3DDeviceImpl *This, IWineD3DSurfa RECT vp_rect; WINED3DVIEWPORT *vp = &This->stateBlock->viewport; UINT drawable_width, drawable_height; + IWineD3DSurfaceImpl *depth_stencil = (IWineD3DSurfaceImpl *) This->stencilBufferTarget;
/* When we're clearing parts of the drawable, make sure that the target surface is well up to date in the * drawable. After the clear we'll mark the drawable up to date, so we have to make sure that this is true @@ -4858,6 +4859,26 @@ HRESULT IWineD3DDeviceImpl_ClearSurface(IWineD3DDeviceImpl *This, IWineD3DSurfa checkGLcall("glClearDepth"); glMask = glMask | GL_DEPTH_BUFFER_BIT; IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(WINED3DRS_ZWRITEENABLE)); + + if(This->depth_copy_state == WINED3D_DCS_COPY) { + if(vp->X != 0 || vp->Y != 0 || + vp->Width < depth_stencil->currentDesc.Width || vp->Height < depth_stencil->currentDesc.Height) { + depth_copy((IWineD3DDevice *) This); + } + else if(This->stateBlock->renderState[WINED3DRS_SCISSORTESTENABLE] && ( + This->stateBlock->scissorRect.left > 0 || This->stateBlock->scissorRect.top > 0 || + This->stateBlock->scissorRect.right < depth_stencil->currentDesc.Width || + This->stateBlock->scissorRect.bottom < depth_stencil->currentDesc.Height)) { + depth_copy((IWineD3DDevice *) This); + } + else if(Count > 0 && pRects && ( + pRects[0].x1 > 0 || pRects[0].y1 > 0 || + pRects[0].x2 < depth_stencil->currentDesc.Width || + pRects[0].y2 < depth_stencil->currentDesc.Height)) { + depth_copy((IWineD3DDevice *) This); + } + } + This->depth_copy_state = WINED3D_DCS_INITIAL; }
if (Flags & WINED3DCLEAR_TARGET) { diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c index 70a8c46..2ece349 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c @@ -757,7 +757,7 @@ static void depth_blt(IWineD3DDevice *iface, GLuint texture) { This->shader_backend->shader_select(iface, use_ps(This), use_vs(This)); }
-static void depth_copy(IWineD3DDevice *iface) { +void depth_copy(IWineD3DDevice *iface) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DSurfaceImpl *depth_stencil = (IWineD3DSurfaceImpl *)This->auto_depth_stencil_buffer;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 27b1dc1..21c37cb 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -411,6 +411,8 @@ extern glAttribFunc normal_funcs[WINED3DDECLTYPE_UNUSED]; #define GET_TEXCOORD_SIZE_FROM_FVF(d3dvtVertexType, tex_num) \ (((((d3dvtVertexType) >> (16 + (2 * (tex_num)))) + 1) & 0x03) + 1)
+void depth_copy(IWineD3DDevice *iface); + /* Routines and structures related to state management */ typedef struct WineD3DContext WineD3DContext; typedef void (*APPLYSTATEFUNC)(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *ctx);