Chromium Code Reviews| 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 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2017 const char* function_name, | 2017 const char* function_name, |
| 2018 GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, | 2018 GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, |
| 2019 GLsizei width, GLsizei height, GLsizei depth, GLenum format, | 2019 GLsizei width, GLsizei height, GLsizei depth, GLenum format, |
| 2020 Texture* texture); | 2020 Texture* texture); |
| 2021 bool ValidateCopyTextureCHROMIUMTextures(const char* function_name, | 2021 bool ValidateCopyTextureCHROMIUMTextures(const char* function_name, |
| 2022 TextureRef* source_texture_ref, | 2022 TextureRef* source_texture_ref, |
| 2023 TextureRef* dest_texture_ref); | 2023 TextureRef* dest_texture_ref); |
| 2024 CopyTextureMethod ValidateCopyTextureCHROMIUMInternalFormats( | 2024 CopyTextureMethod ValidateCopyTextureCHROMIUMInternalFormats( |
| 2025 const char* function_name, | 2025 const char* function_name, |
| 2026 TextureRef* source_texture_ref, | 2026 TextureRef* source_texture_ref, |
| 2027 GLint source_level, | |
| 2027 GLenum dest_internal_format); | 2028 GLenum dest_internal_format); |
| 2028 bool ValidateCompressedCopyTextureCHROMIUM(const char* function_name, | 2029 bool ValidateCompressedCopyTextureCHROMIUM(const char* function_name, |
| 2029 TextureRef* source_texture_ref, | 2030 TextureRef* source_texture_ref, |
| 2030 TextureRef* dest_texture_ref); | 2031 TextureRef* dest_texture_ref); |
| 2031 | 2032 |
| 2032 void RenderWarning(const char* filename, int line, const std::string& msg); | 2033 void RenderWarning(const char* filename, int line, const std::string& msg); |
| 2033 void PerformanceWarning( | 2034 void PerformanceWarning( |
| 2034 const char* filename, int line, const std::string& msg); | 2035 const char* filename, int line, const std::string& msg); |
| 2035 | 2036 |
| 2036 const FeatureInfo::FeatureFlags& features() const { | 2037 const FeatureInfo::FeatureFlags& features() const { |
| (...skipping 3518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5555 | 5556 |
| 5556 void GLES2DecoderImpl::RestoreRenderbufferBindings() { | 5557 void GLES2DecoderImpl::RestoreRenderbufferBindings() { |
| 5557 state_.RestoreRenderbufferBindings(); | 5558 state_.RestoreRenderbufferBindings(); |
| 5558 } | 5559 } |
| 5559 | 5560 |
| 5560 void GLES2DecoderImpl::RestoreTextureState(unsigned service_id) const { | 5561 void GLES2DecoderImpl::RestoreTextureState(unsigned service_id) const { |
| 5561 Texture* texture = texture_manager()->GetTextureForServiceId(service_id); | 5562 Texture* texture = texture_manager()->GetTextureForServiceId(service_id); |
| 5562 if (texture) { | 5563 if (texture) { |
| 5563 GLenum target = texture->target(); | 5564 GLenum target = texture->target(); |
| 5564 glBindTexture(target, service_id); | 5565 glBindTexture(target, service_id); |
| 5565 glTexParameteri( | 5566 glTexParameteri(target, GL_TEXTURE_WRAP_S, texture->wrap_s()); |
| 5566 target, GL_TEXTURE_WRAP_S, texture->wrap_s()); | 5567 glTexParameteri(target, GL_TEXTURE_WRAP_T, texture->wrap_t()); |
| 5567 glTexParameteri( | 5568 glTexParameteri(target, GL_TEXTURE_MIN_FILTER, texture->min_filter()); |
| 5568 target, GL_TEXTURE_WRAP_T, texture->wrap_t()); | 5569 glTexParameteri(target, GL_TEXTURE_MAG_FILTER, texture->mag_filter()); |
| 5569 glTexParameteri( | 5570 if (feature_info_->IsWebGL2OrES3Context()) { |
| 5570 target, GL_TEXTURE_MIN_FILTER, texture->min_filter()); | 5571 #if defined(OS_ANDROID) |
|
qiankun
2017/01/11 10:58:22
It seems android has a bug about base level.
Zhenyao Mo
2017/01/11 18:41:41
I'd like a bug filed with details of the problem o
Ken Russell (switch to Gerrit)
2017/01/11 19:53:03
Agree.
qiankun
2017/01/12 15:38:16
If you look at the failure log, you can find not a
| |
| 5571 glTexParameteri( | 5572 // Only set GL_TEXTURE_BASE_LEVEL if base level changed because Android |
| 5572 target, GL_TEXTURE_MAG_FILTER, texture->mag_filter()); | 5573 // has bug on base level. |
| 5574 GLint base_level = 0; | |
| 5575 glGetTexParameteriv(target, GL_TEXTURE_BASE_LEVEL, &base_level); | |
|
Zhenyao Mo
2017/01/11 18:41:41
Querying the driver seems heavier than necessary.
Ken Russell (switch to Gerrit)
2017/01/11 19:53:03
Yes, please create a driver bug workaround rather
| |
| 5576 if (base_level != texture->base_level()) | |
| 5577 glTexParameteri(target, GL_TEXTURE_BASE_LEVEL, texture->base_level()); | |
| 5578 #else | |
| 5579 glTexParameteri(target, GL_TEXTURE_BASE_LEVEL, texture->base_level()); | |
| 5580 #endif | |
| 5581 } | |
| 5573 RestoreTextureUnitBindings(state_.active_texture_unit); | 5582 RestoreTextureUnitBindings(state_.active_texture_unit); |
| 5574 } | 5583 } |
| 5575 } | 5584 } |
| 5576 | 5585 |
| 5577 void GLES2DecoderImpl::ClearAllAttributes() const { | 5586 void GLES2DecoderImpl::ClearAllAttributes() const { |
| 5578 // Must use native VAO 0, as RestoreAllAttributes can't fully restore | 5587 // Must use native VAO 0, as RestoreAllAttributes can't fully restore |
| 5579 // other VAOs. | 5588 // other VAOs. |
| 5580 if (feature_info_->feature_flags().native_vertex_array_object) | 5589 if (feature_info_->feature_flags().native_vertex_array_object) |
| 5581 glBindVertexArrayOES(0); | 5590 glBindVertexArrayOES(0); |
| 5582 | 5591 |
| (...skipping 10603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16186 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, | 16195 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, |
| 16187 "invalid source texture target binding"); | 16196 "invalid source texture target binding"); |
| 16188 return false; | 16197 return false; |
| 16189 } | 16198 } |
| 16190 return true; | 16199 return true; |
| 16191 } | 16200 } |
| 16192 | 16201 |
| 16193 CopyTextureMethod GLES2DecoderImpl::ValidateCopyTextureCHROMIUMInternalFormats( | 16202 CopyTextureMethod GLES2DecoderImpl::ValidateCopyTextureCHROMIUMInternalFormats( |
| 16194 const char* function_name, | 16203 const char* function_name, |
| 16195 TextureRef* source_texture_ref, | 16204 TextureRef* source_texture_ref, |
| 16205 GLint source_level, | |
| 16196 GLenum dest_internal_format) { | 16206 GLenum dest_internal_format) { |
| 16197 GLenum source_type = 0; | 16207 GLenum source_type = 0; |
| 16198 GLenum source_internal_format = 0; | 16208 GLenum source_internal_format = 0; |
| 16199 Texture* source_texture = source_texture_ref->texture(); | 16209 Texture* source_texture = source_texture_ref->texture(); |
| 16200 source_texture->GetLevelType(source_texture->target(), 0, &source_type, | 16210 source_texture->GetLevelType(source_texture->target(), source_level, |
| 16201 &source_internal_format); | 16211 &source_type, &source_internal_format); |
| 16202 | 16212 |
| 16203 bool valid_dest_format = false; | 16213 bool valid_dest_format = false; |
| 16204 // TODO(qiankun.miao@intel.com): ALPHA, LUMINANCE and LUMINANCE_ALPHA formats | 16214 // TODO(qiankun.miao@intel.com): ALPHA, LUMINANCE and LUMINANCE_ALPHA formats |
| 16205 // are not supported on GL core profile. See crbug.com/577144. Enable the | 16215 // are not supported on GL core profile. See crbug.com/577144. Enable the |
| 16206 // workaround for glCopyTexImage and glCopyTexSubImage in | 16216 // workaround for glCopyTexImage and glCopyTexSubImage in |
| 16207 // gles2_cmd_copy_tex_image.cc for glCopyTextureCHROMIUM implementation. | 16217 // gles2_cmd_copy_tex_image.cc for glCopyTextureCHROMIUM implementation. |
| 16208 switch (dest_internal_format) { | 16218 switch (dest_internal_format) { |
| 16209 case GL_RGB: | 16219 case GL_RGB: |
| 16210 case GL_RGBA: | 16220 case GL_RGBA: |
| 16211 case GL_RGB8: | 16221 case GL_RGB8: |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16355 GLuint dest_id, | 16365 GLuint dest_id, |
| 16356 GLint dest_level, | 16366 GLint dest_level, |
| 16357 GLenum internal_format, | 16367 GLenum internal_format, |
| 16358 GLenum dest_type, | 16368 GLenum dest_type, |
| 16359 GLboolean unpack_flip_y, | 16369 GLboolean unpack_flip_y, |
| 16360 GLboolean unpack_premultiply_alpha, | 16370 GLboolean unpack_premultiply_alpha, |
| 16361 GLboolean unpack_unmultiply_alpha) { | 16371 GLboolean unpack_unmultiply_alpha) { |
| 16362 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopyTextureCHROMIUM"); | 16372 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopyTextureCHROMIUM"); |
| 16363 static const char kFunctionName[] = "glCopyTextureCHROMIUM"; | 16373 static const char kFunctionName[] = "glCopyTextureCHROMIUM"; |
| 16364 | 16374 |
| 16365 // TODO(qiankun.miao@intel.com): Remove this after level > 0 support is | |
| 16366 // implemented. See: https://crbug.com/612542. | |
| 16367 DCHECK(source_level == 0); | |
| 16368 DCHECK(dest_level == 0); | |
| 16369 | |
| 16370 TextureRef* source_texture_ref = GetTexture(source_id); | 16375 TextureRef* source_texture_ref = GetTexture(source_id); |
| 16371 TextureRef* dest_texture_ref = GetTexture(dest_id); | 16376 TextureRef* dest_texture_ref = GetTexture(dest_id); |
| 16372 | 16377 |
| 16373 if (!ValidateCopyTextureCHROMIUMTextures(kFunctionName, source_texture_ref, | 16378 if (!ValidateCopyTextureCHROMIUMTextures(kFunctionName, source_texture_ref, |
| 16374 dest_texture_ref)) { | 16379 dest_texture_ref)) { |
| 16375 return; | 16380 return; |
| 16376 } | 16381 } |
| 16377 | 16382 |
| 16383 if (source_level < 0 || dest_level < 0 || | |
| 16384 (feature_info_->IsWebGL1OrES2Context() && source_level > 0)) { | |
| 16385 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, | |
| 16386 "source_level or dest_level out of range"); | |
| 16387 return; | |
| 16388 } | |
| 16389 | |
| 16378 Texture* source_texture = source_texture_ref->texture(); | 16390 Texture* source_texture = source_texture_ref->texture(); |
| 16379 Texture* dest_texture = dest_texture_ref->texture(); | 16391 Texture* dest_texture = dest_texture_ref->texture(); |
| 16380 GLenum source_target = source_texture->target(); | 16392 GLenum source_target = source_texture->target(); |
| 16381 GLenum dest_target = dest_texture->target(); | 16393 GLenum dest_target = dest_texture->target(); |
| 16382 | 16394 |
| 16383 GLenum source_type = 0; | 16395 GLenum source_type = 0; |
| 16384 GLenum source_internal_format = 0; | 16396 GLenum source_internal_format = 0; |
| 16385 source_texture->GetLevelType(source_target, 0, &source_type, | 16397 source_texture->GetLevelType(source_target, source_level, &source_type, |
| 16386 &source_internal_format); | 16398 &source_internal_format); |
| 16387 GLenum format = | 16399 GLenum format = |
| 16388 TextureManager::ExtractFormatFromStorageFormat(internal_format); | 16400 TextureManager::ExtractFormatFromStorageFormat(internal_format); |
| 16389 if (!texture_manager()->ValidateTextureParameters( | 16401 if (!texture_manager()->ValidateTextureParameters( |
| 16390 GetErrorState(), kFunctionName, true, format, dest_type, | 16402 GetErrorState(), kFunctionName, true, format, dest_type, |
| 16391 internal_format, 0)) { | 16403 internal_format, dest_level)) { |
| 16392 return; | 16404 return; |
| 16393 } | 16405 } |
| 16394 | 16406 |
| 16395 CopyTextureMethod method = ValidateCopyTextureCHROMIUMInternalFormats( | 16407 CopyTextureMethod method = ValidateCopyTextureCHROMIUMInternalFormats( |
| 16396 kFunctionName, source_texture_ref, internal_format); | 16408 kFunctionName, source_texture_ref, source_level, internal_format); |
| 16397 // INVALID_OPERATION is already generated by | 16409 // INVALID_OPERATION is already generated by |
| 16398 // ValidateCopyTextureCHROMIUMInternalFormats. | 16410 // ValidateCopyTextureCHROMIUMInternalFormats. |
| 16399 if (NOT_COPYABLE == method) { | 16411 if (method == NOT_COPYABLE) { |
| 16400 return; | 16412 return; |
| 16401 } | 16413 } |
| 16402 | 16414 |
| 16415 // Draw to a fbo attaching level 0 of an intermediate texture, | |
| 16416 // then copy from the fbo to dest texture level with glCopyTexImage2D. | |
| 16417 // For WebGL 1.0 or OpenGL ES 2.0, DIRECT_DRAW path isn't available for | |
| 16418 // dest_level > 0 due to level > 0 isn't supported by glFramebufferTexture2D | |
| 16419 // in ES2 context. Go to DRAW_AND_COPY path in this case. | |
| 16420 // TODO(qiankun.miao@intel.com): for WebGL 2.0 or OpenGL ES 3.0, both | |
| 16421 // DIRECT_DRAW path for dest_level > 0 and DIRECT_COPY path for source_level > | |
| 16422 // 0 are not available due to a framebuffer completeness bug: | |
| 16423 // crbug.com/678526. Once the bug is fixed, the limitation for WebGL 2.0 and | |
| 16424 // OpenGL ES 3.0 can be lifted. | |
| 16425 if ((dest_level > 0 && method == DIRECT_DRAW) || | |
| 16426 (source_level > 0 && method == DIRECT_COPY)) { | |
| 16427 method = DRAW_AND_COPY; | |
| 16428 } | |
| 16429 | |
| 16403 if (feature_info_->feature_flags().desktop_srgb_support) { | 16430 if (feature_info_->feature_flags().desktop_srgb_support) { |
| 16404 bool enable_framebuffer_srgb = | 16431 bool enable_framebuffer_srgb = |
| 16405 GetColorEncodingFromInternalFormat(source_internal_format) == GL_SRGB || | 16432 GetColorEncodingFromInternalFormat(source_internal_format) == GL_SRGB || |
| 16406 GetColorEncodingFromInternalFormat(internal_format) == GL_SRGB; | 16433 GetColorEncodingFromInternalFormat(internal_format) == GL_SRGB; |
| 16407 state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb); | 16434 state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb); |
| 16408 } | 16435 } |
| 16409 | 16436 |
| 16410 int source_width = 0; | 16437 int source_width = 0; |
| 16411 int source_height = 0; | 16438 int source_height = 0; |
| 16412 gl::GLImage* image = | 16439 gl::GLImage* image = |
| 16413 source_texture->GetLevelImage(source_target, 0); | 16440 source_texture->GetLevelImage(source_target, source_level); |
| 16414 if (image) { | 16441 if (image) { |
| 16415 gfx::Size size = image->GetSize(); | 16442 gfx::Size size = image->GetSize(); |
| 16416 source_width = size.width(); | 16443 source_width = size.width(); |
| 16417 source_height = size.height(); | 16444 source_height = size.height(); |
| 16418 if (source_width <= 0 || source_height <= 0) { | 16445 if (source_width <= 0 || source_height <= 0) { |
| 16419 LOCAL_SET_GL_ERROR( | 16446 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "invalid image size"); |
| 16420 GL_INVALID_VALUE, | |
| 16421 "glCopyTextureChromium", "invalid image size"); | |
| 16422 return; | 16447 return; |
| 16423 } | 16448 } |
| 16424 } else { | 16449 } else { |
| 16425 if (!source_texture->GetLevelSize(source_target, 0, | 16450 if (!source_texture->GetLevelSize(source_target, source_level, |
| 16426 &source_width, &source_height, nullptr)) { | 16451 &source_width, &source_height, nullptr)) { |
| 16427 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, | 16452 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, |
| 16428 "glCopyTextureChromium", | 16453 "source texture has no data for level"); |
| 16429 "source texture has no level 0"); | |
| 16430 return; | 16454 return; |
| 16431 } | 16455 } |
| 16432 | 16456 |
| 16433 // Check that this type of texture is allowed. | 16457 // Check that this type of texture is allowed. |
| 16434 if (!texture_manager()->ValidForTarget(source_target, 0, | 16458 if (!texture_manager()->ValidForTarget(source_target, source_level, |
| 16435 source_width, source_height, 1)) { | 16459 source_width, source_height, 1)) { |
| 16436 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "Bad dimensions"); | 16460 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "Bad dimensions"); |
| 16437 return; | 16461 return; |
| 16438 } | 16462 } |
| 16439 } | 16463 } |
| 16440 | 16464 |
| 16441 if (dest_texture->IsImmutable()) { | 16465 if (dest_texture->IsImmutable()) { |
| 16442 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, | 16466 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, |
| 16443 "texture is immutable"); | 16467 "texture is immutable"); |
| 16444 return; | 16468 return; |
| 16445 } | 16469 } |
| 16446 | 16470 |
| 16447 // Clear the source texture if necessary. | 16471 // Clear the source texture if necessary. |
| 16448 if (!texture_manager()->ClearTextureLevel(this, source_texture_ref, | 16472 if (!texture_manager()->ClearTextureLevel(this, source_texture_ref, |
| 16449 source_target, 0)) { | 16473 source_target, source_level)) { |
| 16450 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, kFunctionName, "dimensions too big"); | 16474 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, kFunctionName, "dimensions too big"); |
| 16451 return; | 16475 return; |
| 16452 } | 16476 } |
| 16453 | 16477 |
| 16454 if (!InitializeCopyTextureCHROMIUM(kFunctionName)) | 16478 if (!InitializeCopyTextureCHROMIUM(kFunctionName)) |
| 16455 return; | 16479 return; |
| 16456 | 16480 |
| 16457 GLenum dest_type_previous = dest_type; | 16481 GLenum dest_type_previous = dest_type; |
| 16458 GLenum dest_internal_format = internal_format; | 16482 GLenum dest_internal_format = internal_format; |
| 16459 int dest_width = 0; | 16483 int dest_width = 0; |
| 16460 int dest_height = 0; | 16484 int dest_height = 0; |
| 16461 bool dest_level_defined = dest_texture->GetLevelSize( | 16485 bool dest_level_defined = dest_texture->GetLevelSize( |
| 16462 dest_target, 0, &dest_width, &dest_height, nullptr); | 16486 dest_target, dest_level, &dest_width, &dest_height, nullptr); |
| 16463 | 16487 |
| 16464 if (dest_level_defined) { | 16488 if (dest_level_defined) { |
| 16465 dest_texture->GetLevelType(dest_target, 0, &dest_type_previous, | 16489 dest_texture->GetLevelType(dest_target, dest_level, &dest_type_previous, |
| 16466 &dest_internal_format); | 16490 &dest_internal_format); |
| 16467 } | 16491 } |
| 16468 | 16492 |
| 16469 // Resize the destination texture to the dimensions of the source texture. | 16493 // Resize the destination texture to the dimensions of the source texture. |
| 16470 if (!dest_level_defined || dest_width != source_width || | 16494 if (!dest_level_defined || dest_width != source_width || |
| 16471 dest_height != source_height || | 16495 dest_height != source_height || |
| 16472 dest_internal_format != internal_format || | 16496 dest_internal_format != internal_format || |
| 16473 dest_type_previous != dest_type) { | 16497 dest_type_previous != dest_type) { |
| 16474 // Ensure that the glTexImage2D succeeds. | 16498 // Ensure that the glTexImage2D succeeds. |
| 16475 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(kFunctionName); | 16499 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(kFunctionName); |
| 16476 glBindTexture(dest_target, dest_texture->service_id()); | 16500 glBindTexture(dest_target, dest_texture->service_id()); |
| 16477 glTexImage2D(dest_target, 0, TextureManager::AdjustTexInternalFormat( | 16501 glTexImage2D(dest_target, dest_level, |
| 16478 feature_info_.get(), internal_format), | 16502 TextureManager::AdjustTexInternalFormat(feature_info_.get(), |
| 16503 internal_format), | |
| 16479 source_width, source_height, 0, | 16504 source_width, source_height, 0, |
| 16480 TextureManager::AdjustTexFormat(feature_info_.get(), format), | 16505 TextureManager::AdjustTexFormat(feature_info_.get(), format), |
| 16481 dest_type, NULL); | 16506 dest_type, nullptr); |
| 16482 GLenum error = LOCAL_PEEK_GL_ERROR(kFunctionName); | 16507 GLenum error = LOCAL_PEEK_GL_ERROR(kFunctionName); |
| 16483 if (error != GL_NO_ERROR) { | 16508 if (error != GL_NO_ERROR) { |
| 16484 RestoreCurrentTextureBindings(&state_, dest_target); | 16509 RestoreCurrentTextureBindings(&state_, dest_target); |
| 16485 return; | 16510 return; |
| 16486 } | 16511 } |
| 16487 | 16512 |
| 16488 texture_manager()->SetLevelInfo(dest_texture_ref, dest_target, 0, | 16513 texture_manager()->SetLevelInfo(dest_texture_ref, dest_target, dest_level, |
| 16489 internal_format, source_width, | 16514 internal_format, source_width, |
| 16490 source_height, 1, 0, format, dest_type, | 16515 source_height, 1, 0, format, dest_type, |
| 16491 gfx::Rect(source_width, source_height)); | 16516 gfx::Rect(source_width, source_height)); |
| 16492 dest_texture->ApplyFormatWorkarounds(feature_info_.get()); | 16517 dest_texture->ApplyFormatWorkarounds(feature_info_.get()); |
| 16493 } else { | 16518 } else { |
| 16494 texture_manager()->SetLevelCleared(dest_texture_ref, dest_target, 0, true); | 16519 texture_manager()->SetLevelCleared(dest_texture_ref, dest_target, |
| 16520 dest_level, true); | |
| 16495 } | 16521 } |
| 16496 | 16522 |
| 16497 // Try using GLImage::CopyTexImage when possible. | 16523 // Try using GLImage::CopyTexImage when possible. |
| 16498 bool unpack_premultiply_alpha_change = | 16524 bool unpack_premultiply_alpha_change = |
| 16499 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; | 16525 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; |
| 16500 if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { | 16526 // TODO(qiankun.miao@intel.com): Support level > 0 for CopyTexImage. |
| 16527 if (image && dest_level == 0 && !unpack_flip_y && | |
| 16528 !unpack_premultiply_alpha_change) { | |
| 16501 glBindTexture(dest_target, dest_texture->service_id()); | 16529 glBindTexture(dest_target, dest_texture->service_id()); |
| 16502 if (image->CopyTexImage(dest_target)) | 16530 if (image->CopyTexImage(dest_target)) |
| 16503 return; | 16531 return; |
| 16504 } | 16532 } |
| 16505 | 16533 |
| 16506 DoCopyTexImageIfNeeded(source_texture, source_target); | 16534 DoCopyTexImageIfNeeded(source_texture, source_target); |
| 16507 | 16535 |
| 16508 // GL_TEXTURE_EXTERNAL_OES texture requires that we apply a transform matrix | 16536 // GL_TEXTURE_EXTERNAL_OES texture requires that we apply a transform matrix |
| 16509 // before presenting. | 16537 // before presenting. |
| 16510 if (source_target == GL_TEXTURE_EXTERNAL_OES) { | 16538 if (source_target == GL_TEXTURE_EXTERNAL_OES) { |
| 16511 if (GLStreamTextureImage* image = | 16539 if (GLStreamTextureImage* image = |
| 16512 source_texture->GetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES, | 16540 source_texture->GetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES, |
| 16513 0)) { | 16541 source_level)) { |
| 16514 GLfloat transform_matrix[16]; | 16542 GLfloat transform_matrix[16]; |
| 16515 image->GetTextureMatrix(transform_matrix); | 16543 image->GetTextureMatrix(transform_matrix); |
| 16516 copy_texture_CHROMIUM_->DoCopyTextureWithTransform( | 16544 copy_texture_CHROMIUM_->DoCopyTextureWithTransform( |
| 16517 this, source_target, source_texture->service_id(), | 16545 this, source_target, source_texture->service_id(), source_level, |
| 16518 source_internal_format, dest_target, dest_texture->service_id(), | 16546 source_internal_format, dest_target, dest_texture->service_id(), |
| 16519 internal_format, source_width, source_height, | 16547 dest_level, internal_format, source_width, source_height, |
| 16520 unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, | 16548 unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, |
| 16521 unpack_unmultiply_alpha == GL_TRUE, transform_matrix); | 16549 unpack_unmultiply_alpha == GL_TRUE, transform_matrix); |
| 16522 return; | 16550 return; |
| 16523 } | 16551 } |
| 16524 } | 16552 } |
| 16525 | 16553 |
| 16526 copy_texture_CHROMIUM_->DoCopyTexture( | 16554 copy_texture_CHROMIUM_->DoCopyTexture( |
| 16527 this, source_target, source_texture->service_id(), source_internal_format, | 16555 this, source_target, source_texture->service_id(), source_level, |
| 16528 dest_target, dest_texture->service_id(), internal_format, source_width, | 16556 source_internal_format, dest_target, dest_texture->service_id(), |
| 16529 source_height, unpack_flip_y == GL_TRUE, | 16557 dest_level, internal_format, source_width, source_height, |
| 16530 unpack_premultiply_alpha == GL_TRUE, unpack_unmultiply_alpha == GL_TRUE, | 16558 unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, |
| 16531 method); | 16559 unpack_unmultiply_alpha == GL_TRUE, method); |
| 16532 } | 16560 } |
| 16533 | 16561 |
| 16534 void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( | 16562 void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( |
| 16535 GLuint source_id, | 16563 GLuint source_id, |
| 16536 GLint source_level, | 16564 GLint source_level, |
| 16537 GLuint dest_id, | 16565 GLuint dest_id, |
| 16538 GLint dest_level, | 16566 GLint dest_level, |
| 16539 GLint xoffset, | 16567 GLint xoffset, |
| 16540 GLint yoffset, | 16568 GLint yoffset, |
| 16541 GLint x, | 16569 GLint x, |
| 16542 GLint y, | 16570 GLint y, |
| 16543 GLsizei width, | 16571 GLsizei width, |
| 16544 GLsizei height, | 16572 GLsizei height, |
| 16545 GLboolean unpack_flip_y, | 16573 GLboolean unpack_flip_y, |
| 16546 GLboolean unpack_premultiply_alpha, | 16574 GLboolean unpack_premultiply_alpha, |
| 16547 GLboolean unpack_unmultiply_alpha) { | 16575 GLboolean unpack_unmultiply_alpha) { |
| 16548 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopySubTextureCHROMIUM"); | 16576 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopySubTextureCHROMIUM"); |
| 16549 | 16577 |
| 16550 // TODO(qiankun.miao@intel.com): Remove this after level > 0 support is | |
| 16551 // implemented. See: https://crbug.com/612542. | |
| 16552 DCHECK(source_level == 0); | |
| 16553 DCHECK(dest_level == 0); | |
| 16554 | |
| 16555 static const char kFunctionName[] = "glCopySubTextureCHROMIUM"; | 16578 static const char kFunctionName[] = "glCopySubTextureCHROMIUM"; |
| 16556 TextureRef* source_texture_ref = GetTexture(source_id); | 16579 TextureRef* source_texture_ref = GetTexture(source_id); |
| 16557 TextureRef* dest_texture_ref = GetTexture(dest_id); | 16580 TextureRef* dest_texture_ref = GetTexture(dest_id); |
| 16558 | 16581 |
| 16559 if (!ValidateCopyTextureCHROMIUMTextures(kFunctionName, source_texture_ref, | 16582 if (!ValidateCopyTextureCHROMIUMTextures(kFunctionName, source_texture_ref, |
| 16560 dest_texture_ref)) { | 16583 dest_texture_ref)) { |
| 16561 return; | 16584 return; |
| 16562 } | 16585 } |
| 16563 | 16586 |
| 16587 if (source_level < 0 || dest_level < 0 || | |
| 16588 (feature_info_->IsWebGL1OrES2Context() && source_level > 0)) { | |
| 16589 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, | |
| 16590 "source_level or dest_level out of range"); | |
| 16591 return; | |
| 16592 } | |
| 16593 | |
| 16564 Texture* source_texture = source_texture_ref->texture(); | 16594 Texture* source_texture = source_texture_ref->texture(); |
| 16565 Texture* dest_texture = dest_texture_ref->texture(); | 16595 Texture* dest_texture = dest_texture_ref->texture(); |
| 16566 GLenum source_target = source_texture->target(); | 16596 GLenum source_target = source_texture->target(); |
| 16567 GLenum dest_target = dest_texture->target(); | 16597 GLenum dest_target = dest_texture->target(); |
| 16568 int source_width = 0; | 16598 int source_width = 0; |
| 16569 int source_height = 0; | 16599 int source_height = 0; |
| 16570 gl::GLImage* image = | 16600 gl::GLImage* image = |
| 16571 source_texture->GetLevelImage(source_target, 0); | 16601 source_texture->GetLevelImage(source_target, source_level); |
| 16572 if (image) { | 16602 if (image) { |
| 16573 gfx::Size size = image->GetSize(); | 16603 gfx::Size size = image->GetSize(); |
| 16574 source_width = size.width(); | 16604 source_width = size.width(); |
| 16575 source_height = size.height(); | 16605 source_height = size.height(); |
| 16576 if (source_width <= 0 || source_height <= 0) { | 16606 if (source_width <= 0 || source_height <= 0) { |
| 16577 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "invalid image size"); | 16607 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "invalid image size"); |
| 16578 return; | 16608 return; |
| 16579 } | 16609 } |
| 16580 | 16610 |
| 16581 // Ideally we should not need to check that the sub-texture copy rectangle | 16611 // Ideally we should not need to check that the sub-texture copy rectangle |
| 16582 // is valid in two different ways, here and below. However currently there | 16612 // is valid in two different ways, here and below. However currently there |
| 16583 // is no guarantee that a texture backed by a GLImage will have sensible | 16613 // is no guarantee that a texture backed by a GLImage will have sensible |
| 16584 // level info. If this synchronization were to be enforced then this and | 16614 // level info. If this synchronization were to be enforced then this and |
| 16585 // other functions in this file could be cleaned up. | 16615 // other functions in this file could be cleaned up. |
| 16586 // See: https://crbug.com/586476 | 16616 // See: https://crbug.com/586476 |
| 16587 int32_t max_x; | 16617 int32_t max_x; |
| 16588 int32_t max_y; | 16618 int32_t max_y; |
| 16589 if (!SafeAddInt32(x, width, &max_x) || !SafeAddInt32(y, height, &max_y) || | 16619 if (!SafeAddInt32(x, width, &max_x) || !SafeAddInt32(y, height, &max_y) || |
| 16590 x < 0 || y < 0 || max_x > source_width || max_y > source_height) { | 16620 x < 0 || y < 0 || max_x > source_width || max_y > source_height) { |
| 16591 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, | 16621 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, |
| 16592 "source texture bad dimensions"); | 16622 "source texture bad dimensions"); |
| 16593 return; | 16623 return; |
| 16594 } | 16624 } |
| 16595 } else { | 16625 } else { |
| 16596 if (!source_texture->GetLevelSize(source_target, 0, | 16626 if (!source_texture->GetLevelSize(source_target, source_level, |
| 16597 &source_width, &source_height, nullptr)) { | 16627 &source_width, &source_height, nullptr)) { |
| 16598 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, | 16628 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, |
| 16599 "source texture has no level 0"); | 16629 "source texture has no data for level"); |
| 16600 return; | 16630 return; |
| 16601 } | 16631 } |
| 16602 | 16632 |
| 16603 // Check that this type of texture is allowed. | 16633 // Check that this type of texture is allowed. |
| 16604 if (!texture_manager()->ValidForTarget(source_target, 0, | 16634 if (!texture_manager()->ValidForTarget(source_target, source_level, |
| 16605 source_width, source_height, 1)) { | 16635 source_width, source_height, 1)) { |
| 16606 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, | 16636 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, |
| 16607 "source texture bad dimensions"); | 16637 "source texture bad dimensions"); |
| 16608 return; | 16638 return; |
| 16609 } | 16639 } |
| 16610 | 16640 |
| 16611 if (!source_texture->ValidForTexture(source_target, 0, x, y, 0, width, | 16641 if (!source_texture->ValidForTexture(source_target, source_level, x, y, 0, |
| 16612 height, 1)) { | 16642 width, height, 1)) { |
| 16613 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, | 16643 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, |
| 16614 "source texture bad dimensions."); | 16644 "source texture bad dimensions."); |
| 16615 return; | 16645 return; |
| 16616 } | 16646 } |
| 16617 } | 16647 } |
| 16618 | 16648 |
| 16619 GLenum source_type = 0; | 16649 GLenum source_type = 0; |
| 16620 GLenum source_internal_format = 0; | 16650 GLenum source_internal_format = 0; |
| 16621 source_texture->GetLevelType(source_target, 0, &source_type, | 16651 source_texture->GetLevelType(source_target, source_level, &source_type, |
| 16622 &source_internal_format); | 16652 &source_internal_format); |
| 16623 | 16653 |
| 16624 GLenum dest_type = 0; | 16654 GLenum dest_type = 0; |
| 16625 GLenum dest_internal_format = 0; | 16655 GLenum dest_internal_format = 0; |
| 16626 bool dest_level_defined = dest_texture->GetLevelType( | 16656 bool dest_level_defined = dest_texture->GetLevelType( |
| 16627 dest_target, 0, &dest_type, &dest_internal_format); | 16657 dest_target, dest_level, &dest_type, &dest_internal_format); |
| 16628 if (!dest_level_defined) { | 16658 if (!dest_level_defined) { |
| 16629 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, | 16659 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, |
| 16630 "destination texture is not defined"); | 16660 "destination texture is not defined"); |
| 16631 return; | 16661 return; |
| 16632 } | 16662 } |
| 16633 if (!dest_texture->ValidForTexture(dest_target, 0, xoffset, | 16663 if (!dest_texture->ValidForTexture(dest_target, dest_level, xoffset, yoffset, |
| 16634 yoffset, 0, width, height, 1)) { | 16664 0, width, height, 1)) { |
| 16635 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, | 16665 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, |
| 16636 "destination texture bad dimensions."); | 16666 "destination texture bad dimensions."); |
| 16637 return; | 16667 return; |
| 16638 } | 16668 } |
| 16639 | 16669 |
| 16640 CopyTextureMethod method = ValidateCopyTextureCHROMIUMInternalFormats( | 16670 CopyTextureMethod method = ValidateCopyTextureCHROMIUMInternalFormats( |
| 16641 kFunctionName, source_texture_ref, dest_internal_format); | 16671 kFunctionName, source_texture_ref, source_level, dest_internal_format); |
| 16642 // INVALID_OPERATION is already generated by | 16672 // INVALID_OPERATION is already generated by |
| 16643 // ValidateCopyTextureCHROMIUMInternalFormats. | 16673 // ValidateCopyTextureCHROMIUMInternalFormats. |
| 16644 if (NOT_COPYABLE == method) { | 16674 if (method == NOT_COPYABLE) { |
| 16645 return; | 16675 return; |
| 16646 } | 16676 } |
| 16647 | 16677 |
| 16678 // Draw to a fbo attaching level 0 of an intermediate texture, | |
| 16679 // then copy from the fbo to dest texture level with glCopyTexImage2D. | |
| 16680 // For WebGL 1.0 or OpenGL ES 2.0, DIRECT_DRAW path isn't available for | |
| 16681 // dest_level > 0 due to level > 0 isn't supported by glFramebufferTexture2D | |
| 16682 // in ES2 context. Go to DRAW_AND_COPY path in this case. | |
| 16683 // TODO(qiankun.miao@intel.com): for WebGL 2.0 or OpenGL ES 3.0, both | |
| 16684 // DIRECT_DRAW path for dest_level > 0 and DIRECT_COPY path for source_level > | |
| 16685 // 0 are not available due to a framebuffer completeness bug: | |
| 16686 // crbug.com/678526. Once the bug is fixed, the limitation for WebGL 2.0 and | |
| 16687 // OpenGL ES 3.0 can be lifted. | |
| 16688 if ((dest_level > 0 && method == DIRECT_DRAW) || | |
| 16689 (source_level > 0 && method == DIRECT_COPY)) { | |
| 16690 method = DRAW_AND_COPY; | |
| 16691 } | |
| 16692 | |
| 16648 if (feature_info_->feature_flags().desktop_srgb_support) { | 16693 if (feature_info_->feature_flags().desktop_srgb_support) { |
| 16649 bool enable_framebuffer_srgb = | 16694 bool enable_framebuffer_srgb = |
| 16650 GetColorEncodingFromInternalFormat(source_internal_format) == GL_SRGB || | 16695 GetColorEncodingFromInternalFormat(source_internal_format) == GL_SRGB || |
| 16651 GetColorEncodingFromInternalFormat(dest_internal_format) == GL_SRGB; | 16696 GetColorEncodingFromInternalFormat(dest_internal_format) == GL_SRGB; |
| 16652 state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb); | 16697 state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb); |
| 16653 } | 16698 } |
| 16654 | 16699 |
| 16655 // Clear the source texture if necessary. | 16700 // Clear the source texture if necessary. |
| 16656 if (!texture_manager()->ClearTextureLevel(this, source_texture_ref, | 16701 if (!texture_manager()->ClearTextureLevel(this, source_texture_ref, |
| 16657 source_target, 0)) { | 16702 source_target, source_level)) { |
| 16658 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, kFunctionName, | 16703 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, kFunctionName, |
| 16659 "source texture dimensions too big"); | 16704 "source texture dimensions too big"); |
| 16660 return; | 16705 return; |
| 16661 } | 16706 } |
| 16662 | 16707 |
| 16663 if (!InitializeCopyTextureCHROMIUM(kFunctionName)) | 16708 if (!InitializeCopyTextureCHROMIUM(kFunctionName)) |
| 16664 return; | 16709 return; |
| 16665 | 16710 |
| 16666 int dest_width = 0; | 16711 int dest_width = 0; |
| 16667 int dest_height = 0; | 16712 int dest_height = 0; |
| 16668 bool ok = dest_texture->GetLevelSize( | 16713 bool ok = dest_texture->GetLevelSize(dest_target, dest_level, &dest_width, |
| 16669 dest_target, 0, &dest_width, &dest_height, nullptr); | 16714 &dest_height, nullptr); |
| 16670 DCHECK(ok); | 16715 DCHECK(ok); |
| 16671 if (xoffset != 0 || yoffset != 0 || width != dest_width || | 16716 if (xoffset != 0 || yoffset != 0 || width != dest_width || |
| 16672 height != dest_height) { | 16717 height != dest_height) { |
| 16673 gfx::Rect cleared_rect; | 16718 gfx::Rect cleared_rect; |
| 16674 if (TextureManager::CombineAdjacentRects( | 16719 if (TextureManager::CombineAdjacentRects( |
| 16675 dest_texture->GetLevelClearedRect(dest_target, 0), | 16720 dest_texture->GetLevelClearedRect(dest_target, dest_level), |
| 16676 gfx::Rect(xoffset, yoffset, width, height), &cleared_rect)) { | 16721 gfx::Rect(xoffset, yoffset, width, height), &cleared_rect)) { |
| 16677 DCHECK_GE( | 16722 DCHECK_GE(cleared_rect.size().GetArea(), |
| 16678 cleared_rect.size().GetArea(), | 16723 dest_texture->GetLevelClearedRect(dest_target, dest_level) |
| 16679 dest_texture->GetLevelClearedRect(dest_target, 0).size().GetArea()); | 16724 .size() |
| 16680 texture_manager()->SetLevelClearedRect(dest_texture_ref, dest_target, 0, | 16725 .GetArea()); |
| 16681 cleared_rect); | 16726 texture_manager()->SetLevelClearedRect(dest_texture_ref, dest_target, |
| 16727 dest_level, cleared_rect); | |
| 16682 } else { | 16728 } else { |
| 16683 // Otherwise clear part of texture level that is not already cleared. | 16729 // Otherwise clear part of texture level that is not already cleared. |
| 16684 if (!texture_manager()->ClearTextureLevel(this, dest_texture_ref, | 16730 if (!texture_manager()->ClearTextureLevel(this, dest_texture_ref, |
| 16685 dest_target, 0)) { | 16731 dest_target, dest_level)) { |
| 16686 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, kFunctionName, | 16732 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, kFunctionName, |
| 16687 "destination texture dimensions too big"); | 16733 "destination texture dimensions too big"); |
| 16688 return; | 16734 return; |
| 16689 } | 16735 } |
| 16690 } | 16736 } |
| 16691 } else { | 16737 } else { |
| 16692 texture_manager()->SetLevelCleared(dest_texture_ref, dest_target, 0, | 16738 texture_manager()->SetLevelCleared(dest_texture_ref, dest_target, |
| 16693 true); | 16739 dest_level, true); |
| 16694 } | 16740 } |
| 16695 | 16741 |
| 16696 // Try using GLImage::CopyTexSubImage when possible. | 16742 // Try using GLImage::CopyTexSubImage when possible. |
| 16697 bool unpack_premultiply_alpha_change = | 16743 bool unpack_premultiply_alpha_change = |
| 16698 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; | 16744 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; |
| 16699 if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { | 16745 // TODO(qiankun.miao@intel.com): Support level > 0 for CopyTexSubImage. |
| 16746 if (image && dest_level == 0 && !unpack_flip_y && | |
| 16747 !unpack_premultiply_alpha_change) { | |
| 16700 ScopedTextureBinder binder( | 16748 ScopedTextureBinder binder( |
| 16701 &state_, dest_texture->service_id(), dest_target); | 16749 &state_, dest_texture->service_id(), dest_target); |
| 16702 if (image->CopyTexSubImage(dest_target, gfx::Point(xoffset, yoffset), | 16750 if (image->CopyTexSubImage(dest_target, gfx::Point(xoffset, yoffset), |
| 16703 gfx::Rect(x, y, width, height))) { | 16751 gfx::Rect(x, y, width, height))) { |
| 16704 return; | 16752 return; |
| 16705 } | 16753 } |
| 16706 } | 16754 } |
| 16707 | 16755 |
| 16708 DoCopyTexImageIfNeeded(source_texture, source_target); | 16756 DoCopyTexImageIfNeeded(source_texture, source_target); |
| 16709 | 16757 |
| 16710 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix | 16758 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix |
| 16711 // before presenting. | 16759 // before presenting. |
| 16712 if (source_target == GL_TEXTURE_EXTERNAL_OES) { | 16760 if (source_target == GL_TEXTURE_EXTERNAL_OES) { |
| 16713 if (GLStreamTextureImage* image = | 16761 if (GLStreamTextureImage* image = |
| 16714 source_texture->GetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES, | 16762 source_texture->GetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES, |
| 16715 0)) { | 16763 source_level)) { |
| 16716 GLfloat transform_matrix[16]; | 16764 GLfloat transform_matrix[16]; |
| 16717 image->GetTextureMatrix(transform_matrix); | 16765 image->GetTextureMatrix(transform_matrix); |
| 16718 copy_texture_CHROMIUM_->DoCopySubTextureWithTransform( | 16766 copy_texture_CHROMIUM_->DoCopySubTextureWithTransform( |
| 16719 this, source_target, source_texture->service_id(), | 16767 this, source_target, source_texture->service_id(), source_level, |
| 16720 source_internal_format, dest_target, dest_texture->service_id(), | 16768 source_internal_format, dest_target, dest_texture->service_id(), |
| 16721 dest_internal_format, xoffset, yoffset, x, y, width, height, | 16769 dest_level, dest_internal_format, xoffset, yoffset, x, y, width, |
| 16722 dest_width, dest_height, source_width, source_height, | 16770 height, dest_width, dest_height, source_width, source_height, |
| 16723 unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, | 16771 unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, |
| 16724 unpack_unmultiply_alpha == GL_TRUE, transform_matrix); | 16772 unpack_unmultiply_alpha == GL_TRUE, transform_matrix); |
| 16725 return; | 16773 return; |
| 16726 } | 16774 } |
| 16727 } | 16775 } |
| 16728 copy_texture_CHROMIUM_->DoCopySubTexture( | 16776 copy_texture_CHROMIUM_->DoCopySubTexture( |
| 16729 this, source_target, source_texture->service_id(), source_internal_format, | 16777 this, source_target, source_texture->service_id(), source_level, |
| 16730 dest_target, dest_texture->service_id(), dest_internal_format, xoffset, | 16778 source_internal_format, dest_target, dest_texture->service_id(), |
| 16731 yoffset, x, y, width, height, dest_width, dest_height, source_width, | 16779 dest_level, dest_internal_format, xoffset, yoffset, x, y, width, height, |
| 16732 source_height, unpack_flip_y == GL_TRUE, | 16780 dest_width, dest_height, source_width, source_height, |
| 16733 unpack_premultiply_alpha == GL_TRUE, unpack_unmultiply_alpha == GL_TRUE, | 16781 unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, |
| 16734 method); | 16782 unpack_unmultiply_alpha == GL_TRUE, method); |
| 16735 } | 16783 } |
| 16736 | 16784 |
| 16737 bool GLES2DecoderImpl::InitializeCopyTexImageBlitter( | 16785 bool GLES2DecoderImpl::InitializeCopyTexImageBlitter( |
| 16738 const char* function_name) { | 16786 const char* function_name) { |
| 16739 if (!copy_tex_image_blit_.get()) { | 16787 if (!copy_tex_image_blit_.get()) { |
| 16740 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(function_name); | 16788 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(function_name); |
| 16741 copy_tex_image_blit_.reset( | 16789 copy_tex_image_blit_.reset( |
| 16742 new CopyTexImageResourceManager(feature_info_.get())); | 16790 new CopyTexImageResourceManager(feature_info_.get())); |
| 16743 copy_tex_image_blit_->Initialize(this); | 16791 copy_tex_image_blit_->Initialize(this); |
| 16744 if (LOCAL_PEEK_GL_ERROR(function_name) != GL_NO_ERROR) | 16792 if (LOCAL_PEEK_GL_ERROR(function_name) != GL_NO_ERROR) |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16896 RestoreCurrentTextureBindings(&state_, dest_texture->target()); | 16944 RestoreCurrentTextureBindings(&state_, dest_texture->target()); |
| 16897 return; | 16945 return; |
| 16898 } | 16946 } |
| 16899 | 16947 |
| 16900 texture_manager()->SetLevelInfo( | 16948 texture_manager()->SetLevelInfo( |
| 16901 dest_texture_ref, dest_texture->target(), 0, GL_RGBA, source_width, | 16949 dest_texture_ref, dest_texture->target(), 0, GL_RGBA, source_width, |
| 16902 source_height, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 16950 source_height, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 16903 gfx::Rect(source_width, source_height)); | 16951 gfx::Rect(source_width, source_height)); |
| 16904 | 16952 |
| 16905 copy_texture_CHROMIUM_->DoCopyTexture( | 16953 copy_texture_CHROMIUM_->DoCopyTexture( |
| 16906 this, source_texture->target(), source_texture->service_id(), | 16954 this, source_texture->target(), source_texture->service_id(), 0, |
| 16907 source_internal_format, dest_texture->target(), | 16955 source_internal_format, dest_texture->target(), |
| 16908 dest_texture->service_id(), GL_RGBA, source_width, source_height, false, | 16956 dest_texture->service_id(), 0, GL_RGBA, source_width, source_height, |
| 16909 false, false, DIRECT_DRAW); | 16957 false, false, false, DIRECT_DRAW); |
| 16910 } | 16958 } |
| 16911 | 16959 |
| 16912 void GLES2DecoderImpl::TexStorageImpl(GLenum target, | 16960 void GLES2DecoderImpl::TexStorageImpl(GLenum target, |
| 16913 GLsizei levels, | 16961 GLsizei levels, |
| 16914 GLenum internal_format, | 16962 GLenum internal_format, |
| 16915 GLsizei width, | 16963 GLsizei width, |
| 16916 GLsizei height, | 16964 GLsizei height, |
| 16917 GLsizei depth, | 16965 GLsizei depth, |
| 16918 ContextState::Dimension dimension, | 16966 ContextState::Dimension dimension, |
| 16919 const char* function_name) { | 16967 const char* function_name) { |
| (...skipping 2231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 19151 } | 19199 } |
| 19152 | 19200 |
| 19153 // Include the auto-generated part of this file. We split this because it means | 19201 // Include the auto-generated part of this file. We split this because it means |
| 19154 // we can easily edit the non-auto generated parts right here in this file | 19202 // we can easily edit the non-auto generated parts right here in this file |
| 19155 // instead of having to edit some template or the code generator. | 19203 // instead of having to edit some template or the code generator. |
| 19156 #include "base/macros.h" | 19204 #include "base/macros.h" |
| 19157 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 19205 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 19158 | 19206 |
| 19159 } // namespace gles2 | 19207 } // namespace gles2 |
| 19160 } // namespace gpu | 19208 } // namespace gpu |
| OLD | NEW |