| Index: src/gpu/gl/GrGLProgramDataManager.h
|
| diff --git a/src/gpu/gl/GrGLProgramDataManager.h b/src/gpu/gl/GrGLProgramDataManager.h
|
| index 3082f6f02b66abcea9cfa534f88e1816e224a9af..8a98a75caea0eff1a62d52cbc214f16497dd62ac 100644
|
| --- a/src/gpu/gl/GrGLProgramDataManager.h
|
| +++ b/src/gpu/gl/GrGLProgramDataManager.h
|
| @@ -26,34 +26,51 @@ class GrGLProgramBuilder;
|
| class GrGLProgramDataManager : public SkRefCnt {
|
| public:
|
| // Opaque handle to a uniform
|
| - class UniformHandle {
|
| + class ShaderResourceHandle {
|
| public:
|
| - /** Creates a reference to an unifrom of a GrGLShaderBuilder.
|
| - * The ref can be used to set the uniform with corresponding the GrGLProgramDataManager.*/
|
| - static UniformHandle CreateFromUniformIndex(int i);
|
| -
|
| bool isValid() const { return -1 != fValue; }
|
| -
|
| - bool operator==(const UniformHandle& other) const { return other.fValue == fValue; }
|
| -
|
| - UniformHandle()
|
| + ShaderResourceHandle()
|
| : fValue(-1) {
|
| }
|
| -
|
| - private:
|
| - UniformHandle(int value)
|
| + protected:
|
| + ShaderResourceHandle(int value)
|
| : fValue(value) {
|
| SkASSERT(isValid());
|
| }
|
| + int fValue;
|
| + };
|
|
|
| + class UniformHandle : public ShaderResourceHandle {
|
| + public:
|
| + /** Creates a reference to an unifrom of a GrGLShaderBuilder.
|
| + * The ref can be used to set the uniform with corresponding the GrGLProgramDataManager.*/
|
| + static UniformHandle CreateFromUniformIndex(int i);
|
| + UniformHandle() { }
|
| + bool operator==(const UniformHandle& other) const { return other.fValue == fValue; }
|
| + private:
|
| + UniformHandle(int value) : ShaderResourceHandle(value) { }
|
| int toProgramDataIndex() const { SkASSERT(isValid()); return fValue; }
|
| int toShaderBuilderIndex() const { return toProgramDataIndex(); }
|
|
|
| - int fValue;
|
| friend class GrGLProgramDataManager; // For accessing toProgramDataIndex().
|
| friend class GrGLProgramBuilder; // For accessing toShaderBuilderIndex().
|
| };
|
|
|
| + class VaryingHandle : public ShaderResourceHandle {
|
| + public:
|
| + /** Creates a reference to a varying in separable varyings of a GrGLShaderBuilder.
|
| + * The ref can be used to set the varying with the corresponding GrGLProgramDataManager.*/
|
| + static VaryingHandle CreateFromSeparableVaryingIndex(int i) {
|
| + return VaryingHandle(i);
|
| + }
|
| + VaryingHandle() { }
|
| + bool operator==(const VaryingHandle& other) const { return other.fValue == fValue; }
|
| + private:
|
| + VaryingHandle(int value) : ShaderResourceHandle(value) { }
|
| + int toProgramDataIndex() const { SkASSERT(isValid()); return fValue; }
|
| + friend class GrGLProgramDataManager; // For accessing toProgramDataIndex().
|
| + };
|
| +
|
| GrGLProgramDataManager(GrGpuGL*, GrGLProgram*, const GrGLProgramBuilder&);
|
|
|
| /** Functions for uploading uniform values. The varities ending in v can be used to upload to an
|
| @@ -78,6 +95,10 @@ public:
|
| // convenience method for uploading a SkMatrix to a 3x3 matrix uniform
|
| void setSkMatrix(UniformHandle, const SkMatrix&) const;
|
|
|
| + void setProgramPathFragmentInputTransform(VaryingHandle i,
|
| + unsigned components,
|
| + const SkMatrix& matrix) const;
|
| +
|
| private:
|
| enum {
|
| kUnusedUniform = -1,
|
| @@ -91,9 +112,17 @@ private:
|
| int fArrayCount;
|
| );
|
| };
|
| + struct Varying {
|
| + GrGLint fLocation;
|
| + SkDEBUGCODE(
|
| + GrSLType fType;
|
| + );
|
| + };
|
|
|
| SkTArray<Uniform, true> fUniforms;
|
| + SkTArray<Varying, true> fVaryings;
|
| GrGpuGL* fGpu;
|
| + GrGLProgram* fProgram;
|
|
|
| typedef SkRefCnt INHERITED;
|
| };
|
|
|