| OLD | NEW |
| 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 GrOptDrawState_DEFINED | 8 #ifndef GrOptDrawState_DEFINED |
| 9 #define GrOptDrawState_DEFINED | 9 #define GrOptDrawState_DEFINED |
| 10 | 10 |
| 11 #include "GrDrawState.h" | 11 #include "GrDrawState.h" |
| 12 #include "GrRODrawState.h" | 12 #include "GrRODrawState.h" |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * Subclass of GrRODrawState that holds an optimized version of a GrDrawState. L
ike it's parent | 15 * Subclass of GrRODrawState that holds an optimized version of a GrDrawState. L
ike it's parent |
| 16 * it is meant to be an immutable class, and simply adds a few helpful data memb
ers not in the | 16 * it is meant to be an immutable class, and simply adds a few helpful data memb
ers not in the |
| 17 * base class. | 17 * base class. |
| 18 */ | 18 */ |
| 19 class GrOptDrawState : public GrRODrawState { | 19 class GrOptDrawState : public GrRODrawState { |
| 20 public: | 20 public: |
| 21 bool operator== (const GrOptDrawState& that) const; | 21 bool operator== (const GrOptDrawState& that) const; |
| 22 | 22 |
| 23 bool inputColorIsUsed() const { return fInputColorIsUsed; } | 23 bool inputColorIsUsed() const { return fInputColorIsUsed; } |
| 24 bool inputCoverageIsUsed() const { return fInputCoverageIsUsed; } | 24 bool inputCoverageIsUsed() const { return fInputCoverageIsUsed; } |
| 25 | 25 |
| 26 bool readsDst() const { return fReadsDst; } |
| 27 bool readsFragPosition() const { return fReadsFragPosition; } |
| 28 bool requiresVertexShader() const { return fRequiresVertexShader; } |
| 29 |
| 26 private: | 30 private: |
| 27 /** | 31 /** |
| 28 * Constructs and optimized drawState out of a GrRODrawState. | 32 * Constructs and optimized drawState out of a GrRODrawState. |
| 29 */ | 33 */ |
| 30 GrOptDrawState(const GrDrawState& drawState, BlendOptFlags blendOptFlags, | 34 GrOptDrawState(const GrDrawState& drawState, BlendOptFlags blendOptFlags, |
| 31 GrBlendCoeff optSrcCoeff, GrBlendCoeff optDstCoeff); | 35 GrBlendCoeff optSrcCoeff, GrBlendCoeff optDstCoeff); |
| 32 | 36 |
| 33 /** | 37 /** |
| 34 * Loops through all the color stage effects to check if the stage will igno
re color input or | 38 * Loops through all the color stage effects to check if the stage will igno
re color input or |
| 35 * always output a constant color. In the ignore color input case we can ign
ore all previous | 39 * always output a constant color. In the ignore color input case we can ign
ore all previous |
| (...skipping 18 matching lines...) Expand all Loading... |
| 54 * set, then vertex attributes with binding (GrVertexAttribute)i will be rem
oved. | 58 * set, then vertex attributes with binding (GrVertexAttribute)i will be rem
oved. |
| 55 */ | 59 */ |
| 56 void removeFixedFunctionVertexAttribs(uint8_t removeVAFlags); | 60 void removeFixedFunctionVertexAttribs(uint8_t removeVAFlags); |
| 57 | 61 |
| 58 /** | 62 /** |
| 59 * Alter the OptDrawState (adjusting stages, vertex attribs, flags, etc.) ba
sed on the | 63 * Alter the OptDrawState (adjusting stages, vertex attribs, flags, etc.) ba
sed on the |
| 60 * BlendOptFlags. | 64 * BlendOptFlags. |
| 61 */ | 65 */ |
| 62 void adjustFromBlendOpts(); | 66 void adjustFromBlendOpts(); |
| 63 | 67 |
| 68 /** |
| 69 * Loop over the effect stages to determine various info like what data they
will read and what |
| 70 * shaders they require. |
| 71 */ |
| 72 void getStageStats(); |
| 73 |
| 64 // These flags are needed to protect the code from creating an unused unifor
m color/coverage | 74 // These flags are needed to protect the code from creating an unused unifor
m color/coverage |
| 65 // which will cause shader compiler errors. | 75 // which will cause shader compiler errors. |
| 66 bool fInputColorIsUsed; | 76 bool fInputColorIsUsed; |
| 67 bool fInputCoverageIsUsed; | 77 bool fInputCoverageIsUsed; |
| 68 | 78 |
| 79 // These flags give aggregated info on the effect stages that are used when
building programs. |
| 80 bool fReadsDst; |
| 81 bool fReadsFragPosition; |
| 82 bool fRequiresVertexShader; |
| 83 |
| 69 SkAutoSTArray<4, GrVertexAttrib> fOptVA; | 84 SkAutoSTArray<4, GrVertexAttrib> fOptVA; |
| 70 | 85 |
| 71 BlendOptFlags fBlendOptFlags; | 86 BlendOptFlags fBlendOptFlags; |
| 72 | 87 |
| 73 friend GrOptDrawState* GrDrawState::createOptState() const; | 88 friend GrOptDrawState* GrDrawState::createOptState() const; |
| 74 typedef GrRODrawState INHERITED; | 89 typedef GrRODrawState INHERITED; |
| 75 }; | 90 }; |
| 76 | 91 |
| 77 #endif | 92 #endif |
| OLD | NEW |