From 16c708c33909fa1fba6e0e160e276ecb3818388f Mon Sep 17 00:00:00 2001 From: Matteo Bruni Date: Thu, 3 May 2018 00:04:02 +0200 Subject: [PATCH] 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 Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- 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 89506b1b02e..164f9c95baf 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 175fd14a0ef..34e08e9ba51 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 }, -- 2.11.4.GIT