Chromium Code Reviews| Index: include/gpu/GrEffectStage.h |
| =================================================================== |
| --- include/gpu/GrEffectStage.h (revision 7952) |
| +++ include/gpu/GrEffectStage.h (working copy) |
| @@ -116,6 +116,7 @@ |
| stage.fEffectRef->get()->incDeferredRefCounts(); |
| fEffect = stage.fEffectRef->get(); |
| fCoordChangeMatrix = stage.fCoordChangeMatrix; |
| + fVertexAttribIndices = stage.fVertexAttribIndices; |
| } |
| SkDEBUGCODE(fInitialized = true;) |
| } |
| @@ -126,6 +127,7 @@ |
| if (NULL != fEffect) { |
| stage->fEffectRef = GrEffect::CreateEffectRef(fEffect); |
| stage->fCoordChangeMatrix = fCoordChangeMatrix; |
| + stage->fVertexAttribIndices = fVertexAttribIndices; |
| } else { |
| stage->fEffectRef = NULL; |
| } |
| @@ -139,6 +141,16 @@ |
| return false; |
| } |
| + int vertexAttribCount = fVertexAttribIndices.count(); |
| + if (vertexAttribCount != stage.fVertexAttribIndices.count()) { |
| + return false; |
| + } |
| + for (int i = 0; i < vertexAttribCount; ++i) { |
| + if (fVertexAttribIndices[i] != stage.fVertexAttribIndices[i]) { |
| + return false; |
| + } |
| + } |
| + |
| if (!(*stage.getEffect())->isEqual(*fEffect)) { |
| return false; |
| } |
| @@ -149,6 +161,7 @@ |
| private: |
| const GrEffect* fEffect; |
| SkMatrix fCoordChangeMatrix; |
| + SkSTArray<2, int, true> fVertexAttribIndices; |
| SkDEBUGCODE(bool fInitialized;) |
| }; |
| @@ -171,9 +184,20 @@ |
| const GrEffectRef* getEffect() const { return fEffectRef; } |
| + void setVertexAttribIndices(const int indices[], int count) { |
|
robertphillips
2013/03/05 20:30:13
Is there a reserve we can use here?
jvanverth1
2013/03/07 15:21:54
Done.
|
| + fVertexAttribIndices.reset(); |
| + for (int index = 0; index < count; ++index) { |
| + fVertexAttribIndices.push_back(indices[index]); |
| + } |
| + } |
| + |
| + const int* getVertexAttribIndices() const { return fVertexAttribIndices.begin(); } |
| + int getVertexAttribIndexCount() const { return fVertexAttribIndices.count(); } |
| + |
| private: |
| - SkMatrix fCoordChangeMatrix; |
| - const GrEffectRef* fEffectRef; |
| + SkMatrix fCoordChangeMatrix; |
| + const GrEffectRef* fEffectRef; |
| + SkSTArray<2, int, true> fVertexAttribIndices; |
| GR_DEBUGCODE(mutable int fSavedCoordChangeCnt;) |
| }; |