Matteo Bruni : wined3d: Use core functions to set the stencil mask on GL 2.0+.

Alexandre Julliard julliard at winehq.org
Mon May 14 17:20:09 CDT 2018


Module: wine
Branch: master
Commit: 16c708c33909fa1fba6e0e160e276ecb3818388f
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=16c708c33909fa1fba6e0e160e276ecb3818388f

Author: Matteo Bruni <mbruni at codeweavers.com>
Date:   Thu May  3 00:04:02 2018 +0200

wined3d: Use core functions to set the stencil mask on GL 2.0+.

glStencilMask() is defined as setting both front and back stencil
masks in GL 2.0+ and we don't want to use the EXT_stencil_two_side
entry points even if they happen to be available there.
D3D doesn't support separate front / back stencil write masks anyway.

Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/directx.c | 4 ++++
 dlls/wined3d/state.c   | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 89506b1..164f9c9 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -4049,7 +4049,11 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter,
         gl_info->supported[WINED3D_GL_BLEND_EQUATION] = TRUE;
 
     if (gl_version >= MAKEDWORD_VERSION(2, 0))
+    {
         gl_info->supported[WINED3D_GL_VERSION_2_0] = TRUE;
+        /* We want to use the core APIs for two-sided stencil in GL 2.0. */
+        gl_info->supported[EXT_STENCIL_TWO_SIDE] = FALSE;
+    }
     if (gl_version >= MAKEDWORD_VERSION(3, 2))
         gl_info->supported[WINED3D_GL_VERSION_3_2] = TRUE;
 
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 175fd14..34e08e9 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -1003,7 +1003,7 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_
     }
 }
 
-static void state_stencilwrite2s(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
+static void state_stencilwrite2s_ext(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 {
     DWORD mask = state->fb->depth_stencil ? state->render_states[WINED3D_RS_STENCILWRITEMASK] : 0;
     const struct wined3d_gl_info *gl_info = context->gl_info;
@@ -4603,7 +4603,7 @@ const struct StateEntryTemplate misc_state_template[] =
     { STATE_RENDER(WINED3D_RS_STENCILFUNC),               { STATE_RENDER(WINED3D_RS_STENCILENABLE),             NULL                }, WINED3D_GL_EXT_NONE             },
     { STATE_RENDER(WINED3D_RS_STENCILREF),                { STATE_RENDER(WINED3D_RS_STENCILENABLE),             NULL                }, WINED3D_GL_EXT_NONE             },
     { STATE_RENDER(WINED3D_RS_STENCILMASK),               { STATE_RENDER(WINED3D_RS_STENCILENABLE),             NULL                }, WINED3D_GL_EXT_NONE             },
-    { STATE_RENDER(WINED3D_RS_STENCILWRITEMASK),          { STATE_RENDER(WINED3D_RS_STENCILWRITEMASK),          state_stencilwrite2s}, EXT_STENCIL_TWO_SIDE            },
+    { STATE_RENDER(WINED3D_RS_STENCILWRITEMASK),          { STATE_RENDER(WINED3D_RS_STENCILWRITEMASK),          state_stencilwrite2s_ext}, EXT_STENCIL_TWO_SIDE        },
     { STATE_RENDER(WINED3D_RS_STENCILWRITEMASK),          { STATE_RENDER(WINED3D_RS_STENCILWRITEMASK),          state_stencilwrite  }, WINED3D_GL_EXT_NONE             },
     { STATE_RENDER(WINED3D_RS_TWOSIDEDSTENCILMODE),       { STATE_RENDER(WINED3D_RS_STENCILENABLE),             NULL                }, WINED3D_GL_EXT_NONE             },
     { STATE_RENDER(WINED3D_RS_BACK_STENCILFAIL),          { STATE_RENDER(WINED3D_RS_STENCILENABLE),             NULL                }, WINED3D_GL_EXT_NONE             },




More information about the wine-cvs mailing list