| 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 13185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13196 return; | 13196 return; |
| 13197 } | 13197 } |
| 13198 } else { | 13198 } else { |
| 13199 if (!source_texture->GetLevelSize(source_texture->target(), 0, | 13199 if (!source_texture->GetLevelSize(source_texture->target(), 0, |
| 13200 &source_width, &source_height, nullptr)) { | 13200 &source_width, &source_height, nullptr)) { |
| 13201 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", | 13201 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", |
| 13202 "source texture has no level 0"); | 13202 "source texture has no level 0"); |
| 13203 return; | 13203 return; |
| 13204 } | 13204 } |
| 13205 | 13205 |
| 13206 if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0, |
| 13207 width, height, 1)) { |
| 13208 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", |
| 13209 "source texture bad dimensions."); |
| 13210 return; |
| 13211 } |
| 13212 |
| 13206 // Check that this type of texture is allowed. | 13213 // Check that this type of texture is allowed. |
| 13207 if (!texture_manager()->ValidForTarget(source_texture->target(), 0, | 13214 if (!texture_manager()->ValidForTarget(source_texture->target(), 0, |
| 13208 source_width, source_height, 1)) { | 13215 source_width, source_height, 1)) { |
| 13209 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", | 13216 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", |
| 13210 "source texture bad dimensions"); | 13217 "source texture bad dimensions"); |
| 13211 return; | 13218 return; |
| 13212 } | 13219 } |
| 13213 } | 13220 } |
| 13214 | 13221 |
| 13215 GLenum source_type = 0; | 13222 GLenum source_type = 0; |
| 13216 GLenum source_internal_format = 0; | 13223 GLenum source_internal_format = 0; |
| 13217 source_texture->GetLevelType(source_texture->target(), 0, &source_type, | 13224 source_texture->GetLevelType(source_texture->target(), 0, &source_type, |
| 13218 &source_internal_format); | 13225 &source_internal_format); |
| 13219 if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0, | |
| 13220 width, height, 1)) { | |
| 13221 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", | |
| 13222 "source texture bad dimensions."); | |
| 13223 return; | |
| 13224 } | |
| 13225 | 13226 |
| 13226 GLenum dest_type = 0; | 13227 GLenum dest_type = 0; |
| 13227 GLenum dest_internal_format = 0; | 13228 GLenum dest_internal_format = 0; |
| 13228 bool dest_level_defined = dest_texture->GetLevelType( | 13229 bool dest_level_defined = dest_texture->GetLevelType( |
| 13229 dest_texture->target(), 0, &dest_type, &dest_internal_format); | 13230 dest_texture->target(), 0, &dest_type, &dest_internal_format); |
| 13230 if (!dest_level_defined) { | 13231 if (!dest_level_defined) { |
| 13231 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCopySubTextureCHROMIUM", | 13232 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCopySubTextureCHROMIUM", |
| 13232 "destination texture is not defined"); | 13233 "destination texture is not defined"); |
| 13233 return; | 13234 return; |
| 13234 } | 13235 } |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13518 return; | 13519 return; |
| 13519 } | 13520 } |
| 13520 } else { | 13521 } else { |
| 13521 if (!source_texture->GetLevelSize(source_texture->target(), 0, | 13522 if (!source_texture->GetLevelSize(source_texture->target(), 0, |
| 13522 &source_width, &source_height, nullptr)) { | 13523 &source_width, &source_height, nullptr)) { |
| 13523 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", | 13524 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", |
| 13524 "source texture has no level 0"); | 13525 "source texture has no level 0"); |
| 13525 return; | 13526 return; |
| 13526 } | 13527 } |
| 13527 | 13528 |
| 13529 if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0, |
| 13530 width, height, 1)) { |
| 13531 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", |
| 13532 "source texture bad dimensions."); |
| 13533 return; |
| 13534 } |
| 13535 |
| 13528 // Check that this type of texture is allowed. | 13536 // Check that this type of texture is allowed. |
| 13529 if (!texture_manager()->ValidForTarget(source_texture->target(), 0, | 13537 if (!texture_manager()->ValidForTarget(source_texture->target(), 0, |
| 13530 source_width, source_height, 1)) { | 13538 source_width, source_height, 1)) { |
| 13531 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", | 13539 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", |
| 13532 "source texture bad dimensions"); | 13540 "source texture bad dimensions"); |
| 13533 return; | 13541 return; |
| 13534 } | 13542 } |
| 13535 } | 13543 } |
| 13536 | 13544 |
| 13537 GLenum source_type = 0; | 13545 GLenum source_type = 0; |
| 13538 GLenum source_internal_format = 0; | 13546 GLenum source_internal_format = 0; |
| 13539 source_texture->GetLevelType(source_texture->target(), 0, &source_type, | 13547 source_texture->GetLevelType(source_texture->target(), 0, &source_type, |
| 13540 &source_internal_format); | 13548 &source_internal_format); |
| 13541 if (!source_texture->ValidForTexture(source_texture->target(), 0, x, y, 0, | |
| 13542 width, height, 1)) { | |
| 13543 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM", | |
| 13544 "source texture bad dimensions."); | |
| 13545 return; | |
| 13546 } | |
| 13547 | 13549 |
| 13548 GLenum dest_type = 0; | 13550 GLenum dest_type = 0; |
| 13549 GLenum dest_internal_format = 0; | 13551 GLenum dest_internal_format = 0; |
| 13550 bool dest_level_defined = dest_texture->GetLevelType( | 13552 bool dest_level_defined = dest_texture->GetLevelType( |
| 13551 dest_texture->target(), 0, &dest_type, &dest_internal_format); | 13553 dest_texture->target(), 0, &dest_type, &dest_internal_format); |
| 13552 if (!dest_level_defined) { | 13554 if (!dest_level_defined) { |
| 13553 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, | 13555 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, |
| 13554 "glCompressedCopySubTextureCHROMIUM", | 13556 "glCompressedCopySubTextureCHROMIUM", |
| 13555 "destination texture is not defined"); | 13557 "destination texture is not defined"); |
| 13556 return; | 13558 return; |
| (...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14980 return error::kNoError; | 14982 return error::kNoError; |
| 14981 } | 14983 } |
| 14982 | 14984 |
| 14983 // Include the auto-generated part of this file. We split this because it means | 14985 // Include the auto-generated part of this file. We split this because it means |
| 14984 // we can easily edit the non-auto generated parts right here in this file | 14986 // we can easily edit the non-auto generated parts right here in this file |
| 14985 // instead of having to edit some template or the code generator. | 14987 // instead of having to edit some template or the code generator. |
| 14986 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 14988 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 14987 | 14989 |
| 14988 } // namespace gles2 | 14990 } // namespace gles2 |
| 14989 } // namespace gpu | 14991 } // namespace gpu |
| OLD | NEW |