| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include <list> | 5 #include <list> |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "gpu/command_buffer/service/buffer_manager.h" | 9 #include "gpu/command_buffer/service/buffer_manager.h" |
| 10 #include "gpu/command_buffer/service/gl_utils.h" | 10 #include "gpu/command_buffer/service/gl_utils.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 DCHECK_GT(real_stride, 0); | 104 DCHECK_GT(real_stride, 0); |
| 105 buffer_ = buffer; | 105 buffer_ = buffer; |
| 106 size_ = size; | 106 size_ = size; |
| 107 type_ = type; | 107 type_ = type; |
| 108 normalized_ = normalized; | 108 normalized_ = normalized; |
| 109 gl_stride_ = gl_stride; | 109 gl_stride_ = gl_stride; |
| 110 real_stride_ = real_stride; | 110 real_stride_ = real_stride; |
| 111 offset_ = offset; | 111 offset_ = offset; |
| 112 } | 112 } |
| 113 | 113 |
| 114 void Unbind(BufferManager::BufferInfo* buffer) { |
| 115 if (buffer_ == buffer) { |
| 116 buffer_ = NULL; |
| 117 } |
| 118 } |
| 119 |
| 114 // The index of this attrib. | 120 // The index of this attrib. |
| 115 GLuint index_; | 121 GLuint index_; |
| 116 | 122 |
| 117 // Whether or not this attribute is enabled. | 123 // Whether or not this attribute is enabled. |
| 118 bool enabled_; | 124 bool enabled_; |
| 119 | 125 |
| 120 // number of components (1, 2, 3, 4) | 126 // number of components (1, 2, 3, 4) |
| 121 GLint size_; | 127 GLint size_; |
| 122 | 128 |
| 123 // GL_BYTE, GL_FLOAT, etc. See glVertexAttribPointer. | 129 // GL_BYTE, GL_FLOAT, etc. See glVertexAttribPointer. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 --num_fixed_attribs_; | 194 --num_fixed_attribs_; |
| 189 } | 195 } |
| 190 if (type == GL_FIXED) { | 196 if (type == GL_FIXED) { |
| 191 ++num_fixed_attribs_; | 197 ++num_fixed_attribs_; |
| 192 } | 198 } |
| 193 info->SetInfo( | 199 info->SetInfo( |
| 194 buffer, size, type, normalized, gl_stride, real_stride, offset); | 200 buffer, size, type, normalized, gl_stride, real_stride, offset); |
| 195 } | 201 } |
| 196 } | 202 } |
| 197 | 203 |
| 204 void Unbind(BufferManager::BufferInfo* buffer); |
| 198 | 205 |
| 199 private: | 206 private: |
| 200 uint32 max_vertex_attribs_; | 207 uint32 max_vertex_attribs_; |
| 201 | 208 |
| 202 // number of attribs using type GL_FIXED. | 209 // number of attribs using type GL_FIXED. |
| 203 int num_fixed_attribs_; | 210 int num_fixed_attribs_; |
| 204 | 211 |
| 205 // Info for each vertex attribute saved so we can check at glDrawXXX time | 212 // Info for each vertex attribute saved so we can check at glDrawXXX time |
| 206 // if it is safe to draw. | 213 // if it is safe to draw. |
| 207 scoped_array<VertexAttribInfo> vertex_attrib_infos_; | 214 scoped_array<VertexAttribInfo> vertex_attrib_infos_; |
| 208 | 215 |
| 209 // Lists for which vertex attribs are enabled, disabled. | 216 // Lists for which vertex attribs are enabled, disabled. |
| 210 VertexAttribInfoList enabled_vertex_attribs_; | 217 VertexAttribInfoList enabled_vertex_attribs_; |
| 211 VertexAttribInfoList disabled_vertex_attribs_; | 218 VertexAttribInfoList disabled_vertex_attribs_; |
| 212 }; | 219 }; |
| 213 | 220 |
| 214 } // namespace gles2 | 221 } // namespace gles2 |
| 215 } // namespace gpu | 222 } // namespace gpu |
| OLD | NEW |