| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrXferProcessor_DEFINED | 8 #ifndef GrXferProcessor_DEFINED |
| 9 #define GrXferProcessor_DEFINED | 9 #define GrXferProcessor_DEFINED |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 kIConstA_GrBlendCoeff, //<! one minus constant color alpha | 41 kIConstA_GrBlendCoeff, //<! one minus constant color alpha |
| 42 kS2C_GrBlendCoeff, | 42 kS2C_GrBlendCoeff, |
| 43 kIS2C_GrBlendCoeff, | 43 kIS2C_GrBlendCoeff, |
| 44 kS2A_GrBlendCoeff, | 44 kS2A_GrBlendCoeff, |
| 45 kIS2A_GrBlendCoeff, | 45 kIS2A_GrBlendCoeff, |
| 46 | 46 |
| 47 kTotalGrBlendCoeffCount | 47 kTotalGrBlendCoeffCount |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 /** | 50 /** |
| 51 * Barriers for blending. When a shader reads the dst directly, an Xfer barrier
is sometimes |
| 52 * required after a pixel has been written, before it can be safely read again. |
| 53 */ |
| 54 enum GrXferBarrierType { |
| 55 kTexture_GrXferBarrierType, //<! Required when a shader reads and renders to
the same texture. |
| 56 }; |
| 57 |
| 58 /** |
| 51 * GrXferProcessor is responsible for implementing the xfer mode that blends the
src color and dst | 59 * GrXferProcessor is responsible for implementing the xfer mode that blends the
src color and dst |
| 52 * color. It does this by emitting fragment shader code and controlling the fixe
d-function blend | 60 * color. It does this by emitting fragment shader code and controlling the fixe
d-function blend |
| 53 * state. The inputs to its shader code are the final computed src color and fra
ctional pixel | 61 * state. The inputs to its shader code are the final computed src color and fra
ctional pixel |
| 54 * coverage. The GrXferProcessor's shader code writes the fragment shader output
color that goes | 62 * coverage. The GrXferProcessor's shader code writes the fragment shader output
color that goes |
| 55 * into the fixed-function blend. When dual-source blending is available, it may
also write a | 63 * into the fixed-function blend. When dual-source blending is available, it may
also write a |
| 56 * seconday fragment shader output color. When allowed by the backend API, the G
rXferProcessor may | 64 * seconday fragment shader output color. When allowed by the backend API, the G
rXferProcessor may |
| 57 * read the destination color. The GrXferProcessor is responsible for setting th
e blend coefficients | 65 * read the destination color. The GrXferProcessor is responsible for setting th
e blend coefficients |
| 58 * and blend constant color. | 66 * and blend constant color. |
| 59 * | 67 * |
| 60 * A GrXferProcessor is never installed directly into our draw state, but instea
d is created from a | 68 * A GrXferProcessor is never installed directly into our draw state, but instea
d is created from a |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 * overrideColor will be the required value that should be passed into the X
P. | 125 * overrideColor will be the required value that should be passed into the X
P. |
| 118 * A caller who calls this function on a XP is required to honor the returne
d OptFlags | 126 * A caller who calls this function on a XP is required to honor the returne
d OptFlags |
| 119 * and color values for its draw. | 127 * and color values for its draw. |
| 120 */ | 128 */ |
| 121 virtual OptFlags getOptimizations(const GrProcOptInfo& colorPOI, | 129 virtual OptFlags getOptimizations(const GrProcOptInfo& colorPOI, |
| 122 const GrProcOptInfo& coveragePOI, | 130 const GrProcOptInfo& coveragePOI, |
| 123 bool doesStencilWrite, | 131 bool doesStencilWrite, |
| 124 GrColor* overrideColor, | 132 GrColor* overrideColor, |
| 125 const GrDrawTargetCaps& caps) = 0; | 133 const GrDrawTargetCaps& caps) = 0; |
| 126 | 134 |
| 135 /** |
| 136 * Returns whether this XP will require an Xfer barrier on the given rt. If
true, outBarrierType |
| 137 * is updated to contain the type of barrier needed. |
| 138 */ |
| 139 virtual bool willNeedXferBarrier(const GrRenderTarget* rt, |
| 140 const GrDrawTargetCaps& caps, |
| 141 GrXferBarrierType* outBarrierType) const; |
| 142 |
| 127 struct BlendInfo { | 143 struct BlendInfo { |
| 128 GrBlendCoeff fSrcBlend; | 144 GrBlendCoeff fSrcBlend; |
| 129 GrBlendCoeff fDstBlend; | 145 GrBlendCoeff fDstBlend; |
| 130 GrColor fBlendConstant; | 146 GrColor fBlendConstant; |
| 131 bool fWriteColor; | 147 bool fWriteColor; |
| 132 }; | 148 }; |
| 133 | 149 |
| 134 void getBlendInfo(BlendInfo* blendInfo) const { | 150 void getBlendInfo(BlendInfo* blendInfo) const { |
| 135 blendInfo->fSrcBlend = kOne_GrBlendCoeff; | 151 blendInfo->fSrcBlend = kOne_GrBlendCoeff; |
| 136 blendInfo->fDstBlend = kZero_GrBlendCoeff; | 152 blendInfo->fDstBlend = kZero_GrBlendCoeff; |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 enum { | 337 enum { |
| 322 kIllegalXPFClassID = 0, | 338 kIllegalXPFClassID = 0, |
| 323 }; | 339 }; |
| 324 static int32_t gCurrXPFClassID; | 340 static int32_t gCurrXPFClassID; |
| 325 | 341 |
| 326 typedef GrProgramElement INHERITED; | 342 typedef GrProgramElement INHERITED; |
| 327 }; | 343 }; |
| 328 | 344 |
| 329 #endif | 345 #endif |
| 330 | 346 |
| OLD | NEW |