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 13005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13016 memset(zero.get(), 0, pixels_size); | 13016 memset(zero.get(), 0, pixels_size); |
| 13017 glTexImage2D(target, level, TextureManager::AdjustTexInternalFormat( | 13017 glTexImage2D(target, level, TextureManager::AdjustTexInternalFormat( |
| 13018 feature_info_.get(), internal_format), | 13018 feature_info_.get(), internal_format), |
| 13019 width, height, border, format, type, zero.get()); | 13019 width, height, border, format, type, zero.get()); |
| 13020 if (copyHeight > 0 && copyWidth > 0) { | 13020 if (copyHeight > 0 && copyWidth > 0) { |
| 13021 GLint dx = copyX - x; | 13021 GLint dx = copyX - x; |
| 13022 GLint dy = copyY - y; | 13022 GLint dy = copyY - y; |
| 13023 GLint destX = dx; | 13023 GLint destX = dx; |
| 13024 GLint destY = dy; | 13024 GLint destY = dy; |
| 13025 if (requires_luma_blit) { | 13025 if (requires_luma_blit) { |
| 13026 copy_tex_image_blit_->DoCopyTexSubImage2DToLUMAComatabilityTexture( | 13026 copy_tex_image_blit_->DoCopyTexSubImageToLUMAComatabilityTexture( |
| 13027 this, texture->service_id(), texture->target(), target, format, | 13027 this, texture->service_id(), texture->target(), target, format, |
| 13028 type, level, destX, destY, copyX, copyY, copyWidth, copyHeight, | 13028 type, level, destX, destY, 0, copyX, copyY, copyWidth, copyHeight, |
| 13029 framebuffer_state_.bound_read_framebuffer->service_id(), | 13029 framebuffer_state_.bound_read_framebuffer->service_id(), |
| 13030 framebuffer_state_.bound_read_framebuffer | 13030 framebuffer_state_.bound_read_framebuffer |
| 13031 ->GetReadBufferInternalFormat()); | 13031 ->GetReadBufferInternalFormat()); |
| 13032 } else { | 13032 } else { |
| 13033 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, | 13033 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, |
| 13034 copyWidth, copyHeight); | 13034 copyWidth, copyHeight); |
| 13035 } | 13035 } |
| 13036 } | 13036 } |
| 13037 } else { | 13037 } else { |
| 13038 GLenum final_internal_format = TextureManager::AdjustTexInternalFormat( | 13038 GLenum final_internal_format = TextureManager::AdjustTexInternalFormat( |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13192 // Write all pixels in below. | 13192 // Write all pixels in below. |
| 13193 texture_manager()->SetLevelCleared(texture_ref, target, level, true); | 13193 texture_manager()->SetLevelCleared(texture_ref, target, level, true); |
| 13194 } | 13194 } |
| 13195 | 13195 |
| 13196 if (copyHeight > 0 && copyWidth > 0) { | 13196 if (copyHeight > 0 && copyWidth > 0) { |
| 13197 if (CopyTexImageResourceManager::CopyTexImageRequiresBlit( | 13197 if (CopyTexImageResourceManager::CopyTexImageRequiresBlit( |
| 13198 feature_info_.get(), internal_format)) { | 13198 feature_info_.get(), internal_format)) { |
| 13199 if (!InitializeCopyTexImageBlitter("glCopyTexSubImage2D")) { | 13199 if (!InitializeCopyTexImageBlitter("glCopyTexSubImage2D")) { |
| 13200 return; | 13200 return; |
| 13201 } | 13201 } |
| 13202 copy_tex_image_blit_->DoCopyTexSubImage2DToLUMAComatabilityTexture( | 13202 copy_tex_image_blit_->DoCopyTexSubImageToLUMAComatabilityTexture( |
| 13203 this, texture->service_id(), texture->target(), target, | 13203 this, texture->service_id(), texture->target(), target, |
| 13204 internal_format, type, level, xoffset, yoffset, x, y, width, height, | 13204 internal_format, type, level, xoffset, yoffset, 0, |
| 13205 x, y, width, height, | |
| 13205 framebuffer_state_.bound_read_framebuffer->service_id(), | 13206 framebuffer_state_.bound_read_framebuffer->service_id(), |
| 13206 framebuffer_state_.bound_read_framebuffer | 13207 framebuffer_state_.bound_read_framebuffer |
| 13207 ->GetReadBufferInternalFormat()); | 13208 ->GetReadBufferInternalFormat()); |
| 13208 } else { | 13209 } else { |
| 13209 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, copyWidth, | 13210 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, copyWidth, |
| 13210 copyHeight); | 13211 copyHeight); |
| 13211 } | 13212 } |
| 13212 } | 13213 } |
| 13213 | 13214 |
| 13214 // This may be a slow command. Exit command processing to allow for | 13215 // This may be a slow command. Exit command processing to allow for |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13282 // for TexSubImage3D. | 13283 // for TexSubImage3D. |
| 13283 if (!texture->IsLevelCleared(target, level)) { | 13284 if (!texture->IsLevelCleared(target, level)) { |
| 13284 if (!texture_manager()->ClearTextureLevel(this, texture_ref, target, | 13285 if (!texture_manager()->ClearTextureLevel(this, texture_ref, target, |
| 13285 level)) { | 13286 level)) { |
| 13286 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, func_name, "dimensions too big"); | 13287 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, func_name, "dimensions too big"); |
| 13287 return; | 13288 return; |
| 13288 } | 13289 } |
| 13289 DCHECK(texture->IsLevelCleared(target, level)); | 13290 DCHECK(texture->IsLevelCleared(target, level)); |
| 13290 } | 13291 } |
| 13291 | 13292 |
| 13292 // TODO(yunchao): Follow-up CLs are necessary. For instance: | |
| 13293 // 1. emulation of unsized formats in core profile | |
| 13294 | |
| 13295 if (copyHeight > 0 && copyWidth > 0) { | 13293 if (copyHeight > 0 && copyWidth > 0) { |
| 13296 glCopyTexSubImage3D(target, level, destX, destY, zoffset, | 13294 if (CopyTexImageResourceManager::CopyTexImageRequiresBlit( |
| 13297 copyX, copyY, copyWidth, copyHeight); | 13295 feature_info_.get(), internal_format)) { |
| 13296 if (!InitializeCopyTexImageBlitter(func_name)) { | |
| 13297 return; | |
| 13298 } | |
| 13299 copy_tex_image_blit_->DoCopyTexSubImageToLUMAComatabilityTexture( | |
| 13300 this, texture->service_id(), texture->target(), target, | |
| 13301 internal_format, type, level, xoffset, yoffset, zoffset, | |
| 13302 x, y, width, height, | |
|
piman
2016/08/17 16:47:27
Should this be destX/destY/copyX/copyY/copyWidth/c
yunchao
2016/08/22 14:57:20
Done.
| |
| 13303 framebuffer_state_.bound_read_framebuffer->service_id(), | |
| 13304 framebuffer_state_.bound_read_framebuffer | |
| 13305 ->GetReadBufferInternalFormat()); | |
| 13306 } else { | |
| 13307 glCopyTexSubImage3D(target, level, destX, destY, zoffset, | |
| 13308 copyX, copyY, copyWidth, copyHeight); | |
| 13309 } | |
| 13298 } | 13310 } |
| 13299 | 13311 |
| 13300 // This may be a slow command. Exit command processing to allow for | 13312 // This may be a slow command. Exit command processing to allow for |
| 13301 // context preemption and GPU watchdog checks. | 13313 // context preemption and GPU watchdog checks. |
| 13302 ExitCommandProcessingEarly(); | 13314 ExitCommandProcessingEarly(); |
| 13303 } | 13315 } |
| 13304 | 13316 |
| 13305 error::Error GLES2DecoderImpl::HandleTexSubImage2D(uint32_t immediate_data_size, | 13317 error::Error GLES2DecoderImpl::HandleTexSubImage2D(uint32_t immediate_data_size, |
| 13306 const void* cmd_data) { | 13318 const void* cmd_data) { |
| 13307 const gles2::cmds::TexSubImage2D& c = | 13319 const gles2::cmds::TexSubImage2D& c = |
| (...skipping 4454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 17762 } | 17774 } |
| 17763 | 17775 |
| 17764 // Include the auto-generated part of this file. We split this because it means | 17776 // Include the auto-generated part of this file. We split this because it means |
| 17765 // we can easily edit the non-auto generated parts right here in this file | 17777 // we can easily edit the non-auto generated parts right here in this file |
| 17766 // instead of having to edit some template or the code generator. | 17778 // instead of having to edit some template or the code generator. |
| 17767 #include "base/macros.h" | 17779 #include "base/macros.h" |
| 17768 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 17780 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 17769 | 17781 |
| 17770 } // namespace gles2 | 17782 } // namespace gles2 |
| 17771 } // namespace gpu | 17783 } // namespace gpu |
| OLD | NEW |