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 13246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13257 return; | 13257 return; |
| 13258 } | 13258 } |
| 13259 | 13259 |
| 13260 if (FormsTextureCopyingFeedbackLoop(texture_ref, level, zoffset)) { | 13260 if (FormsTextureCopyingFeedbackLoop(texture_ref, level, zoffset)) { |
| 13261 LOCAL_SET_GL_ERROR( | 13261 LOCAL_SET_GL_ERROR( |
| 13262 GL_INVALID_OPERATION, | 13262 GL_INVALID_OPERATION, |
| 13263 func_name, "source and destination textures are the same"); | 13263 func_name, "source and destination textures are the same"); |
| 13264 return; | 13264 return; |
| 13265 } | 13265 } |
| 13266 | 13266 |
| 13267 // For 3D textures, we always clear the entire texture. See the code in | 13267 ScopedResolvedFrameBufferBinder binder(this, false, true); |
| 13268 // TextureManager::ValidateAndDoTexSubImage for TexSubImage3D. | 13268 gfx::Size size = GetBoundReadFrameBufferSize(); |
| 13269 GLint copyX = 0; | |
| 13270 GLint copyY = 0; | |
| 13271 GLint copyWidth = 0; | |
| 13272 GLint copyHeight = 0; | |
| 13273 Clip(x, width, size.width(), ©X, ©Width); | |
| 13274 Clip(y, height, size.height(), ©Y, ©Height); | |
| 13275 | |
| 13276 GLint dx = copyX - x; | |
| 13277 GLint dy = copyY - y; | |
| 13278 GLint destX = xoffset + dx; | |
| 13279 GLint destY = yoffset + dy; | |
| 13280 // For 3D textures, we always clear the entire texture to 0 if it is not | |
| 13281 // cleared. See the code in TextureManager::ValidateAndDoTexSubImage | |
| 13282 // for TexSubImage3D. | |
| 13269 if (!texture->IsLevelCleared(target, level)) { | 13283 if (!texture->IsLevelCleared(target, level)) { |
| 13270 texture_manager()->ClearTextureLevel(this, texture_ref, target, level); | 13284 texture_manager()->ClearTextureLevel(this, texture_ref, target, level); |
|
Zhenyao Mo
2016/08/15 17:47:32
This might return false. Can you follow the lead
yunchao
2016/08/16 03:15:04
Done.
| |
| 13271 DCHECK(texture->IsLevelCleared(target, level)); | 13285 DCHECK(texture->IsLevelCleared(target, level)); |
| 13272 } | 13286 } |
| 13273 | 13287 |
| 13274 // TODO(yunchao): Follow-up CLs are necessary. For instance: | 13288 // TODO(yunchao): Follow-up CLs are necessary. For instance: |
| 13275 // 1. emulation of unsized formats in core profile | 13289 // 1. emulation of unsized formats in core profile |
| 13276 // 2. out-of-bounds reading, etc. | |
| 13277 | 13290 |
| 13278 glCopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, | 13291 if (copyHeight > 0 && copyWidth > 0) { |
| 13279 height); | 13292 glCopyTexSubImage3D(target, level, destX, destY, zoffset, |
| 13293 copyX, copyY, copyWidth, copyHeight); | |
| 13294 } | |
| 13280 | 13295 |
| 13281 // This may be a slow command. Exit command processing to allow for | 13296 // This may be a slow command. Exit command processing to allow for |
| 13282 // context preemption and GPU watchdog checks. | 13297 // context preemption and GPU watchdog checks. |
| 13283 ExitCommandProcessingEarly(); | 13298 ExitCommandProcessingEarly(); |
| 13284 } | 13299 } |
| 13285 | 13300 |
| 13286 error::Error GLES2DecoderImpl::HandleTexSubImage2D(uint32_t immediate_data_size, | 13301 error::Error GLES2DecoderImpl::HandleTexSubImage2D(uint32_t immediate_data_size, |
| 13287 const void* cmd_data) { | 13302 const void* cmd_data) { |
| 13288 const gles2::cmds::TexSubImage2D& c = | 13303 const gles2::cmds::TexSubImage2D& c = |
| 13289 *static_cast<const gles2::cmds::TexSubImage2D*>(cmd_data); | 13304 *static_cast<const gles2::cmds::TexSubImage2D*>(cmd_data); |
| (...skipping 4453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 17743 } | 17758 } |
| 17744 | 17759 |
| 17745 // Include the auto-generated part of this file. We split this because it means | 17760 // Include the auto-generated part of this file. We split this because it means |
| 17746 // we can easily edit the non-auto generated parts right here in this file | 17761 // we can easily edit the non-auto generated parts right here in this file |
| 17747 // instead of having to edit some template or the code generator. | 17762 // instead of having to edit some template or the code generator. |
| 17748 #include "base/macros.h" | 17763 #include "base/macros.h" |
| 17749 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 17764 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 17750 | 17765 |
| 17751 } // namespace gles2 | 17766 } // namespace gles2 |
| 17752 } // namespace gpu | 17767 } // namespace gpu |
| OLD | NEW |