Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 2234923002: [Command buffer] CopyTexSubImage3D: Copying pixels outside of framebuffer should be untouched (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed zmo@'s feedback Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..35f446c720f89f2752691a06f5e8eb770fafe581 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -13264,19 +13264,38 @@ 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(), &copyX, &copyWidth);
+ Clip(y, height, size.height(), &copyY, &copyHeight);
+
+ 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);
+ if (!texture_manager()->ClearTextureLevel(this, texture_ref, target,
+ level)) {
+ LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, func_name, "dimensions too big");
+ return;
+ }
DCHECK(texture->IsLevelCleared(target, level));
}
// 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.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698