| Index: include/gpu/GrXferProcessor.h
|
| diff --git a/include/gpu/GrXferProcessor.h b/include/gpu/GrXferProcessor.h
|
| index 12042d3f74617beca61710e19f1a75bccdf18aa7..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) {
|
| + return equation > kLastBasicGrBlendEquation;
|
| +}
|
| +
|
| +/**
|
| * Coeffecients for alpha-blending.
|
| */
|
| enum GrBlendCoeff {
|
| @@ -48,6 +85,15 @@ enum GrBlendCoeff {
|
| };
|
|
|
| /**
|
| + * Barriers for blending. When a shader reads the dst directly, an Xfer barrier is sometimes
|
| + * required after a pixel has been written, before it can be safely read again.
|
| + */
|
| +enum GrXferBarrierType {
|
| + kTexture_GrXferBarrierType, //<! Required when a shader reads and renders to the same texture.
|
| + kBlend_GrXferBarrierType, //<! Required by certain blend extensions.
|
| +};
|
| +
|
| +/**
|
| * GrXferProcessor is responsible for implementing the xfer mode that blends the src color and dst
|
| * color. It does this by emitting fragment shader code and controlling the fixed-function blend
|
| * state. The inputs to its shader code are the final computed src color and fractional pixel
|
| @@ -124,14 +170,24 @@ public:
|
| GrColor* overrideColor,
|
| const GrDrawTargetCaps& caps) = 0;
|
|
|
| + /**
|
| + * Returns whether this XP will require an Xfer barrier on the given rt. If true, outBarrierType
|
| + * is updated to contain the type of barrier needed.
|
| + */
|
| + virtual bool willNeedXferBarrier(const GrRenderTarget* rt,
|
| + const GrDrawTargetCaps& caps,
|
| + 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;
|
|
|