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

Side by Side Diff: include/gpu/GrXferProcessor.h

Issue 787233003: Add XP to handle the cases where we disable color write. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 6 years 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 unified diff | Download patch
« no previous file with comments | « gyp/gpu.gypi ('k') | include/gpu/effects/GrPorterDuffXferProcessor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 colorWriteDisabled once colorWriteDisabled is its o wn XP.
90 virtual OptFlags getOptimizations(const GrProcOptInfo& colorPOI, 89 virtual OptFlags getOptimizations(const GrProcOptInfo& colorPOI,
91 const GrProcOptInfo& coveragePOI, 90 const GrProcOptInfo& coveragePOI,
92 bool colorWriteDisabled,
93 bool doesStencilWrite, 91 bool doesStencilWrite,
94 GrColor* overrideColor, 92 GrColor* overrideColor,
95 const GrDrawTargetCaps& caps) = 0; 93 const GrDrawTargetCaps& caps) = 0;
96 94
97 struct BlendInfo { 95 struct BlendInfo {
96 BlendInfo() : fWriteColor(true) {}
97
98 GrBlendCoeff fSrcBlend; 98 GrBlendCoeff fSrcBlend;
99 GrBlendCoeff fDstBlend; 99 GrBlendCoeff fDstBlend;
100 GrColor fBlendConstant; 100 GrColor fBlendConstant;
101 bool fWriteColor;
101 }; 102 };
102 103
103 virtual void getBlendInfo(BlendInfo* blendInfo) const = 0; 104 virtual void getBlendInfo(BlendInfo* blendInfo) const = 0;
104 105
105 /** Will this prceossor read the destination pixel value? */ 106 /** Will this prceossor read the destination pixel value? */
106 bool willReadDstColor() const { return fWillReadDstColor; } 107 bool willReadDstColor() const { return fWillReadDstColor; }
107 108
108 /** 109 /**
109 * Returns whether or not this xferProcossor will set a secondary output to be used with dual 110 * Returns whether or not this xferProcossor will set a secondary output to be used with dual
110 * source blending. 111 * source blending.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 virtual bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlag s) const = 0; 170 virtual bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlag s) const = 0;
170 171
171 /** 172 /**
172 * Depending on color blend mode requested it may or may not be possible to correctly blend with 173 * Depending on color blend mode requested it may or may not be possible to correctly blend with
173 * fractional pixel coverage generated by the fragment shader. 174 * fractional pixel coverage generated by the fragment shader.
174 * 175 *
175 * This function considers the known color and coverage input into the xfer processor and 176 * This function considers the known color and coverage input into the xfer processor and
176 * certain state information (colorWriteDisabled) to determine whether 177 * certain state information (colorWriteDisabled) to determine whether
177 * coverage can be handled correctly. 178 * coverage can be handled correctly.
178 */ 179 */
179 // TODO: remove need for colorWriteDisabled once colorWriteDisabled is its o wn XP. 180 virtual bool canApplyCoverage(const GrProcOptInfo& colorPOI,
180 virtual bool canApplyCoverage(const GrProcOptInfo& colorPOI, const GrProcOpt Info& coveragePOI, 181 const GrProcOptInfo& coveragePOI) const = 0;
181 bool colorWriteDisabled) const = 0;
182 182
183 183
184 struct InvariantOutput { 184 struct InvariantOutput {
185 bool fWillBlendWithDst; 185 bool fWillBlendWithDst;
186 GrColor fBlendedColor; 186 GrColor fBlendedColor;
187 uint32_t fBlendedColorFlags; 187 uint32_t fBlendedColorFlags;
188 }; 188 };
189 189
190 /** 190 /**
191 * This function returns known information about the output of the xfer proc essor produced by 191 * This function returns known information about the output of the xfer proc essor produced by
192 * this xp factory. The invariant color information returned by this functio n refers to the 192 * this xp factory. The invariant color information returned by this functio n refers to the
193 * final color produced after all blending. 193 * final color produced after all blending.
194 */ 194 */
195 // TODO: remove need for colorWriteDisabled once only XP can read dst.
196 virtual void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcO ptInfo& coveragePOI, 195 virtual void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcO ptInfo& coveragePOI,
197 bool colorWriteDisabled, InvariantOutput*) c onst = 0; 196 InvariantOutput*) const = 0;
198 197
199 /** 198 /**
200 * Determines whether multiplying the computed per-pixel color by the pixel' s fractional 199 * Determines whether multiplying the computed per-pixel color by the pixel' s fractional
201 * coverage before the blend will give the correct final destination color. In general it 200 * coverage before the blend will give the correct final destination color. In general it
202 * will not as coverage is applied after blending. 201 * will not as coverage is applied after blending.
203 */ 202 */
204 virtual bool canTweakAlphaForCoverage() const = 0; 203 virtual bool canTweakAlphaForCoverage() const = 0;
205 204
205 /**
206 * Returns true if the XP generated by this factory will read dst.
207 */
208 // TODO: Currently this function must also check if the color/coverage stage s read dst.
209 // Once only XP's can read dst we can remove the ProcOptInfo's from th is function.
210 virtual bool willReadDst(const GrProcOptInfo& colorPOI,
211 const GrProcOptInfo& coveragePOI) const = 0;
212
206 bool isEqual(const GrXPFactory& that) const { 213 bool isEqual(const GrXPFactory& that) const {
207 if (this->classID() != that.classID()) { 214 if (this->classID() != that.classID()) {
208 return false; 215 return false;
209 } 216 }
210 return this->onIsEqual(that); 217 return this->onIsEqual(that);
211 } 218 }
212 219
213 /** 220 /**
214 * Helper for down-casting to a GrXPFactory subclass 221 * Helper for down-casting to a GrXPFactory subclass
215 */ 222 */
(...skipping 29 matching lines...) Expand all
245 enum { 252 enum {
246 kIllegalXPFClassID = 0, 253 kIllegalXPFClassID = 0,
247 }; 254 };
248 static int32_t gCurrXPFClassID; 255 static int32_t gCurrXPFClassID;
249 256
250 typedef GrProgramElement INHERITED; 257 typedef GrProgramElement INHERITED;
251 }; 258 };
252 259
253 #endif 260 #endif
254 261
OLDNEW
« no previous file with comments | « gyp/gpu.gypi ('k') | include/gpu/effects/GrPorterDuffXferProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698