| 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 13452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13463 !ValidateCompressedTexFuncData(func_name, width, height, depth, | 13463 !ValidateCompressedTexFuncData(func_name, width, height, depth, |
| 13464 internal_format, image_size, data)) { | 13464 internal_format, image_size, data)) { |
| 13465 return error::kNoError; | 13465 return error::kNoError; |
| 13466 } | 13466 } |
| 13467 | 13467 |
| 13468 if (!EnsureGPUMemoryAvailable(image_size)) { | 13468 if (!EnsureGPUMemoryAvailable(image_size)) { |
| 13469 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, func_name, "out of memory"); | 13469 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, func_name, "out of memory"); |
| 13470 return error::kNoError; | 13470 return error::kNoError; |
| 13471 } | 13471 } |
| 13472 | 13472 |
| 13473 if (texture->IsAttachedToFramebuffer()) { | |
| 13474 framebuffer_state_.clear_state_dirty = true; | |
| 13475 } | |
| 13476 | |
| 13477 std::unique_ptr<int8_t[]> zero; | 13473 std::unique_ptr<int8_t[]> zero; |
| 13478 if (!state_.bound_pixel_unpack_buffer && !data) { | 13474 if (!state_.bound_pixel_unpack_buffer && !data) { |
| 13479 zero.reset(new int8_t[image_size]); | 13475 zero.reset(new int8_t[image_size]); |
| 13480 memset(zero.get(), 0, image_size); | 13476 memset(zero.get(), 0, image_size); |
| 13481 data = zero.get(); | 13477 data = zero.get(); |
| 13482 } | 13478 } |
| 13483 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(func_name); | 13479 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(func_name); |
| 13484 const CompressedFormatInfo* format_info = | 13480 const CompressedFormatInfo* format_info = |
| 13485 GetCompressedFormatInfo(internal_format); | 13481 GetCompressedFormatInfo(internal_format); |
| 13486 if (format_info != nullptr && !format_info->support_check(*feature_info_)) { | 13482 if (format_info != nullptr && !format_info->support_check(*feature_info_)) { |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14070 LOCAL_SET_GL_ERROR( | 14066 LOCAL_SET_GL_ERROR( |
| 14071 GL_INVALID_OPERATION, | 14067 GL_INVALID_OPERATION, |
| 14072 func_name, "source and destination textures are the same"); | 14068 func_name, "source and destination textures are the same"); |
| 14073 return; | 14069 return; |
| 14074 } | 14070 } |
| 14075 | 14071 |
| 14076 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(func_name); | 14072 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(func_name); |
| 14077 ScopedResolvedFramebufferBinder binder(this, false, true); | 14073 ScopedResolvedFramebufferBinder binder(this, false, true); |
| 14078 gfx::Size size = GetBoundReadFramebufferSize(); | 14074 gfx::Size size = GetBoundReadFramebufferSize(); |
| 14079 | 14075 |
| 14080 if (texture->IsAttachedToFramebuffer()) { | |
| 14081 framebuffer_state_.clear_state_dirty = true; | |
| 14082 } | |
| 14083 | |
| 14084 bool requires_luma_blit = | 14076 bool requires_luma_blit = |
| 14085 CopyTexImageResourceManager::CopyTexImageRequiresBlit(feature_info_.get(), | 14077 CopyTexImageResourceManager::CopyTexImageRequiresBlit(feature_info_.get(), |
| 14086 format); | 14078 format); |
| 14087 if (requires_luma_blit && | 14079 if (requires_luma_blit && |
| 14088 !InitializeCopyTexImageBlitter(func_name)) { | 14080 !InitializeCopyTexImageBlitter(func_name)) { |
| 14089 return; | 14081 return; |
| 14090 } | 14082 } |
| 14091 | 14083 |
| 14092 // Clip to size to source dimensions | 14084 // Clip to size to source dimensions |
| 14093 gfx::Rect src(x, y, width, height); | 14085 gfx::Rect src(x, y, width, height); |
| (...skipping 2808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16902 return; | 16894 return; |
| 16903 } | 16895 } |
| 16904 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( | 16896 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( |
| 16905 &state_, target); | 16897 &state_, target); |
| 16906 if (!texture_ref) { | 16898 if (!texture_ref) { |
| 16907 LOCAL_SET_GL_ERROR( | 16899 LOCAL_SET_GL_ERROR( |
| 16908 GL_INVALID_OPERATION, function_name, "unknown texture for target"); | 16900 GL_INVALID_OPERATION, function_name, "unknown texture for target"); |
| 16909 return; | 16901 return; |
| 16910 } | 16902 } |
| 16911 Texture* texture = texture_ref->texture(); | 16903 Texture* texture = texture_ref->texture(); |
| 16912 if (texture->IsAttachedToFramebuffer()) { | |
| 16913 framebuffer_state_.clear_state_dirty = true; | |
| 16914 } | |
| 16915 if (texture->IsImmutable()) { | 16904 if (texture->IsImmutable()) { |
| 16916 LOCAL_SET_GL_ERROR( | 16905 LOCAL_SET_GL_ERROR( |
| 16917 GL_INVALID_OPERATION, function_name, "texture is immutable"); | 16906 GL_INVALID_OPERATION, function_name, "texture is immutable"); |
| 16918 return; | 16907 return; |
| 16919 } | 16908 } |
| 16920 | 16909 |
| 16921 GLenum format = TextureManager::ExtractFormatFromStorageFormat( | 16910 GLenum format = TextureManager::ExtractFormatFromStorageFormat( |
| 16922 internal_format); | 16911 internal_format); |
| 16923 GLenum type = TextureManager::ExtractTypeFromStorageFormat(internal_format); | 16912 GLenum type = TextureManager::ExtractTypeFromStorageFormat(internal_format); |
| 16924 | 16913 |
| (...skipping 2193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19118 } | 19107 } |
| 19119 | 19108 |
| 19120 // Include the auto-generated part of this file. We split this because it means | 19109 // Include the auto-generated part of this file. We split this because it means |
| 19121 // we can easily edit the non-auto generated parts right here in this file | 19110 // we can easily edit the non-auto generated parts right here in this file |
| 19122 // instead of having to edit some template or the code generator. | 19111 // instead of having to edit some template or the code generator. |
| 19123 #include "base/macros.h" | 19112 #include "base/macros.h" |
| 19124 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 19113 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 19125 | 19114 |
| 19126 } // namespace gles2 | 19115 } // namespace gles2 |
| 19127 } // namespace gpu | 19116 } // namespace gpu |
| OLD | NEW |