wined3d: Added two sided stencil support to WINED3DRS_STENCILFAIL,
WINED3DRS_STENCILZFAIL and WINED3DRS_STENCILPASS
Vitaly Budovski
vbudovsk at cs.rmit.edu.au
Sat Mar 4 00:52:24 CST 2006
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(-)
-------------- next part --------------
32f987ca65aea26df83cb4df2c104c3146e8d4ba
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 124b8bf..e8b64d4 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);
--
1.0.4
More information about the wine-patches
mailing list