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

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: Addressed comments Created 5 years, 8 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
Index: include/gpu/GrXferProcessor.h
diff --git a/include/gpu/GrXferProcessor.h b/include/gpu/GrXferProcessor.h
index 8f1df67dab309ed1340c684b6186127ab4601aff..3eeedcfebf7e5db7c0cf5a3267ac98972a4e4f52 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
+
+ kLastBasicGrBlendEquation = kReverseSubtract_GrBlendEquation,
+
+ // 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
+};
+
+bool constexpr GrBlendEquationIsAdvanced(GrBlendEquation equation) {
Chris Dalton 2015/04/23 16:45:49 Are we allowing C++11-isms yet?
bsalomon 2015/04/23 16:53:33 Some but not all. I'm not sure about the state of
+ return equation > kLastBasicGrBlendEquation;
+}
+
+/**
* 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.
};
/**
@@ -141,13 +179,15 @@ public:
GrXferBarrierType* outBarrierType) const;
struct BlendInfo {
- GrBlendCoeff fSrcBlend;
- GrBlendCoeff fDstBlend;
- GrColor fBlendConstant;
- bool fWriteColor;
+ GrBlendEquation fEquation;
+ GrBlendCoeff fSrcBlend;
+ GrBlendCoeff fDstBlend;
+ GrColor fBlendConstant;
+ bool fWriteColor;
};
void getBlendInfo(BlendInfo* blendInfo) const {
+ blendInfo->fEquation = kAdd_GrBlendEquation;
blendInfo->fSrcBlend = kOne_GrBlendCoeff;
blendInfo->fDstBlend = kZero_GrBlendCoeff;
blendInfo->fBlendConstant = 0;

Powered by Google App Engine
This is Rietveld 408576698