Module: wine Branch: refs/heads/master Commit: 63585380a9a8caf4379d70b4759c7054200c983c URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=63585380a9a8caf4379d70b4...
Author: Vitaly Budovski vbudovsk@cs.rmit.edu.au Date: Sun Feb 26 01:53:48 2006 +1100
wined3d: Implemented WINED3DRS_CCW_STENCIL* render states.
---
dlls/wined3d/device.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 70 insertions(+), 0 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 7130c55..dd72818 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3729,11 +3729,81 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRen case WINED3DRS_ADAPTIVETESS_Z : case WINED3DRS_ADAPTIVETESS_W : case WINED3DRS_ENABLEADAPTIVETESSELLATION : + { + FIXME("(%p)->(%d,%ld) not handled yet\n", This, State, Value); + break; + } case WINED3DRS_TWOSIDEDSTENCILMODE : + { + if(Value) { + TRACE("Two-sided stencil mode enabled\n"); + } else { + TRACE("Two-sided stencil mode disabled\n"); + } + break; + } case WINED3DRS_CCW_STENCILFAIL : case WINED3DRS_CCW_STENCILZFAIL : case WINED3DRS_CCW_STENCILPASS : + { + 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_CCW_STENCILFAIL == State) { + stencilFail = action; + } + else if(WINED3DRS_CCW_STENCILZFAIL == State) { + depthFail = action; + } + else if(WINED3DRS_CCW_STENCILPASS == State) { + stencilPass = action; + } + + if(!This->stateBlock->renderState[WINED3DRS_TWOSIDEDSTENCILMODE]) { + glStencilOpSeparate(GL_BACK, stencilFail, depthFail, stencilPass); + checkGLcall("glStencilOpSeparate(GL_BACK,...)"); + } else { + glStencilOp(stencilFail, depthFail, stencilPass); + checkGLcall("glStencilOp(...)"); + } + break; + } case WINED3DRS_CCW_STENCILFUNC : + { + GLint func; + GLint ref = This->stateBlock->renderState[WINED3DRS_STENCILREF]; + GLuint mask = This->stateBlock->renderState[WINED3DRS_STENCILMASK]; + + func = GL_ALWAYS; + switch ((D3DCMPFUNC)Value) { + case D3DCMP_NEVER: func = GL_NEVER; break; + case D3DCMP_LESS: func = GL_LESS; break; + case D3DCMP_EQUAL: func = GL_EQUAL; break; + case D3DCMP_LESSEQUAL: func = GL_LEQUAL; break; + case D3DCMP_GREATER: func = GL_GREATER; break; + case D3DCMP_NOTEQUAL: func = GL_NOTEQUAL; break; + case D3DCMP_GREATEREQUAL: func = GL_GEQUAL; break; + case D3DCMP_ALWAYS: func = GL_ALWAYS; break; + default: + FIXME("Unrecognized/Unhandled D3DCMPFUNC value %ld\n", Value); + } + This->stencilfunc = func; + if(!This->stateBlock->renderState[WINED3DRS_TWOSIDEDSTENCILMODE]) { + glStencilFuncSeparate(GL_BACK, func, ref, mask); + checkGLcall("glStencilFuncSeparate(GL_BACK,...)"); + } else { + glStencilFunc(func, ref, mask); + checkGLcall("glStencilFunc(...)"); + } + break; + } case WINED3DRS_COLORWRITEENABLE1 : case WINED3DRS_COLORWRITEENABLE2 : case WINED3DRS_COLORWRITEENABLE3 :