Skip to content

perf: reduce neutral screen-effect filter work - #2

Merged
bbbreaddd merged 4 commits into
bbbreaddd:mainfrom
AbdullahTrees:perf/elide-identity-filters
Nov 16, 2026
Merged

bbbreaddd merged 4 commits into
bbbreaddd:mainfrom
AbdullahTrees:perf/elide-identity-filters

Conversation

@AbdullahTrees

@AbdullahTrees AbdullahTrees commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Neutral screen-effect filters can leave unnecessary rendering work on every frame.

This combines native-path identity checks for blur, zoom blur and bloom with shader-qualified pass reduction for Gaussian blur. Authored shader chains retain their filters and apply hooks. Gaussian pass collapsing is limited to recognized shaders in full-viewport, resolution-one plans with an identity projection. It preserves the filter boundary, clipping, blending and scratch writes needed later in the chain; other authored plans retain their original passes. No shader variants or additional shader-program slots are used. Existing OMORI patches are unchanged.

Validation:

  • JavaScript suite: 2,316 passed, 50 skipped, zero failed.
  • Focused lint and source verification passed.
  • Local Pixi 4.5.4 and 4.8.9 comparisons cover static pixels, movement, fades, standalone blur directions, nesting and render-to-texture feedback. Four assertions retain existing sub-resolution reference discrepancies as TODOs.
  • Added regressions for authored shaders, custom apply hooks, subclasses and scratch-target dependencies.
  • One local moving-fullscreen Gaussian microbenchmark reduced actual filter draws from eight to two and total frame time from 15.3 to 9.1 ms. This is not a gameplay FPS result; the combined change has not established a handheld pixel-error bound.

@AbdullahTrees

Copy link
Copy Markdown
Contributor Author

@bbbreaddd any reason this isn't getting merged? This is actually a huge source of lag for unoptimized games. Care has been taken to ensure filters with non-zero effects are not ignored.

@bbbreaddd

Copy link
Copy Markdown
Owner

Sorry, I meant to respond but forgot to.
Filters are definitely extremely heavy on low end handhelds, but just because it's strength is 0 doesn't actually mean it doesn't change what's rendered. I've ran into this issue myself in OMORI, I think it was the title screen, and I did try a similar fix but found out it wasn't really a good solution. I ended up adding a more specific optimization but only to OMORI. I'll upload my game-specific patches soon but if you can find a better way to implement this safely, I might consider it

@bbbreaddd
bbbreaddd marked this pull request as draft October 24, 2026 06:14
@AbdullahTrees
AbdullahTrees force-pushed the perf/elide-identity-filters branch from d5e5f2c to 9e7c620 Compare November 5, 2026 20:54
Effect plugins commonly attach filters once and leave them on a container
at zero strength so an animation can ramp them up later. When the same
container also carries a custom fragment filter, PMJS builds one
custom-filter plan from the whole chain and runs every pass, although the
idle filters return their input unchanged: a zero BlurFilter alone is two
directions times quality 4, eight full-frame passes.

Leave identity filters out of both the custom plan and the fallback group
chain: zero blur on both axes, ZoomBlur with zero strength, and
AdvancedBloom with bloomScale 0 and brightness 1. The plan is rebuilt from
the live filter array every frame, so a filter that starts ramping up is
included again on the next frame.

Example: OMORI's Aries001_AnimationScreenEffects keeps such filters on
every spriteset for the whole game. On an RG40XX-H (Mali-G31, muOS) one
map went from 11.7 to 29.4 fps and native draw from 45 to 2.7 ms; the
12-pass plan disappears. The all-filters-off ceiling is 29.7 fps / 2.1 ms.
@AbdullahTrees
AbdullahTrees force-pushed the perf/elide-identity-filters branch from 9e7c620 to fa19ce2 Compare November 5, 2026 20:54
@bbbreaddd bbbreaddd changed the title perf: elide identity screen-effect filters from the filter chain perf: reduce neutral screen-effect filter work Nov 16, 2026
@bbbreaddd
bbbreaddd marked this pull request as ready for review November 16, 2026 00:17
@bbbreaddd
bbbreaddd merged commit 03ed1a5 into bbbreaddd:main Nov 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants