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

Side by Side Diff: gpu/command_buffer/service/program_manager.h

Issue 3743001: FBTF: Fix more ctor/dtors found by clang plugin. (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: Rebase to pick up mac fix on ToT Created 10 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « gpu/command_buffer/service/id_manager.cc ('k') | gpu/command_buffer/service/program_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ 6 #define GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 14 matching lines...) Expand all
25 // This is used to track which attributes a particular program needs 25 // This is used to track which attributes a particular program needs
26 // so we can verify at glDrawXXX time that every attribute is either disabled 26 // so we can verify at glDrawXXX time that every attribute is either disabled
27 // or if enabled that it points to a valid source. 27 // or if enabled that it points to a valid source.
28 class ProgramInfo : public base::RefCounted<ProgramInfo> { 28 class ProgramInfo : public base::RefCounted<ProgramInfo> {
29 public: 29 public:
30 typedef scoped_refptr<ProgramInfo> Ref; 30 typedef scoped_refptr<ProgramInfo> Ref;
31 31
32 static const int kMaxAttachedShaders = 2; 32 static const int kMaxAttachedShaders = 2;
33 33
34 struct UniformInfo { 34 struct UniformInfo {
35 UniformInfo(GLsizei _size, GLenum _type, const std::string& _name) 35 UniformInfo(GLsizei _size, GLenum _type, const std::string& _name);
36 : size(_size), 36 ~UniformInfo();
37 type(_type), 37
38 name(_name) {
39 }
40 bool IsSampler() const { 38 bool IsSampler() const {
41 return type == GL_SAMPLER_2D || type == GL_SAMPLER_CUBE; 39 return type == GL_SAMPLER_2D || type == GL_SAMPLER_CUBE;
42 } 40 }
43 41
44 GLsizei size; 42 GLsizei size;
45 GLenum type; 43 GLenum type;
46 bool is_array; 44 bool is_array;
47 std::string name; 45 std::string name;
48 std::vector<GLint> element_locations; 46 std::vector<GLint> element_locations;
49 std::vector<GLuint> texture_units; 47 std::vector<GLuint> texture_units;
50 }; 48 };
51 struct VertexAttribInfo { 49 struct VertexAttribInfo {
52 VertexAttribInfo(GLsizei _size, GLenum _type, const std::string& _name, 50 VertexAttribInfo(GLsizei _size, GLenum _type, const std::string& _name,
53 GLint _location) 51 GLint _location)
54 : size(_size), 52 : size(_size),
55 type(_type), 53 type(_type),
56 location(_location), 54 location(_location),
57 name(_name) { 55 name(_name) {
58 } 56 }
59 GLsizei size; 57 GLsizei size;
60 GLenum type; 58 GLenum type;
61 GLint location; 59 GLint location;
62 std::string name; 60 std::string name;
63 }; 61 };
64 62
65 typedef std::vector<UniformInfo> UniformInfoVector; 63 typedef std::vector<UniformInfo> UniformInfoVector;
66 typedef std::vector<VertexAttribInfo> AttribInfoVector; 64 typedef std::vector<VertexAttribInfo> AttribInfoVector;
67 typedef std::vector<int> SamplerIndices; 65 typedef std::vector<int> SamplerIndices;
68 66
69 explicit ProgramInfo(GLuint service_id) 67 explicit ProgramInfo(GLuint service_id);
70 : max_attrib_name_length_(0),
71 max_uniform_name_length_(0),
72 service_id_(service_id),
73 valid_(false) {
74 }
75 68
76 GLuint service_id() const { 69 GLuint service_id() const {
77 return service_id_; 70 return service_id_;
78 } 71 }
79 72
80 const SamplerIndices& sampler_indices() { 73 const SamplerIndices& sampler_indices() {
81 return sampler_indices_; 74 return sampler_indices_;
82 } 75 }
83 76
84 // Resets the program after an unsuccessful link. 77 // Resets the program after an unsuccessful link.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 } 140 }
148 141
149 void set_log_info(const std::string& str) { 142 void set_log_info(const std::string& str) {
150 log_info_ = str; 143 log_info_ = str;
151 } 144 }
152 145
153 private: 146 private:
154 friend class base::RefCounted<ProgramInfo>; 147 friend class base::RefCounted<ProgramInfo>;
155 friend class ProgramManager; 148 friend class ProgramManager;
156 149
157 ~ProgramInfo() { } 150 ~ProgramInfo();
158 151
159 void MarkAsDeleted() { 152 void MarkAsDeleted() {
160 service_id_ = 0; 153 service_id_ = 0;
161 } 154 }
162 155
163 const UniformInfo* AddUniformInfo( 156 const UniformInfo* AddUniformInfo(
164 GLsizei size, GLenum type, GLint location, const std::string& name); 157 GLsizei size, GLenum type, GLint location, const std::string& name);
165 158
166 GLsizei max_attrib_name_length_; 159 GLsizei max_attrib_name_length_;
167 160
(...skipping 20 matching lines...) Expand all
188 // Shaders by type of shader. 181 // Shaders by type of shader.
189 ShaderManager::ShaderInfo::Ref attached_shaders_[kMaxAttachedShaders]; 182 ShaderManager::ShaderInfo::Ref attached_shaders_[kMaxAttachedShaders];
190 183
191 // This is true if glLinkProgram was successful. 184 // This is true if glLinkProgram was successful.
192 bool valid_; 185 bool valid_;
193 186
194 // Log info 187 // Log info
195 std::string log_info_; 188 std::string log_info_;
196 }; 189 };
197 190
198 ProgramManager() { } 191 ProgramManager();
199 ~ProgramManager(); 192 ~ProgramManager();
200 193
201 // Must call before destruction. 194 // Must call before destruction.
202 void Destroy(bool have_context); 195 void Destroy(bool have_context);
203 196
204 // Creates a new program info. 197 // Creates a new program info.
205 void CreateProgramInfo(GLuint client_id, GLuint service_id); 198 void CreateProgramInfo(GLuint client_id, GLuint service_id);
206 199
207 // Gets a program info 200 // Gets a program info
208 ProgramInfo* GetProgramInfo(GLuint client_id); 201 ProgramInfo* GetProgramInfo(GLuint client_id);
(...skipping 13 matching lines...) Expand all
222 typedef std::map<GLuint, ProgramInfo::Ref> ProgramInfoMap; 215 typedef std::map<GLuint, ProgramInfo::Ref> ProgramInfoMap;
223 ProgramInfoMap program_infos_; 216 ProgramInfoMap program_infos_;
224 217
225 DISALLOW_COPY_AND_ASSIGN(ProgramManager); 218 DISALLOW_COPY_AND_ASSIGN(ProgramManager);
226 }; 219 };
227 220
228 } // namespace gles2 221 } // namespace gles2
229 } // namespace gpu 222 } // namespace gpu
230 223
231 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ 224 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/id_manager.cc ('k') | gpu/command_buffer/service/program_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698