| OLD | NEW |
| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 return enabled_vertex_attribs_; | 193 return enabled_vertex_attribs_; |
| 194 } | 194 } |
| 195 | 195 |
| 196 VertexAttrib* GetVertexAttrib(GLuint index) { | 196 VertexAttrib* GetVertexAttrib(GLuint index) { |
| 197 if (index < vertex_attribs_.size()) { | 197 if (index < vertex_attribs_.size()) { |
| 198 return &vertex_attribs_[index]; | 198 return &vertex_attribs_[index]; |
| 199 } | 199 } |
| 200 return NULL; | 200 return NULL; |
| 201 } | 201 } |
| 202 | 202 |
| 203 void UpdateAttribBaseTypeAndMask(GLuint loc, GLenum base_type) { |
| 204 DCHECK(loc >=0 && loc < 16); |
| 205 int shift_bits = loc * 2; |
| 206 attrib_written_mask_ |= 0x3 << shift_bits; |
| 207 attrib_base_type_mask_ |= base_type << shift_bits; |
| 208 } |
| 209 |
| 210 uint32_t attrib_base_type_mask() const { |
| 211 return attrib_base_type_mask_; |
| 212 } |
| 213 |
| 214 uint32_t attrib_written_mask() const { |
| 215 return attrib_written_mask_; |
| 216 } |
| 217 |
| 203 void SetAttribInfo( | 218 void SetAttribInfo( |
| 204 GLuint index, | 219 GLuint index, |
| 205 Buffer* buffer, | 220 Buffer* buffer, |
| 206 GLint size, | 221 GLint size, |
| 207 GLenum type, | 222 GLenum type, |
| 208 GLboolean normalized, | 223 GLboolean normalized, |
| 209 GLsizei gl_stride, | 224 GLsizei gl_stride, |
| 210 GLsizei real_stride, | 225 GLsizei real_stride, |
| 211 GLsizei offset, | 226 GLsizei offset, |
| 212 GLboolean integer) { | 227 GLboolean integer) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 deleted_ = true; | 292 deleted_ = true; |
| 278 } | 293 } |
| 279 | 294 |
| 280 // number of attribs using type GL_FIXED. | 295 // number of attribs using type GL_FIXED. |
| 281 int num_fixed_attribs_; | 296 int num_fixed_attribs_; |
| 282 | 297 |
| 283 // Info for each vertex attribute saved so we can check at glDrawXXX time | 298 // Info for each vertex attribute saved so we can check at glDrawXXX time |
| 284 // if it is safe to draw. | 299 // if it is safe to draw. |
| 285 std::vector<VertexAttrib> vertex_attribs_; | 300 std::vector<VertexAttrib> vertex_attribs_; |
| 286 | 301 |
| 302 // Vertex attrib base types: FLOAT, INT, or UINT. |
| 303 // We have up to 16 attribs, each is encoded into 2 bits, total 32 bits: |
| 304 // the lowest 2 bits for location 0, the highest 2 bits for location 15. |
| 305 uint32_t attrib_base_type_mask_; |
| 306 // Same layout as above, 2 bits per location, 0x03 if a location is set |
| 307 // by vertexAttrib API, 0x00 if not. |
| 308 uint32_t attrib_written_mask_; |
| 309 |
| 287 // The currently bound element array buffer. If this is 0 it is illegal | 310 // The currently bound element array buffer. If this is 0 it is illegal |
| 288 // to call glDrawElements. | 311 // to call glDrawElements. |
| 289 scoped_refptr<Buffer> element_array_buffer_; | 312 scoped_refptr<Buffer> element_array_buffer_; |
| 290 | 313 |
| 291 // Lists for which vertex attribs are enabled, disabled. | 314 // Lists for which vertex attribs are enabled, disabled. |
| 292 VertexAttribList enabled_vertex_attribs_; | 315 VertexAttribList enabled_vertex_attribs_; |
| 293 VertexAttribList disabled_vertex_attribs_; | 316 VertexAttribList disabled_vertex_attribs_; |
| 294 | 317 |
| 295 // The VertexArrayManager that owns this VertexAttribManager | 318 // The VertexArrayManager that owns this VertexAttribManager |
| 296 VertexArrayManager* manager_; | 319 VertexArrayManager* manager_; |
| 297 | 320 |
| 298 // True if deleted. | 321 // True if deleted. |
| 299 bool deleted_; | 322 bool deleted_; |
| 300 | 323 |
| 301 // Service side vertex array object id. | 324 // Service side vertex array object id. |
| 302 GLuint service_id_; | 325 GLuint service_id_; |
| 303 }; | 326 }; |
| 304 | 327 |
| 305 } // namespace gles2 | 328 } // namespace gles2 |
| 306 } // namespace gpu | 329 } // namespace gpu |
| 307 | 330 |
| 308 #endif // GPU_COMMAND_BUFFER_SERVICE_VERTEX_ATTRIB_MANAGER_H_ | 331 #endif // GPU_COMMAND_BUFFER_SERVICE_VERTEX_ATTRIB_MANAGER_H_ |
| 309 | 332 |
| OLD | NEW |