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/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <stdio.h> | 10 #include <stdio.h> |
(...skipping 9349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9360 LOCAL_RENDER_WARNING("Render count or primcount is 0."); | 9360 LOCAL_RENDER_WARNING("Render count or primcount is 0."); |
9361 return error::kNoError; | 9361 return error::kNoError; |
9362 } | 9362 } |
9363 | 9363 |
9364 if (feature_info_->IsWebGL2OrES3Context() && !AttribsTypeMatch()) { | 9364 if (feature_info_->IsWebGL2OrES3Context() && !AttribsTypeMatch()) { |
9365 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, | 9365 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, |
9366 "vertexAttrib function must match shader attrib type"); | 9366 "vertexAttrib function must match shader attrib type"); |
9367 return error::kNoError; | 9367 return error::kNoError; |
9368 } | 9368 } |
9369 | 9369 |
9370 GLuint max_vertex_accessed = first + count - 1; | 9370 base::CheckedNumeric<GLuint> checked_max_vertex = first; |
| 9371 checked_max_vertex += count - 1; |
| 9372 // first and count-1 are both a non-negative int, so their sum fits an |
| 9373 // unsigned int. |
| 9374 GLuint max_vertex_accessed = checked_max_vertex.ValueOrDie(); |
9371 if (IsDrawValid(function_name, max_vertex_accessed, instanced, primcount)) { | 9375 if (IsDrawValid(function_name, max_vertex_accessed, instanced, primcount)) { |
9372 if (!ClearUnclearedTextures()) { | 9376 if (!ClearUnclearedTextures()) { |
9373 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "out of memory"); | 9377 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "out of memory"); |
9374 return error::kNoError; | 9378 return error::kNoError; |
9375 } | 9379 } |
9376 bool simulated_attrib_0 = false; | 9380 bool simulated_attrib_0 = false; |
9377 if (!SimulateAttrib0( | 9381 if (!SimulateAttrib0( |
9378 function_name, max_vertex_accessed, &simulated_attrib_0)) { | 9382 function_name, max_vertex_accessed, &simulated_attrib_0)) { |
9379 return error::kNoError; | 9383 return error::kNoError; |
9380 } | 9384 } |
(...skipping 8595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17976 } | 17980 } |
17977 | 17981 |
17978 // Include the auto-generated part of this file. We split this because it means | 17982 // Include the auto-generated part of this file. We split this because it means |
17979 // we can easily edit the non-auto generated parts right here in this file | 17983 // we can easily edit the non-auto generated parts right here in this file |
17980 // instead of having to edit some template or the code generator. | 17984 // instead of having to edit some template or the code generator. |
17981 #include "base/macros.h" | 17985 #include "base/macros.h" |
17982 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 17986 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
17983 | 17987 |
17984 } // namespace gles2 | 17988 } // namespace gles2 |
17985 } // namespace gpu | 17989 } // namespace gpu |
OLD | NEW |