Chromium Code Reviews| Index: src/gpu/GrProcOptInfo.h |
| diff --git a/src/gpu/GrProcOptInfo.h b/src/gpu/GrProcOptInfo.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..138b7da11ce2b1a0c86fbffd63e0fd8f67435760 |
| --- /dev/null |
| +++ b/src/gpu/GrProcOptInfo.h |
| @@ -0,0 +1,87 @@ |
| +/* |
| + * Copyright 2014 Google Inc. |
| + * |
| + * Use of this source code is governed by a BSD-style license that can be |
| + * found in the LICENSE file. |
| + */ |
| + |
| +#ifndef GrProcOptInfo_DEFINED |
| +#define GrProcOptInfo_DEFINED |
| + |
| +#include "GrColor.h" |
| +#include "GrInvariantOutput.h" |
| + |
| +class GrFragmentStage; |
| +class GrGeometryProcessor; |
| + |
| +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.
|
| +public: |
| + GrProcOptInfo() |
| + : fInOut(0, static_cast<GrColorComponentFlags>(0), false), |
| + 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
|
| + fInputColorIsUsed(true), |
| + fInputColor(0), |
| + fRemoveVertexAttrib(false), |
| + fReadsDst(false) {} |
| + |
| + void calcWithInitialValues(const GrFragmentStage*, int stageCount, GrColor startColor, |
| + GrColorComponentFlags flags, bool areCoverageStages, |
| + const GrGeometryProcessor* gp = NULL); |
| + |
| + bool isSolidWhite() const { return fInOut.isSolidWhite(); } |
| + bool isOpaque() const { return fInOut.isOpaque(); } |
| + |
| + GrColor color() const { return fInOut.color(); } |
| + uint8_t validFlags() const { return fInOut.validFlags(); } |
| + |
| + /** |
| + * Returns the index of the first effective color stage. If an intermediate stage doesn't read |
| + * its input or has a known output, then we can ignore all earlier stages since they will not |
| + * affect the final output. Thus the first effective stage index is the index to the first stage |
| + * that will have an effect on the final output. |
| + * |
| + * If the firstEffectiveStageIndex is used, corresponding values from inputColorIsUsed(), |
|
bsalomon
2014/11/13 15:09:19
"If stages before the first effective stage are re
egdaniel
2014/11/13 18:34:16
Done.
|
| + * inputColorToEffectiveStage(), removeVertexAttribs(), and readsDst() must be used when setting |
| + * up the draw to ensure correct drawing. |
| + */ |
| + int firstEffectiveStageIndex() const { return fFirstEffectStageIndex; } |
| + |
| + /** |
| + * This value returns whether or not an input will be read by the starting stage. 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.
|
| + * stage is assumed to be that which is indexed by firstEffectiveStageIndex(). |
| + */ |
| + bool inputColorIsUsed() const { return fInputColorIsUsed; } |
| + |
| + /** |
| + * This returns the color that should be inputed into the starting stage. This 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.
|
| + * valid if inputColorIsUsed is true and we are not using vertex attribs for color/coverage |
| + * input. The starting stage is assumed to be that which is indexed by |
| + * firstEffectiveStageIndex(). |
| + */ |
| + GrColor inputColorToEffectiveStage() const { return fInputColor; } |
| + |
| + /** |
| + * Returns whether or not the client should remove corresponding color/coverage vertex attribs |
| + * for the given set of stages. If we remove stages because of a known output at some |
| + * intermediate stage, then we want to feed that known output into the start of its following |
| + * stage. Thus we want to make sure we don't use color/coverage vertex attribs for this reduced |
| + * set of stages. |
| + */ |
|
bsalomon
2014/11/13 15:09:19
"Given the set of optimizations determined by GrPr
egdaniel
2014/11/13 18:34:16
Done.
|
| + bool removeVertexAttrib() const { return fRemoveVertexAttrib; } |
| + |
| + /** |
| + * Returns whether or not any of the stages, begining with start stage, will read the dst. The |
| + * start stage is determined by firstEffectiveStageIndex() |
| + */ |
| + 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.
|
| + |
| +private: |
| + GrInvariantOutput fInOut; |
| + int fFirstEffectStageIndex; |
| + bool fInputColorIsUsed; |
| + GrColor fInputColor; |
| + bool fRemoveVertexAttrib; |
| + bool fReadsDst; |
| +}; |
| + |
| +#endif |