Index: cc/layer_tree_host_impl.cc |
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc |
index d1e90409007a922b5268a96b5b7f4a61af1e3151..3e2b083d9b15f33e52205d50f4445fcf49121866 100644 |
--- a/cc/layer_tree_host_impl.cc |
+++ b/cc/layer_tree_host_impl.cc |
@@ -841,11 +841,33 @@ const RendererCapabilities& LayerTreeHostImpl::rendererCapabilities() const |
return m_renderer->capabilities(); |
} |
+namespace { |
+// This implements a simple fence based on client side swaps. |
+// This is to isolate the ResourceProvider from 'frames' which |
+// it shouldn't need to care about, while still allowing us to |
+// enforce correct texture recycling behavior strictly throughout |
+// the compositor. The reason textures are recycled is so that |
+// we can avoid writing to them while they are in use on the GPU. |
+class SimpleSwapFence : public ResourceProvider::Fence { |
+public: |
+ SimpleSwapFence() : m_passed(false) {} |
+ virtual bool hasPassed() OVERRIDE { return m_passed; } |
+ bool setToPassed() { m_passed = true; } |
nduca
2013/02/05 22:39:05
m_passed -> m_hasPassed
setHasPassed()
epenner
2013/02/05 23:27:36
Done.
|
+private: |
+ bool m_passed; |
+}; |
+} |
+ |
bool LayerTreeHostImpl::swapBuffers() |
nduca
2013/02/05 22:39:05
what if output_surface.h had a scoped<RefPtr> Reso
piman
2013/02/05 22:46:47
Sadly I don't think it knows about it yet, though
epenner
2013/02/05 23:27:36
Done.
|
{ |
DCHECK(m_renderer); |
bool result = m_renderer->swapBuffers(); |
+ scoped_refptr<ResourceProvider::Fence> lastSwapFence = m_resourceProvider->getReadLockFence(); |
+ if (lastSwapFence) |
+ static_cast<SimpleSwapFence*>(lastSwapFence.get())->setToPassed(); |
+ m_resourceProvider->setReadLockFence(new SimpleSwapFence()); |
+ |
piman
2013/02/05 22:19:07
Can we move that logic to the renderer? It shouldn
epenner
2013/02/05 23:27:36
Done.
|
if (m_settings.implSidePainting && |
!activeTree()->AreVisibleResourcesReady()) { |
m_client->didSwapUseIncompleteTileOnImplThread(); |