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 11099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11110 if (!validators_->texture_3_d_target.IsValid(target)) { | 11110 if (!validators_->texture_3_d_target.IsValid(target)) { |
11111 LOCAL_SET_GL_ERROR( | 11111 LOCAL_SET_GL_ERROR( |
11112 GL_INVALID_ENUM, "glCompressedTexSubImage3D", "target"); | 11112 GL_INVALID_ENUM, "glCompressedTexSubImage3D", "target"); |
11113 return; | 11113 return; |
11114 } | 11114 } |
11115 if (!validators_->compressed_texture_format.IsValid(format)) { | 11115 if (!validators_->compressed_texture_format.IsValid(format)) { |
11116 LOCAL_SET_GL_ERROR_INVALID_ENUM( | 11116 LOCAL_SET_GL_ERROR_INVALID_ENUM( |
11117 "glCompressedTexSubImage3D", format, "format"); | 11117 "glCompressedTexSubImage3D", format, "format"); |
11118 return; | 11118 return; |
11119 } | 11119 } |
11120 if (width < 0 || height < 0 || depth < 0) { | 11120 if (!texture_manager()->ValidForTarget(target, level, width, height, depth)) { |
11121 LOCAL_SET_GL_ERROR( | 11121 LOCAL_SET_GL_ERROR( |
11122 GL_INVALID_VALUE, "glCompressedTexSubImage3D", "size < 0"); | 11122 GL_INVALID_VALUE, |
| 11123 "glCompressedTexSubImage3D", "dimensions out of range"); |
11123 return; | 11124 return; |
11124 } | 11125 } |
11125 if (image_size < 0) { | 11126 if (image_size < 0) { |
11126 LOCAL_SET_GL_ERROR( | 11127 LOCAL_SET_GL_ERROR( |
11127 GL_INVALID_VALUE, "glCompressedTexSubImage3D", "imageSize < 0"); | 11128 GL_INVALID_VALUE, "glCompressedTexSubImage3D", "imageSize < 0"); |
11128 return; | 11129 return; |
11129 } | 11130 } |
11130 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( | 11131 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( |
11131 &state_, target); | 11132 &state_, target); |
11132 if (!texture_ref) { | 11133 if (!texture_ref) { |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11334 GLsizei image_size, | 11335 GLsizei image_size, |
11335 const void * data) { | 11336 const void * data) { |
11336 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( | 11337 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( |
11337 &state_, target); | 11338 &state_, target); |
11338 if (!texture_ref) { | 11339 if (!texture_ref) { |
11339 LOCAL_SET_GL_ERROR( | 11340 LOCAL_SET_GL_ERROR( |
11340 GL_INVALID_OPERATION, | 11341 GL_INVALID_OPERATION, |
11341 "glCompressedTexSubImage2D", "unknown texture for target"); | 11342 "glCompressedTexSubImage2D", "unknown texture for target"); |
11342 return; | 11343 return; |
11343 } | 11344 } |
| 11345 if (!texture_manager()->ValidForTarget(target, level, width, height, 1)) { |
| 11346 LOCAL_SET_GL_ERROR( |
| 11347 GL_INVALID_VALUE, |
| 11348 "glCompressedTexSubImage2D", "dimensions out of range"); |
| 11349 return; |
| 11350 } |
11344 Texture* texture = texture_ref->texture(); | 11351 Texture* texture = texture_ref->texture(); |
11345 GLenum type = 0; | 11352 GLenum type = 0; |
11346 GLenum internal_format = 0; | 11353 GLenum internal_format = 0; |
11347 if (!texture->GetLevelType(target, level, &type, &internal_format)) { | 11354 if (!texture->GetLevelType(target, level, &type, &internal_format)) { |
11348 LOCAL_SET_GL_ERROR( | 11355 LOCAL_SET_GL_ERROR( |
11349 GL_INVALID_OPERATION, | 11356 GL_INVALID_OPERATION, |
11350 "glCompressedTexSubImage2D", "level does not exist."); | 11357 "glCompressedTexSubImage2D", "level does not exist."); |
11351 return; | 11358 return; |
11352 } | 11359 } |
11353 if (internal_format != format) { | 11360 if (internal_format != format) { |
(...skipping 4596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15950 } | 15957 } |
15951 | 15958 |
15952 // Include the auto-generated part of this file. We split this because it means | 15959 // Include the auto-generated part of this file. We split this because it means |
15953 // we can easily edit the non-auto generated parts right here in this file | 15960 // we can easily edit the non-auto generated parts right here in this file |
15954 // instead of having to edit some template or the code generator. | 15961 // instead of having to edit some template or the code generator. |
15955 #include "base/macros.h" | 15962 #include "base/macros.h" |
15956 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 15963 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
15957 | 15964 |
15958 } // namespace gles2 | 15965 } // namespace gles2 |
15959 } // namespace gpu | 15966 } // namespace gpu |
OLD | NEW |