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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 9127 matching lines...) Expand 10 before | Expand all | Expand 10 after
9138 9138
9139 ScopedResolvedFrameBufferBinder binder(this, false, true); 9139 ScopedResolvedFrameBufferBinder binder(this, false, true);
9140 gfx::Size size = GetBoundReadFrameBufferSize(); 9140 gfx::Size size = GetBoundReadFrameBufferSize();
9141 GLint copyX = 0; 9141 GLint copyX = 0;
9142 GLint copyY = 0; 9142 GLint copyY = 0;
9143 GLint copyWidth = 0; 9143 GLint copyWidth = 0;
9144 GLint copyHeight = 0; 9144 GLint copyHeight = 0;
9145 Clip(x, width, size.width(), &copyX, &copyWidth); 9145 Clip(x, width, size.width(), &copyX, &copyWidth);
9146 Clip(y, height, size.height(), &copyY, &copyHeight); 9146 Clip(y, height, size.height(), &copyY, &copyHeight);
9147 9147
9148 if (!texture_manager()->ClearTextureLevel(this, texture_ref, target, level)) { 9148 if (xoffset != 0 || yoffset != 0 || width != size.width() ||
9149 LOCAL_SET_GL_ERROR( 9149 height != size.height()) {
9150 GL_OUT_OF_MEMORY, "glCopyTexSubImage2D", "dimensions too big"); 9150 if (!texture_manager()->ClearTextureLevel(this, texture_ref, target,
9151 return; 9151 level)) {
9152 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, "glCopyTexSubImage2D",
9153 "dimensions too big");
9154 return;
9155 }
9156 } else {
9157 // Write all pixels in below.
9158 texture_manager()->SetLevelCleared(texture_ref, target, level, true);
9152 } 9159 }
9153 9160
9154 if (copyX != x || 9161 if (copyX != x ||
9155 copyY != y || 9162 copyY != y ||
9156 copyWidth != width || 9163 copyWidth != width ||
9157 copyHeight != height) { 9164 copyHeight != height) {
9158 // some part was clipped so clear the sub rect. 9165 // some part was clipped so clear the sub rect.
9159 uint32 pixels_size = 0; 9166 uint32 pixels_size = 0;
9160 if (!GLES2Util::ComputeImageDataSizes( 9167 if (!GLES2Util::ComputeImageDataSizes(
9161 width, height, 1, format, type, state_.unpack_alignment, &pixels_size, 9168 width, height, 1, format, type, state_.unpack_alignment, &pixels_size,
(...skipping 2481 matching lines...) Expand 10 before | Expand all | Expand 10 after
11643 } 11650 }
11644 } 11651 }
11645 11652
11646 // Include the auto-generated part of this file. We split this because it means 11653 // Include the auto-generated part of this file. We split this because it means
11647 // we can easily edit the non-auto generated parts right here in this file 11654 // we can easily edit the non-auto generated parts right here in this file
11648 // instead of having to edit some template or the code generator. 11655 // instead of having to edit some template or the code generator.
11649 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 11656 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
11650 11657
11651 } // namespace gles2 11658 } // namespace gles2
11652 } // namespace gpu 11659 } // namespace gpu
OLDNEW
« 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