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

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

Issue 2460973002: gpu, cmaa: reuse CopyTextureCHROMIUMResourceManager (Closed)
Patch Set: revert unrelated change Created 4 years, 1 month 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
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 GLint y, 466 GLint y,
467 GLsizei width, 467 GLsizei width,
468 GLsizei height, 468 GLsizei height,
469 GLsizei dest_width, 469 GLsizei dest_width,
470 GLsizei dest_height, 470 GLsizei dest_height,
471 GLsizei source_width, 471 GLsizei source_width,
472 GLsizei source_height, 472 GLsizei source_height,
473 bool flip_y, 473 bool flip_y,
474 bool premultiply_alpha, 474 bool premultiply_alpha,
475 bool unpremultiply_alpha) { 475 bool unpremultiply_alpha) {
476 bool use_gl_copy_tex_sub_image_2d = true;
477 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)
478 // glDrawArrays is faster than glCopyTexSubImage2D on IA Mesa driver,
479 // although opposite in Android.
480 // TODO(dshwang): After Mesa fixes this issue, remove this hack.
481 // https://bugs.freedesktop.org/show_bug.cgi?id=98478 crbug.com/535198
482 use_gl_copy_tex_sub_image_2d = false;
483 #endif
476 bool premultiply_alpha_change = premultiply_alpha ^ unpremultiply_alpha; 484 bool premultiply_alpha_change = premultiply_alpha ^ unpremultiply_alpha;
477 // GL_INVALID_OPERATION is generated if the currently bound framebuffer's 485 // GL_INVALID_OPERATION is generated if the currently bound framebuffer's
478 // format does not contain a superset of the components required by the base 486 // format does not contain a superset of the components required by the base
479 // format of internalformat. 487 // format of internalformat.
480 // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glCopyTexImage2D.xml 488 // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glCopyTexImage2D.xml
481 bool source_format_contain_superset_of_dest_format = 489 bool source_format_contain_superset_of_dest_format =
482 (source_internal_format == dest_internal_format && 490 (source_internal_format == dest_internal_format &&
483 source_internal_format != GL_BGRA_EXT) || 491 source_internal_format != GL_BGRA_EXT) ||
484 (source_internal_format == GL_RGBA && dest_internal_format == GL_RGB); 492 (source_internal_format == GL_RGBA && dest_internal_format == GL_RGB);
485 // GL_TEXTURE_RECTANGLE_ARB on FBO is supported by OpenGL, not GLES2, 493 // GL_TEXTURE_RECTANGLE_ARB on FBO is supported by OpenGL, not GLES2,
486 // so restrict this to GL_TEXTURE_2D. 494 // so restrict this to GL_TEXTURE_2D.
487 if (source_target == GL_TEXTURE_2D && dest_target == GL_TEXTURE_2D && 495 if (use_gl_copy_tex_sub_image_2d && source_target == GL_TEXTURE_2D &&
488 !flip_y && !premultiply_alpha_change && 496 dest_target == GL_TEXTURE_2D && !flip_y && !premultiply_alpha_change &&
489 source_format_contain_superset_of_dest_format) { 497 source_format_contain_superset_of_dest_format) {
490 DoCopyTexSubImage2D(decoder, source_target, source_id, dest_target, dest_id, 498 DoCopyTexSubImage2D(decoder, source_target, source_id, dest_target, dest_id,
491 xoffset, yoffset, x, y, width, height, framebuffer_); 499 xoffset, yoffset, x, y, width, height, framebuffer_);
492 return; 500 return;
493 } 501 }
494 502
495 DoCopySubTextureWithTransform( 503 DoCopySubTextureWithTransform(
496 decoder, source_target, source_id, source_internal_format, dest_target, 504 decoder, source_target, source_id, source_internal_format, dest_target,
497 dest_id, dest_internal_format, xoffset, yoffset, x, y, width, height, 505 dest_id, dest_internal_format, xoffset, yoffset, x, y, width, height,
498 dest_width, dest_height, source_width, source_height, flip_y, 506 dest_width, dest_height, source_width, source_height, flip_y,
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 decoder->RestoreTextureUnitBindings(0); 771 decoder->RestoreTextureUnitBindings(0);
764 decoder->RestoreActiveTexture(); 772 decoder->RestoreActiveTexture();
765 decoder->RestoreProgramBindings(); 773 decoder->RestoreProgramBindings();
766 decoder->RestoreBufferBindings(); 774 decoder->RestoreBufferBindings();
767 decoder->RestoreFramebufferBindings(); 775 decoder->RestoreFramebufferBindings();
768 decoder->RestoreGlobalState(); 776 decoder->RestoreGlobalState();
769 } 777 }
770 778
771 } // namespace gles2 779 } // namespace gles2
772 } // namespace gpu 780 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698