 Chromium Code Reviews
 Chromium Code Reviews Issue 504203004:
  Attach GrOptDrawState into shader building pipeline  (Closed) 
  Base URL: https://skia.googlesource.com/skia.git@opt2
    
  
    Issue 504203004:
  Attach GrOptDrawState into shader building pipeline  (Closed) 
  Base URL: https://skia.googlesource.com/skia.git@opt2| Index: src/gpu/GrOptDrawState.h | 
| diff --git a/src/gpu/GrOptDrawState.h b/src/gpu/GrOptDrawState.h | 
| index a4edc01c8a465cdf3a510dc10af7b2811fddb8c7..d1ba45280a92f2f8c32ca98331ae349a472ae44c 100644 | 
| --- a/src/gpu/GrOptDrawState.h | 
| +++ b/src/gpu/GrOptDrawState.h | 
| @@ -8,10 +8,9 @@ | 
| #ifndef GrOptDrawState_DEFINED | 
| #define GrOptDrawState_DEFINED | 
| +#include "GrDrawState.h" | 
| #include "GrRODrawState.h" | 
| -class GrDrawState; | 
| - | 
| /** | 
| * Subclass of GrRODrawState that holds an optimized version of a GrDrawState. Like it's parent | 
| * it is meant to be an immutable class, and simply adds a few helpful data members not in the | 
| @@ -19,15 +18,19 @@ class GrDrawState; | 
| */ | 
| class GrOptDrawState : public GrRODrawState { | 
| public: | 
| + bool operator== (const GrOptDrawState& that) const; | 
| + | 
| + bool inputColorIsUsed() const { return fInputColorIsUsed; } | 
| + bool inputCoverageIsUsed() const { return fInputCoverageIsUsed; } | 
| + | 
| +private: | 
| /** | 
| * Constructs and optimized drawState out of a GrRODrawState. | 
| */ | 
| - explicit GrOptDrawState(const GrDrawState& drawState); | 
| + GrOptDrawState(const GrDrawState& drawState, BlendOptFlags blendOptFlags, | 
| + GrBlendCoeff optSrcCoeff, GrBlendCoeff optDstCoeff); | 
| - 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 | 
| @@ -37,7 +40,7 @@ private: | 
| */ | 
| void copyEffectiveColorStages(const GrDrawState& ds); | 
| - /* | 
| + /** | 
| * 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 | 
| @@ -45,14 +48,30 @@ private: | 
| */ | 
| void copyEffectiveCoverageStages(const GrDrawState& ds); | 
| - /* | 
| + /** | 
| * This function takes in a flag and removes the corresponding fixed function vertex attributes. | 
| * The flags are in the same order as GrVertexAttribBinding array. If bit i of removeVAFlags is | 
| * set, then vertex attributes with binding (GrVertexAttribute)i will be removed. | 
| */ | 
| void removeFixedFunctionVertexAttribs(uint8_t removeVAFlags); | 
| - void removeColorVertexAttrib(); | 
| + /** | 
| + * Alter the OptDrawState (adjusting stages, vertex attribs, flags, etc.) based on the | 
| + * BlendOptFlags. | 
| + */ | 
| + void adjustFromBlendOpts(); | 
| + | 
| + /** | 
| + * Set the VAIndexMap to basically return the idenity of the VA's that were passed in from the | 
| + * DrawState. | 
| + */ | 
| + void initializeVAIndexMap(); | 
| + | 
| + /** | 
| + * Loop over the various effect stages and remap any non-fixed function VA's to have the corret | 
| + * index based off of fVAIndexMap | 
| + */ | 
| + void remapEffectStagesVAIndices(); | 
| // These flags are needed to protect the code from creating an unused uniform color/coverage | 
| // which will cause shader compiler errors. | 
| @@ -60,7 +79,11 @@ private: | 
| bool fInputCoverageIsUsed; | 
| SkAutoSTArray<4, GrVertexAttrib> fOptVA; | 
| + SkAutoSTArray<4, int> fVAIndexMap; | 
| + | 
| + BlendOptFlags fBlendOptFlags; | 
| + friend GrOptDrawState* GrDrawState::createOptState() const; | 
| 
bsalomon
2014/09/15 14:04:34
Is it possible that GrOptState's cons just take a
 
egdaniel
2014/09/15 17:51:35
In order to keep all the blendOpt flag stuff priva
 | 
| typedef GrRODrawState INHERITED; | 
| }; |