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

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

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