From: Elizabeth Figura zfigura@codeweavers.com
We still need to pass it through the CS, for the sake of wined3d_ffp_vs_settings. --- dlls/wined3d/glsl_shader.c | 8 -------- dlls/wined3d/shader.c | 4 ++-- dlls/wined3d/shader_spirv.c | 2 -- dlls/wined3d/stateblock.c | 15 +++++++++++++-- dlls/wined3d/utils.c | 9 ++++++--- dlls/wined3d/wined3d_private.h | 2 ++ 6 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 48943dbbe2a..f906d7caa82 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -12074,12 +12074,6 @@ static void glsl_fragment_pipe_shader(struct wined3d_context *context, context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_PIXEL; }
-static void glsl_fragment_pipe_fog(struct wined3d_context *context, - const struct wined3d_state *state, DWORD state_id) -{ - context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_PIXEL; -} - static void glsl_fragment_pipe_vdecl(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { @@ -12158,8 +12152,6 @@ static const struct wined3d_state_entry_template glsl_fragment_pipe_state_templa {STATE_RENDER(WINED3D_RS_ALPHAFUNC), {STATE_RENDER(WINED3D_RS_ALPHATESTENABLE), NULL }, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_ALPHATESTENABLE), {STATE_RENDER(WINED3D_RS_ALPHATESTENABLE), glsl_fragment_pipe_core_alpha_test }, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_COLORKEYENABLE), {STATE_RENDER(WINED3D_RS_COLORKEYENABLE), state_nop }, WINED3D_GL_EXT_NONE }, - {STATE_RENDER(WINED3D_RS_FOGENABLE), {STATE_RENDER(WINED3D_RS_FOGENABLE), glsl_fragment_pipe_fog }, WINED3D_GL_EXT_NONE }, - {STATE_RENDER(WINED3D_RS_FOGTABLEMODE), {STATE_RENDER(WINED3D_RS_FOGTABLEMODE), glsl_fragment_pipe_fog }, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_SRGBWRITEENABLE), {STATE_RENDER(WINED3D_RS_SRGBWRITEENABLE), state_srgbwrite }, ARB_FRAMEBUFFER_SRGB}, {STATE_RENDER(WINED3D_RS_SRGBWRITEENABLE), {STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL), NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_ARG0), {STATE_RENDER(WINED3D_RS_COLORKEYENABLE), NULL }, WINED3D_GL_EXT_NONE }, diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index 1c0aada0681..6d4e07ed82e 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -3064,9 +3064,9 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 else { args->vp_mode = WINED3D_VP_MODE_SHADER; - if (state->render_states[WINED3D_RS_FOGENABLE]) + if (state->extra_ps_args.fog_enable) { - switch (state->render_states[WINED3D_RS_FOGTABLEMODE]) + switch (state->extra_ps_args.fog_mode) { case WINED3D_FOG_NONE: case WINED3D_FOG_LINEAR: args->fog = WINED3D_FFP_PS_FOG_LINEAR; break; diff --git a/dlls/wined3d/shader_spirv.c b/dlls/wined3d/shader_spirv.c index a033c69feec..93fbdbf864e 100644 --- a/dlls/wined3d/shader_spirv.c +++ b/dlls/wined3d/shader_spirv.c @@ -1285,8 +1285,6 @@ static const struct wined3d_state_entry_template spirv_fragment_pipe_vk_fp_state { {STATE_RENDER(WINED3D_RS_ALPHATESTENABLE), {STATE_RENDER(WINED3D_RS_ALPHATESTENABLE), state_nop}}, {STATE_RENDER(WINED3D_RS_ALPHAFUNC), {STATE_RENDER(WINED3D_RS_ALPHAFUNC), state_nop}}, - {STATE_RENDER(WINED3D_RS_FOGENABLE), {STATE_RENDER(WINED3D_RS_FOGENABLE), state_nop}}, - {STATE_RENDER(WINED3D_RS_FOGTABLEMODE), {STATE_RENDER(WINED3D_RS_FOGTABLEMODE), state_nop}}, {STATE_RENDER(WINED3D_RS_FOGVERTEXMODE), {STATE_RENDER(WINED3D_RS_FOGVERTEXMODE), state_nop}}, {STATE_RENDER(WINED3D_RS_SRGBWRITEENABLE), {STATE_RENDER(WINED3D_RS_SRGBWRITEENABLE), state_nop}}, {0}, /* Terminate */ diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index cb26f01a0b9..a586d102fb7 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1670,7 +1670,6 @@ void CDECL wined3d_stateblock_set_render_state(struct wined3d_stateblock *stateb case WINED3D_RS_COLORVERTEX: case WINED3D_RS_DIFFUSEMATERIALSOURCE: case WINED3D_RS_EMISSIVEMATERIALSOURCE: - case WINED3D_RS_FOGENABLE: case WINED3D_RS_LIGHTING: case WINED3D_RS_LOCALVIEWER: case WINED3D_RS_NORMALIZENORMALS: @@ -1704,7 +1703,6 @@ void CDECL wined3d_stateblock_set_render_state(struct wined3d_stateblock *stateb stateblock->changed.fog_constants = 1; break;
- case WINED3D_RS_FOGTABLEMODE: case WINED3D_RS_FOGVERTEXMODE: stateblock->changed.ffp_vs_settings = 1; stateblock->changed.fog_constants = 1; @@ -1715,6 +1713,17 @@ void CDECL wined3d_stateblock_set_render_state(struct wined3d_stateblock *stateb stateblock->changed.extra_ps_args = 1; break;
+ case WINED3D_RS_FOGENABLE: + stateblock->changed.ffp_vs_settings = 1; + stateblock->changed.extra_ps_args = 1; + break; + + case WINED3D_RS_FOGTABLEMODE: + stateblock->changed.ffp_vs_settings = 1; + stateblock->changed.fog_constants = 1; + stateblock->changed.extra_ps_args = 1; + break; + default: break; } @@ -3954,6 +3963,8 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
args.point_sprite = state->rs[WINED3D_RS_POINTSPRITEENABLE]; args.flat_shading = state->rs[WINED3D_RS_SHADEMODE] == WINED3D_SHADE_FLAT; + args.fog_enable = state->rs[WINED3D_RS_FOGENABLE]; + args.fog_mode = state->rs[WINED3D_RS_FOGTABLEMODE]; wined3d_device_context_emit_set_extra_ps_args(context, &args); }
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index f068c6ebf77..fd0715a004f 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -6362,11 +6362,11 @@ void wined3d_ffp_get_fs_settings(const struct wined3d_state *state, for (; i < WINED3D_MAX_FFP_TEXTURES; ++i) memset(&settings->op[i], 0xff, sizeof(settings->op[i]));
- if (!state->render_states[WINED3D_RS_FOGENABLE]) + if (!state->extra_ps_args.fog_enable) { settings->fog = WINED3D_FFP_PS_FOG_OFF; } - else if (state->render_states[WINED3D_RS_FOGTABLEMODE] == WINED3D_FOG_NONE) + else if (state->extra_ps_args.fog_mode == WINED3D_FOG_NONE) { if (use_vs(state) || state->vertex_declaration->position_transformed) { @@ -6391,7 +6391,7 @@ void wined3d_ffp_get_fs_settings(const struct wined3d_state *state, } else { - switch (state->render_states[WINED3D_RS_FOGTABLEMODE]) + switch (state->extra_ps_args.fog_mode) { case WINED3D_FOG_LINEAR: settings->fog = WINED3D_FFP_PS_FOG_LINEAR; @@ -6402,6 +6402,9 @@ void wined3d_ffp_get_fs_settings(const struct wined3d_state *state, case WINED3D_FOG_EXP2: settings->fog = WINED3D_FFP_PS_FOG_EXP2; break; + case WINED3D_FOG_NONE: + /* unreachable */ + break; } } settings->sRGB_write = !d3d_info->srgb_write_control && needs_srgb_write(d3d_info, state, &state->fb); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 9a391475ba8..f9674643983 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2877,6 +2877,8 @@ struct wined3d_extra_ps_args { bool point_sprite; bool flat_shading; + bool fog_enable; + enum wined3d_fog_mode fog_mode; };
struct wined3d_blend_state