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

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

Issue 824173003: gpu: Don't clear texture level in DoCopyTexSubImage2D() if not needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add unittests Created 5 years, 11 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 | gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc » ('j') | 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 0d778f3570ed2ab036adb03d327847c825248b4c..f56d47bad381a31ed09cf508a1ba09d9314b97b6 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -9145,10 +9145,17 @@ void GLES2DecoderImpl::DoCopyTexSubImage2D(
Clip(x, width, size.width(), &copyX, &copyWidth);
Clip(y, height, size.height(), &copyY, &copyHeight);
- if (!texture_manager()->ClearTextureLevel(this, texture_ref, target, level)) {
- LOCAL_SET_GL_ERROR(
- GL_OUT_OF_MEMORY, "glCopyTexSubImage2D", "dimensions too big");
- return;
+ if (xoffset != 0 || yoffset != 0 || width != size.width() ||
+ height != size.height()) {
+ if (!texture_manager()->ClearTextureLevel(this, texture_ref, target,
+ level)) {
+ LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, "glCopyTexSubImage2D",
+ "dimensions too big");
+ return;
+ }
+ } else {
+ // Write all pixels in below.
+ texture_manager()->SetLevelCleared(texture_ref, target, level, true);
}
if (copyX != x ||
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698