wined3d: Add separate stencil state setup via GL 2.0+ core functions.

This commit is contained in:
Matteo Bruni 2015-01-21 18:32:32 +01:00 committed by Alexandre Julliard
parent 7d1203a741
commit 8ddb7e32f8
2 changed files with 16 additions and 3 deletions

View File

@ -2889,6 +2889,8 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info)
USE_GL_FUNC(glMapBuffer) /* OpenGL 1.5 */ USE_GL_FUNC(glMapBuffer) /* OpenGL 1.5 */
USE_GL_FUNC(glPointParameteri) /* OpenGL 1.4 */ USE_GL_FUNC(glPointParameteri) /* OpenGL 1.4 */
USE_GL_FUNC(glPointParameteriv) /* OpenGL 1.4 */ USE_GL_FUNC(glPointParameteriv) /* OpenGL 1.4 */
USE_GL_FUNC(glStencilFuncSeparate) /* OpenGL 2.0 */
USE_GL_FUNC(glStencilOpSeparate) /* OpenGL 2.0 */
USE_GL_FUNC(glUnmapBuffer) /* OpenGL 1.5 */ USE_GL_FUNC(glUnmapBuffer) /* OpenGL 1.5 */
#undef USE_GL_FUNC #undef USE_GL_FUNC
@ -4915,7 +4917,8 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte
caps->StencilCaps |= WINED3DSTENCILCAPS_DECR | caps->StencilCaps |= WINED3DSTENCILCAPS_DECR |
WINED3DSTENCILCAPS_INCR; WINED3DSTENCILCAPS_INCR;
} }
if (gl_info->supported[EXT_STENCIL_TWO_SIDE] || gl_info->supported[ATI_SEPARATE_STENCIL]) if (gl_info->supported[WINED3D_GL_VERSION_2_0] || gl_info->supported[EXT_STENCIL_TWO_SIDE]
|| gl_info->supported[ATI_SEPARATE_STENCIL])
{ {
caps->StencilCaps |= WINED3DSTENCILCAPS_TWOSIDED; caps->StencilCaps |= WINED3DSTENCILCAPS_TWOSIDED;
} }

View File

@ -860,7 +860,15 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_
gl_info->gl_ops.gl.p_glEnable(GL_STENCIL_TEST); gl_info->gl_ops.gl.p_glEnable(GL_STENCIL_TEST);
checkGLcall("glEnable GL_STENCIL_TEST"); checkGLcall("glEnable GL_STENCIL_TEST");
if (gl_info->supported[EXT_STENCIL_TWO_SIDE]) if (gl_info->supported[WINED3D_GL_VERSION_2_0])
{
GL_EXTCALL(glStencilFuncSeparate(GL_FRONT, func, ref, mask));
GL_EXTCALL(glStencilOpSeparate(GL_FRONT, stencilFail, depthFail, stencilPass));
GL_EXTCALL(glStencilFuncSeparate(GL_BACK, func_ccw, ref, mask));
GL_EXTCALL(glStencilOpSeparate(GL_BACK, stencilFail_ccw, depthFail_ccw, stencilPass_ccw));
checkGLcall("setting two sided stencil state");
}
else if (gl_info->supported[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
@ -881,7 +889,9 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_
checkGLcall("glStencilOpSeparateATI(GL_FRONT, ...)"); checkGLcall("glStencilOpSeparateATI(GL_FRONT, ...)");
GL_EXTCALL(glStencilOpSeparateATI(GL_BACK, stencilFail_ccw, depthFail_ccw, stencilPass_ccw)); GL_EXTCALL(glStencilOpSeparateATI(GL_BACK, stencilFail_ccw, depthFail_ccw, stencilPass_ccw));
checkGLcall("glStencilOpSeparateATI(GL_BACK, ...)"); checkGLcall("glStencilOpSeparateATI(GL_BACK, ...)");
} else { }
else
{
ERR("Separate (two sided) stencil not supported on this version of opengl. Caps weren't honored?\n"); ERR("Separate (two sided) stencil not supported on this version of opengl. Caps weren't honored?\n");
} }
} }