summaryrefslogtreecommitdiffstats
path: root/cc/direct_renderer.cc
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-14 07:13:48 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-14 07:13:48 +0000
commit66321643bdea820f7682d79dee3663610f26b95d (patch)
tree9f0302ed0ba4f944b52b780053cda804168e7791 /cc/direct_renderer.cc
parentcf64404b033f544103752869df8ec97c3be10a5d (diff)
downloadchromium_src-66321643bdea820f7682d79dee3663610f26b95d.zip
chromium_src-66321643bdea820f7682d79dee3663610f26b95d.tar.gz
chromium_src-66321643bdea820f7682d79dee3663610f26b95d.tar.bz2
Allow using a larger-than-necessary texture as cached render pass backing
When moving a composited layer around the screen that requires a render pass, it's not all that unusual for the required size to be slightly different from frame to frame. This lets us use an oversized texture as the framebuffer attachment. BUG=161868 Review URL: https://chromiumcodereview.appspot.com/11420079 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173112 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/direct_renderer.cc')
-rw-r--r--cc/direct_renderer.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/cc/direct_renderer.cc b/cc/direct_renderer.cc
index 0b2d74b..3460160 100644
--- a/cc/direct_renderer.cc
+++ b/cc/direct_renderer.cc
@@ -113,6 +113,11 @@ DirectRenderer::~DirectRenderer()
{
}
+void DirectRenderer::setEnlargePassTextureAmountForTesting(gfx::Vector2d amount)
+{
+ m_enlargePassTextureAmount = amount;
+}
+
void DirectRenderer::decideRenderPassAllocationsForFrame(const RenderPassList& renderPassesInDrawOrder)
{
base::hash_map<RenderPass::Id, const RenderPass*> renderPassesInFrame;
@@ -134,7 +139,9 @@ void DirectRenderer::decideRenderPassAllocationsForFrame(const RenderPassList& r
CachedResource* texture = passIterator->second;
DCHECK(texture);
- if (texture->id() && (texture->size() != requiredSize || texture->format() != requiredFormat))
+ bool sizeAppropriate = texture->size().width() >= requiredSize.width() &&
+ texture->size().height() >= requiredSize.height();
+ if (texture->id() && (!sizeAppropriate || texture->format() != requiredFormat))
texture->Free();
}
@@ -267,7 +274,10 @@ bool DirectRenderer::useRenderPass(DrawingFrame& frame, const RenderPass* render
CachedResource* texture = m_renderPassTextures.get(renderPass->id);
DCHECK(texture);
- if (!texture->id() && !texture->Allocate(Renderer::ImplPool, renderPassTextureSize(renderPass), renderPassTextureFormat(renderPass), ResourceProvider::TextureUsageFramebuffer))
+
+ gfx::Size size = renderPassTextureSize(renderPass);
+ size.Enlarge(m_enlargePassTextureAmount.x(), m_enlargePassTextureAmount.y());
+ if (!texture->id() && !texture->Allocate(Renderer::ImplPool, size, renderPassTextureFormat(renderPass), ResourceProvider::TextureUsageFramebuffer))
return false;
return bindFramebufferToTexture(frame, texture, renderPass->output_rect);