Ethan Nicholas | 7461a4a | 2017-12-21 14:18:01 -0500 | [diff] [blame] | 1 | /* |
Ethan Nicholas | 130fb3f | 2018-02-01 12:14:34 -0500 | [diff] [blame] | 2 | * Copyright 2018 Google Inc. |
Ethan Nicholas | 7461a4a | 2017-12-21 14:18:01 -0500 | [diff] [blame] | 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
Ethan Nicholas | 130fb3f | 2018-02-01 12:14:34 -0500 | [diff] [blame] | 8 | /************************************************************************************************** |
| 9 | *** This file was autogenerated from GrYUVtoRGBEffect.fp; do not modify. |
| 10 | **************************************************************************************************/ |
Ethan Nicholas | 7461a4a | 2017-12-21 14:18:01 -0500 | [diff] [blame] | 11 | #ifndef GrYUVtoRGBEffect_DEFINED |
| 12 | #define GrYUVtoRGBEffect_DEFINED |
| 13 | #include "SkTypes.h" |
Ethan Nicholas | 7461a4a | 2017-12-21 14:18:01 -0500 | [diff] [blame] | 14 | #include "GrFragmentProcessor.h" |
| 15 | #include "GrCoordTransform.h" |
| 16 | class GrYUVtoRGBEffect : public GrFragmentProcessor { |
| 17 | public: |
| 18 | static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> yProxy, |
| 19 | sk_sp<GrTextureProxy> uProxy, |
| 20 | sk_sp<GrTextureProxy> vProxy, |
Ethan Nicholas | 7461a4a | 2017-12-21 14:18:01 -0500 | [diff] [blame] | 21 | SkYUVColorSpace colorSpace, bool nv12); |
Robert Phillips | ba5c439 | 2018-07-25 12:37:14 -0400 | [diff] [blame] | 22 | SkString dumpInfo() const override; |
Michael Ludwig | a427559 | 2018-08-31 10:52:47 -0400 | [diff] [blame^] | 23 | const SkMatrix44& ySamplerTransform() const { return fYSamplerTransform; } |
| 24 | const SkMatrix44& uSamplerTransform() const { return fUSamplerTransform; } |
| 25 | const SkMatrix44& vSamplerTransform() const { return fVSamplerTransform; } |
| 26 | const SkMatrix44& colorSpaceMatrix() const { return fColorSpaceMatrix; } |
| 27 | const bool& nv12() const { return fNv12; } |
Ethan Nicholas | 7461a4a | 2017-12-21 14:18:01 -0500 | [diff] [blame] | 28 | static std::unique_ptr<GrFragmentProcessor> Make( |
| 29 | sk_sp<GrTextureProxy> ySampler, SkMatrix44 ySamplerTransform, |
| 30 | sk_sp<GrTextureProxy> uSampler, SkMatrix44 uSamplerTransform, |
| 31 | sk_sp<GrTextureProxy> vSampler, SkMatrix44 vSamplerTransform, |
| 32 | SkMatrix44 colorSpaceMatrix, bool nv12, GrSamplerState uvSamplerParams) { |
| 33 | return std::unique_ptr<GrFragmentProcessor>(new GrYUVtoRGBEffect( |
| 34 | ySampler, ySamplerTransform, uSampler, uSamplerTransform, vSampler, |
| 35 | vSamplerTransform, colorSpaceMatrix, nv12, uvSamplerParams)); |
| 36 | } |
| 37 | GrYUVtoRGBEffect(const GrYUVtoRGBEffect& src); |
| 38 | std::unique_ptr<GrFragmentProcessor> clone() const override; |
| 39 | const char* name() const override { return "YUVtoRGBEffect"; } |
| 40 | |
| 41 | private: |
| 42 | GrYUVtoRGBEffect(sk_sp<GrTextureProxy> ySampler, SkMatrix44 ySamplerTransform, |
| 43 | sk_sp<GrTextureProxy> uSampler, SkMatrix44 uSamplerTransform, |
| 44 | sk_sp<GrTextureProxy> vSampler, SkMatrix44 vSamplerTransform, |
| 45 | SkMatrix44 colorSpaceMatrix, bool nv12, GrSamplerState uvSamplerParams) |
| 46 | : INHERITED(kGrYUVtoRGBEffect_ClassID, kNone_OptimizationFlags) |
| 47 | , fYSampler(std::move(ySampler)) |
| 48 | , fYSamplerTransform(ySamplerTransform) |
| 49 | , fUSampler(std::move(uSampler), uvSamplerParams) |
| 50 | , fUSamplerTransform(uSamplerTransform) |
| 51 | , fVSampler(std::move(vSampler), uvSamplerParams) |
| 52 | , fVSamplerTransform(vSamplerTransform) |
| 53 | , fColorSpaceMatrix(colorSpaceMatrix) |
| 54 | , fNv12(nv12) |
| 55 | , fYSamplerCoordTransform(ySamplerTransform, fYSampler.proxy()) |
| 56 | , fUSamplerCoordTransform(uSamplerTransform, fUSampler.proxy()) |
| 57 | , fVSamplerCoordTransform(vSamplerTransform, fVSampler.proxy()) { |
Brian Salomon | f7dcd76 | 2018-07-30 14:48:15 -0400 | [diff] [blame] | 58 | this->setTextureSamplerCnt(3); |
Ethan Nicholas | 7461a4a | 2017-12-21 14:18:01 -0500 | [diff] [blame] | 59 | this->addCoordTransform(&fYSamplerCoordTransform); |
| 60 | this->addCoordTransform(&fUSamplerCoordTransform); |
| 61 | this->addCoordTransform(&fVSamplerCoordTransform); |
| 62 | } |
| 63 | GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; |
| 64 | void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; |
| 65 | bool onIsEqual(const GrFragmentProcessor&) const override; |
Brian Salomon | f7dcd76 | 2018-07-30 14:48:15 -0400 | [diff] [blame] | 66 | const TextureSampler& onTextureSampler(int) const override; |
Ethan Nicholas | 7461a4a | 2017-12-21 14:18:01 -0500 | [diff] [blame] | 67 | GR_DECLARE_FRAGMENT_PROCESSOR_TEST |
| 68 | TextureSampler fYSampler; |
| 69 | SkMatrix44 fYSamplerTransform; |
| 70 | TextureSampler fUSampler; |
| 71 | SkMatrix44 fUSamplerTransform; |
| 72 | TextureSampler fVSampler; |
| 73 | SkMatrix44 fVSamplerTransform; |
| 74 | SkMatrix44 fColorSpaceMatrix; |
| 75 | bool fNv12; |
| 76 | GrCoordTransform fYSamplerCoordTransform; |
| 77 | GrCoordTransform fUSamplerCoordTransform; |
| 78 | GrCoordTransform fVSamplerCoordTransform; |
| 79 | typedef GrFragmentProcessor INHERITED; |
| 80 | }; |
| 81 | #endif |