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