Skip to content

Commit

Permalink
[chromium] Texture layer should not generate zero textureId quads
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=94550

Patch by Alexandre Elias <aelias@google.com> on 2012-08-20
Reviewed by Adrienne Walker.

After a context loss, CCTextureLayerImpl would clear its textureId
but continued to produce external resources and quads with the zero
textureid.  Add early returns so that CCTextureLayerImpl becomes
inert after a context loss.

Added assertion in read lock so that dontUseOldResourcesAfterLostContext
test catches the problem.

* platform/graphics/chromium/cc/CCResourceProvider.h:
(WebCore::CCScopedLockResourceForRead::CCScopedLockResourceForRead):
* platform/graphics/chromium/cc/CCTextureLayerImpl.cpp:
(WebCore::CCTextureLayerImpl::willDraw):
(WebCore::CCTextureLayerImpl::appendQuads):
(WebCore::CCTextureLayerImpl::didDraw):
(WebCore::CCTextureLayerImpl::didLoseContext):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@126122 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
webkit-commit-queue committed Aug 21, 2012
1 parent 04e8f83 commit 9824c71
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
23 changes: 23 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,26 @@
2012-08-20 Alexandre Elias <aelias@google.com>

[chromium] Texture layer should not generate zero textureId quads
https://bugs.webkit.org/show_bug.cgi?id=94550

Reviewed by Adrienne Walker.

After a context loss, CCTextureLayerImpl would clear its textureId
but continued to produce external resources and quads with the zero
textureid. Add early returns so that CCTextureLayerImpl becomes
inert after a context loss.

Added assertion in read lock so that dontUseOldResourcesAfterLostContext
test catches the problem.

* platform/graphics/chromium/cc/CCResourceProvider.h:
(WebCore::CCScopedLockResourceForRead::CCScopedLockResourceForRead):
* platform/graphics/chromium/cc/CCTextureLayerImpl.cpp:
(WebCore::CCTextureLayerImpl::willDraw):
(WebCore::CCTextureLayerImpl::appendQuads):
(WebCore::CCTextureLayerImpl::didDraw):
(WebCore::CCTextureLayerImpl::didLoseContext):

2012-08-20 Kent Tamura <tkent@chromium.org>

[Chromium] Make the popup positioning code testable
Expand Down
Expand Up @@ -224,7 +224,10 @@ class CCScopedLockResourceForRead {
CCScopedLockResourceForRead(CCResourceProvider* resourceProvider, CCResourceProvider::ResourceId resourceId)
: m_resourceProvider(resourceProvider)
, m_resourceId(resourceId)
, m_textureId(resourceProvider->lockForRead(resourceId)) { }
, m_textureId(resourceProvider->lockForRead(resourceId))
{
ASSERT(m_textureId);
}

~CCScopedLockResourceForRead()
{
Expand Down
Expand Up @@ -52,20 +52,24 @@ CCTextureLayerImpl::~CCTextureLayerImpl()

void CCTextureLayerImpl::willDraw(CCResourceProvider* resourceProvider)
{
if (!m_textureId)
return;
ASSERT(!m_externalTextureResource);
m_externalTextureResource = resourceProvider->createResourceFromExternalTexture(m_textureId);
}

void CCTextureLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&)
{
ASSERT(m_externalTextureResource);
if (!m_externalTextureResource)
return;
IntRect quadRect(IntPoint(), contentBounds());
quadList.append(CCTextureDrawQuad::create(sharedQuadState, quadRect, m_externalTextureResource, m_premultipliedAlpha, m_uvRect, m_flipped));
}

void CCTextureLayerImpl::didDraw(CCResourceProvider* resourceProvider)
{
ASSERT(m_externalTextureResource);
if (!m_externalTextureResource)
return;
// FIXME: the following assert will not be true when sending resources to a
// parent compositor. A synchronization scheme (double-buffering or
// pipelining of updates) for the client will need to exist to solve this.
Expand All @@ -84,6 +88,7 @@ void CCTextureLayerImpl::dumpLayerProperties(TextStream& ts, int indent) const
void CCTextureLayerImpl::didLoseContext()
{
m_textureId = 0;
m_externalTextureResource = 0;
}

}
Expand Down

0 comments on commit 9824c71

Please sign in to comment.