Module: wine Branch: master Commit: 6963fd0bef5f0a1112c6a11a03d1d046972b2cdb URL: https://source.winehq.org/git/wine.git/?a=commit;h=6963fd0bef5f0a1112c6a11a0...
Author: Paul Gofman gofmanp@gmail.com Date: Tue Feb 5 18:57:25 2019 +0300
wined3d: Use lower 8 bits only from _ALPHAREF state.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=38138 Signed-off-by: Paul Gofman gofmanp@gmail.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/wined3d/arb_program_shader.c | 2 +- dlls/wined3d/glsl_shader.c | 4 ++-- dlls/wined3d/state.c | 2 +- dlls/wined3d/wined3d_private.h | 5 +++++ 4 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 4dafb34..37ec7e9 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -5945,7 +5945,7 @@ static void alpha_test_arbfp(struct wined3d_context *context, const struct wined return; }
- ref = ((float)state->render_states[WINED3D_RS_ALPHAREF]) / 255.0f; + ref = wined3d_alpha_ref(state); glParm = wined3d_gl_compare_func(state->render_states[WINED3D_RS_ALPHAFUNC]);
if (glParm) diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 3298a60..db6760e 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -2032,7 +2032,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
if (update_mask & WINED3D_SHADER_CONST_PS_ALPHA_TEST) { - float ref = state->render_states[WINED3D_RS_ALPHAREF] / 255.0f; + float ref = wined3d_alpha_ref(state);
GL_EXTCALL(glUniform1f(prog->ps.alpha_test_ref_location, ref)); checkGLcall("alpha test emulation uniform"); @@ -12308,7 +12308,7 @@ static void glsl_fragment_pipe_alpha_test_func(struct wined3d_context *context, { const struct wined3d_gl_info *gl_info = context->gl_info; GLint func = wined3d_gl_compare_func(state->render_states[WINED3D_RS_ALPHAFUNC]); - float ref = state->render_states[WINED3D_RS_ALPHAREF] / 255.0f; + float ref = wined3d_alpha_ref(state);
if (func) { diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 8708aa09..1b5eacd 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -681,7 +681,7 @@ void state_alpha_test(struct wined3d_context *context, const struct wined3d_stat } else { - ref = ((float)state->render_states[WINED3D_RS_ALPHAREF]) / 255.0f; + ref = wined3d_alpha_ref(state); glParm = wined3d_gl_compare_func(state->render_states[WINED3D_RS_ALPHAFUNC]); } if (glParm) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 1e3ec28..e34d80f 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3100,6 +3100,11 @@ static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD sta return context->isStateDirty[idx] & (1u << shift); }
+static inline float wined3d_alpha_ref(const struct wined3d_state *state) +{ + return (state->render_states[WINED3D_RS_ALPHAREF] & 0xff) / 255.0f; +} + const char *wined3d_debug_resource_access(DWORD access) DECLSPEC_HIDDEN; const char *wined3d_debug_bind_flags(DWORD bind_flags) DECLSPEC_HIDDEN; const char *wined3d_debug_view_desc(const struct wined3d_view_desc *d,