| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 &releaseCallback3)); | 214 &releaseCallback3)); |
| 215 | 215 |
| 216 // Release mailboxes by specific order; 1, 3, 2. | 216 // Release mailboxes by specific order; 1, 3, 2. |
| 217 m_drawingBuffer->markContentsChanged(); | 217 m_drawingBuffer->markContentsChanged(); |
| 218 releaseCallback1->Run(gpu::SyncToken(), false /* lostResource */); | 218 releaseCallback1->Run(gpu::SyncToken(), false /* lostResource */); |
| 219 m_drawingBuffer->markContentsChanged(); | 219 m_drawingBuffer->markContentsChanged(); |
| 220 releaseCallback3->Run(gpu::SyncToken(), false /* lostResource */); | 220 releaseCallback3->Run(gpu::SyncToken(), false /* lostResource */); |
| 221 m_drawingBuffer->markContentsChanged(); | 221 m_drawingBuffer->markContentsChanged(); |
| 222 releaseCallback2->Run(gpu::SyncToken(), false /* lostResource */); | 222 releaseCallback2->Run(gpu::SyncToken(), false /* lostResource */); |
| 223 | 223 |
| 224 // The first recycled mailbox must be 2. 1 and 3 were deleted by FIFO order be
cause | 224 // The first recycled mailbox must be 2. 1 and 3 were deleted by FIFO order |
| 225 // DrawingBuffer never keeps more than one mailbox. | 225 // because DrawingBuffer never keeps more than one mailbox. |
| 226 cc::TextureMailbox recycledTextureMailbox1; | 226 cc::TextureMailbox recycledTextureMailbox1; |
| 227 std::unique_ptr<cc::SingleReleaseCallback> recycledReleaseCallback1; | 227 std::unique_ptr<cc::SingleReleaseCallback> recycledReleaseCallback1; |
| 228 m_drawingBuffer->markContentsChanged(); | 228 m_drawingBuffer->markContentsChanged(); |
| 229 EXPECT_TRUE(m_drawingBuffer->PrepareTextureMailbox( | 229 EXPECT_TRUE(m_drawingBuffer->PrepareTextureMailbox( |
| 230 &recycledTextureMailbox1, &recycledReleaseCallback1)); | 230 &recycledTextureMailbox1, &recycledReleaseCallback1)); |
| 231 EXPECT_EQ(textureMailbox2.mailbox(), recycledTextureMailbox1.mailbox()); | 231 EXPECT_EQ(textureMailbox2.mailbox(), recycledTextureMailbox1.mailbox()); |
| 232 | 232 |
| 233 // The second recycled mailbox must be a new mailbox. | 233 // The second recycled mailbox must be a new mailbox. |
| 234 cc::TextureMailbox recycledTextureMailbox2; | 234 cc::TextureMailbox recycledTextureMailbox2; |
| 235 std::unique_ptr<cc::SingleReleaseCallback> recycledReleaseCallback2; | 235 std::unique_ptr<cc::SingleReleaseCallback> recycledReleaseCallback2; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 260 gpu::SyncToken waitSyncToken; | 260 gpu::SyncToken waitSyncToken; |
| 261 m_gl->GenSyncTokenCHROMIUM(m_gl->InsertFenceSyncCHROMIUM(), | 261 m_gl->GenSyncTokenCHROMIUM(m_gl->InsertFenceSyncCHROMIUM(), |
| 262 waitSyncToken.GetData()); | 262 waitSyncToken.GetData()); |
| 263 releaseCallback->Run(waitSyncToken, false /* lostResource */); | 263 releaseCallback->Run(waitSyncToken, false /* lostResource */); |
| 264 // m_drawingBuffer will wait for the sync point when recycling. | 264 // m_drawingBuffer will wait for the sync point when recycling. |
| 265 EXPECT_EQ(gpu::SyncToken(), m_gl->mostRecentlyWaitedSyncToken()); | 265 EXPECT_EQ(gpu::SyncToken(), m_gl->mostRecentlyWaitedSyncToken()); |
| 266 | 266 |
| 267 m_drawingBuffer->markContentsChanged(); | 267 m_drawingBuffer->markContentsChanged(); |
| 268 EXPECT_TRUE(m_drawingBuffer->PrepareTextureMailbox(&textureMailbox, | 268 EXPECT_TRUE(m_drawingBuffer->PrepareTextureMailbox(&textureMailbox, |
| 269 &releaseCallback)); | 269 &releaseCallback)); |
| 270 // m_drawingBuffer waits for the sync point when recycling in PrepareTextureMa
ilbox(). | 270 // m_drawingBuffer waits for the sync point when recycling in |
| 271 // PrepareTextureMailbox(). |
| 271 EXPECT_EQ(waitSyncToken, m_gl->mostRecentlyWaitedSyncToken()); | 272 EXPECT_EQ(waitSyncToken, m_gl->mostRecentlyWaitedSyncToken()); |
| 272 | 273 |
| 273 m_drawingBuffer->beginDestruction(); | 274 m_drawingBuffer->beginDestruction(); |
| 274 m_gl->GenSyncTokenCHROMIUM(m_gl->InsertFenceSyncCHROMIUM(), | 275 m_gl->GenSyncTokenCHROMIUM(m_gl->InsertFenceSyncCHROMIUM(), |
| 275 waitSyncToken.GetData()); | 276 waitSyncToken.GetData()); |
| 276 releaseCallback->Run(waitSyncToken, false /* lostResource */); | 277 releaseCallback->Run(waitSyncToken, false /* lostResource */); |
| 277 // m_drawingBuffer waits for the sync point because the destruction is in prog
ress. | 278 // m_drawingBuffer waits for the sync point because the destruction is in |
| 279 // progress. |
| 278 EXPECT_EQ(waitSyncToken, m_gl->mostRecentlyWaitedSyncToken()); | 280 EXPECT_EQ(waitSyncToken, m_gl->mostRecentlyWaitedSyncToken()); |
| 279 } | 281 } |
| 280 | 282 |
| 281 class DrawingBufferImageChromiumTest : public DrawingBufferTest { | 283 class DrawingBufferImageChromiumTest : public DrawingBufferTest { |
| 282 protected: | 284 protected: |
| 283 void SetUp() override { | 285 void SetUp() override { |
| 284 IntSize initialSize(InitialWidth, InitialHeight); | 286 IntSize initialSize(InitialWidth, InitialHeight); |
| 285 std::unique_ptr<GLES2InterfaceForTests> gl = | 287 std::unique_ptr<GLES2InterfaceForTests> gl = |
| 286 wrapUnique(new GLES2InterfaceForTests); | 288 wrapUnique(new GLES2InterfaceForTests); |
| 287 m_gl = gl.get(); | 289 m_gl = gl.get(); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 requestDepth(requestDepth), | 496 requestDepth(requestDepth), |
| 495 expectedRenderBuffers(expectedRenderBuffers), | 497 expectedRenderBuffers(expectedRenderBuffers), |
| 496 testCaseName(testCaseName) {} | 498 testCaseName(testCaseName) {} |
| 497 | 499 |
| 498 bool requestStencil; | 500 bool requestStencil; |
| 499 bool requestDepth; | 501 bool requestDepth; |
| 500 size_t expectedRenderBuffers; | 502 size_t expectedRenderBuffers; |
| 501 const char* const testCaseName; | 503 const char* const testCaseName; |
| 502 }; | 504 }; |
| 503 | 505 |
| 504 // This tests that when the packed depth+stencil extension is supported DrawingB
uffer always allocates | 506 // This tests that, when the packed depth+stencil extension is supported, and |
| 505 // a single packed renderbuffer if either is requested and properly computes the
actual context attributes | 507 // either depth or stencil is requested, DrawingBuffer always allocates a single |
| 506 // as defined by WebGL. We always allocate a packed buffer in this case since ma
ny desktop OpenGL drivers | 508 // packed renderbuffer and properly computes the actual context attributes as |
| 507 // that support this extension do not consider a framebuffer with only a depth o
r a stencil buffer attached | 509 // defined by WebGL. We always allocate a packed buffer in this case since many |
| 508 // to be complete. | 510 // desktop OpenGL drivers that support this extension do not consider a |
| 511 // framebuffer with only a depth or a stencil buffer attached to be complete. |
| 509 TEST(DrawingBufferDepthStencilTest, packedDepthStencilSupported) { | 512 TEST(DrawingBufferDepthStencilTest, packedDepthStencilSupported) { |
| 510 DepthStencilTestCase cases[] = { | 513 DepthStencilTestCase cases[] = { |
| 511 DepthStencilTestCase(false, false, 0, "neither"), | 514 DepthStencilTestCase(false, false, 0, "neither"), |
| 512 DepthStencilTestCase(true, false, 1, "stencil only"), | 515 DepthStencilTestCase(true, false, 1, "stencil only"), |
| 513 DepthStencilTestCase(false, true, 1, "depth only"), | 516 DepthStencilTestCase(false, true, 1, "depth only"), |
| 514 DepthStencilTestCase(true, true, 1, "both"), | 517 DepthStencilTestCase(true, true, 1, "both"), |
| 515 }; | 518 }; |
| 516 | 519 |
| 517 for (size_t i = 0; i < WTF_ARRAY_LENGTH(cases); i++) { | 520 for (size_t i = 0; i < WTF_ARRAY_LENGTH(cases); i++) { |
| 518 SCOPED_TRACE(cases[i].testCaseName); | 521 SCOPED_TRACE(cases[i].testCaseName); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 m_drawingBuffer->setIsHidden(true); | 589 m_drawingBuffer->setIsHidden(true); |
| 587 releaseCallback->Run(waitSyncToken, false /* lostResource */); | 590 releaseCallback->Run(waitSyncToken, false /* lostResource */); |
| 588 // m_drawingBuffer deletes mailbox immediately when hidden. | 591 // m_drawingBuffer deletes mailbox immediately when hidden. |
| 589 | 592 |
| 590 EXPECT_EQ(waitSyncToken, m_gl->mostRecentlyWaitedSyncToken()); | 593 EXPECT_EQ(waitSyncToken, m_gl->mostRecentlyWaitedSyncToken()); |
| 591 | 594 |
| 592 m_drawingBuffer->beginDestruction(); | 595 m_drawingBuffer->beginDestruction(); |
| 593 } | 596 } |
| 594 | 597 |
| 595 } // namespace blink | 598 } // namespace blink |
| OLD | NEW |