Module: wine Branch: refs/heads/master Commit: f2f59cae61c7017e22c6121c5a74d93ffb7eb46c URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=f2f59cae61c7017e22c6121c...
Author: Vitaly Budovski vbudovsk@cs.rmit.edu.au Date: Sat Mar 4 17:52:24 2006 +1100
wined3d: Added two sided stencil support to WINED3DRS_STENCILFAIL, WINED3DRS_STENCILZFAIL and WINED3DRS_STENCILPASS.
---
dlls/wined3d/device.c | 93 ++++++++++++++++++++++++------------------------- 1 files changed, 46 insertions(+), 47 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 894a70a..047b2b9 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3195,57 +3195,56 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRen break;
case WINED3DRS_STENCILFAIL : - { - GLenum fail ; - GLint zpass ; - GLint zfail ; - - fail = StencilOp(Value); - glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS, &zpass); - checkGLcall("glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS, &zpass);"); - glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL, &zfail); - checkGLcall("glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL, &zfail);"); - - TRACE("StencilOp fail=%x, zfail=%x, zpass=%x\n", fail, zfail, zpass); - glStencilOp(fail, zfail, zpass); - checkGLcall("glStencilOp(fail, zfail, zpass);"); - } - break; case WINED3DRS_STENCILZFAIL : - { - GLint fail ; - GLint zpass ; - GLenum zfail ; - - glGetIntegerv(GL_STENCIL_FAIL, &fail); - checkGLcall("glGetIntegerv(GL_STENCIL_FAIL, &fail);"); - glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS, &zpass); - checkGLcall("glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS, &zpass);"); - zfail = StencilOp(Value); - - TRACE("StencilOp fail=%x, zfail=%x, zpass=%x\n", fail, zfail, zpass); - glStencilOp(fail, zfail, zpass); - checkGLcall("glStencilOp(fail, zfail, zpass);"); - } - break; case WINED3DRS_STENCILPASS : - { - GLint fail ; - GLenum zpass ; - GLint zfail ; - - glGetIntegerv(GL_STENCIL_FAIL, &fail); - checkGLcall("glGetIntegerv(GL_STENCIL_FAIL, &fail);"); - zpass = StencilOp(Value); - glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL, &zfail); - checkGLcall("glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL, &zfail);"); - - TRACE("StencilOp fail=%x, zfail=%x, zpass=%x\n", fail, zfail, zpass); - glStencilOp(fail, zfail, zpass); - checkGLcall("glStencilOp(fail, zfail, zpass);"); + { + GLint stencilFail; + GLint depthFail; + GLint stencilPass; + + GLint action = StencilOp(Value); + + glGetIntegerv(GL_STENCIL_FAIL, &stencilFail); + glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL, &depthFail); + glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS, &stencilPass); + + if(WINED3DRS_STENCILFAIL == State) { + stencilFail = action; + } + else if(WINED3DRS_STENCILZFAIL == State) { + depthFail = action; + } + else if(WINED3DRS_STENCILPASS == State) { + stencilPass = action; } - break;
+ if(!This->stateBlock->renderState[WINED3DRS_TWOSIDEDSTENCILMODE]) { + if(GL_EXTCALL(glStencilOpSeparate)) { + GL_EXTCALL(glStencilOpSeparate(GL_FRONT, stencilFail, depthFail, stencilPass)); + checkGLcall("glStencilOpSeparate(GL_FRONT,...)"); + } + else if(GL_EXTCALL(glActiveStencilFaceEXT)) { + glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT); + checkGLcall("glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT)"); + GL_EXTCALL(glActiveStencilFaceEXT(GL_FRONT)); + checkGLcall("glActiveStencilFaceEXT(GL_FRONT)"); + glStencilOp(stencilFail, depthFail, stencilPass); + checkGLcall("glStencilOp(...)"); + } + else if(GL_EXTCALL(glStencilOpSeparateATI)) { + GL_EXTCALL(glStencilOpSeparateATI(GL_FRONT, stencilFail, depthFail, stencilPass)); + checkGLcall("glStencilOpSeparateATI(GL_FRONT,...)"); + } else { + TRACE("Separate stencil operation not supported on this version of opengl"); + glStencilOp(stencilFail, depthFail, stencilPass); + checkGLcall("glStencilOp(...)"); + } + } else { + glStencilOp(stencilFail, depthFail, stencilPass); + checkGLcall("glStencilOp(...)"); + } + break; + } case WINED3DRS_STENCILWRITEMASK : { glStencilMask(Value);