New issue
Advanced search Search tips
Starred by 6 users

Issue metadata

Status: Accepted
Area: ImageFilter
Priority: Medium
Type: Defect

Sign in to add a comment

Break SkMorphologyImageFilter into multiple passes

Project Member Reported by, Jun 25 2013

Issue description

SkMorphologyImageFilter currently uses a loop in the fragment shader with a number of iterations equal to the radius size (one pass for horizontal, one pass for vertical). This will exceed the loop limits or texture samples of some older GPUs. We should break each pass into multiple subpasses in order to avoid exceeding the loop limits.

In addition to improving compatibility, this kind of divide-and-conquer approach may improve performance (although this should be benchmarked).  For example, consider a morphology of radius 4, and assume a limit of 3 texture samples for simplicity.

Current implementation: 9 texture reads, 9 min/max and 1 write.

A two-pass approach would yield:
Pass 1, radius 1 (-1, 0, 1):   3 reads, 3 min/max, 1 write
Pass 2: radius 2 (-3, 0, 3):   3 reads, 3 min/max, 1 write

Total: 6 reads, 6 min/max, 2 writes.
Project Member

Comment 1 by, Dec 7 2015

Labels: Hotlist-Fixit

Sign in to add a comment