OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2015 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #ifndef GrGLUniformHandler_DEFINED |
| 9 #define GrGLUniformHandler_DEFINED |
| 10 |
| 11 #include "glsl/GrGLSLUniformHandler.h" |
| 12 |
| 13 #include "gl/GrGLProgramDataManager.h" |
| 14 |
| 15 class GrGLCaps; |
| 16 |
| 17 static const int kUniformsPerBlock = 8; |
| 18 |
| 19 class GrGLUniformHandler : public GrGLSLUniformHandler { |
| 20 public: |
| 21 explicit GrGLUniformHandler(GrGLSLProgramBuilder* program) |
| 22 : INHERITED(program) |
| 23 , fUniforms(kUniformsPerBlock) {} |
| 24 |
| 25 const GrGLSLShaderVar& getUniformVariable(UniformHandle u) const override { |
| 26 return fUniforms[u.toIndex()].fVariable; |
| 27 } |
| 28 |
| 29 const char* getUniformCStr(UniformHandle u) const override { |
| 30 return this->getUniformVariable(u).c_str(); |
| 31 } |
| 32 |
| 33 // Manually set uniform locations for all our uniforms. |
| 34 void bindUniformLocations(GrGLuint programID, const GrGLCaps& caps); |
| 35 |
| 36 // Updates the loction of the Uniforms if we cannot bind uniform locations m
anually |
| 37 void getUniformLocations(GrGLuint programID, const GrGLCaps& caps); |
| 38 |
| 39 private: |
| 40 UniformHandle internalAddUniformArray(uint32_t visibility, |
| 41 GrSLType type, |
| 42 GrSLPrecision precision, |
| 43 const char* name, |
| 44 bool mangleName, |
| 45 int arrayCount, |
| 46 const char** outName) override; |
| 47 |
| 48 void appendUniformDecls(ShaderVisibility, SkString*) const override; |
| 49 |
| 50 const GrGLGpu* glGpu() const; |
| 51 |
| 52 typedef GrGLProgramDataManager::UniformInfo UniformInfo; |
| 53 typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray; |
| 54 |
| 55 UniformInfoArray fUniforms; |
| 56 |
| 57 friend class GrGLProgramBuilder; |
| 58 |
| 59 typedef GrGLSLUniformHandler INHERITED; |
| 60 }; |
| 61 |
| 62 #endif |
OLD | NEW |