Repository navigation
Conversation
Apple GPUs (M-series, A-series) use tile-based deferred rendering (TBDR) where each render pass forces an expensive tile flush/reload cycle. The KawaseBlurFilter performs N full-resolution passes (one per quality level), making DropShadowFilter extremely slow on Macs and iPhones. This adds a downsampled blur path that processes blur passes at half resolution (configurable), reducing per-pass texture bandwidth by ~4x: - KawaseBlurFilter: new `applyDownsampled()` method that downscales before blur and upscales on the final pass - DropShadowFilter: new `downsample` option (default 0.5) that automatically uses the downsampled path - DropShadowFilter: early exit when alpha <= 0 to skip all GPU work - DropShadowFilter: cap quality padding at 16 to reduce overdraw Since drop shadows are inherently blurry, the quality difference from half-resolution blur is negligible while the performance improvement is significant on TBDR architectures. Fixes pixijs#327 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
|
@bigtimebuddy optimizes DropShadowFilter for Apple GPUs by using a downsampled blur pass. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #327 -- DropShadowFilter has very low performance (as low as 3 FPS) on Macs and iPhones.
Root cause: Apple GPUs (M-series, A-series) use tile-based deferred rendering (TBDR) where each render pass forces an expensive tile flush and reload cycle. The
KawaseBlurFilterperformsqualitynumber of full-resolution render passes, each sampling 4 texels per pixel. At quality=8 with a large texture, this means 8 full-resolution passes with 4 texture reads each -- catastrophic on TBDR architectures.Solution: Perform blur passes at reduced resolution. Since drop shadows are inherently blurry, blurring at half (or quarter) resolution and then upscaling produces visually identical results while dramatically reducing per-pass texture bandwidth.
Changes
KawaseBlurFilter.applyDownsampled()-- New public method that:DropShadowFilter.downsample-- New option (default0.5) that controls the blur resolution:0.5= half resolution (default, best quality/performance balance)0.25= quarter resolution (maximum performance)falseor1= full resolution (original behavior)Early exit optimization -- Skip all shadow GPU work when
alpha <= 0Padding cap -- Cap quality padding contribution at 16 to reduce unnecessary overdraw at high quality settings
Performance impact
At half resolution (default), each blur pass processes ~4x fewer pixels. For a typical DropShadowFilter with quality=3:
The downsampled blur passes are ~4x cheaper each, giving an estimated 2-3x overall speedup on TBDR GPUs, with higher gains at higher quality settings.
Backward compatibility
downsample: falseTest plan
downsample: falseproduces identical output to the original implementationdownsample: 0.25works correctly (quarter resolution)alphais set to 0🤖 Generated with Claude Code