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 13026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13037 memset(zero.get(), 0, pixels_size); | 13037 memset(zero.get(), 0, pixels_size); |
| 13038 glTexImage2D(target, level, TextureManager::AdjustTexInternalFormat( | 13038 glTexImage2D(target, level, TextureManager::AdjustTexInternalFormat( |
| 13039 feature_info_.get(), internal_format), | 13039 feature_info_.get(), internal_format), |
| 13040 width, height, border, format, type, zero.get()); | 13040 width, height, border, format, type, zero.get()); |
| 13041 if (copyHeight > 0 && copyWidth > 0) { | 13041 if (copyHeight > 0 && copyWidth > 0) { |
| 13042 GLint dx = copyX - x; | 13042 GLint dx = copyX - x; |
| 13043 GLint dy = copyY - y; | 13043 GLint dy = copyY - y; |
| 13044 GLint destX = dx; | 13044 GLint destX = dx; |
| 13045 GLint destY = dy; | 13045 GLint destY = dy; |
| 13046 if (requires_luma_blit) { | 13046 if (requires_luma_blit) { |
| 13047 copy_tex_image_blit_->DoCopyTexSubImage2DToLUMACompatibilityTexture( | 13047 copy_tex_image_blit_->DoCopyTexSubImageToLUMACompatibilityTexture( |
| 13048 this, texture->service_id(), texture->target(), target, format, | 13048 this, texture->service_id(), texture->target(), target, format, |
| 13049 type, level, destX, destY, copyX, copyY, copyWidth, copyHeight, | 13049 type, level, destX, destY, 0, copyX, copyY, copyWidth, copyHeight, |
| 13050 GetBoundReadFrameBufferServiceId(), | 13050 GetBoundReadFrameBufferServiceId(), |
| 13051 GetBoundReadFrameBufferInternalFormat()); | 13051 GetBoundReadFrameBufferInternalFormat()); |
| 13052 } else { | 13052 } else { |
| 13053 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, | 13053 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, |
| 13054 copyWidth, copyHeight); | 13054 copyWidth, copyHeight); |
| 13055 } | 13055 } |
| 13056 } | 13056 } |
| 13057 } else { | 13057 } else { |
| 13058 GLenum final_internal_format = TextureManager::AdjustTexInternalFormat( | 13058 GLenum final_internal_format = TextureManager::AdjustTexInternalFormat( |
| 13059 feature_info_.get(), internal_format); | 13059 feature_info_.get(), internal_format); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13211 // Write all pixels in below. | 13211 // Write all pixels in below. |
| 13212 texture_manager()->SetLevelCleared(texture_ref, target, level, true); | 13212 texture_manager()->SetLevelCleared(texture_ref, target, level, true); |
| 13213 } | 13213 } |
| 13214 | 13214 |
| 13215 if (copyHeight > 0 && copyWidth > 0) { | 13215 if (copyHeight > 0 && copyWidth > 0) { |
| 13216 if (CopyTexImageResourceManager::CopyTexImageRequiresBlit( | 13216 if (CopyTexImageResourceManager::CopyTexImageRequiresBlit( |
| 13217 feature_info_.get(), internal_format)) { | 13217 feature_info_.get(), internal_format)) { |
| 13218 if (!InitializeCopyTexImageBlitter("glCopyTexSubImage2D")) { | 13218 if (!InitializeCopyTexImageBlitter("glCopyTexSubImage2D")) { |
| 13219 return; | 13219 return; |
| 13220 } | 13220 } |
| 13221 copy_tex_image_blit_->DoCopyTexSubImage2DToLUMACompatibilityTexture( | 13221 copy_tex_image_blit_->DoCopyTexSubImageToLUMACompatibilityTexture( |
| 13222 this, texture->service_id(), texture->target(), target, | 13222 this, texture->service_id(), texture->target(), target, |
| 13223 internal_format, type, level, xoffset, yoffset, x, y, width, height, | 13223 internal_format, type, level, xoffset, yoffset, 0, |
| 13224 copyX, copyY, copyWidth, copyHeight, | |
| 13224 GetBoundReadFrameBufferServiceId(), | 13225 GetBoundReadFrameBufferServiceId(), |
| 13225 GetBoundReadFrameBufferInternalFormat()); | 13226 GetBoundReadFrameBufferInternalFormat()); |
| 13226 } else { | 13227 } else { |
| 13227 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, copyWidth, | 13228 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, copyWidth, |
| 13228 copyHeight); | 13229 copyHeight); |
| 13229 } | 13230 } |
| 13230 } | 13231 } |
| 13231 | 13232 |
| 13232 // This may be a slow command. Exit command processing to allow for | 13233 // This may be a slow command. Exit command processing to allow for |
| 13233 // context preemption and GPU watchdog checks. | 13234 // context preemption and GPU watchdog checks. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13300 // for TexSubImage3D. | 13301 // for TexSubImage3D. |
| 13301 if (!texture->IsLevelCleared(target, level)) { | 13302 if (!texture->IsLevelCleared(target, level)) { |
| 13302 if (!texture_manager()->ClearTextureLevel(this, texture_ref, target, | 13303 if (!texture_manager()->ClearTextureLevel(this, texture_ref, target, |
| 13303 level)) { | 13304 level)) { |
| 13304 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, func_name, "dimensions too big"); | 13305 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, func_name, "dimensions too big"); |
| 13305 return; | 13306 return; |
| 13306 } | 13307 } |
| 13307 DCHECK(texture->IsLevelCleared(target, level)); | 13308 DCHECK(texture->IsLevelCleared(target, level)); |
| 13308 } | 13309 } |
| 13309 | 13310 |
| 13310 // TODO(yunchao): Follow-up CLs are necessary. For instance: | |
| 13311 // 1. emulation of unsized formats in core profile | |
| 13312 | |
| 13313 if (copyHeight > 0 && copyWidth > 0) { | 13311 if (copyHeight > 0 && copyWidth > 0) { |
| 13314 glCopyTexSubImage3D(target, level, destX, destY, zoffset, | 13312 if (CopyTexImageResourceManager::CopyTexImageRequiresBlit( |
| 13315 copyX, copyY, copyWidth, copyHeight); | 13313 feature_info_.get(), internal_format)) { |
| 13314 if (!InitializeCopyTexImageBlitter(func_name)) { | |
| 13315 return; | |
| 13316 } | |
| 13317 copy_tex_image_blit_->DoCopyTexSubImageToLUMACompatibilityTexture( | |
| 13318 this, texture->service_id(), texture->target(), target, | |
| 13319 internal_format, type, level, xoffset, yoffset, zoffset, | |
|
Zhenyao Mo
2016/08/22 17:57:15
Same question, should xoffset/yoffset be destX/des
yunchao
2016/08/23 13:32:17
You are right.
| |
| 13320 copyX, copyY, copyWidth, copyHeight, | |
| 13321 GetBoundReadFrameBufferServiceId(), | |
| 13322 GetBoundReadFrameBufferInternalFormat()); | |
| 13323 } else { | |
| 13324 glCopyTexSubImage3D(target, level, destX, destY, zoffset, | |
| 13325 copyX, copyY, copyWidth, copyHeight); | |
| 13326 } | |
| 13316 } | 13327 } |
| 13317 | 13328 |
| 13318 // This may be a slow command. Exit command processing to allow for | 13329 // This may be a slow command. Exit command processing to allow for |
| 13319 // context preemption and GPU watchdog checks. | 13330 // context preemption and GPU watchdog checks. |
| 13320 ExitCommandProcessingEarly(); | 13331 ExitCommandProcessingEarly(); |
| 13321 } | 13332 } |
| 13322 | 13333 |
| 13323 error::Error GLES2DecoderImpl::HandleTexSubImage2D(uint32_t immediate_data_size, | 13334 error::Error GLES2DecoderImpl::HandleTexSubImage2D(uint32_t immediate_data_size, |
| 13324 const void* cmd_data) { | 13335 const void* cmd_data) { |
| 13325 const gles2::cmds::TexSubImage2D& c = | 13336 const gles2::cmds::TexSubImage2D& c = |
| (...skipping 4454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 17780 } | 17791 } |
| 17781 | 17792 |
| 17782 // Include the auto-generated part of this file. We split this because it means | 17793 // Include the auto-generated part of this file. We split this because it means |
| 17783 // we can easily edit the non-auto generated parts right here in this file | 17794 // we can easily edit the non-auto generated parts right here in this file |
| 17784 // instead of having to edit some template or the code generator. | 17795 // instead of having to edit some template or the code generator. |
| 17785 #include "base/macros.h" | 17796 #include "base/macros.h" |
| 17786 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 17797 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 17787 | 17798 |
| 17788 } // namespace gles2 | 17799 } // namespace gles2 |
| 17789 } // namespace gpu | 17800 } // namespace gpu |
| OLD | NEW |