| 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 #include "gpu/command_buffer/service/vertex_attrib_manager.h" | 5 #include "gpu/command_buffer/service/vertex_attrib_manager.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 current_program->GetAttribInfoByLocation(attrib->index()); | 188 current_program->GetAttribInfoByLocation(attrib->index()); |
| 189 if (attrib_info) { | 189 if (attrib_info) { |
| 190 divisor0 |= (attrib->divisor() == 0); | 190 divisor0 |= (attrib->divisor() == 0); |
| 191 have_enabled_active_attribs = true; | 191 have_enabled_active_attribs = true; |
| 192 GLuint count = attrib->MaxVertexAccessed(primcount, max_vertex_accessed); | 192 GLuint count = attrib->MaxVertexAccessed(primcount, max_vertex_accessed); |
| 193 // This attrib is used in the current program. | 193 // This attrib is used in the current program. |
| 194 if (!attrib->CanAccess(count)) { | 194 if (!attrib->CanAccess(count)) { |
| 195 ERRORSTATE_SET_GL_ERROR( | 195 ERRORSTATE_SET_GL_ERROR( |
| 196 error_state, GL_INVALID_OPERATION, function_name, | 196 error_state, GL_INVALID_OPERATION, function_name, |
| 197 (std::string( | 197 (std::string( |
| 198 "attempt to access out of range vertices in attribute ") + | 198 "attempt to access out of range vertices in attribute ") + |
| 199 base::IntToString(attrib->index())).c_str()); | 199 base::UintToString(attrib->index())).c_str()); |
| 200 return false; | 200 return false; |
| 201 } | 201 } |
| 202 if (use_client_side_arrays_for_stream_buffers) { | 202 if (use_client_side_arrays_for_stream_buffers) { |
| 203 Buffer* buffer = attrib->buffer(); | 203 Buffer* buffer = attrib->buffer(); |
| 204 glEnableVertexAttribArray(attrib->index()); | 204 glEnableVertexAttribArray(attrib->index()); |
| 205 if (buffer->IsClientSideArray()) { | 205 if (buffer->IsClientSideArray()) { |
| 206 if (current_buffer_id != 0) { | 206 if (current_buffer_id != 0) { |
| 207 current_buffer_id = 0; | 207 current_buffer_id = 0; |
| 208 glBindBuffer(GL_ARRAY_BUFFER, 0); | 208 glBindBuffer(GL_ARRAY_BUFFER, 0); |
| 209 } | 209 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 } else { | 237 } else { |
| 238 // This attrib is not used in the current program. | 238 // This attrib is not used in the current program. |
| 239 if (!attrib->buffer()) { | 239 if (!attrib->buffer()) { |
| 240 ERRORSTATE_SET_GL_ERROR( | 240 ERRORSTATE_SET_GL_ERROR( |
| 241 error_state, GL_INVALID_OPERATION, function_name, | 241 error_state, GL_INVALID_OPERATION, function_name, |
| 242 (std::string( | 242 (std::string( |
| 243 "attempt to render with no buffer attached to " | 243 "attempt to render with no buffer attached to " |
| 244 "enabled attribute ") + | 244 "enabled attribute ") + |
| 245 base::IntToString(attrib->index())).c_str()); | 245 base::UintToString(attrib->index())).c_str()); |
| 246 return false; | 246 return false; |
| 247 } else if (use_client_side_arrays_for_stream_buffers) { | 247 } else if (use_client_side_arrays_for_stream_buffers) { |
| 248 Buffer* buffer = attrib->buffer(); | 248 Buffer* buffer = attrib->buffer(); |
| 249 // Disable client side arrays for unused attributes else we'll | 249 // Disable client side arrays for unused attributes else we'll |
| 250 // read bad memory | 250 // read bad memory |
| 251 if (buffer->IsClientSideArray()) { | 251 if (buffer->IsClientSideArray()) { |
| 252 // Don't disable attrib 0 since it's special. | 252 // Don't disable attrib 0 since it's special. |
| 253 if (attrib->index() > 0) { | 253 if (attrib->index() > 0) { |
| 254 glDisableVertexAttribArray(attrib->index()); | 254 glDisableVertexAttribArray(attrib->index()); |
| 255 } | 255 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 272 if (current_buffer_id != kInitialBufferId) { | 272 if (current_buffer_id != kInitialBufferId) { |
| 273 // Restore the buffer binding. | 273 // Restore the buffer binding. |
| 274 decoder->RestoreBufferBindings(); | 274 decoder->RestoreBufferBindings(); |
| 275 } | 275 } |
| 276 | 276 |
| 277 return true; | 277 return true; |
| 278 } | 278 } |
| 279 | 279 |
| 280 } // namespace gles2 | 280 } // namespace gles2 |
| 281 } // namespace gpu | 281 } // namespace gpu |
| OLD | NEW |