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

Unified Diff: Source/platform/graphics/gpu/DrawingBufferTest.cpp

Issue 253663002: WebGL: Wait for the sync point that the compositor inserted before deleting a mailbox. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: build fix due to -Werror=sign-compare Created 6 years, 8 months 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
« no previous file with comments | « Source/platform/graphics/gpu/DrawingBuffer.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/gpu/DrawingBufferTest.cpp
diff --git a/Source/platform/graphics/gpu/DrawingBufferTest.cpp b/Source/platform/graphics/gpu/DrawingBufferTest.cpp
index 25fb4ee4d24a175d72bc93066e14023737f2d996..e99e7630bc8521d0a07f91d0575229b3e37feff6 100644
--- a/Source/platform/graphics/gpu/DrawingBufferTest.cpp
+++ b/Source/platform/graphics/gpu/DrawingBufferTest.cpp
@@ -61,7 +61,8 @@ public:
WebGraphicsContext3DForTests()
: MockWebGraphicsContext3D()
, m_boundTexture(0)
- , m_currentMailboxByte(0) { }
+ , m_currentMailboxByte(0)
+ , m_mostRecentlyWaitedSyncPoint(0) { }
virtual void bindTexture(WGC3Denum target, WebGLId texture)
{
@@ -95,11 +96,28 @@ public:
return m_mostRecentlyProducedSize;
}
+ virtual unsigned insertSyncPoint()
+ {
+ static unsigned syncPointGenerator = 0;
+ return ++syncPointGenerator;
+ }
+
+ virtual void waitSyncPoint(unsigned syncPoint)
+ {
+ m_mostRecentlyWaitedSyncPoint = syncPoint;
+ }
+
+ unsigned mostRecentlyWaitedSyncPoint()
+ {
+ return m_mostRecentlyWaitedSyncPoint;
+ }
+
private:
WebGLId m_boundTexture;
HashMap<WebGLId, IntSize> m_textureSizes;
WGC3Dbyte m_currentMailboxByte;
IntSize m_mostRecentlyProducedSize;
+ unsigned m_mostRecentlyWaitedSyncPoint;
};
static const int initialWidth = 100;
@@ -250,7 +268,6 @@ TEST_F(DrawingBufferTest, verifyDestructionCompleteAfterAllMailboxesReleased)
EXPECT_EQ(live, false);
}
-
class TextureMailboxWrapper {
public:
explicit TextureMailboxWrapper(const blink::WebExternalTextureMailbox& mailbox)
@@ -272,8 +289,6 @@ TEST_F(DrawingBufferTest, verifyRecyclingMailboxesByFIFO)
blink::WebExternalTextureMailbox mailbox2;
blink::WebExternalTextureMailbox mailbox3;
- IntSize initialSize(initialWidth, initialHeight);
-
// Produce mailboxes.
m_drawingBuffer->markContentsChanged();
EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox1, 0));
@@ -312,4 +327,34 @@ TEST_F(DrawingBufferTest, verifyRecyclingMailboxesByFIFO)
m_drawingBuffer->beginDestruction();
}
+TEST_F(DrawingBufferTest, verifyInsertAndWaitSyncPointCorrectly)
+{
+ blink::WebExternalTextureMailbox mailbox;
+
+ // Produce mailboxes.
+ m_drawingBuffer->markContentsChanged();
+ EXPECT_EQ(0u, webContext()->mostRecentlyWaitedSyncPoint());
+ EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
+ // prepareMailbox() does not wait for any sync point.
+ EXPECT_EQ(0u, webContext()->mostRecentlyWaitedSyncPoint());
+
+ unsigned waitSyncPoint = webContext()->insertSyncPoint();
+ mailbox.syncPoint = waitSyncPoint;
+ m_drawingBuffer->mailboxReleased(mailbox);
+ // m_drawingBuffer will wait for the sync point when recycling.
+ EXPECT_EQ(0u, webContext()->mostRecentlyWaitedSyncPoint());
+
+ m_drawingBuffer->markContentsChanged();
+ EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
+ // m_drawingBuffer waits for the sync point when recycling in prepareMailbox().
+ EXPECT_EQ(waitSyncPoint, webContext()->mostRecentlyWaitedSyncPoint());
+
+ m_drawingBuffer->beginDestruction();
+ waitSyncPoint = webContext()->insertSyncPoint();
+ mailbox.syncPoint = waitSyncPoint;
+ m_drawingBuffer->mailboxReleased(mailbox);
+ // m_drawingBuffer waits for the sync point because the destruction is in progress.
+ EXPECT_EQ(waitSyncPoint, webContext()->mostRecentlyWaitedSyncPoint());
+}
+
} // namespace
« no previous file with comments | « Source/platform/graphics/gpu/DrawingBuffer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698