Skip to content

Commit

Permalink
Bug 1710325 - Fix offset clamping in SWGL blur fast-path. r=jrmuizel
Browse files Browse the repository at this point in the history
We accidentally were clamping the horizontal stage of the separable blur some
number of samples too early before the end of the row, rather than at the end
of the row.

Differential Revision: https://phabricator.services.mozilla.com/D115309
  • Loading branch information
lsalzman committed May 18, 2021
1 parent 1a6a786 commit a04a443
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
10 changes: 7 additions & 3 deletions gfx/wr/swgl/src/texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -1025,9 +1025,13 @@ static VectorType<uint16_t, 4 * sizeof(P)> gaussianBlurHorizontal(
// texture bounds, we compute the valid radius that doesn't require clamping
// and fall back to a slower clamping loop outside of that valid radius.
int offset = 1;
// The left bound is how much we can offset the sample before the start of
// the row bounds.
int leftBound = i.x - max(minX, 0);
int rightBound = min(maxX, sampler->width) - (i.x + 4);
int validRadius = min(radius, min(leftBound, rightBound));
// The right bound is how much we can offset the sample before the end of the
// row bounds.
int rightBound = min(maxX, sampler->width - 1) - i.x;
int validRadius = min(radius, min(leftBound, rightBound - (4 - 1)));
for (; offset <= validRadius; offset++) {
// Overwrite the pixel that needs to be shifted out with the new pixel, and
// shift it into the correct location.
Expand Down Expand Up @@ -1096,7 +1100,7 @@ static VectorType<uint16_t, 4 * sizeof(P)> gaussianBlurVertical(
// a slower clamping loop outside of that valid radius.
int offset = 1;
int belowBound = i.y - max(minY, 0);
int aboveBound = min(maxY, sampler->height) - (i.y + 1);
int aboveBound = min(maxY, sampler->height - 1) - i.y;
int validRadius = min(radius, min(belowBound, aboveBound));
for (; offset <= validRadius; offset++) {
rowAbove += sampler->stride;
Expand Down
4 changes: 2 additions & 2 deletions gfx/wr/wrench/reftests/boxshadow/reftest.list
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ fuzzy-if(platform(swgl),3,2) == inset-no-blur-radius.yaml inset-no-blur-radius-r
platform(linux,mac) == inset-alpha.yaml inset-alpha.png
platform(linux,mac) == boxshadow-spread-only.yaml boxshadow-spread-only-ref.png
== box-shadow-clip.yaml box-shadow-clip-ref.yaml
fuzzy(1,402) fuzzy-if(platform(swgl),2,1402) == inset-large-offset.yaml inset-large-offset-ref.png
fuzzy(1,402) fuzzy-if(platform(swgl),2,1208) == inset-large-offset.yaml inset-large-offset-ref.png
platform(linux,mac) == inset-border-radius.yaml inset-border-radius.png
platform(linux,mac) == inset-offset.yaml inset-offset.png
platform(linux,mac) == inset-neg-offset.yaml inset-neg-offset.png
Expand All @@ -23,7 +23,7 @@ platform(linux,mac) == inset-subpx.yaml inset-subpx.png
platform(linux,mac) fuzzy(1,4) == inset-downscale.yaml inset-downscale.png
platform(linux,mac) fuzzy(1,979) == box-shadow-cache.yaml box-shadow-cache.png
platform(linux,mac) fuzzy(1,685) == overlap1.yaml overlap1.png
fuzzy(2,757) fuzzy-if(platform(swgl),15,2469) == overlap2.yaml overlap2.png
fuzzy(2,757) fuzzy-if(platform(swgl),2,2414) == overlap2.yaml overlap2.png
platform(linux,mac) fuzzy(1,48) == no-stretch.yaml no-stretch.png
platform(linux,mac) fuzzy(1,9) == box-shadow-stretch-mode-x.yaml box-shadow-stretch-mode-x.png
platform(linux,mac) fuzzy(1,41) == box-shadow-stretch-mode-y.yaml box-shadow-stretch-mode-y.png
Expand Down
2 changes: 1 addition & 1 deletion gfx/wr/wrench/reftests/text/reftest.list
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fuzzy(1,1) == shadow-huge.yaml shadow-huge-ref.yaml
!= shadow-clipped-text.yaml blank.yaml
!= non-opaque.yaml non-opaque-notref.yaml
== decorations.yaml decorations-ref.yaml
skip_on(android,device) fuzzy(1,3635) fuzzy-if(platform(swgl),3,14624) == decorations-suite.yaml decorations-suite.png # Fails on Pixel2
skip_on(android,device) fuzzy(1,3635) fuzzy-if(platform(swgl),3,13395) == decorations-suite.yaml decorations-suite.png # Fails on Pixel2
== 1658.yaml 1658-ref.yaml
fuzzy(2,405) == split-batch.yaml split-batch-ref.yaml
# Next 3 tests affected by bug 1548099 on Android
Expand Down
2 changes: 1 addition & 1 deletion layout/reftests/svg/filters/css-filter-chains/reftest.list
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# Some platforms render this complex filter chain a little differently, and that's ok.
fuzzy(0-5,0-13638) fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)&&layersGPUAccelerated,0-35,0-13638) fuzzy-if(webrender,4-6,12000-19484) fuzzy-if(webrender&&swgl,9-10,19336-20088) == long-chain.html long-chain-ref.html # Win10: Bug 1258241
== moz-element.html moz-element-ref.html
fuzzy-if(webrender,13-15,7670-7982) fuzzy-if(webrender&&swgl,12-12,14052-14052) == same-filter.html same-filter-ref.html
fuzzy-if(webrender,13-15,7670-7982) fuzzy-if(webrender&&swgl,11-12,14052-14056) == same-filter.html same-filter-ref.html
2 changes: 1 addition & 1 deletion layout/reftests/text-overflow/reftest.list
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fuzzy-if(webrender,0-3,0-825) == quirks-decorations.html quirks-decorations-ref.
== standards-decorations.html standards-decorations-ref.html
== standards-line-height.html standards-line-height-ref.html
fuzzy-if(skiaContent,0-1,0-4200) fuzzy-if(webrender,0-47,0-6) == selection.html selection-ref.html
fuzzy-if(webrender,0-8,0-509) fuzzy-if(webrender&&swgl&&gtkWidget,49-49,18-18) == marker-shadow.html marker-shadow-ref.html
fuzzy-if(webrender,0-8,0-509) == marker-shadow.html marker-shadow-ref.html
fuzzy-if(webrender,0-3,0-25) == aligned-baseline.html aligned-baseline-ref.html
fuzzy-if(skiaContent,0-1,0-5) == clipped-elements.html clipped-elements-ref.html
== theme-overflow.html theme-overflow-ref.html
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[viewBox-scaling-text-001.html]
expected:
if (os == "android") and not swgl and not debug and not webrender: ["PASS", "FAIL"]
if (os == "android") and swgl: FAIL
if (os == "android") and not debug and not webrender: ["PASS", "FAIL"]

0 comments on commit a04a443

Please sign in to comment.