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

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

Issue 11275120: Virtual GL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_VERTEX_ATTRIB_MANAGER_H_ 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_VERTEX_ATTRIB_MANAGER_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_VERTEX_ATTRIB_MANAGER_H_ 6 #define GPU_COMMAND_BUFFER_SERVICE_VERTEX_ATTRIB_MANAGER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <vector>
9 #include "base/logging.h" 10 #include "base/logging.h"
10 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
11 #include "build/build_config.h" 12 #include "build/build_config.h"
12 #include "gpu/command_buffer/service/buffer_manager.h" 13 #include "gpu/command_buffer/service/buffer_manager.h"
13 #include "gpu/command_buffer/service/gl_utils.h" 14 #include "gpu/command_buffer/service/gl_utils.h"
14 #include "gpu/gpu_export.h" 15 #include "gpu/gpu_export.h"
15 16
16 namespace gpu { 17 namespace gpu {
17 namespace gles2 { 18 namespace gles2 {
18 19
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 194
194 bool HaveFixedAttribs() const { 195 bool HaveFixedAttribs() const {
195 return num_fixed_attribs_ != 0; 196 return num_fixed_attribs_ != 0;
196 } 197 }
197 198
198 const VertexAttribInfoList& GetEnabledVertexAttribInfos() const { 199 const VertexAttribInfoList& GetEnabledVertexAttribInfos() const {
199 return enabled_vertex_attribs_; 200 return enabled_vertex_attribs_;
200 } 201 }
201 202
202 VertexAttribInfo* GetVertexAttribInfo(GLuint index) { 203 VertexAttribInfo* GetVertexAttribInfo(GLuint index) {
203 if (index < max_vertex_attribs_) { 204 if (index < vertex_attrib_infos_.size()) {
204 return &vertex_attrib_infos_[index]; 205 return &vertex_attrib_infos_[index];
205 } 206 }
206 return NULL; 207 return NULL;
207 } 208 }
208 209
209 void SetAttribInfo( 210 void SetAttribInfo(
210 GLuint index, 211 GLuint index,
211 BufferManager::BufferInfo* buffer, 212 BufferManager::BufferInfo* buffer,
212 GLint size, 213 GLint size,
213 GLenum type, 214 GLenum type,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 void Unbind(BufferManager::BufferInfo* buffer); 251 void Unbind(BufferManager::BufferInfo* buffer);
251 252
252 bool IsDeleted() const { 253 bool IsDeleted() const {
253 return deleted_; 254 return deleted_;
254 } 255 }
255 256
256 bool IsValid() const { 257 bool IsValid() const {
257 return !IsDeleted(); 258 return !IsDeleted();
258 } 259 }
259 260
261 size_t num_attribs() const {
262 return vertex_attrib_infos_.size();
263 }
264
260 private: 265 private:
261 friend class VertexArrayManager; 266 friend class VertexArrayManager;
262 friend class VertexArrayManagerTest; 267 friend class VertexArrayManagerTest;
263 friend class base::RefCounted<VertexAttribManager>; 268 friend class base::RefCounted<VertexAttribManager>;
264 269
265 // Used when creating from a VertexArrayManager 270 // Used when creating from a VertexArrayManager
266 VertexAttribManager(VertexArrayManager* manager, GLuint service_id, 271 VertexAttribManager(VertexArrayManager* manager, GLuint service_id,
267 uint32 num_vertex_attribs); 272 uint32 num_vertex_attribs);
268 273
269 ~VertexAttribManager(); 274 ~VertexAttribManager();
270 275
271 void MarkAsDeleted() { 276 void MarkAsDeleted() {
272 deleted_ = true; 277 deleted_ = true;
273 } 278 }
274 279
275 uint32 max_vertex_attribs_;
276
277 // number of attribs using type GL_FIXED. 280 // number of attribs using type GL_FIXED.
278 int num_fixed_attribs_; 281 int num_fixed_attribs_;
279 282
280 // Info for each vertex attribute saved so we can check at glDrawXXX time 283 // Info for each vertex attribute saved so we can check at glDrawXXX time
281 // if it is safe to draw. 284 // if it is safe to draw.
282 scoped_array<VertexAttribInfo> vertex_attrib_infos_; 285 std::vector<VertexAttribInfo> vertex_attrib_infos_;
283 286
284 // The currently bound element array buffer. If this is 0 it is illegal 287 // The currently bound element array buffer. If this is 0 it is illegal
285 // to call glDrawElements. 288 // to call glDrawElements.
286 BufferManager::BufferInfo::Ref element_array_buffer_; 289 BufferManager::BufferInfo::Ref element_array_buffer_;
287 290
288 // Lists for which vertex attribs are enabled, disabled. 291 // Lists for which vertex attribs are enabled, disabled.
289 VertexAttribInfoList enabled_vertex_attribs_; 292 VertexAttribInfoList enabled_vertex_attribs_;
290 VertexAttribInfoList disabled_vertex_attribs_; 293 VertexAttribInfoList disabled_vertex_attribs_;
291 294
292 // The VertexArrayManager that owns this VertexAttribManager 295 // The VertexArrayManager that owns this VertexAttribManager
293 VertexArrayManager* manager_; 296 VertexArrayManager* manager_;
294 297
295 // True if deleted. 298 // True if deleted.
296 bool deleted_; 299 bool deleted_;
297 300
298 // Service side vertex array object id. 301 // Service side vertex array object id.
299 GLuint service_id_; 302 GLuint service_id_;
300 }; 303 };
301 304
302 } // namespace gles2 305 } // namespace gles2
303 } // namespace gpu 306 } // namespace gpu
304 307
305 #endif // GPU_COMMAND_BUFFER_SERVICE_VERTEX_ATTRIB_MANAGER_H_ 308 #endif // GPU_COMMAND_BUFFER_SERVICE_VERTEX_ATTRIB_MANAGER_H_
306 309
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_mock.h ('k') | gpu/command_buffer/service/vertex_attrib_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698