Chromium Code Reviews| Index: gpu/command_buffer/service/gles2_cmd_decoder.cc |
| diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| index 68b894846bb0ff89ffbdd837869f1f4f0492aaf6..34a3991a041384ca96d8bd87ff79d67daea5d493 100644 |
| --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| @@ -13264,8 +13264,22 @@ void GLES2DecoderImpl::DoCopyTexSubImage3D( |
| return; |
| } |
| - // For 3D textures, we always clear the entire texture. See the code in |
| - // TextureManager::ValidateAndDoTexSubImage for TexSubImage3D. |
| + ScopedResolvedFrameBufferBinder binder(this, false, true); |
| + gfx::Size size = GetBoundReadFrameBufferSize(); |
| + GLint copyX = 0; |
| + GLint copyY = 0; |
| + GLint copyWidth = 0; |
| + GLint copyHeight = 0; |
| + Clip(x, width, size.width(), ©X, ©Width); |
| + Clip(y, height, size.height(), ©Y, ©Height); |
| + |
| + GLint dx = copyX - x; |
| + GLint dy = copyY - y; |
| + GLint destX = xoffset + dx; |
| + GLint destY = yoffset + dy; |
| + // For 3D textures, we always clear the entire texture to 0 if it is not |
| + // cleared. See the code in TextureManager::ValidateAndDoTexSubImage |
| + // for TexSubImage3D. |
| if (!texture->IsLevelCleared(target, level)) { |
| 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.
|
| DCHECK(texture->IsLevelCleared(target, level)); |
| @@ -13273,10 +13287,11 @@ void GLES2DecoderImpl::DoCopyTexSubImage3D( |
| // TODO(yunchao): Follow-up CLs are necessary. For instance: |
| // 1. emulation of unsized formats in core profile |
| - // 2. out-of-bounds reading, etc. |
| - glCopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, |
| - height); |
| + if (copyHeight > 0 && copyWidth > 0) { |
| + glCopyTexSubImage3D(target, level, destX, destY, zoffset, |
| + copyX, copyY, copyWidth, copyHeight); |
| + } |
| // This may be a slow command. Exit command processing to allow for |
| // context preemption and GPU watchdog checks. |