Index: src/gpu/gl/GrGLProgramDataManager.h |
diff --git a/src/gpu/gl/GrGLProgramDataManager.h b/src/gpu/gl/GrGLProgramDataManager.h |
index 644ba951c4a5f68dd84dcb8952de6bf8f9c36900..7931768ddb56a8bb7b260fcad0946a269705a254 100644 |
--- a/src/gpu/gl/GrGLProgramDataManager.h |
+++ b/src/gpu/gl/GrGLProgramDataManager.h |
@@ -24,38 +24,29 @@ class GrGLProgramBuilder; |
*/ |
class GrGLProgramDataManager : SkNoncopyable { |
public: |
- // Opaque handle to a uniform |
+ // Opaque handle to a resource |
class ShaderResourceHandle { |
public: |
- bool isValid() const { return -1 != fValue; } |
- ShaderResourceHandle() |
- : fValue(-1) { |
- } |
- protected: |
ShaderResourceHandle(int value) |
: fValue(value) { |
- SkASSERT(isValid()); |
+ SkASSERT(this->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(); } |
+ ShaderResourceHandle() |
+ : fValue(kInvalid_ShaderResourceHandle) { |
+ } |
+ |
+ bool operator==(const ShaderResourceHandle& other) const { return other.fValue == fValue; } |
+ bool isValid() const { return kInvalid_ShaderResourceHandle != fValue; } |
+ int toIndex() const { SkASSERT(this->isValid()); return fValue; } |
- friend class GrGLProgramDataManager; // For accessing toProgramDataIndex(). |
- friend class GrGLProgramBuilder; // For accessing toShaderBuilderIndex(). |
- friend class GrGLGeometryProcessor; |
+ private: |
+ static const int kInvalid_ShaderResourceHandle = -1; |
+ int fValue; |
}; |
+ typedef ShaderResourceHandle UniformHandle; |
+ |
struct UniformInfo { |
GrGLShaderVar fVariable; |
uint32_t fVisibility; |