From: Elizabeth Figura zfigura@codeweavers.com
Analogous to shader_disable().
We'd like to pass a wined3d_state pointer to fp_enable() to let it handle actually compiling the fragment pipeline, which doesn't mesh well conceptually with its use in shader_disable(). --- dlls/wined3d/arb_program_shader.c | 29 ++++++++++----- dlls/wined3d/ati_fragment_shader.c | 27 +++++++++----- dlls/wined3d/ffp_gl.c | 37 ++++++++++--------- dlls/wined3d/glsl_shader.c | 25 ++++++++----- dlls/wined3d/nvidia_texture_shader.c | 55 +++++++++++++++++++--------- dlls/wined3d/shader.c | 2 +- dlls/wined3d/shader_spirv.c | 8 +++- dlls/wined3d/wined3d_private.h | 1 + 8 files changed, 117 insertions(+), 67 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 33ea2aed990..19d6df81b58 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -4771,7 +4771,7 @@ static void shader_arb_disable(void *shader_priv, struct wined3d_context *contex gl_info->gl_ops.gl.p_glDisable(GL_FRAGMENT_PROGRAM_ARB); checkGLcall("glDisable(GL_FRAGMENT_PROGRAM_ARB)"); } - priv->fragment_pipe->fp_enable(context, FALSE); + priv->fragment_pipe->fp_disable(context);
if (gl_info->supported[ARB_VERTEX_PROGRAM]) { @@ -5756,6 +5756,14 @@ static void arbfp_enable(const struct wined3d_context *context, BOOL enable) } }
+static void arbfp_disable(const struct wined3d_context *context) +{ + const struct wined3d_gl_info *gl_info = wined3d_context_gl_const(context)->gl_info; + + gl_info->gl_ops.gl.p_glDisable(GL_FRAGMENT_PROGRAM_ARB); + checkGLcall("glDisable(GL_FRAGMENT_PROGRAM_ARB)"); +} + static void *arbfp_alloc(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv) { struct shader_arb_priv *priv; @@ -6898,15 +6906,16 @@ static void arbfp_free_context_data(struct wined3d_context *context)
const struct wined3d_fragment_pipe_ops arbfp_fragment_pipeline = { - arbfp_enable, - arbfp_get_caps, - arbfp_get_emul_mask, - arbfp_alloc, - arbfp_free, - arbfp_alloc_context_data, - arbfp_free_context_data, - shader_arb_color_fixup_supported, - arbfp_fragmentstate_template, + .fp_enable = arbfp_enable, + .fp_disable = arbfp_disable, + .get_caps = arbfp_get_caps, + .get_emul_mask = arbfp_get_emul_mask, + .alloc_private = arbfp_alloc, + .free_private = arbfp_free, + .allocate_context_data = arbfp_alloc_context_data, + .free_context_data = arbfp_free_context_data, + .color_fixup_supported = shader_arb_color_fixup_supported, + .states = arbfp_fragmentstate_template, };
struct arbfp_blit_type diff --git a/dlls/wined3d/ati_fragment_shader.c b/dlls/wined3d/ati_fragment_shader.c index 605d050ff7d..058fd1680a9 100644 --- a/dlls/wined3d/ati_fragment_shader.c +++ b/dlls/wined3d/ati_fragment_shader.c @@ -1267,6 +1267,14 @@ static void atifs_enable(const struct wined3d_context *context, BOOL enable) } }
+static void atifs_disable(const struct wined3d_context *context) +{ + const struct wined3d_gl_info *gl_info = wined3d_context_gl_const(context)->gl_info; + + gl_info->gl_ops.gl.p_glDisable(GL_FRAGMENT_SHADER_ATI); + checkGLcall("glDisable(GL_FRAGMENT_SHADER_ATI)"); +} + static void atifs_get_caps(const struct wined3d_adapter *adapter, struct fragment_caps *caps) { memset(caps, 0, sizeof(*caps)); @@ -1382,13 +1390,14 @@ static void atifs_free_context_data(struct wined3d_context *context)
const struct wined3d_fragment_pipe_ops atifs_fragment_pipeline = { - atifs_enable, - atifs_get_caps, - atifs_get_emul_mask, - atifs_alloc, - atifs_free, - atifs_alloc_context_data, - atifs_free_context_data, - atifs_color_fixup_supported, - atifs_fragmentstate_template, + .fp_enable = atifs_enable, + .fp_disable = atifs_disable, + .get_caps = atifs_get_caps, + .get_emul_mask = atifs_get_emul_mask, + .alloc_private = atifs_alloc, + .free_private = atifs_free, + .allocate_context_data = atifs_alloc_context_data, + .free_context_data = atifs_free_context_data, + .color_fixup_supported = atifs_color_fixup_supported, + .states = atifs_fragmentstate_template, }; diff --git a/dlls/wined3d/ffp_gl.c b/dlls/wined3d/ffp_gl.c index 8d8a14107eb..a9c6bd9fbb2 100644 --- a/dlls/wined3d/ffp_gl.c +++ b/dlls/wined3d/ffp_gl.c @@ -4955,15 +4955,16 @@ static void ffp_none_context_free(struct wined3d_context *context)
const struct wined3d_fragment_pipe_ops ffp_fragment_pipeline = { - ffp_pipe_enable, - ffp_fragment_get_caps, - ffp_fragment_get_emul_mask, - ffp_alloc, - ffp_free, - ffp_none_context_alloc, - ffp_none_context_free, - ffp_color_fixup_supported, - ffp_fragmentstate_template, + .fp_enable = ffp_pipe_enable, + .fp_disable = ffp_pipe_disable, + .get_caps = ffp_fragment_get_caps, + .get_emul_mask = ffp_fragment_get_emul_mask, + .alloc_private = ffp_alloc, + .free_private = ffp_free, + .allocate_context_data = ffp_none_context_alloc, + .free_context_data = ffp_none_context_free, + .color_fixup_supported = ffp_color_fixup_supported, + .states = ffp_fragmentstate_template, };
static void none_pipe_enable(const struct wined3d_context *context, BOOL enable) {} @@ -5014,15 +5015,15 @@ static BOOL fp_none_color_fixup_supported(struct color_fixup_desc fixup)
const struct wined3d_fragment_pipe_ops none_fragment_pipe = { - none_pipe_enable, - fp_none_get_caps, - fp_none_get_emul_mask, - none_alloc, - none_free, - ffp_none_context_alloc, - ffp_none_context_free, - fp_none_color_fixup_supported, - NULL, + .fp_enable = none_pipe_enable, + .fp_disable = none_pipe_disable, + .get_caps = fp_none_get_caps, + .get_emul_mask = fp_none_get_emul_mask, + .alloc_private = none_alloc, + .free_private = none_free, + .allocate_context_data = ffp_none_context_alloc, + .free_context_data = ffp_none_context_free, + .color_fixup_supported = fp_none_color_fixup_supported, };
static unsigned int num_handlers(const APPLYSTATEFUNC *funcs) diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index f2a71bd7402..f6697773bb2 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -10821,7 +10821,7 @@ static void shader_glsl_disable(void *shader_priv, struct wined3d_context *conte checkGLcall("glUseProgram");
priv->vertex_pipe->vp_disable(context); - priv->fragment_pipe->fp_enable(context, FALSE); + priv->fragment_pipe->fp_disable(context);
if (needs_legacy_glsl_syntax(gl_info) && gl_info->supported[ARB_COLOR_BUFFER_FLOAT]) { @@ -12065,6 +12065,10 @@ static void glsl_fragment_pipe_enable(const struct wined3d_context *context, BOO /* Nothing to do. */ }
+static void glsl_fragment_pipe_disable(const struct wined3d_context *context) +{ +} + static void glsl_fragment_pipe_get_caps(const struct wined3d_adapter *adapter, struct fragment_caps *caps) { const struct wined3d_gl_info *gl_info = &wined3d_adapter_gl_const(adapter)->gl_info; @@ -12424,15 +12428,16 @@ static void glsl_fragment_pipe_free_context_data(struct wined3d_context *context
const struct wined3d_fragment_pipe_ops glsl_fragment_pipe = { - glsl_fragment_pipe_enable, - glsl_fragment_pipe_get_caps, - glsl_fragment_pipe_get_emul_mask, - glsl_fragment_pipe_alloc, - glsl_fragment_pipe_free, - glsl_fragment_pipe_alloc_context_data, - glsl_fragment_pipe_free_context_data, - shader_glsl_color_fixup_supported, - glsl_fragment_pipe_state_template, + .fp_enable = glsl_fragment_pipe_enable, + .fp_disable = glsl_fragment_pipe_disable, + .get_caps = glsl_fragment_pipe_get_caps, + .get_emul_mask = glsl_fragment_pipe_get_emul_mask, + .alloc_private = glsl_fragment_pipe_alloc, + .free_private = glsl_fragment_pipe_free, + .allocate_context_data = glsl_fragment_pipe_alloc_context_data, + .free_context_data = glsl_fragment_pipe_free_context_data, + .color_fixup_supported = shader_glsl_color_fixup_supported, + .states = glsl_fragment_pipe_state_template, };
struct glsl_blitter_args diff --git a/dlls/wined3d/nvidia_texture_shader.c b/dlls/wined3d/nvidia_texture_shader.c index 0e56f5f58e0..14510b25f0e 100644 --- a/dlls/wined3d/nvidia_texture_shader.c +++ b/dlls/wined3d/nvidia_texture_shader.c @@ -676,6 +676,14 @@ static void nvrc_enable(const struct wined3d_context *context, BOOL enable) } }
+static void nvrc_disable(const struct wined3d_context *context) +{ + const struct wined3d_gl_info *gl_info = wined3d_context_gl_const(context)->gl_info; + + gl_info->gl_ops.gl.p_glDisable(GL_REGISTER_COMBINERS_NV); + checkGLcall("glDisable(GL_REGISTER_COMBINERS_NV)"); +} + /* Context activation is done by the caller. */ static void nvts_enable(const struct wined3d_context *context, BOOL enable) { @@ -694,6 +702,15 @@ static void nvts_enable(const struct wined3d_context *context, BOOL enable) } }
+static void nvts_disable(const struct wined3d_context *context) +{ + const struct wined3d_gl_info *gl_info = wined3d_context_gl_const(context)->gl_info; + + nvrc_disable(context); + gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_SHADER_NV); + checkGLcall("glDisable(GL_TEXTURE_SHADER_NV)"); +} + static void nvrc_fragment_get_caps(const struct wined3d_adapter *adapter, struct fragment_caps *caps) { const struct wined3d_gl_info *gl_info = &wined3d_adapter_gl_const(adapter)->gl_info; @@ -931,26 +948,28 @@ static void nvrc_context_free(struct wined3d_context *context)
const struct wined3d_fragment_pipe_ops nvts_fragment_pipeline = { - nvts_enable, - nvrc_fragment_get_caps, - nvrc_fragment_get_emul_mask, - nvrc_fragment_alloc, - nvrc_fragment_free, - nvrc_context_alloc, - nvrc_context_free, - nvts_color_fixup_supported, - nvrc_fragmentstate_template, + .fp_enable = nvts_enable, + .fp_disable = nvts_disable, + .get_caps = nvrc_fragment_get_caps, + .get_emul_mask = nvrc_fragment_get_emul_mask, + .alloc_private = nvrc_fragment_alloc, + .free_private = nvrc_fragment_free, + .allocate_context_data = nvrc_context_alloc, + .free_context_data = nvrc_context_free, + .color_fixup_supported = nvts_color_fixup_supported, + .states = nvrc_fragmentstate_template, };
const struct wined3d_fragment_pipe_ops nvrc_fragment_pipeline = { - nvrc_enable, - nvrc_fragment_get_caps, - nvrc_fragment_get_emul_mask, - nvrc_fragment_alloc, - nvrc_fragment_free, - nvrc_context_alloc, - nvrc_context_free, - nvts_color_fixup_supported, - nvrc_fragmentstate_template, + .fp_enable = nvrc_enable, + .fp_disable = nvrc_disable, + .get_caps = nvrc_fragment_get_caps, + .get_emul_mask = nvrc_fragment_get_emul_mask, + .alloc_private = nvrc_fragment_alloc, + .free_private = nvrc_fragment_free, + .allocate_context_data = nvrc_context_alloc, + .free_context_data = nvrc_context_free, + .color_fixup_supported = nvts_color_fixup_supported, + .states = nvrc_fragmentstate_template, }; diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index 7832f41e988..a130fe69583 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -1953,7 +1953,7 @@ static void shader_none_disable(void *shader_priv, struct wined3d_context *conte struct shader_none_priv *priv = shader_priv;
priv->vertex_pipe->vp_disable(context); - priv->fragment_pipe->fp_enable(context, FALSE); + priv->fragment_pipe->fp_disable(context);
context->shader_update_mask = (1u << WINED3D_SHADER_TYPE_PIXEL) | (1u << WINED3D_SHADER_TYPE_VERTEX) diff --git a/dlls/wined3d/shader_spirv.c b/dlls/wined3d/shader_spirv.c index 4a675fe5a0f..c58d9d0efb4 100644 --- a/dlls/wined3d/shader_spirv.c +++ b/dlls/wined3d/shader_spirv.c @@ -905,7 +905,7 @@ static void shader_spirv_disable(void *shader_priv, struct wined3d_context *cont struct shader_spirv_priv *priv = shader_priv;
priv->vertex_pipe->vp_disable(context); - priv->fragment_pipe->fp_enable(context, false); + priv->fragment_pipe->fp_disable(context);
context_vk->compute.vk_pipeline = VK_NULL_HANDLE; context->shader_update_mask = (1u << WINED3D_SHADER_TYPE_PIXEL) @@ -1223,6 +1223,11 @@ static void spirv_fragment_pipe_vk_fp_enable(const struct wined3d_context *conte /* Nothing to do. */ }
+static void spirv_fragment_pipe_vk_fp_disable(const struct wined3d_context *context) +{ + /* Nothing to do. */ +} + static void spirv_fragment_pipe_vk_fp_get_caps(const struct wined3d_adapter *adapter, struct fragment_caps *caps) { memset(caps, 0, sizeof(*caps)); @@ -1285,6 +1290,7 @@ static const struct wined3d_state_entry_template spirv_fragment_pipe_vk_fp_state static const struct wined3d_fragment_pipe_ops spirv_fragment_pipe_vk = { .fp_enable = spirv_fragment_pipe_vk_fp_enable, + .fp_disable = spirv_fragment_pipe_vk_fp_disable, .get_caps = spirv_fragment_pipe_vk_fp_get_caps, .get_emul_mask = spirv_fragment_pipe_vk_fp_get_emul_mask, .alloc_private = spirv_fragment_pipe_vk_fp_alloc, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 3d39ef62afe..f7503c65205 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2002,6 +2002,7 @@ struct wined3d_state_entry_template struct wined3d_fragment_pipe_ops { void (*fp_enable)(const struct wined3d_context *context, BOOL enable); + void (*fp_disable)(const struct wined3d_context *context); void (*get_caps)(const struct wined3d_adapter *adapter, struct fragment_caps *caps); unsigned int (*get_emul_mask)(const struct wined3d_adapter *adapter); void *(*alloc_private)(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv);