summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhubbe@chromium.org <hubbe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-29 22:18:20 +0000
committerhubbe@chromium.org <hubbe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-29 22:18:20 +0000
commitd16194ce59bce31f9b53f98fb24ee19d4e59ff7e (patch)
treec10f032ee28c10e1625a17fb12bd6ee036e7aaf1
parentaa72609f2bcec9f314939a4dd987db9b8926539f (diff)
downloadchromium_src-d16194ce59bce31f9b53f98fb24ee19d4e59ff7e.zip
chromium_src-d16194ce59bce31f9b53f98fb24ee19d4e59ff7e.tar.gz
chromium_src-d16194ce59bce31f9b53f98fb24ee19d4e59ff7e.tar.bz2
Minor optimization for tab capture on Aura.
When the scaling is FAST (the default) and MRT is enabled, just skip the scaling step as the first step in the MRT pipeline is fully capable of doing a bilinear scale already. BUG=284550 Review URL: https://codereview.chromium.org/48903007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231653 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/common/gpu/client/gl_helper.cc22
1 files changed, 18 insertions, 4 deletions
diff --git a/content/common/gpu/client/gl_helper.cc b/content/common/gpu/client/gl_helper.cc
index dd39347..c8d57ac 100644
--- a/content/common/gpu/client/gl_helper.cc
+++ b/content/common/gpu/client/gl_helper.cc
@@ -284,6 +284,7 @@ class GLHelper::CopyTextureToImpl :
CopyTextureToImpl* copy_impl_;
gfx::Size dst_size_;
gfx::Rect dst_subrect_;
+ GLHelper::ScalerQuality quality_;
ScalerHolder scaler_;
scoped_ptr<content::GLHelperScaling::ShaderInterface> pass1_shader_;
scoped_ptr<content::GLHelperScaling::ShaderInterface> pass2_shader_;
@@ -891,6 +892,7 @@ GLHelper::CopyTextureToImpl::ReadbackYUV_MRT::ReadbackYUV_MRT(
copy_impl_(copy_impl),
dst_size_(dst_size),
dst_subrect_(dst_subrect),
+ quality_(quality),
scaler_(context, scaler_impl->CreateScaler(
quality,
src_size,
@@ -952,15 +954,27 @@ void GLHelper::CopyTextureToImpl::ReadbackYUV_MRT::ReadbackYUV(
WebGLId mailbox_texture =
copy_impl_->ConsumeMailboxToTexture(mailbox, sync_point);
- // Scale texture to right size.
- scaler_.Scale(mailbox_texture);
- context_->deleteTexture(mailbox_texture);
+ WebGLId texture;
+ if (quality_ == GLHelper::SCALER_QUALITY_FAST) {
+ // Optimization: SCALER_QUALITY_FAST is just a single bilinear
+ // pass, which pass1_shader_ can do just as well, so let's skip
+ // the actual scaling in that case.
+ texture = mailbox_texture;
+ } else {
+ // Scale texture to right size.
+ scaler_.Scale(mailbox_texture);
+ texture = scaler_.texture();
+ }
+
std::vector<WebKit::WebGLId> outputs(2);
// Convert the scaled texture in to Y, U and V planes.
outputs[0] = y_.texture();
outputs[1] = uv_;
- pass1_shader_->Execute(scaler_.texture(), outputs);
+ pass1_shader_->Execute(texture, outputs);
+
+ context_->deleteTexture(mailbox_texture);
+
outputs[0] = u_.texture();
outputs[1] = v_.texture();
pass2_shader_->Execute(uv_, outputs);