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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc

Issue 744713002: gpu: fix CopyTextureCHROMIUM for immutable texture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 | no next file » | 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_copy_texture_chromium.h" 5 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "gpu/command_buffer/service/gl_utils.h" 10 #include "gpu/command_buffer/service/gl_utils.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 void DoCopyTexImage2D(const gpu::gles2::GLES2Decoder* decoder, 216 void DoCopyTexImage2D(const gpu::gles2::GLES2Decoder* decoder,
217 GLenum source_target, 217 GLenum source_target,
218 GLuint source_id, 218 GLuint source_id,
219 GLuint dest_id, 219 GLuint dest_id,
220 GLint dest_level, 220 GLint dest_level,
221 GLenum dest_internal_format, 221 GLenum dest_internal_format,
222 GLsizei width, 222 GLsizei width,
223 GLsizei height, 223 GLsizei height,
224 GLuint framebuffer) { 224 GLuint framebuffer) {
225 DCHECK(source_target == GL_TEXTURE_2D || 225 DCHECK(source_target == GL_TEXTURE_2D ||
226 source_target == GL_TEXTURE_RECTANGLE_ARB); 226 source_target == GL_TEXTURE_RECTANGLE_ARB);
dshwang 2014/11/20 14:59:40 already check GL_TEXTURE_RECTANGLE_ARB
227 if (BindFramebufferTexture2D( 227 if (BindFramebufferTexture2D(
228 source_target, source_id, 0 /* level */, framebuffer)) { 228 source_target, source_id, 0 /* level */, framebuffer)) {
229 glBindTexture(GL_TEXTURE_2D, dest_id); 229 glBindTexture(GL_TEXTURE_2D, dest_id);
230 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 230 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
231 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 231 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
232 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 232 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
233 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 233 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
234 glCopyTexImage2D(GL_TEXTURE_2D, 234 glCopyTexImage2D(GL_TEXTURE_2D,
235 dest_level, 235 dest_level,
236 dest_internal_format, 236 dest_internal_format,
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 bool premultiply_alpha_change = premultiply_alpha ^ unpremultiply_alpha; 327 bool premultiply_alpha_change = premultiply_alpha ^ unpremultiply_alpha;
328 // GL_INVALID_OPERATION is generated if the currently bound framebuffer's 328 // GL_INVALID_OPERATION is generated if the currently bound framebuffer's
329 // format does not contain a superset of the components required by the base 329 // format does not contain a superset of the components required by the base
330 // format of internalformat. 330 // format of internalformat.
331 // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glCopyTexImage2D.xml 331 // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glCopyTexImage2D.xml
332 bool source_format_contain_superset_of_dest_format = 332 bool source_format_contain_superset_of_dest_format =
333 source_internal_format == dest_internal_format || 333 source_internal_format == dest_internal_format ||
334 (source_internal_format == GL_RGBA && dest_internal_format == GL_RGB); 334 (source_internal_format == GL_RGBA && dest_internal_format == GL_RGB);
335 // GL_TEXTURE_RECTANGLE_ARB on FBO is supported by OpenGL, not GLES2, 335 // GL_TEXTURE_RECTANGLE_ARB on FBO is supported by OpenGL, not GLES2,
336 // so restrict this to GL_TEXTURE_2D. 336 // so restrict this to GL_TEXTURE_2D.
337 if (source_target == GL_TEXTURE_2D && !flip_y && !premultiply_alpha_change && 337 if ((source_target == GL_TEXTURE_2D ||
338 source_target == GL_TEXTURE_RECTANGLE_ARB) &&
339 !flip_y && !premultiply_alpha_change &&
338 source_format_contain_superset_of_dest_format) { 340 source_format_contain_superset_of_dest_format) {
339 DoCopyTexImage2D(decoder, 341 DoCopyTexImage2D(decoder,
340 source_target, 342 source_target,
341 source_id, 343 source_id,
342 dest_id, 344 dest_id,
343 dest_level, 345 dest_level,
344 dest_internal_format, 346 dest_internal_format,
345 width, 347 width,
346 height, 348 height,
347 framebuffer_); 349 framebuffer_);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 decoder->RestoreTextureState(dest_id); 475 decoder->RestoreTextureState(dest_id);
474 decoder->RestoreTextureUnitBindings(0); 476 decoder->RestoreTextureUnitBindings(0);
475 decoder->RestoreActiveTexture(); 477 decoder->RestoreActiveTexture();
476 decoder->RestoreProgramBindings(); 478 decoder->RestoreProgramBindings();
477 decoder->RestoreBufferBindings(); 479 decoder->RestoreBufferBindings();
478 decoder->RestoreFramebufferBindings(); 480 decoder->RestoreFramebufferBindings();
479 decoder->RestoreGlobalState(); 481 decoder->RestoreGlobalState();
480 } 482 }
481 483
482 } // namespace gpu 484 } // namespace gpu
OLDNEW
« 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