| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 | 10 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 if (buffer->IsClientSideArray()) { | 265 if (buffer->IsClientSideArray()) { |
| 266 // Don't disable attrib 0 since it's special. | 266 // Don't disable attrib 0 since it's special. |
| 267 if (attrib->index() > 0) { | 267 if (attrib->index() > 0) { |
| 268 glDisableVertexAttribArray(attrib->index()); | 268 glDisableVertexAttribArray(attrib->index()); |
| 269 } | 269 } |
| 270 } | 270 } |
| 271 } | 271 } |
| 272 } | 272 } |
| 273 } | 273 } |
| 274 | 274 |
| 275 // Instanced drawing needs at least one enabled attribute with divisor zero. | 275 // Due to D3D9 limitation, in ES2/WebGL1, instanced drawing needs at least |
| 276 // one enabled attribute with divisor zero. This does not apply to D3D11, |
| 277 // therefore, it also does not apply to ES3/WebGL2. |
| 276 // Non-instanced drawing is fine with having no attributes at all, but if | 278 // Non-instanced drawing is fine with having no attributes at all, but if |
| 277 // there are attributes, at least one should have divisor zero. | 279 // there are attributes, at least one should have divisor zero. |
| 278 // (See ANGLE_instanced_arrays spec) | 280 // (See ANGLE_instanced_arrays spec) |
| 279 if (!divisor0 && (instanced || have_enabled_active_attribs)) { | 281 if (feature_info->IsWebGL1OrES2Context() && !divisor0 && |
| 282 (instanced || have_enabled_active_attribs)) { |
| 280 ERRORSTATE_SET_GL_ERROR( | 283 ERRORSTATE_SET_GL_ERROR( |
| 281 error_state, GL_INVALID_OPERATION, function_name, | 284 error_state, GL_INVALID_OPERATION, function_name, |
| 282 "attempt to draw with all attributes having non-zero divisors"); | 285 "attempt to draw with all attributes having non-zero divisors"); |
| 283 return false; | 286 return false; |
| 284 } | 287 } |
| 285 | 288 |
| 286 if (current_buffer_id != kInitialBufferId) { | 289 if (current_buffer_id != kInitialBufferId) { |
| 287 // Restore the buffer binding. | 290 // Restore the buffer binding. |
| 288 decoder->RestoreBufferBindings(); | 291 decoder->RestoreBufferBindings(); |
| 289 } | 292 } |
| 290 | 293 |
| 291 return true; | 294 return true; |
| 292 } | 295 } |
| 293 | 296 |
| 294 } // namespace gles2 | 297 } // namespace gles2 |
| 295 } // namespace gpu | 298 } // namespace gpu |
| OLD | NEW |