wined3d: Disable depth stencil related states without a depth stencil buffer.
Except with fbos, it is not possible to remove the depth stencil buffer from the opengl frame buffer, so when the d3d app sets a NULL depth stencil disable all states that work with the depth stencil buffer.
This commit is contained in:
parent
5f159452ef
commit
6886b237ad
|
@ -5175,6 +5175,13 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDepthStencilSurface(IWineD3DDevice *
|
|||
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) {
|
||||
set_depth_stencil_fbo(iface, pNewZStencil);
|
||||
}
|
||||
|
||||
if((!tmp && pNewZStencil) || (!pNewZStencil && tmp)) {
|
||||
/* Swapping NULL / non NULL depth stencil affects the depth and tests */
|
||||
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(WINED3DRS_ZENABLE));
|
||||
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(WINED3DRS_STENCILENABLE));
|
||||
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(WINED3DRS_STENCILWRITEMASK));
|
||||
}
|
||||
}
|
||||
|
||||
return hr;
|
||||
|
|
|
@ -105,6 +105,13 @@ static void state_lighting(DWORD state, IWineD3DStateBlockImpl *stateblock, Wine
|
|||
}
|
||||
|
||||
static void state_zenable(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
||||
/* No z test without depth stencil buffers */
|
||||
if(stateblock->wineD3DDevice->stencilBufferTarget == NULL) {
|
||||
glDisable(GL_DEPTH_TEST); /* This also disables z writing in gl */
|
||||
checkGLcall("glDisable GL_DEPTH_TEST");
|
||||
return;
|
||||
}
|
||||
|
||||
switch ((WINED3DZBUFFERTYPE) stateblock->renderState[WINED3DRS_ZENABLE]) {
|
||||
case WINED3DZB_FALSE:
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
@ -611,6 +618,13 @@ state_stencil(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *c
|
|||
GLint depthFail_ccw = GL_KEEP;
|
||||
GLint stencilPass_ccw = GL_KEEP;
|
||||
|
||||
/* No stencil test without a stencil buffer */
|
||||
if(stateblock->wineD3DDevice->stencilBufferTarget == NULL) {
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
checkGLcall("glDisable GL_STENCIL_TEST");
|
||||
return;
|
||||
}
|
||||
|
||||
if( stateblock->set.renderState[WINED3DRS_STENCILENABLE] )
|
||||
onesided_enable = stateblock->renderState[WINED3DRS_STENCILENABLE];
|
||||
if( stateblock->set.renderState[WINED3DRS_TWOSIDEDSTENCILMODE] )
|
||||
|
@ -664,7 +678,11 @@ state_stencil(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *c
|
|||
}
|
||||
|
||||
static void state_stencilwrite(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
||||
glStencilMask(stateblock->renderState[WINED3DRS_STENCILWRITEMASK]);
|
||||
if(stateblock->wineD3DDevice->stencilBufferTarget) {
|
||||
glStencilMask(stateblock->renderState[WINED3DRS_STENCILWRITEMASK]);
|
||||
} else {
|
||||
glStencilMask(0);
|
||||
}
|
||||
checkGLcall("glStencilMask");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue