Chromium Code Reviews| Index: src/gpu/GrOptDrawState.h |
| diff --git a/src/gpu/GrOptDrawState.h b/src/gpu/GrOptDrawState.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9581b10896dcf56c1687e290002cbcd96642428d |
| --- /dev/null |
| +++ b/src/gpu/GrOptDrawState.h |
| @@ -0,0 +1,64 @@ |
| +/* |
| + * 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 GrOptDrawState_DEFINED |
| +#define GrOptDrawState_DEFINED |
| + |
| +#include "GrRODrawState.h" |
| + |
| +class GrDrawState; |
| + |
| +/** |
| + * Sub class that is derived from GrRODrawState. This class holds an optimized version of a |
|
bsalomon
2014/08/26 18:41:44
Subclass of GrRODrawState that holds an... ?
|
| + * drawState. Like it's parent it is meant to be an immutable class, and simply adds a few |
| + * helpful data members not in the base class. |
| + */ |
| +class GrOptDrawState : public GrRODrawState { |
| +public: |
| + /** |
| + * Constructs and optimized drawState out of a GrRODrawState. |
| + */ |
| + explicit GrOptDrawState(const GrDrawState& drawState); |
| + |
| + bool operator== (const GrOptDrawState& that) const; |
| + |
| +private: |
| + /* |
| + * Loops through all the color stage effects to check if the stage will ignore color input or |
| + * always output a constant color. In the ignore color input case we can ignore all previous |
| + * stages. In the constant color case, we can ignore all previous stages and |
| + * the current one and set the state color to the constant color. Once we determine the so |
| + * called first effective stage, we copy all the effective stages into our optimized |
| + * state. |
| + */ |
| + void copyEffectiveColorStages(const GrDrawState& ds); |
| + /* |
|
bsalomon
2014/08/26 18:41:43
\n
|
| + * Loops through all the coverage stage effects to check if the stage will ignore color input. |
| + * If a coverage stage will ignore input, then we can ignore all coverage stages before it. We |
| + * loop to determine the first effective coverage stage, and then copy all of our effective |
| + * coverage stages into our optimized state. |
| + */ |
| + void copyEffectiveCoverageStages(const GrDrawState& ds); |
| + |
| + /* |
| + * This function takes in a flag and removes the corresponding fixed function vertex attributes. |
| + * The flags must be in the same order as GrVertexAttribBinding array. In otherwords the lowest |
|
bsalomon
2014/08/26 18:41:43
I think removeVAFlag should be plural since it can
|
| + * bit is for the position, the 2nd is for the local coord, and so on. |
| + */ |
| + void removeFixedFunctionVertexAttribs(uint8_t removeVAFlag); |
| + |
| + void removeColorVertexAttrib(); |
| + |
| + bool fInputColorIsUsed; |
|
bsalomon
2014/08/26 18:41:43
What's the use case for these?
egdaniel
2014/08/26 18:50:52
Ahh comment only made into last cl for these. Basi
|
| + bool fInputCoverageIsUsed; |
| + |
| + SkAutoSTArray<4, GrVertexAttrib> fOptVA; |
| + |
| + typedef GrRODrawState INHERITED; |
| +}; |
| + |
| +#endif |