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

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

Issue 1149233005: Re-land: gpu: Add GL_TEXTURE_RECTANGLE_ARB support to CopyTexSubImage2D optimization of CopyTexture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: v2 Created 5 years, 6 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_copy_texture_chromium.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc b/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc
index 00f510db2832f23462cd1217cb7763a4477f778c..33ecbd662e9ceb846107ae77d1df7434e8a08032 100644
--- a/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc
+++ b/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include "base/basictypes.h"
+#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/command_buffer/service/gl_utils.h"
#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
@@ -362,18 +363,25 @@ void CopyTextureCHROMIUMResourceManager::DoCopyTexture(
bool premultiply_alpha,
bool unpremultiply_alpha) {
bool premultiply_alpha_change = premultiply_alpha ^ unpremultiply_alpha;
+ uint32_t source_channels = gles2::GLES2Util::GetChannelsForFormat(
+ source_internal_format);
+ uint32_t dest_channels = gles2::GLES2Util::GetChannelsForFormat(
+ dest_internal_format);
// GL_INVALID_OPERATION is generated if the currently bound framebuffer's
// format does not contain a superset of the components required by the base
// format of internalformat.
// https://www.khronos.org/opengles/sdk/docs/man/xhtml/glCopyTexImage2D.xml
bool source_format_contain_superset_of_dest_format =
- (source_internal_format == dest_internal_format &&
- source_internal_format != GL_BGRA_EXT) ||
- (source_internal_format == GL_RGBA && dest_internal_format == GL_RGB);
- // GL_TEXTURE_RECTANGLE_ARB on FBO is supported by OpenGL, not GLES2,
- // so restrict this to GL_TEXTURE_2D.
- if (source_target == GL_TEXTURE_2D && !flip_y && !premultiply_alpha_change &&
- source_format_contain_superset_of_dest_format) {
+ (source_channels & dest_channels) == dest_channels;
+ // Note: GL_TEXTURE_RECTANGLE_ARB is only available if supported on FBOs.
+ bool valid_source_target = source_target == GL_TEXTURE_2D ||
+ source_target == GL_TEXTURE_RECTANGLE_ARB;
+ bool valid_dest_internal_format = dest_internal_format == GL_ALPHA ||
+ dest_internal_format == GL_RGB ||
+ dest_internal_format == GL_RGBA;
+ if (valid_source_target && !flip_y && !premultiply_alpha_change &&
+ source_format_contain_superset_of_dest_format &&
+ valid_dest_internal_format) {
DoCopyTexImage2D(decoder,
source_target,
source_id,
@@ -412,18 +420,25 @@ void CopyTextureCHROMIUMResourceManager::DoCopySubTexture(
bool premultiply_alpha,
bool unpremultiply_alpha) {
bool premultiply_alpha_change = premultiply_alpha ^ unpremultiply_alpha;
+ uint32_t source_channels = gles2::GLES2Util::GetChannelsForFormat(
+ source_internal_format);
+ uint32_t dest_channels = gles2::GLES2Util::GetChannelsForFormat(
+ dest_internal_format);
// GL_INVALID_OPERATION is generated if the currently bound framebuffer's
// format does not contain a superset of the components required by the base
// format of internalformat.
// https://www.khronos.org/opengles/sdk/docs/man/xhtml/glCopyTexImage2D.xml
bool source_format_contain_superset_of_dest_format =
- (source_internal_format == dest_internal_format &&
- source_internal_format != GL_BGRA_EXT) ||
- (source_internal_format == GL_RGBA && dest_internal_format == GL_RGB);
- // GL_TEXTURE_RECTANGLE_ARB on FBO is supported by OpenGL, not GLES2,
- // so restrict this to GL_TEXTURE_2D.
- if (source_target == GL_TEXTURE_2D && !flip_y && !premultiply_alpha_change &&
- source_format_contain_superset_of_dest_format) {
+ (source_channels & dest_channels) == dest_channels;
+ // Note: GL_TEXTURE_RECTANGLE_ARB is only available if supported on FBOs.
+ bool valid_source_target = source_target == GL_TEXTURE_2D ||
+ source_target == GL_TEXTURE_RECTANGLE_ARB;
+ bool valid_dest_internal_format = dest_internal_format == GL_ALPHA ||
+ dest_internal_format == GL_RGB ||
+ dest_internal_format == GL_RGBA;
+ if (valid_source_target && !flip_y && !premultiply_alpha_change &&
+ source_format_contain_superset_of_dest_format &&
+ valid_dest_internal_format) {
DoCopyTexSubImage2D(decoder, source_target, source_id, dest_id, xoffset,
yoffset, x, y, width, height, framebuffer_);
return;
« 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