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

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

Issue 814933002: Add an InvariantOutput for the XPF. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 * fractional pixel coverage generated by the fragment shader. 173 * fractional pixel coverage generated by the fragment shader.
174 * 174 *
175 * This function considers the known color and coverage input into the xfer processor and 175 * This function considers the known color and coverage input into the xfer processor and
176 * certain state information (colorWriteDisabled) to determine whether 176 * certain state information (colorWriteDisabled) to determine whether
177 * coverage can be handled correctly. 177 * coverage can be handled correctly.
178 */ 178 */
179 // TODO: remove need for colorWriteDisabled once colorWriteDisabled is its o wn XP. 179 // TODO: remove need for colorWriteDisabled once colorWriteDisabled is its o wn XP.
180 virtual bool canApplyCoverage(const GrProcOptInfo& colorPOI, const GrProcOpt Info& coveragePOI, 180 virtual bool canApplyCoverage(const GrProcOptInfo& colorPOI, const GrProcOpt Info& coveragePOI,
181 bool colorWriteDisabled) const = 0; 181 bool colorWriteDisabled) const = 0;
182 182
183 /** 183
184 * This function returns true if the destination pixel values will be read f or blending during 184 struct InvariantOutput {
185 * draw. 185 bool fWillBlendWithDst;
186 GrColor fBlendedColor;
187 uint32_t fBlendedColorFlags;
188 };
189
190 /**
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
193 * final color produced after all blending.
186 */ 194 */
187 // TODO: remove need for colorWriteDisabled once only XP can read dst. 195 // TODO: remove need for colorWriteDisabled once only XP can read dst.
188 virtual bool willBlendWithDst(const GrProcOptInfo& colorPOI, const GrProcOpt Info& coveragePOI, 196 virtual void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcO ptInfo& coveragePOI,
189 bool colorWriteDisabled) const = 0; 197 bool colorWriteDisabled, InvariantOutput*) c onst = 0;
190 198
191 /** 199 /**
192 * Determines whether multiplying the computed per-pixel color by the pixel' s fractional 200 * Determines whether multiplying the computed per-pixel color by the pixel' s fractional
193 * coverage before the blend will give the correct final destination color. In general it 201 * coverage before the blend will give the correct final destination color. In general it
194 * will not as coverage is applied after blending. 202 * will not as coverage is applied after blending.
195 */ 203 */
196 virtual bool canTweakAlphaForCoverage() const = 0; 204 virtual bool canTweakAlphaForCoverage() const = 0;
197 205
198 virtual bool getOpaqueAndKnownColor(const GrProcOptInfo& colorPOI,
199 const GrProcOptInfo& coveragePOI, GrColo r* solidColor,
200 uint32_t* solidColorKnownComponents) con st = 0;
201
202 bool isEqual(const GrXPFactory& that) const { 206 bool isEqual(const GrXPFactory& that) const {
203 if (this->classID() != that.classID()) { 207 if (this->classID() != that.classID()) {
204 return false; 208 return false;
205 } 209 }
206 return this->onIsEqual(that); 210 return this->onIsEqual(that);
207 } 211 }
208 212
209 /** 213 /**
210 * Helper for down-casting to a GrXPFactory subclass 214 * Helper for down-casting to a GrXPFactory subclass
211 */ 215 */
(...skipping 29 matching lines...) Expand all
241 enum { 245 enum {
242 kIllegalXPFClassID = 0, 246 kIllegalXPFClassID = 0,
243 }; 247 };
244 static int32_t gCurrXPFClassID; 248 static int32_t gCurrXPFClassID;
245 249
246 typedef GrProgramElement INHERITED; 250 typedef GrProgramElement INHERITED;
247 }; 251 };
248 252
249 #endif 253 #endif
250 254
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698