Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: include/gpu/GrXferProcessor.h

Issue 1037123003: Implement support for KHR_blend_equation_advanced (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_zzz2_barriers
Patch Set: Compiler warning Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrXferProcessor.h
diff --git a/include/gpu/GrXferProcessor.h b/include/gpu/GrXferProcessor.h
index 5f53188e9565416998c09197f904195f92d0126a..7c07b8027d41593cc4de73e7c37d4afa5e5f6309 100644
--- a/include/gpu/GrXferProcessor.h
+++ b/include/gpu/GrXferProcessor.h
@@ -20,6 +20,43 @@ class GrGLXferProcessor;
class GrProcOptInfo;
/**
+ * Equations for alpha-blending.
+ */
+enum GrBlendEquation {
+ kInvalid_GrBlendEquation = -1,
+
+ // Basic blend equations.
+ kAdd_GrBlendEquation, //<! Cs*S + Cd*D
+ kSubtract_GrBlendEquation, //<! Cs*S - Cd*D
+ kReverseSubtract_GrBlendEquation, //<! Cd*D - Cs*S
+
+ // Advanced blend equations. These are described in the SVG and PDF specs.
+ kScreen_GrBlendEquation,
+ kOverlay_GrBlendEquation,
+ kDarken_GrBlendEquation,
+ kLighten_GrBlendEquation,
+ kColorDodge_GrBlendEquation,
+ kColorBurn_GrBlendEquation,
+ kHardLight_GrBlendEquation,
+ kSoftLight_GrBlendEquation,
+ kDifference_GrBlendEquation,
+ kExclusion_GrBlendEquation,
+ kMultiply_GrBlendEquation,
+ kHSLHue_GrBlendEquation,
+ kHSLSaturation_GrBlendEquation,
+ kHSLColor_GrBlendEquation,
+ kHSLLuminosity_GrBlendEquation,
+
+ kTotalGrBlendEquationCount,
+
+ kFirstAdvancedGrBlendEquation = kScreen_GrBlendEquation
+};
+
+inline bool GrBlendEquationIsAdvanced(GrBlendEquation equation) {
+ return equation >= kFirstAdvancedGrBlendEquation;
+}
+
+/**
* Coeffecients for alpha-blending.
*/
enum GrBlendCoeff {
@@ -53,6 +90,7 @@ enum GrBlendCoeff {
*/
enum GrXferBarrierType {
kTexture_GrXferBarrierType, //<! Required when a shader reads and renders to the same texture.
+ kBlend_GrXferBarrierType, //<! Required by certain blend extensions.
};
/**
@@ -142,16 +180,18 @@ public:
struct BlendInfo {
void reset() {
+ fEquation = kAdd_GrBlendEquation;
fSrcBlend = kOne_GrBlendCoeff;
fDstBlend = kZero_GrBlendCoeff;
fBlendConstant = 0;
fWriteColor = true;
}
- GrBlendCoeff fSrcBlend;
- GrBlendCoeff fDstBlend;
- GrColor fBlendConstant;
- bool fWriteColor;
+ GrBlendEquation fEquation;
+ GrBlendCoeff fSrcBlend;
+ GrBlendCoeff fDstBlend;
+ GrColor fBlendConstant;
+ bool fWriteColor;
};
void getBlendInfo(BlendInfo* blendInfo) const {
@@ -219,6 +259,16 @@ private:
GrProcessorKeyBuilder* b) const = 0;
/**
+ * If not using a texture barrier, retrieves whether the subclass will require a different type
+ * of barrier.
+ */
+ virtual bool onWillNeedXferBarrier(const GrRenderTarget*,
+ const GrDrawTargetCaps&,
+ GrXferBarrierType* outBarrierType SK_UNUSED) const {
+ return false;
+ }
+
+ /**
* Retrieves the hardware blend state required by this Xfer processor. The BlendInfo struct
* comes initialized to default values, so the Xfer processor only needs to set the state it
* needs. It may not even need to override this method at all.
« no previous file with comments | « no previous file | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698