Commit 48514369 authored by reveman's avatar reveman Committed by Commit bot

gpu: Add GL_TEXTURE_RECTANGLE_ARB support to CopyTexSubImage2D optimization of CopyTexture.

The availability of this extension is already limited to desktop core
profile as the only reason we need to support it is IOSurfaces on
MacOSX.

This provides 2x performance improvement of copy operations when using
IOSurface backed GpuMemoryBuffers.

BUG=486922

Review URL: https://codereview.chromium.org/1149233005

Cr-Commit-Position: refs/heads/master@{#333159}
parent 9112b1cb
......@@ -367,12 +367,12 @@ void CopyTextureCHROMIUMResourceManager::DoCopyTexture(
// 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 == dest_internal_format ||
(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 &&
// 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;
if (valid_source_target && !flip_y && !premultiply_alpha_change &&
source_format_contain_superset_of_dest_format) {
DoCopyTexImage2D(decoder,
source_target,
......@@ -417,12 +417,12 @@ void CopyTextureCHROMIUMResourceManager::DoCopySubTexture(
// 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 == dest_internal_format ||
(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 &&
// 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;
if (valid_source_target && !flip_y && !premultiply_alpha_change &&
source_format_contain_superset_of_dest_format) {
DoCopyTexSubImage2D(decoder, source_target, source_id, dest_id, xoffset,
yoffset, x, y, width, height, framebuffer_);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment