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

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

Issue 12494005: Use client side arrays for GL_STREAM_DRAW attributes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
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"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "gpu/command_buffer/service/buffer_manager.h" 13 #include "gpu/command_buffer/service/buffer_manager.h"
14 #include "gpu/command_buffer/service/gl_utils.h" 14 #include "gpu/command_buffer/service/gl_utils.h"
15 #include "gpu/gpu_export.h" 15 #include "gpu/gpu_export.h"
16 16
17 namespace gpu { 17 namespace gpu {
18 namespace gles2 { 18 namespace gles2 {
19 19
20 class FeatureInfo;
21 class GLES2Decoder;
22 class Program;
20 class VertexArrayManager; 23 class VertexArrayManager;
21 24
22 // Info about a Vertex Attribute. This is used to track what the user currently 25 // Info about a Vertex Attribute. This is used to track what the user currently
23 // has bound on each Vertex Attribute so that checking can be done at 26 // has bound on each Vertex Attribute so that checking can be done at
24 // glDrawXXX time. 27 // glDrawXXX time.
25 class GPU_EXPORT VertexAttrib { 28 class GPU_EXPORT VertexAttrib {
26 public: 29 public:
27 typedef std::list<VertexAttrib*> VertexAttribInfoList; 30 typedef std::list<VertexAttrib*> VertexAttribInfoList;
28 31
29 VertexAttrib(); 32 VertexAttrib();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 return enabled_; 71 return enabled_;
69 } 72 }
70 73
71 // Find the maximum vertex accessed, accounting for instancing. 74 // Find the maximum vertex accessed, accounting for instancing.
72 GLuint MaxVertexAccessed(GLsizei primcount, 75 GLuint MaxVertexAccessed(GLsizei primcount,
73 GLuint max_vertex_accessed) const { 76 GLuint max_vertex_accessed) const {
74 return (primcount && divisor_) ? ((primcount - 1) / divisor_) : 77 return (primcount && divisor_) ? ((primcount - 1) / divisor_) :
75 max_vertex_accessed; 78 max_vertex_accessed;
76 } 79 }
77 80
81 bool is_client_side_array() const {
82 return is_client_side_array_;
83 }
84
85 void set_is_client_side_array(bool value) {
86 is_client_side_array_ = value;
87 }
88
78 private: 89 private:
79 friend class VertexAttribManager; 90 friend class VertexAttribManager;
80 91
81 void set_enabled(bool enabled) { 92 void set_enabled(bool enabled) {
82 enabled_ = enabled; 93 enabled_ = enabled;
83 } 94 }
84 95
85 void set_index(GLuint index) { 96 void set_index(GLuint index) {
86 index_ = index; 97 index_ = index;
87 } 98 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // The stride passed to glVertexAttribPointer. 143 // The stride passed to glVertexAttribPointer.
133 GLsizei gl_stride_; 144 GLsizei gl_stride_;
134 145
135 // The stride that will be used to access the buffer. This is the actual 146 // The stride that will be used to access the buffer. This is the actual
136 // stide, NOT the GL bogus stride. In other words there is never a stride 147 // stide, NOT the GL bogus stride. In other words there is never a stride
137 // of 0. 148 // of 0.
138 GLsizei real_stride_; 149 GLsizei real_stride_;
139 150
140 GLsizei divisor_; 151 GLsizei divisor_;
141 152
153 // Will be true if this was assigned to a client side array.
154 bool is_client_side_array_;
155
142 // The buffer bound to this attribute. 156 // The buffer bound to this attribute.
143 scoped_refptr<Buffer> buffer_; 157 scoped_refptr<Buffer> buffer_;
144 158
145 // List this info is on. 159 // List this info is on.
146 VertexAttribInfoList* list_; 160 VertexAttribInfoList* list_;
147 161
148 // Iterator for list this info is on. Enabled/Disabled 162 // Iterator for list this info is on. Enabled/Disabled
149 VertexAttribInfoList::iterator it_; 163 VertexAttribInfoList::iterator it_;
150 }; 164 };
151 165
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 } 238 }
225 239
226 bool IsValid() const { 240 bool IsValid() const {
227 return !IsDeleted(); 241 return !IsDeleted();
228 } 242 }
229 243
230 size_t num_attribs() const { 244 size_t num_attribs() const {
231 return vertex_attrib_infos_.size(); 245 return vertex_attrib_infos_.size();
232 } 246 }
233 247
248 bool ValidateBindings(
249 const char* function_name,
250 GLES2Decoder* decoder,
251 FeatureInfo* feature_info,
252 Program* current_program,
253 GLuint max_vertex_accessed,
254 GLsizei primcount);
255
234 private: 256 private:
235 friend class VertexArrayManager; 257 friend class VertexArrayManager;
236 friend class VertexArrayManagerTest; 258 friend class VertexArrayManagerTest;
237 friend class base::RefCounted<VertexAttribManager>; 259 friend class base::RefCounted<VertexAttribManager>;
238 260
239 // Used when creating from a VertexArrayManager 261 // Used when creating from a VertexArrayManager
240 VertexAttribManager(VertexArrayManager* manager, GLuint service_id, 262 VertexAttribManager(VertexArrayManager* manager, GLuint service_id,
241 uint32 num_vertex_attribs); 263 uint32 num_vertex_attribs);
242 264
243 ~VertexAttribManager(); 265 ~VertexAttribManager();
(...skipping 25 matching lines...) Expand all
269 291
270 // Service side vertex array object id. 292 // Service side vertex array object id.
271 GLuint service_id_; 293 GLuint service_id_;
272 }; 294 };
273 295
274 } // namespace gles2 296 } // namespace gles2
275 } // namespace gpu 297 } // namespace gpu
276 298
277 #endif // GPU_COMMAND_BUFFER_SERVICE_VERTEX_ATTRIB_MANAGER_H_ 299 #endif // GPU_COMMAND_BUFFER_SERVICE_VERTEX_ATTRIB_MANAGER_H_
278 300
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/test_helper.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