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 <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 13163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13174 if (image) { | 13174 if (image) { |
13175 gfx::Size size = image->GetSize(); | 13175 gfx::Size size = image->GetSize(); |
13176 source_width = size.width(); | 13176 source_width = size.width(); |
13177 source_height = size.height(); | 13177 source_height = size.height(); |
13178 if (source_width <= 0 || source_height <= 0) { | 13178 if (source_width <= 0 || source_height <= 0) { |
13179 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", | 13179 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", |
13180 "invalid image size"); | 13180 "invalid image size"); |
13181 return; | 13181 return; |
13182 } | 13182 } |
13183 } else { | 13183 } else { |
13184 // TODO(dshwang): make GetLevelSize, ValidForTexture and ValidForTarget | |
13185 // correct for GLImage also. crbug.com/549531 | |
13186 if (!source_texture->GetLevelSize(source_texture->target(), 0, | 13184 if (!source_texture->GetLevelSize(source_texture->target(), 0, |
13187 &source_width, &source_height, nullptr)) { | 13185 &source_width, &source_height, nullptr)) { |
13188 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", | 13186 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", |
13189 "source texture has no level 0"); | 13187 "source texture has no level 0"); |
13190 return; | 13188 return; |
13191 } | 13189 } |
13192 | 13190 |
13193 if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0, | |
13194 width, height, 1)) { | |
13195 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", | |
13196 "source texture bad dimensions."); | |
13197 return; | |
13198 } | |
13199 | |
13200 // Check that this type of texture is allowed. | 13191 // Check that this type of texture is allowed. |
13201 if (!texture_manager()->ValidForTarget(source_texture->target(), 0, | 13192 if (!texture_manager()->ValidForTarget(source_texture->target(), 0, |
13202 source_width, source_height, 1)) { | 13193 source_width, source_height, 1)) { |
13203 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", | 13194 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", |
13204 "source texture bad dimensions"); | 13195 "source texture bad dimensions"); |
13205 return; | 13196 return; |
13206 } | 13197 } |
13207 } | 13198 } |
13208 | 13199 |
13209 GLenum source_type = 0; | 13200 GLenum source_type = 0; |
13210 GLenum source_internal_format = 0; | 13201 GLenum source_internal_format = 0; |
13211 source_texture->GetLevelType(source_texture->target(), 0, &source_type, | 13202 source_texture->GetLevelType(source_texture->target(), 0, &source_type, |
13212 &source_internal_format); | 13203 &source_internal_format); |
| 13204 if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0, |
| 13205 width, height, 1)) { |
| 13206 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", |
| 13207 "source texture bad dimensions."); |
| 13208 return; |
| 13209 } |
13213 | 13210 |
13214 GLenum dest_type = 0; | 13211 GLenum dest_type = 0; |
13215 GLenum dest_internal_format = 0; | 13212 GLenum dest_internal_format = 0; |
13216 bool dest_level_defined = dest_texture->GetLevelType( | 13213 bool dest_level_defined = dest_texture->GetLevelType( |
13217 dest_texture->target(), 0, &dest_type, &dest_internal_format); | 13214 dest_texture->target(), 0, &dest_type, &dest_internal_format); |
13218 if (!dest_level_defined) { | 13215 if (!dest_level_defined) { |
13219 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCopySubTextureCHROMIUM", | 13216 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCopySubTextureCHROMIUM", |
13220 "destination texture is not defined"); | 13217 "destination texture is not defined"); |
13221 return; | 13218 return; |
13222 } | 13219 } |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13506 return; | 13503 return; |
13507 } | 13504 } |
13508 } else { | 13505 } else { |
13509 if (!source_texture->GetLevelSize(source_texture->target(), 0, | 13506 if (!source_texture->GetLevelSize(source_texture->target(), 0, |
13510 &source_width, &source_height, nullptr)) { | 13507 &source_width, &source_height, nullptr)) { |
13511 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", | 13508 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", |
13512 "source texture has no level 0"); | 13509 "source texture has no level 0"); |
13513 return; | 13510 return; |
13514 } | 13511 } |
13515 | 13512 |
13516 if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0, | |
13517 width, height, 1)) { | |
13518 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", | |
13519 "source texture bad dimensions."); | |
13520 return; | |
13521 } | |
13522 | |
13523 // Check that this type of texture is allowed. | 13513 // Check that this type of texture is allowed. |
13524 if (!texture_manager()->ValidForTarget(source_texture->target(), 0, | 13514 if (!texture_manager()->ValidForTarget(source_texture->target(), 0, |
13525 source_width, source_height, 1)) { | 13515 source_width, source_height, 1)) { |
13526 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", | 13516 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", |
13527 "source texture bad dimensions"); | 13517 "source texture bad dimensions"); |
13528 return; | 13518 return; |
13529 } | 13519 } |
13530 } | 13520 } |
13531 | 13521 |
13532 GLenum source_type = 0; | 13522 GLenum source_type = 0; |
13533 GLenum source_internal_format = 0; | 13523 GLenum source_internal_format = 0; |
13534 source_texture->GetLevelType(source_texture->target(), 0, &source_type, | 13524 source_texture->GetLevelType(source_texture->target(), 0, &source_type, |
13535 &source_internal_format); | 13525 &source_internal_format); |
| 13526 if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0, |
| 13527 width, height, 1)) { |
| 13528 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", |
| 13529 "source texture bad dimensions."); |
| 13530 return; |
| 13531 } |
13536 | 13532 |
13537 GLenum dest_type = 0; | 13533 GLenum dest_type = 0; |
13538 GLenum dest_internal_format = 0; | 13534 GLenum dest_internal_format = 0; |
13539 bool dest_level_defined = dest_texture->GetLevelType( | 13535 bool dest_level_defined = dest_texture->GetLevelType( |
13540 dest_texture->target(), 0, &dest_type, &dest_internal_format); | 13536 dest_texture->target(), 0, &dest_type, &dest_internal_format); |
13541 if (!dest_level_defined) { | 13537 if (!dest_level_defined) { |
13542 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, | 13538 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, |
13543 "glCompressedCopySubTextureCHROMIUM", | 13539 "glCompressedCopySubTextureCHROMIUM", |
13544 "destination texture is not defined"); | 13540 "destination texture is not defined"); |
13545 return; | 13541 return; |
(...skipping 1885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15431 return error::kNoError; | 15427 return error::kNoError; |
15432 } | 15428 } |
15433 | 15429 |
15434 // Include the auto-generated part of this file. We split this because it means | 15430 // Include the auto-generated part of this file. We split this because it means |
15435 // we can easily edit the non-auto generated parts right here in this file | 15431 // we can easily edit the non-auto generated parts right here in this file |
15436 // instead of having to edit some template or the code generator. | 15432 // instead of having to edit some template or the code generator. |
15437 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 15433 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
15438 | 15434 |
15439 } // namespace gles2 | 15435 } // namespace gles2 |
15440 } // namespace gpu | 15436 } // namespace gpu |
OLD | NEW |