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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 enum OptFlags { | 51 enum OptFlags { |
52 /** | 52 /** |
53 * No optimizations needed | 53 * No optimizations needed |
54 */ | 54 */ |
55 kNone_Opt = 0, | 55 kNone_Opt = 0, |
56 /** | 56 /** |
57 * The draw can be skipped completely. | 57 * The draw can be skipped completely. |
58 */ | 58 */ |
59 kSkipDraw_OptFlag = 0x1, | 59 kSkipDraw_OptFlag = 0x1, |
60 /** | 60 /** |
61 * Clear color stages, remove color vertex attribs, and use input color | 61 * GrXferProcessor will ignore color, thus no need to provide |
62 */ | 62 */ |
63 kClearColorStages_OptFlag = 0x2, | 63 kIgnoreColor_OptFlag = 0x2, |
64 /** | 64 /** |
65 * Clear coverage stages, remove coverage vertex attribs, and use input
coverage | 65 * GrXferProcessor will ignore coverage, thus no need to provide |
66 */ | 66 */ |
67 kClearCoverageStages_OptFlag = 0x4, | 67 kIgnoreCoverage_OptFlag = 0x4, |
68 /** | 68 /** |
69 * Clear color stages and override input color to that returned by getOp
timizations | 69 * Clear color stages and override input color to that returned by getOp
timizations |
70 */ | 70 */ |
71 kOverrideColor_OptFlag = 0x8, | 71 kOverrideColor_OptFlag = 0x8, |
72 /** | 72 /** |
73 * Set CoverageDrawing_StateBit | 73 * Set CoverageDrawing_StateBit |
74 */ | 74 */ |
75 kSetCoverageDrawing_OptFlag = 0x10, | 75 kSetCoverageDrawing_OptFlag = 0x10, |
76 }; | 76 }; |
77 | 77 |
78 GR_DECL_BITFIELD_OPS_FRIENDS(OptFlags); | 78 GR_DECL_BITFIELD_OPS_FRIENDS(OptFlags); |
79 | 79 |
80 /** | 80 /** |
81 * Determines which optimizations (as described by the ptFlags above) can be
performed by | 81 * Determines which optimizations (as described by the ptFlags above) can be
performed by |
82 * the draw with this xfer processor. If this function is called, the xfer p
rocessor may change | 82 * the draw with this xfer processor. If this function is called, the xfer p
rocessor may change |
83 * its state to reflected the given blend optimizations. If the XP needs to
see a specific input | 83 * its state to reflected the given blend optimizations. If the XP needs to
see a specific input |
84 * color to blend correctly, it will set the OverrideColor flag and the outp
ut parameter | 84 * color to blend correctly, it will set the OverrideColor flag and the outp
ut parameter |
85 * overrideColor will be the required value that should be passed into the X
P. | 85 * overrideColor will be the required value that should be passed into the X
P. |
86 * A caller who calls this function on a XP is required to honor the returne
d OptFlags | 86 * A caller who calls this function on a XP is required to honor the returne
d OptFlags |
87 * and color values for its draw. | 87 * and color values for its draw. |
88 */ | 88 */ |
89 // TODO: remove need for isCoverageDrawing once coverageDrawing is its own X
P. | 89 // TODO: remove need for isCoverageDrawing once coverageDrawing is its own X
P. |
90 // TODO: remove need for colorWriteDisabled once colorWriteDisabled is its o
wn XP. | 90 // TODO: remove need for colorWriteDisabled once colorWriteDisabled is its o
wn XP. |
91 virtual OptFlags getOptimizations(const GrProcOptInfo& colorPOI, | 91 virtual OptFlags getOptimizations(const GrProcOptInfo& colorPOI, |
92 const GrProcOptInfo& coveragePOI, | 92 const GrProcOptInfo& coveragePOI, |
93 bool isCoverageDrawing, | 93 bool isCoverageDrawing, |
94 bool colorWriteDisabled, | 94 bool colorWriteDisabled, |
95 bool doesStencilWrite, | 95 bool doesStencilWrite, |
96 GrColor* overrideColor, | 96 GrColor* overrideColor, |
97 uint8_t* overrideCoverage, | |
98 const GrDrawTargetCaps& caps) = 0; | 97 const GrDrawTargetCaps& caps) = 0; |
99 | 98 |
100 struct BlendInfo { | 99 struct BlendInfo { |
101 GrBlendCoeff fSrcBlend; | 100 GrBlendCoeff fSrcBlend; |
102 GrBlendCoeff fDstBlend; | 101 GrBlendCoeff fDstBlend; |
103 GrColor fBlendConstant; | 102 GrColor fBlendConstant; |
104 }; | 103 }; |
105 | 104 |
106 virtual void getBlendInfo(BlendInfo* blendInfo) const = 0; | 105 virtual void getBlendInfo(BlendInfo* blendInfo) const = 0; |
107 | 106 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 enum { | 252 enum { |
254 kIllegalXPFClassID = 0, | 253 kIllegalXPFClassID = 0, |
255 }; | 254 }; |
256 static int32_t gCurrXPFClassID; | 255 static int32_t gCurrXPFClassID; |
257 | 256 |
258 typedef GrProgramElement INHERITED; | 257 typedef GrProgramElement INHERITED; |
259 }; | 258 }; |
260 | 259 |
261 #endif | 260 #endif |
262 | 261 |
OLD | NEW |