From 897e96a3c3bda30935f705b802a10f093c07374d Mon Sep 17 00:00:00 2001 From: Tyler Denniston Date: Thu, 13 Feb 2020 12:58:57 -0500 Subject: [skqp/release] Remove threshold for scale-pixels Cherry pick of 0e6de918cc9599083559d88cf4dec4e562ac1591 from the skqp/release branch. scale-pixels render test threshold set to -1 Bug: 147278747 Change-Id: I85773cf47f31008bb64feefc95e1ecb08255a50e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270578 Reviewed-by: Derek Sollenberger Commit-Queue: Tyler Denniston Test: CtsSkQPTestCases --- platform_tools/android/apps/skqp/src/main/assets/skqp/rendertests.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform_tools/android/apps/skqp/src/main/assets/skqp/rendertests.txt b/platform_tools/android/apps/skqp/src/main/assets/skqp/rendertests.txt index 14fa55a3ae..83fb0b764b 100644 --- a/platform_tools/android/apps/skqp/src/main/assets/skqp/rendertests.txt +++ b/platform_tools/android/apps/skqp/src/main/assets/skqp/rendertests.txt @@ -560,7 +560,7 @@ savelayer_initfromprev,-1 savelayer_maskfilter,-1 savelayer_unclipped,0 savelayer_with_backdrop,-1 -scale-pixels,0 +scale-pixels,-1 scaled_tilemode_bitmap,0 scaled_tilemode_gradient,0 scaled_tilemodes,1 -- cgit v1.2.3 From 5540432b78ed770d61a3c07a580e9cf28e5f6e03 Mon Sep 17 00:00:00 2001 From: Tyler Denniston Date: Wed, 19 Feb 2020 14:18:20 -0500 Subject: Reland "Add small offset to t in GrLinearGradientLayout." [cherry-pick of 6b2ccfcf6730c1d4fb879b9726a6f33d3e6f38f8 from skia/master] [cherry-pick of b0fae436b91950935035f6e5bbe02495af92a830 from skqp/release] Original change's description: > Revert "Add small offset to t in GrLinearGradientLayout." > > This reverts commit 1a15723397a069c07705f8ed4f9f4c9a0c194816. > > Reason for revert: causes two layout tests to "fail". Need to disable tests > > Original change's description: > > Add small offset to t in GrLinearGradientLayout. > > > > This works around a varying interpolation issue when a hard stop occurs > > a along a row or column of pixel centers. > > > > Bug: chromium:938592 > > Change-Id: I4c239b2831c3e901cbbfa43f0a60a3d7fb0fef75 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/200939 > > Reviewed-by: Michael Ludwig > > Commit-Queue: Brian Salomon > > TBR=bsalomon@google.com,michaelludwig@google.com > > Change-Id: Iebe45929050b8ab1d07574518a1b3d9ac5147512 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: chromium:938592 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/201655 > Reviewed-by: Brian Salomon > Commit-Queue: Brian Salomon TBR=bsalomon@google.com,michaelludwig@google.com Bug: 144257628 Change-Id: Ibd35a39d788d74752ccf2a8ffbac8009928540c7 Reviewed-On: https://skia-review.googlesource.com/c/skia/+/201617 Reviewed-By: Brian Salomon Reviewed-By: Michael Ludwig Commit-Queue: Brian Salomon Reviewed-on: https://skia-review.googlesource.com/c/skia/+/271741 Reviewed-by: Tyler Denniston Test: CtsSkQPTestCases --- src/gpu/gradients/GrLinearGradientLayout.cpp | 6 ++++-- src/gpu/gradients/GrLinearGradientLayout.fp | 9 ++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/gpu/gradients/GrLinearGradientLayout.cpp b/src/gpu/gradients/GrLinearGradientLayout.cpp index cd53b36bcd..d809e004b0 100644 --- a/src/gpu/gradients/GrLinearGradientLayout.cpp +++ b/src/gpu/gradients/GrLinearGradientLayout.cpp @@ -25,8 +25,10 @@ public: auto gradientMatrix = _outer.gradientMatrix(); (void)gradientMatrix; SkString sk_TransformedCoords2D_0 = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]); - fragBuilder->codeAppendf("half t = half(%s.x);\n%s = half4(t, 1.0, 0.0, 0.0);\n", - sk_TransformedCoords2D_0.c_str(), args.fOutputColor); + fragBuilder->codeAppendf( + "half t = half(%s.x) + 1.0000000000000001e-05;\n%s = half4(t, 1.0, 0.0, 0.0);\n", + sk_TransformedCoords2D_0.c_str(), + args.fOutputColor); } private: diff --git a/src/gpu/gradients/GrLinearGradientLayout.fp b/src/gpu/gradients/GrLinearGradientLayout.fp index 3a187f321c..bd144316e8 100644 --- a/src/gpu/gradients/GrLinearGradientLayout.fp +++ b/src/gpu/gradients/GrLinearGradientLayout.fp @@ -12,7 +12,14 @@ in half4x4 gradientMatrix; } void main() { - half t = sk_TransformedCoords2D[0].x; + // We add a tiny delta to t. When gradient stops are set up so that a hard stop in a vertically + // or horizontally oriented gradient falls exactly at a column or row of pixel centers we can + // we can get slightly different interpolated t values along the column/row. By adding the delta + // we will consistently get the color to the "right" of the stop. Of course if the hard stop + // falls at X.5 - delta then we still could get inconsistent results, but that is much less + // likely. crbug.com/938592 + // If/when we add filtering of the gradient this can be removed. + half t = half(sk_TransformedCoords2D[0].x) + 0.00001; sk_OutColor = half4(t, 1, 0, 0); // y = 1 for always valid } -- cgit v1.2.3