Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2014 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #ifndef GrProcOptInfo_DEFINED | |
| 9 #define GrProcOptInfo_DEFINED | |
| 10 | |
| 11 #include "GrColor.h" | |
| 12 #include "GrInvariantOutput.h" | |
| 13 | |
| 14 class GrFragmentStage; | |
| 15 class GrGeometryProcessor; | |
| 16 | |
| 17 class GrProcOptInfo { | |
|
bsalomon
2014/11/13 15:09:19
GrProcOptInfo is gathers invariant data from a set
egdaniel
2014/11/13 18:34:16
Done.
| |
| 18 public: | |
| 19 GrProcOptInfo() | |
| 20 : fInOut(0, static_cast<GrColorComponentFlags>(0), false), | |
| 21 fFirstEffectStageIndex(0), | |
|
bsalomon
2014/11/13 15:09:19
style is to
: fPut()
, fThe()
, fCommas()
, fUnd
egdaniel
2014/11/13 18:34:16
Ahh I understand my error, just like TheColon I sh
| |
| 22 fInputColorIsUsed(true), | |
| 23 fInputColor(0), | |
| 24 fRemoveVertexAttrib(false), | |
| 25 fReadsDst(false) {} | |
| 26 | |
| 27 void calcWithInitialValues(const GrFragmentStage*, int stageCount, GrColor s tartColor, | |
| 28 GrColorComponentFlags flags, bool areCoverageStag es, | |
| 29 const GrGeometryProcessor* gp = NULL); | |
| 30 | |
| 31 bool isSolidWhite() const { return fInOut.isSolidWhite(); } | |
| 32 bool isOpaque() const { return fInOut.isOpaque(); } | |
| 33 | |
| 34 GrColor color() const { return fInOut.color(); } | |
| 35 uint8_t validFlags() const { return fInOut.validFlags(); } | |
| 36 | |
| 37 /** | |
| 38 * Returns the index of the first effective color stage. If an intermediate stage doesn't read | |
| 39 * its input or has a known output, then we can ignore all earlier stages si nce they will not | |
| 40 * affect the final output. Thus the first effective stage index is the inde x to the first stage | |
| 41 * that will have an effect on the final output. | |
| 42 * | |
| 43 * If the firstEffectiveStageIndex is used, corresponding values from inputC olorIsUsed(), | |
|
bsalomon
2014/11/13 15:09:19
"If stages before the first effective stage are re
egdaniel
2014/11/13 18:34:16
Done.
| |
| 44 * inputColorToEffectiveStage(), removeVertexAttribs(), and readsDst() must be used when setting | |
| 45 * up the draw to ensure correct drawing. | |
| 46 */ | |
| 47 int firstEffectiveStageIndex() const { return fFirstEffectStageIndex; } | |
| 48 | |
| 49 /** | |
| 50 * This value returns whether or not an input will be read by the starting s tage. The starting | |
|
bsalomon
2014/11/13 15:09:19
Maybe simplify to "True if the first effective sta
egdaniel
2014/11/13 18:34:16
Done.
| |
| 51 * stage is assumed to be that which is indexed by firstEffectiveStageIndex( ). | |
| 52 */ | |
| 53 bool inputColorIsUsed() const { return fInputColorIsUsed; } | |
| 54 | |
| 55 /** | |
| 56 * This returns the color that should be inputed into the starting stage. Th is value is only | |
|
bsalomon
2014/11/13 15:09:19
"If input color is used and per-vertex colors are
egdaniel
2014/11/13 18:34:16
Done.
| |
| 57 * valid if inputColorIsUsed is true and we are not using vertex attribs for color/coverage | |
| 58 * input. The starting stage is assumed to be that which is indexed by | |
| 59 * firstEffectiveStageIndex(). | |
| 60 */ | |
| 61 GrColor inputColorToEffectiveStage() const { return fInputColor; } | |
| 62 | |
| 63 /** | |
| 64 * Returns whether or not the client should remove corresponding color/cover age vertex attribs | |
| 65 * for the given set of stages. If we remove stages because of a known outpu t at some | |
| 66 * intermediate stage, then we want to feed that known output into the start of its following | |
| 67 * stage. Thus we want to make sure we don't use color/coverage vertex attri bs for this reduced | |
| 68 * set of stages. | |
| 69 */ | |
|
bsalomon
2014/11/13 15:09:19
"Given the set of optimizations determined by GrPr
egdaniel
2014/11/13 18:34:16
Done.
| |
| 70 bool removeVertexAttrib() const { return fRemoveVertexAttrib; } | |
| 71 | |
| 72 /** | |
| 73 * Returns whether or not any of the stages, begining with start stage, will read the dst. The | |
| 74 * start stage is determined by firstEffectiveStageIndex() | |
| 75 */ | |
| 76 bool readsDst() const { return fReadsDst; } | |
|
bsalomon
2014/11/13 15:09:19
"Returns true if any of the stages preserved by Gr
egdaniel
2014/11/13 18:34:16
Done.
| |
| 77 | |
| 78 private: | |
| 79 GrInvariantOutput fInOut; | |
| 80 int fFirstEffectStageIndex; | |
| 81 bool fInputColorIsUsed; | |
| 82 GrColor fInputColor; | |
| 83 bool fRemoveVertexAttrib; | |
| 84 bool fReadsDst; | |
| 85 }; | |
| 86 | |
| 87 #endif | |
| OLD | NEW |