From: Henri Verbeet hverbeet@locutus.nl
If WINED3D_RS_ALPHAREF was never set, the corresponding "push_constants" buffer may not exist either. We don't call glsl_fragment_pipe_alpha_test_func() when using core contexts, which is the reason it works there. This fixes a regression introduced by commit 20fb590cfbbcc54f13cd0e2d08da4742ecdef760. Found by running the regression tests. --- dlls/wined3d/glsl_shader.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index df60415f062..000bf0d3995 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -12155,14 +12155,19 @@ static void glsl_fragment_pipe_tex_transform(struct wined3d_context *context, static void glsl_fragment_pipe_alpha_test_func(struct wined3d_context_gl *context_gl, const struct wined3d_state *state) { - const struct wined3d_ffp_ps_constants *constants = wined3d_buffer_load_sysmem( - context_gl->c.device->push_constants[WINED3D_PUSH_CONSTANTS_PS_FFP], &context_gl->c); const struct wined3d_gl_info *gl_info = context_gl->gl_info; - GLint func = wined3d_gl_compare_func(state->render_states[WINED3D_RS_ALPHAFUNC]); + const struct wined3d_ffp_ps_constants *constants; + struct wined3d_buffer *buffer; + GLfloat ref; + GLint func;
- if (func) + if ((func = wined3d_gl_compare_func(state->render_states[WINED3D_RS_ALPHAFUNC]))) { - gl_info->gl_ops.gl.p_glAlphaFunc(func, constants->alpha_test_ref); + if ((buffer = context_gl->c.device->push_constants[WINED3D_PUSH_CONSTANTS_PS_FFP])) + ref = (constants = wined3d_buffer_load_sysmem(buffer, &context_gl->c))->alpha_test_ref; + else + ref = 0.0f; + gl_info->gl_ops.gl.p_glAlphaFunc(func, ref); checkGLcall("glAlphaFunc"); } }