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

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

Issue 11413094: Fix VAOs and client side arrays (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years 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
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 <vector>
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 15 matching lines...) Expand all
26 public base::RefCounted<VertexAttribManager> { 26 public base::RefCounted<VertexAttribManager> {
27 public: 27 public:
28 typedef scoped_refptr<VertexAttribManager> Ref; 28 typedef scoped_refptr<VertexAttribManager> Ref;
29 29
30 // Info about Vertex Attributes. This is used to track what the user currently 30 // Info about Vertex Attributes. This is used to track what the user currently
31 // has bound on each Vertex Attribute so that checking can be done at 31 // has bound on each Vertex Attribute so that checking can be done at
32 // glDrawXXX time. 32 // glDrawXXX time.
33 class GPU_EXPORT VertexAttribInfo { 33 class GPU_EXPORT VertexAttribInfo {
34 public: 34 public:
35 typedef std::list<VertexAttribInfo*> VertexAttribInfoList; 35 typedef std::list<VertexAttribInfo*> VertexAttribInfoList;
36 struct Vec4 {
37 float v[4];
38 };
39 36
40 VertexAttribInfo(); 37 VertexAttribInfo();
41 ~VertexAttribInfo(); 38 ~VertexAttribInfo();
42 39
43 // Returns true if this VertexAttrib can access index. 40 // Returns true if this VertexAttrib can access index.
44 bool CanAccess(GLuint index) const; 41 bool CanAccess(GLuint index) const;
45 42
46 BufferManager::BufferInfo* buffer() const { 43 BufferManager::BufferInfo* buffer() const {
47 return buffer_; 44 return buffer_;
48 } 45 }
(...skipping 23 matching lines...) Expand all
72 } 69 }
73 70
74 GLuint divisor() const { 71 GLuint divisor() const {
75 return divisor_; 72 return divisor_;
76 } 73 }
77 74
78 bool enabled() const { 75 bool enabled() const {
79 return enabled_; 76 return enabled_;
80 } 77 }
81 78
82 void set_value(const Vec4& value) {
83 value_ = value;
84 }
85
86 const Vec4& value() const {
87 return value_;
88 }
89
90 // Find the maximum vertex accessed, accounting for instancing. 79 // Find the maximum vertex accessed, accounting for instancing.
91 GLuint MaxVertexAccessed(GLsizei primcount, 80 GLuint MaxVertexAccessed(GLsizei primcount,
92 GLuint max_vertex_accessed) const { 81 GLuint max_vertex_accessed) const {
93 return (primcount && divisor_) ? ((primcount - 1) / divisor_) : 82 return (primcount && divisor_) ? ((primcount - 1) / divisor_) :
94 max_vertex_accessed; 83 max_vertex_accessed;
95 } 84 }
96 85
97 private: 86 private:
98 friend class VertexAttribManager; 87 friend class VertexAttribManager;
99 88
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 // The stride passed to glVertexAttribPointer. 153 // The stride passed to glVertexAttribPointer.
165 GLsizei gl_stride_; 154 GLsizei gl_stride_;
166 155
167 // The stride that will be used to access the buffer. This is the actual 156 // The stride that will be used to access the buffer. This is the actual
168 // stide, NOT the GL bogus stride. In other words there is never a stride 157 // stide, NOT the GL bogus stride. In other words there is never a stride
169 // of 0. 158 // of 0.
170 GLsizei real_stride_; 159 GLsizei real_stride_;
171 160
172 GLsizei divisor_; 161 GLsizei divisor_;
173 162
174 // The current value of the attrib.
175 Vec4 value_;
176
177 // The buffer bound to this attribute. 163 // The buffer bound to this attribute.
178 BufferManager::BufferInfo::Ref buffer_; 164 BufferManager::BufferInfo::Ref buffer_;
179 165
180 // List this info is on. 166 // List this info is on.
181 VertexAttribInfoList* list_; 167 VertexAttribInfoList* list_;
182 168
183 // Iterator for list this info is on. Enabled/Disabled 169 // Iterator for list this info is on. Enabled/Disabled
184 VertexAttribInfoList::iterator it_; 170 VertexAttribInfoList::iterator it_;
185 }; 171 };
186 172
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 286
301 // Service side vertex array object id. 287 // Service side vertex array object id.
302 GLuint service_id_; 288 GLuint service_id_;
303 }; 289 };
304 290
305 } // namespace gles2 291 } // namespace gles2
306 } // namespace gpu 292 } // namespace gpu
307 293
308 #endif // GPU_COMMAND_BUFFER_SERVICE_VERTEX_ATTRIB_MANAGER_H_ 294 #endif // GPU_COMMAND_BUFFER_SERVICE_VERTEX_ATTRIB_MANAGER_H_
309 295
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | gpu/command_buffer/service/vertex_attrib_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698