| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrGLProgramDataManager_DEFINED | 8 #ifndef GrGLProgramDataManager_DEFINED |
| 9 #define GrGLProgramDataManager_DEFINED | 9 #define GrGLProgramDataManager_DEFINED |
| 10 | 10 |
| 11 #include "gl/GrGLShaderVar.h" | 11 #include "gl/GrGLShaderVar.h" |
| 12 #include "gl/GrGLSL.h" | 12 #include "gl/GrGLSL.h" |
| 13 #include "GrAllocator.h" | 13 #include "GrAllocator.h" |
| 14 | 14 |
| 15 #include "SkTArray.h" | 15 #include "SkTArray.h" |
| 16 | 16 |
| 17 class GrGpuGL; | 17 class GrGLGpu; |
| 18 class SkMatrix; | 18 class SkMatrix; |
| 19 class GrGLProgram; | 19 class GrGLProgram; |
| 20 class GrGLProgramBuilder; | 20 class GrGLProgramBuilder; |
| 21 | 21 |
| 22 /** Manages the resources used by a shader program. | 22 /** Manages the resources used by a shader program. |
| 23 * The resources are objects the program uses to communicate with the | 23 * The resources are objects the program uses to communicate with the |
| 24 * application code. | 24 * application code. |
| 25 */ | 25 */ |
| 26 class GrGLProgramDataManager : public SkRefCnt { | 26 class GrGLProgramDataManager : public SkRefCnt { |
| 27 public: | 27 public: |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 GrGLShaderVar fVariable; | 60 GrGLShaderVar fVariable; |
| 61 uint32_t fVisibility; | 61 uint32_t fVisibility; |
| 62 GrGLint fLocation; | 62 GrGLint fLocation; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 // This uses an allocator rather than array so that the GrGLShaderVars don't
move in memory | 65 // This uses an allocator rather than array so that the GrGLShaderVars don't
move in memory |
| 66 // after they are inserted. Users of GrGLShaderBuilder get refs to the vars
and ptrs to their | 66 // after they are inserted. Users of GrGLShaderBuilder get refs to the vars
and ptrs to their |
| 67 // name strings. Otherwise, we'd have to hand out copies. | 67 // name strings. Otherwise, we'd have to hand out copies. |
| 68 typedef GrTAllocator<UniformInfo> UniformInfoArray; | 68 typedef GrTAllocator<UniformInfo> UniformInfoArray; |
| 69 | 69 |
| 70 GrGLProgramDataManager(GrGpuGL*, const UniformInfoArray&); | 70 GrGLProgramDataManager(GrGLGpu*, const UniformInfoArray&); |
| 71 | 71 |
| 72 /** Functions for uploading uniform values. The varities ending in v can be
used to upload to an | 72 /** Functions for uploading uniform values. The varities ending in v can be
used to upload to an |
| 73 * array of uniforms. arrayCount must be <= the array count of the uniform. | 73 * array of uniforms. arrayCount must be <= the array count of the uniform. |
| 74 */ | 74 */ |
| 75 void setSampler(UniformHandle, GrGLint texUnit) const; | 75 void setSampler(UniformHandle, GrGLint texUnit) const; |
| 76 void set1f(UniformHandle, GrGLfloat v0) const; | 76 void set1f(UniformHandle, GrGLfloat v0) const; |
| 77 void set1fv(UniformHandle, int arrayCount, const GrGLfloat v[]) const; | 77 void set1fv(UniformHandle, int arrayCount, const GrGLfloat v[]) const; |
| 78 void set2f(UniformHandle, GrGLfloat, GrGLfloat) const; | 78 void set2f(UniformHandle, GrGLfloat, GrGLfloat) const; |
| 79 void set2fv(UniformHandle, int arrayCount, const GrGLfloat v[]) const; | 79 void set2fv(UniformHandle, int arrayCount, const GrGLfloat v[]) const; |
| 80 void set3f(UniformHandle, GrGLfloat, GrGLfloat, GrGLfloat) const; | 80 void set3f(UniformHandle, GrGLfloat, GrGLfloat, GrGLfloat) const; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 99 struct Uniform { | 99 struct Uniform { |
| 100 GrGLint fVSLocation; | 100 GrGLint fVSLocation; |
| 101 GrGLint fFSLocation; | 101 GrGLint fFSLocation; |
| 102 SkDEBUGCODE( | 102 SkDEBUGCODE( |
| 103 GrSLType fType; | 103 GrSLType fType; |
| 104 int fArrayCount; | 104 int fArrayCount; |
| 105 ); | 105 ); |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 SkTArray<Uniform, true> fUniforms; | 108 SkTArray<Uniform, true> fUniforms; |
| 109 GrGpuGL* fGpu; | 109 GrGLGpu* fGpu; |
| 110 | 110 |
| 111 typedef SkRefCnt INHERITED; | 111 typedef SkRefCnt INHERITED; |
| 112 }; | 112 }; |
| 113 #endif | 113 #endif |
| OLD | NEW |