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

Unified Diff: cc/direct_renderer.cc

Issue 11420079: Allow using a larger-than-necessary texture as cached render pass backing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win build fix - filepath literals Created 8 years 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
Index: cc/direct_renderer.cc
diff --git a/cc/direct_renderer.cc b/cc/direct_renderer.cc
index 0b2d74b82076e5108b3d1388d18e71a06b43677d..3460160d3879b0d60a182727941ebff9d9e0d50e 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);
« no previous file with comments | « cc/direct_renderer.h ('k') | cc/gl_renderer.h » ('j') | cc/gl_renderer_pixeltest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698