| 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 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 | 946 |
| 947 // Wrapper for glCopyBufferSubData. | 947 // Wrapper for glCopyBufferSubData. |
| 948 void DoCopyBufferSubData(GLenum readtarget, | 948 void DoCopyBufferSubData(GLenum readtarget, |
| 949 GLenum writetarget, | 949 GLenum writetarget, |
| 950 GLintptr readoffset, | 950 GLintptr readoffset, |
| 951 GLintptr writeoffset, | 951 GLintptr writeoffset, |
| 952 GLsizeiptr size); | 952 GLsizeiptr size); |
| 953 | 953 |
| 954 void DoCopyTextureCHROMIUM(GLuint source_id, | 954 void DoCopyTextureCHROMIUM(GLuint source_id, |
| 955 GLint source_level, | 955 GLint source_level, |
| 956 GLenum dest_target, |
| 956 GLuint dest_id, | 957 GLuint dest_id, |
| 957 GLint dest_level, | 958 GLint dest_level, |
| 958 GLenum internal_format, | 959 GLenum internal_format, |
| 959 GLenum dest_type, | 960 GLenum dest_type, |
| 960 GLboolean unpack_flip_y, | 961 GLboolean unpack_flip_y, |
| 961 GLboolean unpack_premultiply_alpha, | 962 GLboolean unpack_premultiply_alpha, |
| 962 GLboolean unpack_unmultiply_alpha); | 963 GLboolean unpack_unmultiply_alpha); |
| 963 | 964 |
| 964 void DoCopySubTextureCHROMIUM(GLuint source_id, | 965 void DoCopySubTextureCHROMIUM(GLuint source_id, |
| 965 GLint source_level, | 966 GLint source_level, |
| 967 GLenum dest_target, |
| 966 GLuint dest_id, | 968 GLuint dest_id, |
| 967 GLint dest_level, | 969 GLint dest_level, |
| 968 GLint xoffset, | 970 GLint xoffset, |
| 969 GLint yoffset, | 971 GLint yoffset, |
| 970 GLint x, | 972 GLint x, |
| 971 GLint y, | 973 GLint y, |
| 972 GLsizei width, | 974 GLsizei width, |
| 973 GLsizei height, | 975 GLsizei height, |
| 974 GLboolean unpack_flip_y, | 976 GLboolean unpack_flip_y, |
| 975 GLboolean unpack_premultiply_alpha, | 977 GLboolean unpack_premultiply_alpha, |
| (...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2012 GLsizei depth, | 2014 GLsizei depth, |
| 2013 GLenum format, | 2015 GLenum format, |
| 2014 GLsizei size, | 2016 GLsizei size, |
| 2015 const GLvoid* data); | 2017 const GLvoid* data); |
| 2016 bool ValidateCompressedTexSubDimensions( | 2018 bool ValidateCompressedTexSubDimensions( |
| 2017 const char* function_name, | 2019 const char* function_name, |
| 2018 GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, | 2020 GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, |
| 2019 GLsizei width, GLsizei height, GLsizei depth, GLenum format, | 2021 GLsizei width, GLsizei height, GLsizei depth, GLenum format, |
| 2020 Texture* texture); | 2022 Texture* texture); |
| 2021 bool ValidateCopyTextureCHROMIUMTextures(const char* function_name, | 2023 bool ValidateCopyTextureCHROMIUMTextures(const char* function_name, |
| 2024 GLenum dest_target, |
| 2022 TextureRef* source_texture_ref, | 2025 TextureRef* source_texture_ref, |
| 2023 TextureRef* dest_texture_ref); | 2026 TextureRef* dest_texture_ref); |
| 2024 CopyTextureMethod ValidateCopyTextureCHROMIUMInternalFormats( | 2027 CopyTextureMethod ValidateCopyTextureCHROMIUMInternalFormats( |
| 2025 const char* function_name, | 2028 const char* function_name, |
| 2026 TextureRef* source_texture_ref, | 2029 TextureRef* source_texture_ref, |
| 2027 GLint source_level, | 2030 GLint source_level, |
| 2028 GLenum dest_internal_format); | 2031 GLenum dest_internal_format); |
| 2029 bool ValidateCompressedCopyTextureCHROMIUM(const char* function_name, | 2032 bool ValidateCompressedCopyTextureCHROMIUM(const char* function_name, |
| 2030 TextureRef* source_texture_ref, | 2033 TextureRef* source_texture_ref, |
| 2031 TextureRef* dest_texture_ref); | 2034 TextureRef* dest_texture_ref); |
| (...skipping 14094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16126 glIsPathNV(service_id) == GL_TRUE; | 16129 glIsPathNV(service_id) == GL_TRUE; |
| 16127 } | 16130 } |
| 16128 | 16131 |
| 16129 bool GLES2DecoderImpl::DoIsSync(GLuint client_id) { | 16132 bool GLES2DecoderImpl::DoIsSync(GLuint client_id) { |
| 16130 GLsync service_sync = 0; | 16133 GLsync service_sync = 0; |
| 16131 return group_->GetSyncServiceId(client_id, &service_sync); | 16134 return group_->GetSyncServiceId(client_id, &service_sync); |
| 16132 } | 16135 } |
| 16133 | 16136 |
| 16134 bool GLES2DecoderImpl::ValidateCopyTextureCHROMIUMTextures( | 16137 bool GLES2DecoderImpl::ValidateCopyTextureCHROMIUMTextures( |
| 16135 const char* function_name, | 16138 const char* function_name, |
| 16139 GLenum dest_target, |
| 16136 TextureRef* source_texture_ref, | 16140 TextureRef* source_texture_ref, |
| 16137 TextureRef* dest_texture_ref) { | 16141 TextureRef* dest_texture_ref) { |
| 16138 if (!source_texture_ref || !dest_texture_ref) { | 16142 if (!source_texture_ref || !dest_texture_ref) { |
| 16139 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "unknown texture id"); | 16143 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "unknown texture id"); |
| 16140 return false; | 16144 return false; |
| 16141 } | 16145 } |
| 16142 | 16146 |
| 16143 Texture* source_texture = source_texture_ref->texture(); | 16147 Texture* source_texture = source_texture_ref->texture(); |
| 16144 Texture* dest_texture = dest_texture_ref->texture(); | 16148 Texture* dest_texture = dest_texture_ref->texture(); |
| 16145 if (source_texture == dest_texture) { | 16149 if (source_texture == dest_texture) { |
| 16146 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, | 16150 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, |
| 16147 "source and destination textures are the same"); | 16151 "source and destination textures are the same"); |
| 16148 return false; | 16152 return false; |
| 16149 } | 16153 } |
| 16150 | 16154 |
| 16155 if (dest_texture->target() != |
| 16156 GLES2Util::GLFaceTargetToTextureTarget(dest_target)) { |
| 16157 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, |
| 16158 "target should be aligned with dest target"); |
| 16159 return false; |
| 16160 } |
| 16151 switch (dest_texture->target()) { | 16161 switch (dest_texture->target()) { |
| 16152 case GL_TEXTURE_2D: | 16162 case GL_TEXTURE_2D: |
| 16163 case GL_TEXTURE_CUBE_MAP: |
| 16153 case GL_TEXTURE_RECTANGLE_ARB: | 16164 case GL_TEXTURE_RECTANGLE_ARB: |
| 16154 break; | 16165 break; |
| 16155 default: | 16166 default: |
| 16156 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, | 16167 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, |
| 16157 "invalid dest texture target binding"); | 16168 "invalid dest texture target binding"); |
| 16158 return false; | 16169 return false; |
| 16159 } | 16170 } |
| 16160 | 16171 |
| 16161 switch (source_texture->target()) { | 16172 switch (source_texture->target()) { |
| 16162 case GL_TEXTURE_2D: | 16173 case GL_TEXTURE_2D: |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16327 "invalid internal format"); | 16338 "invalid internal format"); |
| 16328 return false; | 16339 return false; |
| 16329 } | 16340 } |
| 16330 | 16341 |
| 16331 return true; | 16342 return true; |
| 16332 } | 16343 } |
| 16333 | 16344 |
| 16334 void GLES2DecoderImpl::DoCopyTextureCHROMIUM( | 16345 void GLES2DecoderImpl::DoCopyTextureCHROMIUM( |
| 16335 GLuint source_id, | 16346 GLuint source_id, |
| 16336 GLint source_level, | 16347 GLint source_level, |
| 16348 GLenum dest_target, |
| 16337 GLuint dest_id, | 16349 GLuint dest_id, |
| 16338 GLint dest_level, | 16350 GLint dest_level, |
| 16339 GLenum internal_format, | 16351 GLenum internal_format, |
| 16340 GLenum dest_type, | 16352 GLenum dest_type, |
| 16341 GLboolean unpack_flip_y, | 16353 GLboolean unpack_flip_y, |
| 16342 GLboolean unpack_premultiply_alpha, | 16354 GLboolean unpack_premultiply_alpha, |
| 16343 GLboolean unpack_unmultiply_alpha) { | 16355 GLboolean unpack_unmultiply_alpha) { |
| 16344 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopyTextureCHROMIUM"); | 16356 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopyTextureCHROMIUM"); |
| 16345 static const char kFunctionName[] = "glCopyTextureCHROMIUM"; | 16357 static const char kFunctionName[] = "glCopyTextureCHROMIUM"; |
| 16346 | 16358 |
| 16347 TextureRef* source_texture_ref = GetTexture(source_id); | 16359 TextureRef* source_texture_ref = GetTexture(source_id); |
| 16348 TextureRef* dest_texture_ref = GetTexture(dest_id); | 16360 TextureRef* dest_texture_ref = GetTexture(dest_id); |
| 16349 | 16361 |
| 16350 if (!ValidateCopyTextureCHROMIUMTextures(kFunctionName, source_texture_ref, | 16362 if (!ValidateCopyTextureCHROMIUMTextures( |
| 16351 dest_texture_ref)) { | 16363 kFunctionName, dest_target, source_texture_ref, dest_texture_ref)) { |
| 16352 return; | 16364 return; |
| 16353 } | 16365 } |
| 16354 | 16366 |
| 16355 if (source_level < 0 || dest_level < 0 || | 16367 if (source_level < 0 || dest_level < 0 || |
| 16356 (feature_info_->IsWebGL1OrES2Context() && source_level > 0)) { | 16368 (feature_info_->IsWebGL1OrES2Context() && source_level > 0)) { |
| 16357 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, | 16369 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, |
| 16358 "source_level or dest_level out of range"); | 16370 "source_level or dest_level out of range"); |
| 16359 return; | 16371 return; |
| 16360 } | 16372 } |
| 16361 | 16373 |
| 16362 Texture* source_texture = source_texture_ref->texture(); | 16374 Texture* source_texture = source_texture_ref->texture(); |
| 16363 Texture* dest_texture = dest_texture_ref->texture(); | 16375 Texture* dest_texture = dest_texture_ref->texture(); |
| 16364 GLenum source_target = source_texture->target(); | 16376 GLenum source_target = source_texture->target(); |
| 16365 GLenum dest_target = dest_texture->target(); | 16377 GLenum dest_binding_target = dest_texture->target(); |
| 16366 | 16378 |
| 16367 GLenum source_type = 0; | 16379 GLenum source_type = 0; |
| 16368 GLenum source_internal_format = 0; | 16380 GLenum source_internal_format = 0; |
| 16369 source_texture->GetLevelType(source_target, source_level, &source_type, | 16381 source_texture->GetLevelType(source_target, source_level, &source_type, |
| 16370 &source_internal_format); | 16382 &source_internal_format); |
| 16371 GLenum format = | 16383 GLenum format = |
| 16372 TextureManager::ExtractFormatFromStorageFormat(internal_format); | 16384 TextureManager::ExtractFormatFromStorageFormat(internal_format); |
| 16373 if (!texture_manager()->ValidateTextureParameters( | 16385 if (!texture_manager()->ValidateTextureParameters( |
| 16374 GetErrorState(), kFunctionName, true, format, dest_type, | 16386 GetErrorState(), kFunctionName, true, format, dest_type, |
| 16375 internal_format, dest_level)) { | 16387 internal_format, dest_level)) { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16462 &dest_internal_format); | 16474 &dest_internal_format); |
| 16463 } | 16475 } |
| 16464 | 16476 |
| 16465 // Resize the destination texture to the dimensions of the source texture. | 16477 // Resize the destination texture to the dimensions of the source texture. |
| 16466 if (!dest_level_defined || dest_width != source_width || | 16478 if (!dest_level_defined || dest_width != source_width || |
| 16467 dest_height != source_height || | 16479 dest_height != source_height || |
| 16468 dest_internal_format != internal_format || | 16480 dest_internal_format != internal_format || |
| 16469 dest_type_previous != dest_type) { | 16481 dest_type_previous != dest_type) { |
| 16470 // Ensure that the glTexImage2D succeeds. | 16482 // Ensure that the glTexImage2D succeeds. |
| 16471 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(kFunctionName); | 16483 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(kFunctionName); |
| 16472 glBindTexture(dest_target, dest_texture->service_id()); | 16484 glBindTexture(dest_binding_target, dest_texture->service_id()); |
| 16473 glTexImage2D(dest_target, dest_level, | 16485 glTexImage2D(dest_target, dest_level, |
| 16474 TextureManager::AdjustTexInternalFormat(feature_info_.get(), | 16486 TextureManager::AdjustTexInternalFormat(feature_info_.get(), |
| 16475 internal_format), | 16487 internal_format), |
| 16476 source_width, source_height, 0, | 16488 source_width, source_height, 0, |
| 16477 TextureManager::AdjustTexFormat(feature_info_.get(), format), | 16489 TextureManager::AdjustTexFormat(feature_info_.get(), format), |
| 16478 dest_type, nullptr); | 16490 dest_type, nullptr); |
| 16479 GLenum error = LOCAL_PEEK_GL_ERROR(kFunctionName); | 16491 GLenum error = LOCAL_PEEK_GL_ERROR(kFunctionName); |
| 16480 if (error != GL_NO_ERROR) { | 16492 if (error != GL_NO_ERROR) { |
| 16481 RestoreCurrentTextureBindings(&state_, dest_target); | 16493 RestoreCurrentTextureBindings(&state_, dest_binding_target); |
| 16482 return; | 16494 return; |
| 16483 } | 16495 } |
| 16484 | 16496 |
| 16485 texture_manager()->SetLevelInfo(dest_texture_ref, dest_target, dest_level, | 16497 texture_manager()->SetLevelInfo(dest_texture_ref, dest_target, dest_level, |
| 16486 internal_format, source_width, | 16498 internal_format, source_width, |
| 16487 source_height, 1, 0, format, dest_type, | 16499 source_height, 1, 0, format, dest_type, |
| 16488 gfx::Rect(source_width, source_height)); | 16500 gfx::Rect(source_width, source_height)); |
| 16489 dest_texture->ApplyFormatWorkarounds(feature_info_.get()); | 16501 dest_texture->ApplyFormatWorkarounds(feature_info_.get()); |
| 16490 } else { | 16502 } else { |
| 16491 texture_manager()->SetLevelCleared(dest_texture_ref, dest_target, | 16503 texture_manager()->SetLevelCleared(dest_texture_ref, dest_target, |
| 16492 dest_level, true); | 16504 dest_level, true); |
| 16493 } | 16505 } |
| 16494 | 16506 |
| 16495 // Try using GLImage::CopyTexImage when possible. | 16507 // Try using GLImage::CopyTexImage when possible. |
| 16496 bool unpack_premultiply_alpha_change = | 16508 bool unpack_premultiply_alpha_change = |
| 16497 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; | 16509 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; |
| 16498 // TODO(qiankun.miao@intel.com): Support level > 0 for CopyTexImage. | 16510 // TODO(qiankun.miao@intel.com): Support level > 0 for CopyTexImage. |
| 16499 if (image && dest_level == 0 && !unpack_flip_y && | 16511 if (image && dest_level == 0 && !unpack_flip_y && |
| 16500 !unpack_premultiply_alpha_change) { | 16512 !unpack_premultiply_alpha_change) { |
| 16501 glBindTexture(dest_target, dest_texture->service_id()); | 16513 glBindTexture(dest_binding_target, dest_texture->service_id()); |
| 16502 if (image->CopyTexImage(dest_target)) | 16514 if (image->CopyTexImage(dest_target)) |
| 16503 return; | 16515 return; |
| 16504 } | 16516 } |
| 16505 | 16517 |
| 16506 DoCopyTexImageIfNeeded(source_texture, source_target); | 16518 DoCopyTexImageIfNeeded(source_texture, source_target); |
| 16507 | 16519 |
| 16508 // GL_TEXTURE_EXTERNAL_OES texture requires that we apply a transform matrix | 16520 // GL_TEXTURE_EXTERNAL_OES texture requires that we apply a transform matrix |
| 16509 // before presenting. | 16521 // before presenting. |
| 16510 if (source_target == GL_TEXTURE_EXTERNAL_OES) { | 16522 if (source_target == GL_TEXTURE_EXTERNAL_OES) { |
| 16511 if (GLStreamTextureImage* image = | 16523 if (GLStreamTextureImage* image = |
| (...skipping 15 matching lines...) Expand all Loading... |
| 16527 this, source_target, source_texture->service_id(), source_level, | 16539 this, source_target, source_texture->service_id(), source_level, |
| 16528 source_internal_format, dest_target, dest_texture->service_id(), | 16540 source_internal_format, dest_target, dest_texture->service_id(), |
| 16529 dest_level, internal_format, source_width, source_height, | 16541 dest_level, internal_format, source_width, source_height, |
| 16530 unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, | 16542 unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, |
| 16531 unpack_unmultiply_alpha == GL_TRUE, method); | 16543 unpack_unmultiply_alpha == GL_TRUE, method); |
| 16532 } | 16544 } |
| 16533 | 16545 |
| 16534 void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( | 16546 void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( |
| 16535 GLuint source_id, | 16547 GLuint source_id, |
| 16536 GLint source_level, | 16548 GLint source_level, |
| 16549 GLenum dest_target, |
| 16537 GLuint dest_id, | 16550 GLuint dest_id, |
| 16538 GLint dest_level, | 16551 GLint dest_level, |
| 16539 GLint xoffset, | 16552 GLint xoffset, |
| 16540 GLint yoffset, | 16553 GLint yoffset, |
| 16541 GLint x, | 16554 GLint x, |
| 16542 GLint y, | 16555 GLint y, |
| 16543 GLsizei width, | 16556 GLsizei width, |
| 16544 GLsizei height, | 16557 GLsizei height, |
| 16545 GLboolean unpack_flip_y, | 16558 GLboolean unpack_flip_y, |
| 16546 GLboolean unpack_premultiply_alpha, | 16559 GLboolean unpack_premultiply_alpha, |
| 16547 GLboolean unpack_unmultiply_alpha) { | 16560 GLboolean unpack_unmultiply_alpha) { |
| 16548 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopySubTextureCHROMIUM"); | 16561 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopySubTextureCHROMIUM"); |
| 16549 | 16562 |
| 16550 static const char kFunctionName[] = "glCopySubTextureCHROMIUM"; | 16563 static const char kFunctionName[] = "glCopySubTextureCHROMIUM"; |
| 16551 TextureRef* source_texture_ref = GetTexture(source_id); | 16564 TextureRef* source_texture_ref = GetTexture(source_id); |
| 16552 TextureRef* dest_texture_ref = GetTexture(dest_id); | 16565 TextureRef* dest_texture_ref = GetTexture(dest_id); |
| 16553 | 16566 |
| 16554 if (!ValidateCopyTextureCHROMIUMTextures(kFunctionName, source_texture_ref, | 16567 if (!ValidateCopyTextureCHROMIUMTextures( |
| 16555 dest_texture_ref)) { | 16568 kFunctionName, dest_target, source_texture_ref, dest_texture_ref)) { |
| 16556 return; | 16569 return; |
| 16557 } | 16570 } |
| 16558 | 16571 |
| 16559 if (source_level < 0 || dest_level < 0 || | 16572 if (source_level < 0 || dest_level < 0 || |
| 16560 (feature_info_->IsWebGL1OrES2Context() && source_level > 0)) { | 16573 (feature_info_->IsWebGL1OrES2Context() && source_level > 0)) { |
| 16561 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, | 16574 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, |
| 16562 "source_level or dest_level out of range"); | 16575 "source_level or dest_level out of range"); |
| 16563 return; | 16576 return; |
| 16564 } | 16577 } |
| 16565 | 16578 |
| 16566 Texture* source_texture = source_texture_ref->texture(); | 16579 Texture* source_texture = source_texture_ref->texture(); |
| 16567 Texture* dest_texture = dest_texture_ref->texture(); | 16580 Texture* dest_texture = dest_texture_ref->texture(); |
| 16568 GLenum source_target = source_texture->target(); | 16581 GLenum source_target = source_texture->target(); |
| 16569 GLenum dest_target = dest_texture->target(); | 16582 GLenum dest_binding_target = dest_texture->target(); |
| 16570 int source_width = 0; | 16583 int source_width = 0; |
| 16571 int source_height = 0; | 16584 int source_height = 0; |
| 16572 gl::GLImage* image = | 16585 gl::GLImage* image = |
| 16573 source_texture->GetLevelImage(source_target, source_level); | 16586 source_texture->GetLevelImage(source_target, source_level); |
| 16574 if (image) { | 16587 if (image) { |
| 16575 gfx::Size size = image->GetSize(); | 16588 gfx::Size size = image->GetSize(); |
| 16576 source_width = size.width(); | 16589 source_width = size.width(); |
| 16577 source_height = size.height(); | 16590 source_height = size.height(); |
| 16578 if (source_width <= 0 || source_height <= 0) { | 16591 if (source_width <= 0 || source_height <= 0) { |
| 16579 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "invalid image size"); | 16592 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "invalid image size"); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16710 texture_manager()->SetLevelCleared(dest_texture_ref, dest_target, | 16723 texture_manager()->SetLevelCleared(dest_texture_ref, dest_target, |
| 16711 dest_level, true); | 16724 dest_level, true); |
| 16712 } | 16725 } |
| 16713 | 16726 |
| 16714 // Try using GLImage::CopyTexSubImage when possible. | 16727 // Try using GLImage::CopyTexSubImage when possible. |
| 16715 bool unpack_premultiply_alpha_change = | 16728 bool unpack_premultiply_alpha_change = |
| 16716 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; | 16729 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; |
| 16717 // TODO(qiankun.miao@intel.com): Support level > 0 for CopyTexSubImage. | 16730 // TODO(qiankun.miao@intel.com): Support level > 0 for CopyTexSubImage. |
| 16718 if (image && dest_level == 0 && !unpack_flip_y && | 16731 if (image && dest_level == 0 && !unpack_flip_y && |
| 16719 !unpack_premultiply_alpha_change) { | 16732 !unpack_premultiply_alpha_change) { |
| 16720 ScopedTextureBinder binder( | 16733 ScopedTextureBinder binder(&state_, dest_texture->service_id(), |
| 16721 &state_, dest_texture->service_id(), dest_target); | 16734 dest_binding_target); |
| 16722 if (image->CopyTexSubImage(dest_target, gfx::Point(xoffset, yoffset), | 16735 if (image->CopyTexSubImage(dest_target, gfx::Point(xoffset, yoffset), |
| 16723 gfx::Rect(x, y, width, height))) { | 16736 gfx::Rect(x, y, width, height))) { |
| 16724 return; | 16737 return; |
| 16725 } | 16738 } |
| 16726 } | 16739 } |
| 16727 | 16740 |
| 16728 DoCopyTexImageIfNeeded(source_texture, source_target); | 16741 DoCopyTexImageIfNeeded(source_texture, source_target); |
| 16729 | 16742 |
| 16730 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix | 16743 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix |
| 16731 // before presenting. | 16744 // before presenting. |
| (...skipping 2440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19172 } | 19185 } |
| 19173 | 19186 |
| 19174 // Include the auto-generated part of this file. We split this because it means | 19187 // Include the auto-generated part of this file. We split this because it means |
| 19175 // we can easily edit the non-auto generated parts right here in this file | 19188 // we can easily edit the non-auto generated parts right here in this file |
| 19176 // instead of having to edit some template or the code generator. | 19189 // instead of having to edit some template or the code generator. |
| 19177 #include "base/macros.h" | 19190 #include "base/macros.h" |
| 19178 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 19191 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 19179 | 19192 |
| 19180 } // namespace gles2 | 19193 } // namespace gles2 |
| 19181 } // namespace gpu | 19194 } // namespace gpu |
| OLD | NEW |