Chromium Code Reviews| Index: gpu/command_buffer/client/gles2_implementation.cc |
| diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc |
| index dbd7fffc60c7037a690a2eb58fa1befa7dc3d720..5e279e74f36b301122fb36351d956d83a5997296 100644 |
| --- a/gpu/command_buffer/client/gles2_implementation.cc |
| +++ b/gpu/command_buffer/client/gles2_implementation.cc |
| @@ -4563,9 +4563,13 @@ void GLES2Implementation::DrawArrays(GLenum mode, GLint first, GLsizei count) { |
| return; |
| } |
| bool simulated = false; |
| - if (!vertex_array_object_manager_->SetupSimulatedClientSideBuffers( |
| - "glDrawArrays", this, helper_, first + count, 0, &simulated)) { |
| - return; |
| + if (vertex_array_object_manager_->SupportsClientSideBuffers()) { |
| + GLsizei num_elements; |
| + SafeAddInt32(first, count, &num_elements); |
|
Zhenyao Mo
2016/08/04 17:40:14
We should generate INVALID_VALUE if SafeAddInt32 r
|
| + if (!vertex_array_object_manager_->SetupSimulatedClientSideBuffers( |
| + "glDrawArrays", this, helper_, num_elements, 0, &simulated)) { |
| + return; |
| + } |
| } |
| helper_->DrawArrays(mode, first, count); |
| RestoreArrayBuffer(simulated); |
| @@ -5576,10 +5580,14 @@ void GLES2Implementation::DrawArraysInstancedANGLE( |
| return; |
| } |
| bool simulated = false; |
| - if (!vertex_array_object_manager_->SetupSimulatedClientSideBuffers( |
| - "glDrawArraysInstancedANGLE", this, helper_, first + count, primcount, |
| - &simulated)) { |
| - return; |
| + if (vertex_array_object_manager_->SupportsClientSideBuffers()) { |
| + GLsizei num_elements; |
| + SafeAddInt32(first, count, &num_elements); |
|
Zhenyao Mo
2016/08/04 17:40:14
Same here.
|
| + if (!vertex_array_object_manager_->SetupSimulatedClientSideBuffers( |
| + "glDrawArraysInstancedANGLE", this, helper_, num_elements, |
| + primcount, &simulated)) { |
| + return; |
| + } |
| } |
| helper_->DrawArraysInstancedANGLE(mode, first, count, primcount); |
| RestoreArrayBuffer(simulated); |