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

wined3d: Fix the GL_ATI_separate_stencil codepath.

glStencilFuncSeparateATI does not take a face argument, instead it sets the front and back facing functions at once. This means the renderstate_stencil_twosided helper function is somewhat pointless for this extension.
parent bcb0f7cc
...@@ -772,16 +772,6 @@ static void state_texfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, Win ...@@ -772,16 +772,6 @@ static void state_texfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, Win
static void static void
renderstate_stencil_twosided(IWineD3DStateBlockImpl *stateblock, GLint face, GLint func, GLint ref, GLuint mask, GLint stencilFail, GLint depthFail, GLint stencilPass ) { renderstate_stencil_twosided(IWineD3DStateBlockImpl *stateblock, GLint face, GLint func, GLint ref, GLuint mask, GLint stencilFail, GLint depthFail, GLint stencilPass ) {
#if 0 /* Don't use OpenGL 2.0 calls for now */
if(GL_EXTCALL(glStencilFuncSeparate) && GL_EXTCALL(glStencilOpSeparate)) {
GL_EXTCALL(glStencilFuncSeparate(face, func, ref, mask));
checkGLcall("glStencilFuncSeparate(...)");
GL_EXTCALL(glStencilOpSeparate(face, stencilFail, depthFail, stencilPass));
checkGLcall("glStencilOpSeparate(...)");
}
else
#endif
if(GL_SUPPORT(EXT_STENCIL_TWO_SIDE)) {
glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT); glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT);
checkGLcall("glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT)"); checkGLcall("glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT)");
GL_EXTCALL(glActiveStencilFaceEXT(face)); GL_EXTCALL(glActiveStencilFaceEXT(face));
...@@ -790,14 +780,6 @@ renderstate_stencil_twosided(IWineD3DStateBlockImpl *stateblock, GLint face, GLi ...@@ -790,14 +780,6 @@ renderstate_stencil_twosided(IWineD3DStateBlockImpl *stateblock, GLint face, GLi
checkGLcall("glStencilFunc(...)"); checkGLcall("glStencilFunc(...)");
glStencilOp(stencilFail, depthFail, stencilPass); glStencilOp(stencilFail, depthFail, stencilPass);
checkGLcall("glStencilOp(...)"); checkGLcall("glStencilOp(...)");
} else if(GL_SUPPORT(ATI_SEPARATE_STENCIL)) {
GL_EXTCALL(glStencilFuncSeparateATI(face, func, ref, mask));
checkGLcall("glStencilFuncSeparateATI(...)");
GL_EXTCALL(glStencilOpSeparateATI(face, stencilFail, depthFail, stencilPass));
checkGLcall("glStencilOpSeparateATI(...)");
} else {
ERR("Separate (two sided) stencil not supported on this version of opengl. Caps weren't honored?\n");
}
} }
static void static void
...@@ -848,20 +830,36 @@ state_stencil(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *c ...@@ -848,20 +830,36 @@ state_stencil(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *c
glEnable(GL_STENCIL_TEST); glEnable(GL_STENCIL_TEST);
checkGLcall("glEnable GL_STENCIL_TEST"); checkGLcall("glEnable GL_STENCIL_TEST");
if(GL_SUPPORT(EXT_STENCIL_TWO_SIDE)) {
/* Apply back first, then front. This function calls glActiveStencilFaceEXT, /* Apply back first, then front. This function calls glActiveStencilFaceEXT,
* which has an effect on the code below too. If we apply the front face * which has an effect on the code below too. If we apply the front face
* afterwards, we are sure that the active stencil face is set to front, * afterwards, we are sure that the active stencil face is set to front,
* and other stencil functions which do not use two sided stencil do not have * and other stencil functions which do not use two sided stencil do not have
* to set it back * to set it back
*/ */
renderstate_stencil_twosided(stateblock, GL_BACK, func_ccw, ref, mask, stencilFail_ccw, depthFail_ccw, stencilPass_ccw); renderstate_stencil_twosided(stateblock, GL_BACK, func_ccw, ref, mask,
renderstate_stencil_twosided(stateblock, GL_FRONT, func, ref, mask, stencilFail, depthFail, stencilPass); stencilFail_ccw, depthFail_ccw, stencilPass_ccw);
renderstate_stencil_twosided(stateblock, GL_FRONT, func, ref, mask,
stencilFail, depthFail, stencilPass);
} else if(GL_SUPPORT(ATI_SEPARATE_STENCIL)) {
GL_EXTCALL(glStencilFuncSeparateATI(func, func_ccw, ref, mask));
checkGLcall("glStencilFuncSeparateATI(...)");
GL_EXTCALL(glStencilOpSeparateATI(GL_FRONT, stencilFail, depthFail, stencilPass));
checkGLcall("glStencilOpSeparateATI(GL_FRONT, ...)");
GL_EXTCALL(glStencilOpSeparateATI(GL_BACK, stencilFail_ccw, depthFail_ccw, stencilPass_ccw));
checkGLcall("glStencilOpSeparateATI(GL_BACK, ...)");
} else {
ERR("Separate (two sided) stencil not supported on this version of opengl. Caps weren't honored?\n");
}
} else if(onesided_enable) { } else if(onesided_enable) {
if(GL_SUPPORT(EXT_STENCIL_TWO_SIDE)) { if(GL_SUPPORT(EXT_STENCIL_TWO_SIDE)) {
glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT); glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);
checkGLcall("glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT)"); checkGLcall("glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT)");
} }
/* This code disables the ATI extension as well, since the standard stencil functions are equal
* to calling the ATI functions with GL_FRONT_AND_BACK as face parameter
*/
glEnable(GL_STENCIL_TEST); glEnable(GL_STENCIL_TEST);
checkGLcall("glEnable GL_STENCIL_TEST"); checkGLcall("glEnable GL_STENCIL_TEST");
glStencilFunc(func, ref, mask); glStencilFunc(func, ref, mask);
......
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