This is a reland of f065907ccc
3rd time's the charm:
The new analytic gradient shader was sporadically triggering violations of the coverage as alpha
compatibility optimization. Unfortunately, even when using the same device and random seed for the
test, the bots did not always reproduce the error. However, we identified the likely cause of the
violation.
The test requires that all output channels are less than the input alpha, which it uses to validate
whether or not the shader is modulating its values by the input alpha. This test does not pass if
the RGB values are greater than 1. The original version of the analytic gradient shader used half4s
for its scale and bias values. Given the threshold limit for hardstops of 0.00024 (SkNearlyZero),
a very small interval that is not treated as a hardstop can create a scale or bias of over 4000.
This moves into the very imprecise region of 16-bit floats, making it plausible that the gradient
outputs colors greater than 1, due to rounding. The kicker is that the random test generation for
stop locations does not use a uniform distribution, but is instead biased towards the remaining
interval, which increases the likelihood of generating a small interval that is not treated as a
hard stop. We are keeping this behavior since ill-conditioned gradients are useful in testing.
Original change's description:
> Reland "Implement an explicit binary search-based analytic gradient colorizer"
>
> This reverts commit 9461dcf130.
>
> Reason for revert: Fixes for ANGLE's incorrect shader behavior
>
> Original change's description:
> > Revert "Implement an explicit binary search-based analytic gradient colorizer"
> >
> > This reverts commit dcc85fc610.
> >
> > Reason for revert: ANGLE is frequently corrupted, particularly radial_gradient4 and mixershader
> >
> > Original change's description:
> > > Implement an explicit binary search-based analytic gradient colorizer
> > >
> > > Provides a reasonably flexible fragment processor that defines another
> > > colorizer implementation for gradients. It can support up to 8
> > > interpolation intervals (which is 16 colors if every stop is a hard stop
> > > or 9 colors if every stop is a smooth transition). It
> > > supports mixtures of hard and smooth stops. It is conditionally compiled
> > > into versions specific to the interval count (so it can produce up to
> > > 8 shader variants).
> > >
> > > The GrGradientShader controller does not remove the single and dual
> > > interval colorizers, which are useful specializations of this explicit
> > > binary search colorizer. Similarly, since it can only handle up to 8
> > > intervals, the texture colorizer is still used as a fallback.
> > >
> > > Currently it does not employ capabilities detection to determine if the
> > > hardware can support the number of required uniforms, which can become
> > > substantial for the larger gradient configurations.
> > >
> > > Bug: chromium:796479, chromium:729727, chromium:696603, chromium:543625, chromium:414254
> > > Change-Id: Ia1f735a5019766ae4796cc22964b2913db34b95b
> > > Reviewed-on: https://skia-review.googlesource.com/155080
> > > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> > > Reviewed-by: Brian Osman <brianosman@google.com>
> >
> > TBR=bsalomon@google.com,brianosman@google.com,michaelludwig@google.com
> >
> > Change-Id: I351a387f0528e4c2db2d47ab2e5d6b336991fb98
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Bug: chromium:796479, chromium:729727, chromium:696603, chromium:543625, chromium:414254
> > Reviewed-on: https://skia-review.googlesource.com/156541
> > Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
>
> TBR=bsalomon@google.com,brianosman@google.com,michaelludwig@google.com
>
> Change-Id: I2aca36307d88c26905d860ec29417ec68c6037cc
> Bug: chromium:796479, chromium:729727, chromium:696603, chromium:543625, chromium:414254
> Reviewed-on: https://skia-review.googlesource.com/156542
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Bug: chromium:796479, chromium:729727, chromium:696603, chromium:543625, chromium:414254
Change-Id: I2d050624781c77cdd160291cadbadac602b48bde
Reviewed-on: https://skia-review.googlesource.com/c/157569
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This reverts commit f065907ccc.
Reason for revert: Processor test failing (inconsistently) on several bots.
Original change's description:
> Reland "Implement an explicit binary search-based analytic gradient colorizer"
>
> This reverts commit 9461dcf130.
>
> Reason for revert: Fixes for ANGLE's incorrect shader behavior
>
> Original change's description:
> > Revert "Implement an explicit binary search-based analytic gradient colorizer"
> >
> > This reverts commit dcc85fc610.
> >
> > Reason for revert: ANGLE is frequently corrupted, particularly radial_gradient4 and mixershader
> >
> > Original change's description:
> > > Implement an explicit binary search-based analytic gradient colorizer
> > >
> > > Provides a reasonably flexible fragment processor that defines another
> > > colorizer implementation for gradients. It can support up to 8
> > > interpolation intervals (which is 16 colors if every stop is a hard stop
> > > or 9 colors if every stop is a smooth transition). It
> > > supports mixtures of hard and smooth stops. It is conditionally compiled
> > > into versions specific to the interval count (so it can produce up to
> > > 8 shader variants).
> > >
> > > The GrGradientShader controller does not remove the single and dual
> > > interval colorizers, which are useful specializations of this explicit
> > > binary search colorizer. Similarly, since it can only handle up to 8
> > > intervals, the texture colorizer is still used as a fallback.
> > >
> > > Currently it does not employ capabilities detection to determine if the
> > > hardware can support the number of required uniforms, which can become
> > > substantial for the larger gradient configurations.
> > >
> > > Bug: chromium:796479, chromium:729727, chromium:696603, chromium:543625, chromium:414254
> > > Change-Id: Ia1f735a5019766ae4796cc22964b2913db34b95b
> > > Reviewed-on: https://skia-review.googlesource.com/155080
> > > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> > > Reviewed-by: Brian Osman <brianosman@google.com>
> >
> > TBR=bsalomon@google.com,brianosman@google.com,michaelludwig@google.com
> >
> > Change-Id: I351a387f0528e4c2db2d47ab2e5d6b336991fb98
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Bug: chromium:796479, chromium:729727, chromium:696603, chromium:543625, chromium:414254
> > Reviewed-on: https://skia-review.googlesource.com/156541
> > Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
>
> TBR=bsalomon@google.com,brianosman@google.com,michaelludwig@google.com
>
> Change-Id: I2aca36307d88c26905d860ec29417ec68c6037cc
> Bug: chromium:796479, chromium:729727, chromium:696603, chromium:543625, chromium:414254
> Reviewed-on: https://skia-review.googlesource.com/156542
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
TBR=bsalomon@google.com,brianosman@google.com,michaelludwig@google.com
Change-Id: Icd925d568d8cdffdc3020c07a9c50a4aa9cf0bb9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:796479, chromium:729727, chromium:696603, chromium:543625, chromium:414254
Reviewed-on: https://skia-review.googlesource.com/157429
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This reverts commit 9461dcf130.
Reason for revert: Fixes for ANGLE's incorrect shader behavior
Original change's description:
> Revert "Implement an explicit binary search-based analytic gradient colorizer"
>
> This reverts commit dcc85fc610.
>
> Reason for revert: ANGLE is frequently corrupted, particularly radial_gradient4 and mixershader
>
> Original change's description:
> > Implement an explicit binary search-based analytic gradient colorizer
> >
> > Provides a reasonably flexible fragment processor that defines another
> > colorizer implementation for gradients. It can support up to 8
> > interpolation intervals (which is 16 colors if every stop is a hard stop
> > or 9 colors if every stop is a smooth transition). It
> > supports mixtures of hard and smooth stops. It is conditionally compiled
> > into versions specific to the interval count (so it can produce up to
> > 8 shader variants).
> >
> > The GrGradientShader controller does not remove the single and dual
> > interval colorizers, which are useful specializations of this explicit
> > binary search colorizer. Similarly, since it can only handle up to 8
> > intervals, the texture colorizer is still used as a fallback.
> >
> > Currently it does not employ capabilities detection to determine if the
> > hardware can support the number of required uniforms, which can become
> > substantial for the larger gradient configurations.
> >
> > Bug: chromium:796479, chromium:729727, chromium:696603, chromium:543625, chromium:414254
> > Change-Id: Ia1f735a5019766ae4796cc22964b2913db34b95b
> > Reviewed-on: https://skia-review.googlesource.com/155080
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> > Reviewed-by: Brian Osman <brianosman@google.com>
>
> TBR=bsalomon@google.com,brianosman@google.com,michaelludwig@google.com
>
> Change-Id: I351a387f0528e4c2db2d47ab2e5d6b336991fb98
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:796479, chromium:729727, chromium:696603, chromium:543625, chromium:414254
> Reviewed-on: https://skia-review.googlesource.com/156541
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
TBR=bsalomon@google.com,brianosman@google.com,michaelludwig@google.com
Change-Id: I2aca36307d88c26905d860ec29417ec68c6037cc
Bug: chromium:796479, chromium:729727, chromium:696603, chromium:543625, chromium:414254
Reviewed-on: https://skia-review.googlesource.com/156542
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This reverts commit dcc85fc610.
Reason for revert: ANGLE is frequently corrupted, particularly radial_gradient4 and mixershader
Original change's description:
> Implement an explicit binary search-based analytic gradient colorizer
>
> Provides a reasonably flexible fragment processor that defines another
> colorizer implementation for gradients. It can support up to 8
> interpolation intervals (which is 16 colors if every stop is a hard stop
> or 9 colors if every stop is a smooth transition). It
> supports mixtures of hard and smooth stops. It is conditionally compiled
> into versions specific to the interval count (so it can produce up to
> 8 shader variants).
>
> The GrGradientShader controller does not remove the single and dual
> interval colorizers, which are useful specializations of this explicit
> binary search colorizer. Similarly, since it can only handle up to 8
> intervals, the texture colorizer is still used as a fallback.
>
> Currently it does not employ capabilities detection to determine if the
> hardware can support the number of required uniforms, which can become
> substantial for the larger gradient configurations.
>
> Bug: chromium:796479, chromium:729727, chromium:696603, chromium:543625, chromium:414254
> Change-Id: Ia1f735a5019766ae4796cc22964b2913db34b95b
> Reviewed-on: https://skia-review.googlesource.com/155080
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
TBR=bsalomon@google.com,brianosman@google.com,michaelludwig@google.com
Change-Id: I351a387f0528e4c2db2d47ab2e5d6b336991fb98
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:796479, chromium:729727, chromium:696603, chromium:543625, chromium:414254
Reviewed-on: https://skia-review.googlesource.com/156541
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Provides a reasonably flexible fragment processor that defines another
colorizer implementation for gradients. It can support up to 8
interpolation intervals (which is 16 colors if every stop is a hard stop
or 9 colors if every stop is a smooth transition). It
supports mixtures of hard and smooth stops. It is conditionally compiled
into versions specific to the interval count (so it can produce up to
8 shader variants).
The GrGradientShader controller does not remove the single and dual
interval colorizers, which are useful specializations of this explicit
binary search colorizer. Similarly, since it can only handle up to 8
intervals, the texture colorizer is still used as a fallback.
Currently it does not employ capabilities detection to determine if the
hardware can support the number of required uniforms, which can become
substantial for the larger gradient configurations.
Bug: chromium:796479, chromium:729727, chromium:696603, chromium:543625, chromium:414254
Change-Id: Ia1f735a5019766ae4796cc22964b2913db34b95b
Reviewed-on: https://skia-review.googlesource.com/155080
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>