Commit 196eaa67 authored by Vitaly Budovski's avatar Vitaly Budovski Committed by Alexandre Julliard

wined3d: Added two sided stencil support to WINED3DRS_STENCILFUNC.

parent f2f59cae
...@@ -3146,29 +3146,51 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE ...@@ -3146,29 +3146,51 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE
case WINED3DRS_STENCILFUNC : case WINED3DRS_STENCILFUNC :
{ {
int glParm = GL_ALWAYS; GLint func;
int ref = This->stateBlock->renderState[WINED3DRS_STENCILREF]; GLint ref = This->stateBlock->renderState[WINED3DRS_STENCILREF];
GLuint mask = This->stateBlock->renderState[WINED3DRS_STENCILMASK]; GLuint mask = This->stateBlock->renderState[WINED3DRS_STENCILMASK];
switch ((D3DCMPFUNC) Value) { func = GL_ALWAYS;
case D3DCMP_NEVER: glParm=GL_NEVER; break; switch ((D3DCMPFUNC)Value) {
case D3DCMP_LESS: glParm=GL_LESS; break; case D3DCMP_NEVER: func = GL_NEVER; break;
case D3DCMP_EQUAL: glParm=GL_EQUAL; break; case D3DCMP_LESS: func = GL_LESS; break;
case D3DCMP_LESSEQUAL: glParm=GL_LEQUAL; break; case D3DCMP_EQUAL: func = GL_EQUAL; break;
case D3DCMP_GREATER: glParm=GL_GREATER; break; case D3DCMP_LESSEQUAL: func = GL_LEQUAL; break;
case D3DCMP_NOTEQUAL: glParm=GL_NOTEQUAL; break; case D3DCMP_GREATER: func = GL_GREATER; break;
case D3DCMP_GREATEREQUAL: glParm=GL_GEQUAL; break; case D3DCMP_NOTEQUAL: func = GL_NOTEQUAL; break;
case D3DCMP_ALWAYS: glParm=GL_ALWAYS; break; case D3DCMP_GREATEREQUAL: func = GL_GEQUAL; break;
case D3DCMP_ALWAYS: func = GL_ALWAYS; break;
default: default:
FIXME("Unrecognized/Unhandled D3DCMPFUNC value %ld\n", Value); FIXME("Unrecognized/Unhandled D3DCMPFUNC value %ld\n", Value);
} }
TRACE("glStencilFunc with Parm=%x, ref=%d, mask=%x\n", glParm, ref, mask); This->stencilfunc = func;
This->stencilfunc = glParm; if(!This->stateBlock->renderState[WINED3DRS_TWOSIDEDSTENCILMODE]) {
glStencilFunc(glParm, ref, mask); if(GL_EXTCALL(glStencilFuncSeparate)) {
checkGLcall("glStencilFunc"); GL_EXTCALL(glStencilFuncSeparate(GL_FRONT, func, ref, mask));
checkGLcall("glStencilFuncSeparate(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)");
glStencilFunc(func, ref, mask);
checkGLcall("glStencilFunc(...)");
}
else if(GL_EXTCALL(glStencilFuncSeparateATI)) {
GL_EXTCALL(glStencilFuncSeparateATI(GL_FRONT, func, ref, mask));
checkGLcall("glStencilFuncSeparateATI(GL_FRONT,...)");
} else {
TRACE("Separate stencil function not supported on this version of opengl");
glStencilFunc(func, ref, mask);
checkGLcall("glStencilFunc(...)");
}
} else {
glStencilFunc(func, ref, mask);
checkGLcall("glStencilFunc(...)");
} }
break; break;
}
case WINED3DRS_STENCILREF : case WINED3DRS_STENCILREF :
{ {
int glParm = This->stencilfunc; int glParm = This->stencilfunc;
......
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