Commit bf7c3813 authored by Daniele Castagna's avatar Daniele Castagna Committed by Commit Bot

cc: Don't use BGRA_EXT with glCopyTexImage2d

When GLRenderer reads back from the framebuffer with glCopyTexImage2d,
it tries to be smart about what internal format to use for the new texture.

Unfortunately on CrOS it ends up using GL_BGRA_EXT, that seems to hit
a particularly slow path in gles2_cmd_decoder.

This CL changes it to RGB/RGBA, decreasing the CPU cost of CopyTexImage2d
of two orders of magnitude when applying fullscreen backdrop effects.

Bug: 900046

Change-Id: I19bd8a9d008109e336f0fd346df130c2d7878154
Reviewed-on: https://chromium-review.googlesource.com/c/1306653Reviewed-by: default avatarKristian H. Kristensen <hoegsberg@chromium.org>
Commit-Queue: Daniele Castagna <dcastagna@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604062}
parent 74331887
...@@ -796,8 +796,15 @@ uint32_t GLRenderer::GetBackdropTexture(const gfx::Rect& window_rect) { ...@@ -796,8 +796,15 @@ uint32_t GLRenderer::GetBackdropTexture(const gfx::Rect& window_rect) {
gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
gl_->CopyTexImage2D(GL_TEXTURE_2D, 0, GetFramebufferCopyTextureFormat(), unsigned internalformat = GetFramebufferCopyTextureFormat();
window_rect.x(), window_rect.y(), window_rect.width(), // CopyTexImage2D requires inernalformat channels to be a subset of
// the channels of the source texture internalformat.
DCHECK(internalformat == GL_RGB || internalformat == GL_RGBA ||
internalformat == GL_BGRA_EXT);
if (internalformat == GL_BGRA_EXT)
internalformat = GL_RGBA;
gl_->CopyTexImage2D(GL_TEXTURE_2D, 0, internalformat, window_rect.x(),
window_rect.y(), window_rect.width(),
window_rect.height(), 0); window_rect.height(), 0);
gl_->BindTexture(GL_TEXTURE_2D, 0); gl_->BindTexture(GL_TEXTURE_2D, 0);
return texture_id; return texture_id;
......
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