Skip to content

fix(drop-shadow): pass resolution to inner KawaseBlurFilter for Apple GPU performance - #524

Open
tarai-dl wants to merge 1 commit into
pixijs:mainfrom
tarai-dl:rn/optimize-dropshadow-apple
Open

tarai-dl wants to merge 1 commit into
pixijs:mainfrom
tarai-dl:rn/optimize-dropshadow-apple

Conversation

@tarai-dl

Copy link
Copy Markdown

Problem

DropShadowFilter has severe performance issues on Apple devices (Mac/iPhone) with Retina displays. On these devices, the filter runs at ~3 FPS even with low quality settings.

Root Cause

The inner KawaseBlurFilter was not receiving the resolution parameter from the parent DropShadowFilter. Without an explicit resolution, PixiJS's filter system defaults to inheriting the renderer's devicePixelRatio. On Apple Retina displays (DPR 2-3x), this causes the blur to be rendered at 2-3x the necessary resolution, resulting in 4-9x more pixels to process.

Changes

  1. Pass resolution to KawaseBlurFilter: Set this._blurFilter.resolution to match the parent filter's resolution (lines 152-156)
  2. Recalculate padding on runtime changes: Added _updatePadding() calls when kernels, pixelSize, pixelSizeX, or pixelSizeY are modified at runtime (similar to PR fix(drop-shadow): recalc padding when kernel/pixel size changes #520)

Impact

  • On Apple Retina displays (DPR 2x): ~4x fewer pixels processed by blur → significant FPS improvement
  • On Apple Retina displays (DPR 3x): ~9x fewer pixels processed by blur → dramatic FPS improvement
  • No visual regression: the blur quality at resolution=1 is sufficient for drop shadow effects
  • Backward compatible: no API changes

Related

Testing

The fix can be verified by checking that DropShadowFilter._blurFilter.resolution equals the filter's resolution on construction, rather than defaulting to the renderer's DPR.

… GPU performance

The KawaseBlurFilter used internally by DropShadowFilter was not receiving the
resolution parameter, causing it to inherit the renderer's devicePixelRatio.
On Apple Retina displays (DPR 2-3x), this resulted in the blur being rendered
at unnecessarily high resolution, causing severe performance issues (~3 FPS).

Additionally, recalculate padding when kernels or pixelSize changes at runtime.

Fixes pixijs#327

This branch has not been deployed

No deployments
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.

DropShadowFilter low performance on Macs and iPhones

1 participant