Reland "Switch sRGB color filter to use GrColorSpaceXformEffect"
This reverts commit 81c8f4b802
.
Other CLs have fixed the precision issue on Bifrost GPUs.
Change-Id: I155a33f7e11e56a8912ae1467d9e2acafab52d6f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279042
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
0e7834f6e9
commit
b4c806c65e
@ -20,6 +20,7 @@
|
||||
#include "src/core/SkWriteBuffer.h"
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "src/gpu/GrColorSpaceXform.h"
|
||||
#include "src/gpu/GrFragmentProcessor.h"
|
||||
#include "src/gpu/effects/generated/GrMixerEffect.h"
|
||||
#endif
|
||||
@ -222,6 +223,7 @@ public:
|
||||
std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(GrRecordingContext*,
|
||||
const GrColorInfo&) const override {
|
||||
// wish our caller would let us know if our input was opaque...
|
||||
#if defined(SK_USE_LEGACY_SRGB_COLOR_FILTER)
|
||||
GrSRGBEffect::Alpha alpha = GrSRGBEffect::Alpha::kPremul;
|
||||
switch (fDir) {
|
||||
case Direction::kLinearToSRGB:
|
||||
@ -229,6 +231,17 @@ public:
|
||||
case Direction::kSRGBToLinear:
|
||||
return GrSRGBEffect::Make(GrSRGBEffect::Mode::kSRGBToLinear, alpha);
|
||||
}
|
||||
#else
|
||||
SkAlphaType at = kPremul_SkAlphaType;
|
||||
switch (fDir) {
|
||||
case Direction::kLinearToSRGB:
|
||||
return GrColorSpaceXformEffect::Make(sk_srgb_linear_singleton(), at,
|
||||
sk_srgb_singleton(), at);
|
||||
case Direction::kSRGBToLinear:
|
||||
return GrColorSpaceXformEffect::Make(sk_srgb_singleton(), at,
|
||||
sk_srgb_linear_singleton(), at);
|
||||
}
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
@ -81,7 +81,12 @@ SkTArray<GrXPFactoryTestFactory*, true>* GrXPFactoryTestFactory::GetFactories()
|
||||
* we verify the count is as expected. If a new factory is added, then these numbers must be
|
||||
* manually adjusted.
|
||||
*/
|
||||
#if defined(SK_USE_LEGACY_SRGB_COLOR_FILTER)
|
||||
static const int kFPFactoryCount = 36;
|
||||
#else
|
||||
static const int kFPFactoryCount = 35;
|
||||
#endif
|
||||
|
||||
static const int kGPFactoryCount = 14;
|
||||
static const int kXPFactoryCount = 4;
|
||||
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
|
||||
#if defined(SK_USE_LEGACY_SRGB_COLOR_FILTER)
|
||||
|
||||
class GrGLSRGBEffect : public GrGLSLFragmentProcessor {
|
||||
public:
|
||||
void emitCode(EmitArgs& args) override {
|
||||
@ -134,3 +136,4 @@ GrGLSLFragmentProcessor* GrSRGBEffect::onCreateGLSLInstance() const {
|
||||
return new GrGLSRGBEffect;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
#include "src/gpu/GrFragmentProcessor.h"
|
||||
|
||||
#if defined(SK_USE_LEGACY_SRGB_COLOR_FILTER)
|
||||
|
||||
class GrSRGBEffect : public GrFragmentProcessor {
|
||||
public:
|
||||
enum class Mode {
|
||||
@ -54,3 +56,5 @@ private:
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user