Chromium Code Reviews| Index: src/gpu/gl/GrGLProgramDataManager.h |
| diff --git a/src/gpu/gl/GrGLProgramDataManager.h b/src/gpu/gl/GrGLProgramDataManager.h |
| index ebbcf54782c1b6a9cbf4301e0af343980e0cc087..9f6f41cbc18ac45b3fce6199f5159ec13ffb6013 100644 |
| --- a/src/gpu/gl/GrGLProgramDataManager.h |
| +++ b/src/gpu/gl/GrGLProgramDataManager.h |
| @@ -16,6 +16,8 @@ |
| class GrGpuGL; |
| class SkMatrix; |
| +class GrGLProgram; |
| +class GrGLShaderBuilder; |
| /** Manages the resources used by a shader program. |
| * The resources are objects the program uses to communicate with the |
| @@ -26,6 +28,8 @@ public: |
| // Opaque handle to a uniform |
| class UniformHandle { |
| 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 0 != fValue; } |
| @@ -42,15 +46,15 @@ public: |
| SkASSERT(isValid()); |
| } |
| - int toUniformIndex() const { SkASSERT(isValid()); return ~fValue; } |
| + int toProgramDataIndex() const { SkASSERT(isValid()); return ~fValue; } |
|
bsalomon
2014/08/01 13:46:45
I'm not sure we still need this munging at all. II
Kimmo Kinnunen
2014/08/04 05:43:27
Done.
|
| + int toShaderBuilderIndex() const { return toProgramDataIndex(); } |
| int fValue; |
| - friend class GrGLProgramDataManager; // For accessing toUniformIndex(). |
| + friend class GrGLProgramDataManager; // For accessing toProgramDataIndex(). |
| + friend class GrGLShaderBuilder; // For accessing toShaderBuilderIndex(). |
| }; |
| - GrGLProgramDataManager(GrGpuGL* gpu); |
| - |
| - UniformHandle appendUniform(GrSLType type, int arrayCount = GrGLShaderVar::kNonArray); |
| + GrGLProgramDataManager(GrGpuGL*, GrGLProgram*, const GrGLShaderBuilder&); |
| /** Functions for uploading uniform values. The varities ending in v can be used to upload to an |
| * array of uniforms. arrayCount must be <= the array count of the uniform. |
| @@ -74,32 +78,6 @@ public: |
| // convenience method for uploading a SkMatrix to a 3x3 matrix uniform |
| void setSkMatrix(UniformHandle, const SkMatrix&) const; |
| - struct BuilderUniform { |
| - GrGLShaderVar fVariable; |
| - uint32_t fVisibility; |
| - }; |
| - // This uses an allocator rather than array so that the GrGLShaderVars don't move in memory |
| - // after they are inserted. Users of GrGLShaderBuilder get refs to the vars and ptrs to their |
| - // name strings. Otherwise, we'd have to hand out copies. |
| - typedef GrTAllocator<BuilderUniform> BuilderUniformArray; |
| - |
| - /** |
| - * Called by the GrGLShaderBuilder to know if the manager is using |
| - * BindUniformLocation. In that case getUniformLocations must be called |
| - * before the program is linked. |
| - */ |
| - bool isUsingBindUniform() const { return fUsingBindUniform; } |
| - |
| - /** |
| - * Called by the GrGLShaderBuilder to get GL locations for all uniforms. |
| - */ |
| - void getUniformLocations(GrGLuint programID, const BuilderUniformArray& uniforms); |
| - |
| - /** |
| - * Called by the GrGLShaderBuilder to access the array by the handle (index). |
| - */ |
| - const BuilderUniform& getBuilderUniform(const BuilderUniformArray&, GrGLProgramDataManager::UniformHandle) const; |
| - |
| private: |
| enum { |
| kUnusedUniform = -1, |
| @@ -108,11 +86,12 @@ private: |
| struct Uniform { |
| GrGLint fVSLocation; |
| GrGLint fFSLocation; |
| - GrSLType fType; |
| - int fArrayCount; |
| + SkDEBUGCODE( |
| + GrSLType fType; |
| + int fArrayCount; |
| + ); |
| }; |
| - bool fUsingBindUniform; |
| SkTArray<Uniform, true> fUniforms; |
| GrGpuGL* fGpu; |