Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: src/gpu/gl/GrGLUniformHandler.h

Issue 1896013003: Revert of Refactor how we store and use samplers in Ganesh (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLSampler.h ('k') | src/gpu/gl/GrGLUniformHandler.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 GrGLUniformHandler_DEFINED 8 #ifndef GrGLUniformHandler_DEFINED
9 #define GrGLUniformHandler_DEFINED 9 #define GrGLUniformHandler_DEFINED
10 10
11 #include "glsl/GrGLSLUniformHandler.h" 11 #include "glsl/GrGLSLUniformHandler.h"
12 12
13 #include "gl/GrGLProgramDataManager.h" 13 #include "gl/GrGLProgramDataManager.h"
14 #include "gl/GrGLSampler.h"
15 14
16 class GrGLCaps; 15 class GrGLCaps;
17 16
18 class GrGLUniformHandler : public GrGLSLUniformHandler { 17 class GrGLUniformHandler : public GrGLSLUniformHandler {
19 public: 18 public:
20 static const int kUniformsPerBlock = 8; 19 static const int kUniformsPerBlock = 8;
21 20
22 const GrGLSLShaderVar& getUniformVariable(UniformHandle u) const override { 21 const GrGLSLShaderVar& getUniformVariable(UniformHandle u) const override {
23 return fUniforms[u.toIndex()].fVariable; 22 return fUniforms[u.toIndex()].fVariable;
24 } 23 }
25 24
26 const char* getUniformCStr(UniformHandle u) const override { 25 const char* getUniformCStr(UniformHandle u) const override {
27 return this->getUniformVariable(u).c_str(); 26 return this->getUniformVariable(u).c_str();
28 } 27 }
29 private: 28 private:
30 explicit GrGLUniformHandler(GrGLSLProgramBuilder* program) 29 explicit GrGLUniformHandler(GrGLSLProgramBuilder* program)
31 : INHERITED(program) 30 : INHERITED(program)
32 , fUniforms(kUniformsPerBlock) {} 31 , fUniforms(kUniformsPerBlock) {}
33 32
34 UniformHandle internalAddUniformArray(uint32_t visibility, 33 UniformHandle internalAddUniformArray(uint32_t visibility,
35 GrSLType type, 34 GrSLType type,
36 GrSLPrecision precision, 35 GrSLPrecision precision,
37 const char* name, 36 const char* name,
38 bool mangleName, 37 bool mangleName,
39 int arrayCount, 38 int arrayCount,
40 const char** outName) override; 39 const char** outName) override;
41 40
42 SamplerHandle internalAddSampler(uint32_t visibility,
43 GrPixelConfig config,
44 GrSLType type,
45 GrSLPrecision precision,
46 const char* name) override;
47
48 int numSamplers() const override { return fSamplers.count(); }
49 const GrGLSLSampler& getSampler(SamplerHandle handle) const override {
50 return fSamplers[handle.toIndex()];
51 }
52
53 void appendUniformDecls(GrShaderFlags visibility, SkString*) const override; 41 void appendUniformDecls(GrShaderFlags visibility, SkString*) const override;
54 42
55 // Manually set uniform locations for all our uniforms. 43 // Manually set uniform locations for all our uniforms.
56 void bindUniformLocations(GrGLuint programID, const GrGLCaps& caps); 44 void bindUniformLocations(GrGLuint programID, const GrGLCaps& caps);
57 45
58 // Updates the loction of the Uniforms if we cannot bind uniform locations m anually 46 // Updates the loction of the Uniforms if we cannot bind uniform locations m anually
59 void getUniformLocations(GrGLuint programID, const GrGLCaps& caps); 47 void getUniformLocations(GrGLuint programID, const GrGLCaps& caps);
60 48
61 const GrGLGpu* glGpu() const; 49 const GrGLGpu* glGpu() const;
62 50
63 typedef GrGLProgramDataManager::UniformInfo UniformInfo; 51 typedef GrGLProgramDataManager::UniformInfo UniformInfo;
64 typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray; 52 typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray;
65 53
66 UniformInfoArray fUniforms; 54 UniformInfoArray fUniforms;
67 55
68 SkTArray<GrGLSampler> fSamplers;
69
70 friend class GrGLProgramBuilder; 56 friend class GrGLProgramBuilder;
71 57
72 typedef GrGLSLUniformHandler INHERITED; 58 typedef GrGLSLUniformHandler INHERITED;
73 }; 59 };
74 60
75 #endif 61 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLSampler.h ('k') | src/gpu/gl/GrGLUniformHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698