Break apart shared use of varying and uniform transforms

This is a pre-cl for: https://codereview.chromium.org/1955893002/

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1961093002

Review-Url: https://codereview.chromium.org/1961093002
This commit is contained in:
egdaniel 2016-05-09 10:22:19 -07:00 committed by Commit bot
parent 9daa4b92d7
commit fe8a839221
3 changed files with 17 additions and 5 deletions

View File

@ -97,7 +97,7 @@ public:
int index,
const SkTArray<const GrCoordTransform*, true>& coordTransforms) override {
const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>();
SkSTArray<2, Transform, true>& transforms = fInstalledTransforms[index];
SkSTArray<2, VaryingTransform, true>& transforms = fInstalledTransforms[index];
int numTransforms = transforms.count();
for (int t = 0; t < numTransforms; ++t) {
SkASSERT(transforms[t].fHandle.isValid());
@ -116,6 +116,14 @@ public:
}
private:
typedef GrGLSLProgramDataManager::VaryingHandle VaryingHandle;
struct VaryingTransform : public Transform {
VaryingTransform() : Transform() {}
VaryingHandle fHandle;
};
SkSTArray<8, SkSTArray<2, VaryingTransform, true> > fInstalledTransforms;
UniformHandle fColorUniform;
GrColor fColor;

View File

@ -100,7 +100,7 @@ private:
const GrGLSLProgramDataManager& pdman,
int index,
const SkTArray<const GrCoordTransform*, true>& transforms) {
SkSTArray<2, Transform, true>& procTransforms = fInstalledTransforms[index];
SkSTArray<2, UniformTransform, true>& procTransforms = fInstalledTransforms[index];
int numTransforms = transforms.count();
for (int t = 0; t < numTransforms; ++t) {
SkASSERT(procTransforms[t].fHandle.isValid());
@ -114,6 +114,13 @@ private:
virtual void onEmitCode(EmitArgs&, GrGPArgs*) = 0;
struct UniformTransform : public Transform {
UniformTransform() : Transform() {}
UniformHandle fHandle;
};
SkSTArray<8, SkSTArray<2, UniformTransform, true> > fInstalledTransforms;
typedef GrGLSLPrimitiveProcessor INHERITED;
};

View File

@ -102,12 +102,9 @@ protected:
struct Transform {
Transform() : fType(kVoid_GrSLType) { fCurrentValue = SkMatrix::InvalidMatrix(); }
UniformHandle fHandle;
SkMatrix fCurrentValue;
GrSLType fType;
};
SkSTArray<8, SkSTArray<2, Transform, true> > fInstalledTransforms;
};
#endif