From: Matteo Bruni Subject: [PATCH 1/5] wined3d: Add separate stencil state setup via GL 2.0+ core functions. Message-Id: <1421861556-12771-1-git-send-email-mbruni@codeweavers.com> Date: Wed, 21 Jan 2015 18:32:32 +0100 --- dlls/wined3d/directx.c | 5 ++++- dlls/wined3d/state.c | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 8f50b5e..4b003d2 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -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(glPointParameteri) /* 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 */ #undef USE_GL_FUNC @@ -4915,7 +4917,8 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte caps->StencilCaps |= WINED3DSTENCILCAPS_DECR | 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; } diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index f7cf14d..7f65998 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -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); 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, * 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, ...)"); GL_EXTCALL(glStencilOpSeparateATI(GL_BACK, stencilFail_ccw, depthFail_ccw, stencilPass_ccw)); checkGLcall("glStencilOpSeparateATI(GL_BACK, ...)"); - } else { + } + else + { ERR("Separate (two sided) stencil not supported on this version of opengl. Caps weren't honored?\n"); } } -- 2.0.5