| 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 17130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17141 if (levels == 0) { | 17141 if (levels == 0) { |
| 17142 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "levels == 0"); | 17142 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "levels == 0"); |
| 17143 return; | 17143 return; |
| 17144 } | 17144 } |
| 17145 bool is_compressed_format = IsCompressedTextureFormat(internal_format); | 17145 bool is_compressed_format = IsCompressedTextureFormat(internal_format); |
| 17146 if (is_compressed_format && target == GL_TEXTURE_3D) { | 17146 if (is_compressed_format && target == GL_TEXTURE_3D) { |
| 17147 LOCAL_SET_GL_ERROR( | 17147 LOCAL_SET_GL_ERROR( |
| 17148 GL_INVALID_OPERATION, function_name, "target invalid for format"); | 17148 GL_INVALID_OPERATION, function_name, "target invalid for format"); |
| 17149 return; | 17149 return; |
| 17150 } | 17150 } |
| 17151 // The glTexStorage entry points require width, height, and depth to be |
| 17152 // at least 1, but the other texture entry points (those which use |
| 17153 // ValidForTarget) do not. So we have to add an extra check here. |
| 17154 bool is_invalid_texstorage_size = width < 1 || height < 1 || depth < 1; |
| 17151 if (!texture_manager()->ValidForTarget(target, 0, width, height, depth) || | 17155 if (!texture_manager()->ValidForTarget(target, 0, width, height, depth) || |
| 17152 TextureManager::ComputeMipMapCount( | 17156 is_invalid_texstorage_size || |
| 17153 target, width, height, depth) < levels) { | 17157 TextureManager::ComputeMipMapCount(target, width, height, depth) < |
| 17158 levels) { |
| 17154 LOCAL_SET_GL_ERROR( | 17159 LOCAL_SET_GL_ERROR( |
| 17155 GL_INVALID_VALUE, function_name, "dimensions out of range"); | 17160 GL_INVALID_VALUE, function_name, "dimensions out of range"); |
| 17156 return; | 17161 return; |
| 17157 } | 17162 } |
| 17158 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( | 17163 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( |
| 17159 &state_, target); | 17164 &state_, target); |
| 17160 if (!texture_ref) { | 17165 if (!texture_ref) { |
| 17161 LOCAL_SET_GL_ERROR( | 17166 LOCAL_SET_GL_ERROR( |
| 17162 GL_INVALID_OPERATION, function_name, "unknown texture for target"); | 17167 GL_INVALID_OPERATION, function_name, "unknown texture for target"); |
| 17163 return; | 17168 return; |
| (...skipping 2225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19389 } | 19394 } |
| 19390 | 19395 |
| 19391 // Include the auto-generated part of this file. We split this because it means | 19396 // Include the auto-generated part of this file. We split this because it means |
| 19392 // we can easily edit the non-auto generated parts right here in this file | 19397 // we can easily edit the non-auto generated parts right here in this file |
| 19393 // instead of having to edit some template or the code generator. | 19398 // instead of having to edit some template or the code generator. |
| 19394 #include "base/macros.h" | 19399 #include "base/macros.h" |
| 19395 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 19400 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 19396 | 19401 |
| 19397 } // namespace gles2 | 19402 } // namespace gles2 |
| 19398 } // namespace gpu | 19403 } // namespace gpu |
| OLD | NEW |