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 14337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14348 if (requires_luma_blit && | 14348 if (requires_luma_blit && |
14349 !InitializeCopyTexImageBlitter(func_name)) { | 14349 !InitializeCopyTexImageBlitter(func_name)) { |
14350 return; | 14350 return; |
14351 } | 14351 } |
14352 | 14352 |
14353 // Clip to size to source dimensions | 14353 // Clip to size to source dimensions |
14354 gfx::Rect src(x, y, width, height); | 14354 gfx::Rect src(x, y, width, height); |
14355 const gfx::Rect dst(0, 0, size.width(), size.height()); | 14355 const gfx::Rect dst(0, 0, size.width(), size.height()); |
14356 src.Intersect(dst); | 14356 src.Intersect(dst); |
14357 | 14357 |
| 14358 GLenum final_internal_format = TextureManager::AdjustTexInternalFormat( |
| 14359 feature_info_.get(), internal_format); |
| 14360 if (workarounds().force_int_cube_texture_complete && |
| 14361 texture->target() == GL_TEXTURE_CUBE_MAP && |
| 14362 GLES2Util::IsIntegerFormat(final_internal_format)) { |
| 14363 TextureManager::DoTexImageArguments args = { |
| 14364 target, |
| 14365 level, |
| 14366 final_internal_format, |
| 14367 width, |
| 14368 height, |
| 14369 1, |
| 14370 border, |
| 14371 format, |
| 14372 type, |
| 14373 nullptr, |
| 14374 pixels_size, |
| 14375 0, |
| 14376 TextureManager::DoTexImageArguments::kTexImage2D}; |
| 14377 texture_manager()->WorkaroundCopyTexImageCubeMap( |
| 14378 &texture_state_, &state_, &framebuffer_state_, texture_ref, func_name, |
| 14379 args); |
| 14380 } |
| 14381 |
14358 if (src.x() != x || src.y() != y || | 14382 if (src.x() != x || src.y() != y || |
14359 src.width() != width || src.height() != height) { | 14383 src.width() != width || src.height() != height) { |
14360 { | 14384 { |
14361 // Add extra scope to destroy zero and the object it owns right | 14385 // Add extra scope to destroy zero and the object it owns right |
14362 // after its usage. | 14386 // after its usage. |
14363 // some part was clipped so clear the rect. | 14387 // some part was clipped so clear the rect. |
14364 | 14388 |
14365 std::unique_ptr<char[]> zero(new char[pixels_size]); | 14389 std::unique_ptr<char[]> zero(new char[pixels_size]); |
14366 memset(zero.get(), 0, pixels_size); | 14390 memset(zero.get(), 0, pixels_size); |
14367 glTexImage2D(target, level, TextureManager::AdjustTexInternalFormat( | 14391 glTexImage2D(target, level, final_internal_format, width, height, border, |
14368 feature_info_.get(), internal_format), | 14392 format, type, zero.get()); |
14369 width, height, border, format, type, zero.get()); | |
14370 } | 14393 } |
14371 | 14394 |
14372 if (!src.IsEmpty()) { | 14395 if (!src.IsEmpty()) { |
14373 GLint destX = src.x() - x; | 14396 GLint destX = src.x() - x; |
14374 GLint destY = src.y() - y; | 14397 GLint destY = src.y() - y; |
14375 if (requires_luma_blit) { | 14398 if (requires_luma_blit) { |
14376 copy_tex_image_blit_->DoCopyTexSubImageToLUMACompatibilityTexture( | 14399 copy_tex_image_blit_->DoCopyTexSubImageToLUMACompatibilityTexture( |
14377 this, texture->service_id(), texture->target(), target, format, | 14400 this, texture->service_id(), texture->target(), target, format, |
14378 type, level, destX, destY, 0, | 14401 type, level, destX, destY, 0, |
14379 src.x(), src.y(), src.width(), src.height(), | 14402 src.x(), src.y(), src.width(), src.height(), |
14380 GetBoundReadFramebufferServiceId(), | 14403 GetBoundReadFramebufferServiceId(), |
14381 GetBoundReadFramebufferInternalFormat()); | 14404 GetBoundReadFramebufferInternalFormat()); |
14382 } else { | 14405 } else { |
14383 glCopyTexSubImage2D(target, level, destX, destY, | 14406 glCopyTexSubImage2D(target, level, destX, destY, |
14384 src.x(), src.y(), src.width(), src.height()); | 14407 src.x(), src.y(), src.width(), src.height()); |
14385 } | 14408 } |
14386 } | 14409 } |
14387 } else { | 14410 } else { |
14388 GLenum final_internal_format = TextureManager::AdjustTexInternalFormat( | |
14389 feature_info_.get(), internal_format); | |
14390 if (workarounds().init_two_cube_map_levels_before_copyteximage && | 14411 if (workarounds().init_two_cube_map_levels_before_copyteximage && |
14391 texture->target() == GL_TEXTURE_CUBE_MAP && | 14412 texture->target() == GL_TEXTURE_CUBE_MAP && |
14392 target != GL_TEXTURE_CUBE_MAP_POSITIVE_X) { | 14413 target != GL_TEXTURE_CUBE_MAP_POSITIVE_X) { |
14393 for (int i = 0; i < 2; ++i) { | 14414 for (int i = 0; i < 2; ++i) { |
14394 TextureManager::DoTexImageArguments args = { | 14415 TextureManager::DoTexImageArguments args = { |
14395 target, i, final_internal_format, width, height, 1, border, | 14416 target, i, final_internal_format, width, height, 1, border, |
14396 format, type, nullptr, pixels_size, 0, | 14417 format, type, nullptr, pixels_size, 0, |
14397 TextureManager::DoTexImageArguments::kTexImage2D }; | 14418 TextureManager::DoTexImageArguments::kTexImage2D }; |
14398 texture_manager()->WorkaroundCopyTexImageCubeMap(&texture_state_, | 14419 texture_manager()->WorkaroundCopyTexImageCubeMap(&texture_state_, |
14399 &state_, &framebuffer_state_, texture_ref, func_name, args); | 14420 &state_, &framebuffer_state_, texture_ref, func_name, args); |
(...skipping 5177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19577 } | 19598 } |
19578 | 19599 |
19579 // Include the auto-generated part of this file. We split this because it means | 19600 // Include the auto-generated part of this file. We split this because it means |
19580 // we can easily edit the non-auto generated parts right here in this file | 19601 // we can easily edit the non-auto generated parts right here in this file |
19581 // instead of having to edit some template or the code generator. | 19602 // instead of having to edit some template or the code generator. |
19582 #include "base/macros.h" | 19603 #include "base/macros.h" |
19583 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 19604 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
19584 | 19605 |
19585 } // namespace gles2 | 19606 } // namespace gles2 |
19586 } // namespace gpu | 19607 } // namespace gpu |
OLD | NEW |