Index: include/gpu/effects/GrAdvancedEquationXferProcessor.h |
diff --git a/include/gpu/effects/GrAdvancedEquationXferProcessor.h b/include/gpu/effects/GrAdvancedEquationXferProcessor.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..223bc9e92656f6ff211119fcd56938f62a4f68a9 |
--- /dev/null |
+++ b/include/gpu/effects/GrAdvancedEquationXferProcessor.h |
@@ -0,0 +1,62 @@ |
+/* |
+ * Copyright 2015 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
+#ifndef GrAdvancedEquationXferProcessor_DEFINED |
+#define GrAdvancedEquationXferProcessor_DEFINED |
+ |
+#include "GrTypes.h" |
+#include "GrXferProcessor.h" |
+ |
+/** |
+ * Provides Xfer processors that implement advanced blend modes in hardware, |
+ * without the need for a dst texture. Can only be used if supported by the GPU. |
+ */ |
+class GrAdvancedEquationXPFactory : public GrXPFactory { |
+public: |
+ static bool IsSupported(const GrContext*, SkXfermode::Mode); |
+ static GrXPFactory* Create(const GrContext*, SkXfermode::Mode); |
+ |
+ bool canTweakAlphaForCoverage() const override; |
+ bool supportsRGBCoverage(GrColor = 0, uint32_t = 0) const override; |
+ |
+ void getInvariantOutput(const GrProcOptInfo&, const GrProcOptInfo&, |
+ GrXPFactory::InvariantOutput* output) const override { |
+ output->fWillBlendWithDst = true; |
+ output->fBlendedColorFlags = 0; |
egdaniel
2015/04/21 18:59:12
I'm assuming there are cases where these are not a
Chris Dalton
2015/04/21 20:39:31
The KHR_blend_equation_advanced extension only add
egdaniel
2015/04/21 20:53:49
Okay that makes sense. Yeah since this is implemen
|
+ } |
+ |
+private: |
+ template<GrBlendEquation> static GrXPFactory* RefFactory(); |
+ |
+ GrAdvancedEquationXPFactory(GrBlendEquation equation); |
+ ~GrAdvancedEquationXPFactory() override; |
+ |
+ GrXferProcessor* onCreateXferProcessor(const GrDrawTargetCaps& caps, |
+ const GrProcOptInfo& colorPOI, |
+ const GrProcOptInfo& coveragePOI, |
+ const GrDeviceCoordTexture* dstCopy) const override; |
+ |
+ bool willReadDstColor(const GrDrawTargetCaps&, const GrProcOptInfo&, |
+ const GrProcOptInfo&) const override { |
+ return false; |
+ } |
+ |
+ bool onIsEqual(const GrXPFactory& xpfBase) const override { |
+ const GrAdvancedEquationXPFactory& xpf = xpfBase.cast<GrAdvancedEquationXPFactory>(); |
+ return fEquation == xpf.fEquation; |
+ } |
+ |
+ const GrBlendEquation fEquation; |
+ SkAutoTUnref<GrXferProcessor> fXferProcessor; |
+ SkAutoTUnref<GrXferProcessor> fXferProcessorWithCoverage; |
+ |
+ GR_DECLARE_XP_FACTORY_TEST; |
+ |
+ typedef GrXPFactory INHERITED; |
+}; |
+ |
+#endif |