[Bugfix] UIGridView::render() has no clean-state early-out — idle grid clears+redraws its RenderTexture every frame #351
Labels
No labels
Alpha Release Requirement
Bugfix
Demo Target
Documentation
Major Feature
Minor Feature
priority:tier1-active
priority:tier2-foundation
priority:tier3-future
priority:tier4-deferred
Refactoring & Cleanup
system:animation
system:documentation
system:grid
system:input
system:performance
system:procgen
system:python-binding
system:rendering
system:ui-hierarchy
Tiny Feature
workflow:blocked
workflow:needs-benchmark
workflow:needs-documentation
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
john/McRogueFace#351
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Rescoped from #255 (which tracked general grid-render perf and is now closed). This is the concrete, actionable defect that verification surfaced.
Problem
The clean-state early-out and
markCompositeDirty()machinery added under #255 live inUIGrid::render(), but that is no longer the live render path. Since the #252 GridView shim, on-screen rendering goes throughUIGridView::render()(src/UIGridView.cpp:131), which has no dirty check and no early-out — it unconditionallyrenderTexture.clear(fill_color)and redraws every frame (src/UIGridView.cpp:165), even when nothing changed.UIGridView.cppreferencesrender_dirty/composite_dirtyonly incenter_camera, never inrender().So the "idle grid re-renders to its RenderTexture every frame" cost that #255 set out to eliminate is still present on the real path — the optimization exists but is dead code on
UIGrid::render().Compounding factors found in the same pass:
sprite_indexsetters (src/UIEntity.cpp) update only the spatial hash — they call neithermarkCompositeDirty()normarkContentDirty(). So even if UIGridView gained a dirty gate, entity motion wouldn't invalidate it correctly without adding the marks.UIGrid::render()'s early-out shader branch falls through instead ofreturning after drawingoutput(src/UIGrid.cpp:108+) — latent, but don't re-inherit it.UIGrid::render()never resets its own dirty flags (clearDirty()is never called there), so its early-out could never re-arm anyway.Proposed fix
UIGrid::render()intoUIGridView::render(): when!render_dirty && !composite_dirty, redraw the cachedoutputsprite and return (handle the shader branch with a realreturn, not a fallthrough).UIGridView::render()actually resets its dirty flags (clearDirty()) after a full re-render so the early-out re-arms.sprite_indexsetters mark the owning grid composite-dirty (not content-dirty — chunk caches are unaffected) so the early-out stays correct while entities move.Acceptance
clear()+redraw its RenderTexture every frame — verify via Callgrind on a static-scene loop and via the Gauntlet idle baseline.References
src/UIGridView.cpp:131,165,src/UIGrid.cpp:108+(legacy early-out),src/UIDrawable.cpp:1068,1082(markContentDirty/markCompositeDirty),src/UIEntity.cpp(entity setters)