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