[PATCH 0/6] MR9814: wined3d: Invalidate less when applying stateblocks.
From: Elizabeth Figura <zfigura@codeweavers.com> --- dlls/wined3d/stateblock.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index df5841e65c3..662459236cb 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -2503,6 +2503,14 @@ static void wined3d_stateblock_invalidate_initial_states(struct wined3d_stateblo stateblock->changed.fog_constants = 1; wined3d_bitmap_set_bits(stateblock->changed.renderState, WINED3D_RS_POINTSIZE_MAX, 1); wined3d_bitmap_set_bits(stateblock->changed.renderState, WINED3D_RS_POINTSIZE_MIN, 1); + stateblock->changed.extra_vs_args = 1; + stateblock->changed.extra_ps_args = 1; + stateblock->changed.rasterizer_state = 1; + /* These force setting depth/stencil, and blend state. + * FIXME: These should probably be made into flags in wined3d_saved_states + * like the rest. */ + wined3d_bitmap_set_bits(stateblock->changed.renderState, WINED3D_RS_BLENDOP, 1); + wined3d_bitmap_set_bits(stateblock->changed.renderState, WINED3D_RS_ZENABLE, 1); } static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const struct wined3d_stateblock *device_state, -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9814
From: Elizabeth Figura <zfigura@codeweavers.com> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59013 --- dlls/wined3d/stateblock.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 662459236cb..4ef53d7d96f 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1590,6 +1590,10 @@ void CDECL wined3d_stateblock_set_vertex_declaration(struct wined3d_stateblock * wined3d_vertex_declaration_decref(prev); stateblock->stateblock_state.vertex_declaration = declaration; stateblock->changed.vertexDecl = TRUE; + + if (declaration == prev) + return; + /* Texture matrices depend on the format of the TEXCOORD attributes. */ /* FIXME: They also depend on whether the draw is pretransformed, * but that should go away. */ -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9814
From: Elizabeth Figura <zfigura@codeweavers.com> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59013 --- dlls/wined3d/stateblock.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 4ef53d7d96f..c5ee846f3be 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -84,6 +84,7 @@ struct wined3d_stateblock { LONG ref; struct wined3d_device *device; + enum wined3d_stateblock_type type; struct wined3d_saved_states changed; @@ -1970,6 +1971,13 @@ void CDECL wined3d_stateblock_set_viewport(struct wined3d_stateblock *stateblock { TRACE("stateblock %p, viewport %p.\n", stateblock, viewport); + if (stateblock->type == WINED3D_SBT_PRIMARY + && !memcmp(viewport, &stateblock->stateblock_state.viewport, sizeof(*viewport))) + { + TRACE("Ignoring redundant call on a primary stateblock.\n"); + return; + } + stateblock->stateblock_state.viewport = *viewport; stateblock->changed.viewport = TRUE; stateblock->changed.point_scale = TRUE; @@ -2524,6 +2532,7 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const stru stateblock->ref = 1; stateblock->device = device; + stateblock->type = type; stateblock->stateblock_state.light_state = &stateblock->light_state; wined3d_stateblock_state_init(&stateblock->stateblock_state, device, type == WINED3D_SBT_PRIMARY ? WINED3D_STATE_INIT_DEFAULT : 0); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9814
From: Elizabeth Figura <zfigura@codeweavers.com> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59013 --- dlls/wined3d/stateblock.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index c5ee846f3be..e0b487c867e 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1799,6 +1799,12 @@ void CDECL wined3d_stateblock_set_texture_stage_state(struct wined3d_stateblock return; } + if (stateblock->type == WINED3D_SBT_PRIMARY && value == stateblock->stateblock_state.texture_states[stage][state]) + { + TRACE("Ignoring redundant call on a primary stateblock.\n"); + return; + } + stateblock->stateblock_state.texture_states[stage][state] = value; stateblock->changed.textureState[stage] |= 1u << state; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9814
From: Elizabeth Figura <zfigura@codeweavers.com> Other states can affect ffp_vs_settings but not fog constants. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59013 --- dlls/wined3d/stateblock.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index e0b487c867e..3a26b2f1510 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1328,15 +1328,19 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock, void CDECL wined3d_stateblock_set_vertex_shader(struct wined3d_stateblock *stateblock, struct wined3d_shader *shader) { + struct wined3d_shader *prev = stateblock->stateblock_state.vs; + TRACE("stateblock %p, shader %p.\n", stateblock, shader); if (shader) wined3d_shader_incref(shader); - if (stateblock->stateblock_state.vs) - wined3d_shader_decref(stateblock->stateblock_state.vs); + if (prev) + wined3d_shader_decref(prev); stateblock->stateblock_state.vs = shader; stateblock->changed.vertexShader = TRUE; stateblock->changed.ffp_vs_settings = 1; + if (!shader != !prev) + stateblock->changed.fog_constants = 1; } static void wined3d_bitmap_set_bits(uint32_t *bitmap, unsigned int start, unsigned int count) @@ -4020,7 +4024,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, offsetof(struct wined3d_ffp_ps_constants, alpha_test_ref), sizeof(f), &f); } - if (changed->fog_constants || changed->ffp_vs_settings || changed->position_transformed) + if (changed->fog_constants || changed->position_transformed) { bool rhw = state->vertex_declaration && state->vertex_declaration->position_transformed; struct wined3d_ffp_fog_constants fog; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9814
From: Elizabeth Figura <zfigura@codeweavers.com> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59013 --- dlls/wined3d/stateblock.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 3a26b2f1510..1871c13ab58 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1649,6 +1649,12 @@ void CDECL wined3d_stateblock_set_render_state(struct wined3d_stateblock *stateb return; } + if (stateblock->type == WINED3D_SBT_PRIMARY && value == stateblock->stateblock_state.rs[state]) + { + TRACE("Ignoring redundant call on a primary stateblock.\n"); + return; + } + stateblock->stateblock_state.rs[state] = value; stateblock->changed.renderState[state >> 5] |= 1u << (state & 0x1f); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9814
participants (2)
-
Elizabeth Figura -
Elizabeth Figura (@zfigura)