Commit 1424e7fd authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Make Clear aware of the depth stencil sharing.

parent 451d85a7
......@@ -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) {
......
......@@ -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;
......
......@@ -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);
......
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