diff options
author | 2017-07-19 15:39:56 +0000 | |
---|---|---|
committer | 2017-07-19 16:07:34 +0000 | |
commit | 0c15ae82f0d5b5356f7650b78d749c09b3bc0403 (patch) | |
tree | 8b612e6fc4efec9d02d91e998ed58bd04612b230 /src/gpu/effects/GrDitherEffect.h | |
parent | dcbb9d90db0e07b7a3625bcdab3af11ab44c4cfe (diff) |
Revert "Revert "Revert "Revert "Improvements to GPU dither.""""
This reverts commit f2290cb924640dfd439458a1ee5e61b31b08850f.
Reason for revert: SPIRV codegen fix has landed
Original change's description:
> Revert "Revert "Revert "Improvements to GPU dither."""
>
> This reverts commit 0f01b2e8b5e3119e91886a2f7ec772a915d97a8c.
>
> Reason for revert: <INSERT REASONING HERE>
>
> Original change's description:
> > Revert "Revert "Improvements to GPU dither.""
> >
> > This reverts commit 38fb308f3156aab1e42a61d77d08906a06263879.
> >
> > Reason for revert: Reland with SkSL caps fix for vulkan
> >
> > Original change's description:
> > > Revert "Improvements to GPU dither."
> > >
> > > This reverts commit 1806e33e6a09b1361de4925d32389a01e0e2c7e7.
> > >
> > > Reason for revert: <INSERT REASONING HERE>
> > >
> > > Original change's description:
> > > > Improvements to GPU dither.
> > > >
> > > > 1) Makes the range of the offset dependent on the config.
> > > >
> > > > 2) Uses an ordered dither on GPUs that support integers in shaders.
> > > >
> > > > 3) Enables dithering for all paints with dither flag when the color type of the dst is 4444
> > > >
> > > > 4) Dithers r,g,b and clamps to 0,a rather than dithering all four channels (same as CPU backend).
> > > >
> > > > Bug: skia:
> > > > Change-Id: Ie22c3adc38c6d1dbbcd97e4b7d16fc843e392c2e
> > > > Reviewed-on: https://skia-review.googlesource.com/23485
> > > > Commit-Queue: Brian Salomon <bsalomon@google.com>
> > > > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > >
> > > TBR=bsalomon@google.com,robertphillips@google.com
> > >
> > > Change-Id: Ie82e88bd9032bf8eee745d32d9b57c335a8997c9
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Bug: skia:
> > > Reviewed-on: https://skia-review.googlesource.com/24325
> > > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > > Commit-Queue: Brian Salomon <bsalomon@google.com>
> >
> > TBR=bsalomon@google.com,robertphillips@google.com
> >
> > Change-Id: Ic38ac276c8b88b8d993a29d1fcbfe37e84becd2a
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Bug: skia:
> > Reviewed-on: https://skia-review.googlesource.com/24282
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
>
> TBR=bsalomon@google.com,robertphillips@google.com
>
> Change-Id: I5ce47b06a1b451942faf9066b1a45a716b1b3f3c
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:
> Reviewed-on: https://skia-review.googlesource.com/24480
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com,robertphillips@google.com
Change-Id: I112df51494bc3cc832fde9c22a6532082df85a81
Reviewed-on: https://skia-review.googlesource.com/24285
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/effects/GrDitherEffect.h')
-rw-r--r-- | src/gpu/effects/GrDitherEffect.h | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/src/gpu/effects/GrDitherEffect.h b/src/gpu/effects/GrDitherEffect.h index a996ad94c2..63c0df7eb2 100644 --- a/src/gpu/effects/GrDitherEffect.h +++ b/src/gpu/effects/GrDitherEffect.h @@ -18,19 +18,47 @@ #include "effects/GrProxyMove.h" class GrDitherEffect : public GrFragmentProcessor { public: - static sk_sp<GrFragmentProcessor> Make() { - return sk_sp<GrFragmentProcessor>(new GrDitherEffect()); + int rangeType() const { return fRangeType; } + + static sk_sp<GrFragmentProcessor> Make(GrPixelConfig dstConfig) { + int rangeType; + switch (dstConfig) { + case kGray_8_GrPixelConfig: + case kRGBA_8888_GrPixelConfig: + case kBGRA_8888_GrPixelConfig: + case kSRGBA_8888_GrPixelConfig: + case kSBGRA_8888_GrPixelConfig: + rangeType = 0; + break; + case kRGB_565_GrPixelConfig: + rangeType = 1; + break; + case kRGBA_4444_GrPixelConfig: + rangeType = 2; + break; + case kUnknown_GrPixelConfig: + case kAlpha_half_GrPixelConfig: + case kRGBA_8888_sint_GrPixelConfig: + case kRGBA_float_GrPixelConfig: + case kRG_float_GrPixelConfig: + case kRGBA_half_GrPixelConfig: + case kAlpha_8_GrPixelConfig: + return nullptr; + } + return sk_sp<GrFragmentProcessor>(new GrDitherEffect(rangeType)); } const char* name() const override { return "DitherEffect"; } private: - GrDitherEffect() - : INHERITED(kNone_OptimizationFlags) { + GrDitherEffect(int rangeType) + : INHERITED(kNone_OptimizationFlags) + , fRangeType(rangeType) { this->initClassID<GrDitherEffect>(); } GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; void onGetGLSLProcessorKey(const GrShaderCaps&,GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; GR_DECLARE_FRAGMENT_PROCESSOR_TEST + int fRangeType; typedef GrFragmentProcessor INHERITED; }; #endif |