| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "wtf/RefPtr.h" | 46 #include "wtf/RefPtr.h" |
| 47 | 47 |
| 48 using testing::Test; | 48 using testing::Test; |
| 49 using testing::_; | 49 using testing::_; |
| 50 | 50 |
| 51 namespace blink { | 51 namespace blink { |
| 52 | 52 |
| 53 namespace { | 53 namespace { |
| 54 | 54 |
| 55 // The target to use when binding a texture to a Chromium image. | 55 // The target to use when binding a texture to a Chromium image. |
| 56 WGC3Denum imageTextureTarget() | 56 GLenum imageTextureTarget() |
| 57 { | 57 { |
| 58 #if OS(MACOSX) | 58 #if OS(MACOSX) |
| 59 return GC3D_TEXTURE_RECTANGLE_ARB; | 59 return GC3D_TEXTURE_RECTANGLE_ARB; |
| 60 #else | 60 #else |
| 61 return GL_TEXTURE_2D; | 61 return GL_TEXTURE_2D; |
| 62 #endif | 62 #endif |
| 63 } | 63 } |
| 64 | 64 |
| 65 // The target to use when preparing a mailbox texture. | 65 // The target to use when preparing a mailbox texture. |
| 66 WGC3Denum drawingBufferTextureTarget(bool allowImageChromium) | 66 GLenum drawingBufferTextureTarget(bool allowImageChromium) |
| 67 { | 67 { |
| 68 if (RuntimeEnabledFeatures::webGLImageChromiumEnabled() && allowImageChromiu
m) | 68 if (RuntimeEnabledFeatures::webGLImageChromiumEnabled() && allowImageChromiu
m) |
| 69 return imageTextureTarget(); | 69 return imageTextureTarget(); |
| 70 return GL_TEXTURE_2D; | 70 return GL_TEXTURE_2D; |
| 71 } | 71 } |
| 72 | 72 |
| 73 } // namespace | 73 } // namespace |
| 74 | 74 |
| 75 class GLES2InterfaceForTests : public gpu::gles2::GLES2InterfaceStub { | 75 class GLES2InterfaceForTests : public gpu::gles2::GLES2InterfaceStub { |
| 76 public: | 76 public: |
| 77 void BindTexture(GLenum target, GLuint texture) override | 77 void BindTexture(GLenum target, GLuint texture) override |
| 78 { | 78 { |
| 79 if (target != m_boundTextureTarget && texture == 0) | 79 if (target != m_boundTextureTarget && texture == 0) |
| 80 return; | 80 return; |
| 81 | 81 |
| 82 // For simplicity, only allow one target to ever be bound. | 82 // For simplicity, only allow one target to ever be bound. |
| 83 ASSERT_TRUE(m_boundTextureTarget == 0 || target == m_boundTextureTarget)
; | 83 ASSERT_TRUE(m_boundTextureTarget == 0 || target == m_boundTextureTarget)
; |
| 84 m_boundTextureTarget = target; | 84 m_boundTextureTarget = target; |
| 85 m_boundTexture = texture; | 85 m_boundTexture = texture; |
| 86 } | 86 } |
| 87 | 87 |
| 88 GLuint64 InsertFenceSyncCHROMIUM() override | 88 GLuint64 InsertFenceSyncCHROMIUM() override |
| 89 { | 89 { |
| 90 static WGC3Duint64 syncPointGenerator = 0; | 90 static GLuint64 syncPointGenerator = 0; |
| 91 return ++syncPointGenerator; | 91 return ++syncPointGenerator; |
| 92 } | 92 } |
| 93 | 93 |
| 94 void WaitSyncTokenCHROMIUM(const GLbyte* syncToken) override | 94 void WaitSyncTokenCHROMIUM(const GLbyte* syncToken) override |
| 95 { | 95 { |
| 96 memcpy(&m_mostRecentlyWaitedSyncToken, syncToken, sizeof(m_mostRecentlyW
aitedSyncToken)); | 96 memcpy(&m_mostRecentlyWaitedSyncToken, syncToken, sizeof(m_mostRecentlyW
aitedSyncToken)); |
| 97 } | 97 } |
| 98 | 98 |
| 99 GLenum CheckFramebufferStatus(GLenum target) override | 99 GLenum CheckFramebufferStatus(GLenum target) override |
| 100 { | 100 { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 121 m_mostRecentlyProducedSize = m_textureSizes.get(texture); | 121 m_mostRecentlyProducedSize = m_textureSizes.get(texture); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei wi
dth, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixel
s) override | 124 void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei wi
dth, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixel
s) override |
| 125 { | 125 { |
| 126 if (target == GL_TEXTURE_2D && !level) { | 126 if (target == GL_TEXTURE_2D && !level) { |
| 127 m_textureSizes.set(m_boundTexture, IntSize(width, height)); | 127 m_textureSizes.set(m_boundTexture, IntSize(width, height)); |
| 128 } | 128 } |
| 129 } | 129 } |
| 130 | 130 |
| 131 WGC3Duint CreateGpuMemoryBufferImageCHROMIUM(GLsizei width, GLsizei height,
GLenum internalformat, GLenum usage) override | 131 GLuint CreateGpuMemoryBufferImageCHROMIUM(GLsizei width, GLsizei height, GLe
num internalformat, GLenum usage) override |
| 132 { | 132 { |
| 133 if (!m_allowImageChromium) | 133 if (!m_allowImageChromium) |
| 134 return false; | 134 return false; |
| 135 m_imageSizes.set(m_currentImageId, IntSize(width, height)); | 135 m_imageSizes.set(m_currentImageId, IntSize(width, height)); |
| 136 return m_currentImageId++; | 136 return m_currentImageId++; |
| 137 } | 137 } |
| 138 | 138 |
| 139 MOCK_METHOD1(DestroyImageMock, void(GLuint imageId)); | 139 MOCK_METHOD1(DestroyImageMock, void(GLuint imageId)); |
| 140 void DestroyImageCHROMIUM(GLuint imageId) | 140 void DestroyImageCHROMIUM(GLuint imageId) |
| 141 { | 141 { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 GLuint currentImageId() const { return m_currentImageId; } | 184 GLuint currentImageId() const { return m_currentImageId; } |
| 185 IntSize mostRecentlyProducedSize() const { return m_mostRecentlyProducedSize
; } | 185 IntSize mostRecentlyProducedSize() const { return m_mostRecentlyProducedSize
; } |
| 186 bool allowImageChromium() const { return m_allowImageChromium; } | 186 bool allowImageChromium() const { return m_allowImageChromium; } |
| 187 | 187 |
| 188 void setAllowImageChromium(bool allow) { m_allowImageChromium = allow; } | 188 void setAllowImageChromium(bool allow) { m_allowImageChromium = allow; } |
| 189 | 189 |
| 190 private: | 190 private: |
| 191 GLuint m_boundTexture = 0; | 191 GLuint m_boundTexture = 0; |
| 192 GLuint m_boundTextureTarget = 0; | 192 GLuint m_boundTextureTarget = 0; |
| 193 GLuint m_mostRecentlyWaitedSyncToken = 0; | 193 GLuint m_mostRecentlyWaitedSyncToken = 0; |
| 194 WGC3Dbyte m_currentMailboxByte = 0; | 194 GLbyte m_currentMailboxByte = 0; |
| 195 IntSize m_mostRecentlyProducedSize; | 195 IntSize m_mostRecentlyProducedSize; |
| 196 bool m_allowImageChromium = true; | 196 bool m_allowImageChromium = true; |
| 197 GLuint m_currentImageId = 1; | 197 GLuint m_currentImageId = 1; |
| 198 HashMap<GLuint, IntSize> m_textureSizes; | 198 HashMap<GLuint, IntSize> m_textureSizes; |
| 199 HashMap<GLuint, IntSize> m_imageSizes; | 199 HashMap<GLuint, IntSize> m_imageSizes; |
| 200 HashMap<GLuint, GLuint> m_imageToTextureMap; | 200 HashMap<GLuint, GLuint> m_imageToTextureMap; |
| 201 }; | 201 }; |
| 202 | 202 |
| 203 class WebGraphicsContext3DForTests : public MockWebGraphicsContext3D { | 203 class WebGraphicsContext3DForTests : public MockWebGraphicsContext3D { |
| 204 public: | 204 public: |
| 205 WebGraphicsContext3DForTests(GLES2InterfaceForTests* contextGL) | 205 WebGraphicsContext3DForTests(GLES2InterfaceForTests* contextGL) |
| 206 : m_contextGL(contextGL) | 206 : m_contextGL(contextGL) |
| 207 { | 207 { |
| 208 } | 208 } |
| 209 | 209 |
| 210 WGC3Duint mostRecentlyWaitedSyncToken() | 210 GLuint mostRecentlyWaitedSyncToken() |
| 211 { | 211 { |
| 212 return m_contextGL->mostRecentlyWaitedSyncToken(); | 212 return m_contextGL->mostRecentlyWaitedSyncToken(); |
| 213 } | 213 } |
| 214 | 214 |
| 215 IntSize mostRecentlyProducedSize() | 215 IntSize mostRecentlyProducedSize() |
| 216 { | 216 { |
| 217 return m_contextGL->mostRecentlyProducedSize(); | 217 return m_contextGL->mostRecentlyProducedSize(); |
| 218 } | 218 } |
| 219 | 219 |
| 220 | 220 |
| 221 WGC3Duint nextImageIdToBeCreated() | 221 GLuint nextImageIdToBeCreated() |
| 222 { | 222 { |
| 223 return m_contextGL->currentImageId(); | 223 return m_contextGL->currentImageId(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 private: | 226 private: |
| 227 GLES2InterfaceForTests* m_contextGL; | 227 GLES2InterfaceForTests* m_contextGL; |
| 228 }; | 228 }; |
| 229 | 229 |
| 230 static const int initialWidth = 100; | 230 static const int initialWidth = 100; |
| 231 static const int initialHeight = 100; | 231 static const int initialHeight = 100; |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 { | 477 { |
| 478 WebExternalTextureMailbox mailbox; | 478 WebExternalTextureMailbox mailbox; |
| 479 | 479 |
| 480 // Produce mailboxes. | 480 // Produce mailboxes. |
| 481 m_drawingBuffer->markContentsChanged(); | 481 m_drawingBuffer->markContentsChanged(); |
| 482 EXPECT_EQ(0u, webContext()->mostRecentlyWaitedSyncToken()); | 482 EXPECT_EQ(0u, webContext()->mostRecentlyWaitedSyncToken()); |
| 483 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); | 483 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); |
| 484 // prepareMailbox() does not wait for any sync point. | 484 // prepareMailbox() does not wait for any sync point. |
| 485 EXPECT_EQ(0u, webContext()->mostRecentlyWaitedSyncToken()); | 485 EXPECT_EQ(0u, webContext()->mostRecentlyWaitedSyncToken()); |
| 486 | 486 |
| 487 WGC3Duint64 waitSyncToken = 0; | 487 GLuint64 waitSyncToken = 0; |
| 488 m_gl->GenSyncTokenCHROMIUM(m_gl->InsertFenceSyncCHROMIUM(), reinterpret_cast
<WGC3Dbyte*>(&waitSyncToken)); | 488 m_gl->GenSyncTokenCHROMIUM(m_gl->InsertFenceSyncCHROMIUM(), reinterpret_cast
<GLbyte*>(&waitSyncToken)); |
| 489 memcpy(mailbox.syncToken, &waitSyncToken, sizeof(waitSyncToken)); | 489 memcpy(mailbox.syncToken, &waitSyncToken, sizeof(waitSyncToken)); |
| 490 mailbox.validSyncToken = true; | 490 mailbox.validSyncToken = true; |
| 491 m_drawingBuffer->mailboxReleased(mailbox, false); | 491 m_drawingBuffer->mailboxReleased(mailbox, false); |
| 492 // m_drawingBuffer will wait for the sync point when recycling. | 492 // m_drawingBuffer will wait for the sync point when recycling. |
| 493 EXPECT_EQ(0u, webContext()->mostRecentlyWaitedSyncToken()); | 493 EXPECT_EQ(0u, webContext()->mostRecentlyWaitedSyncToken()); |
| 494 | 494 |
| 495 m_drawingBuffer->markContentsChanged(); | 495 m_drawingBuffer->markContentsChanged(); |
| 496 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); | 496 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); |
| 497 // m_drawingBuffer waits for the sync point when recycling in prepareMailbox
(). | 497 // m_drawingBuffer waits for the sync point when recycling in prepareMailbox
(). |
| 498 EXPECT_EQ(waitSyncToken, webContext()->mostRecentlyWaitedSyncToken()); | 498 EXPECT_EQ(waitSyncToken, webContext()->mostRecentlyWaitedSyncToken()); |
| 499 | 499 |
| 500 m_drawingBuffer->beginDestruction(); | 500 m_drawingBuffer->beginDestruction(); |
| 501 m_gl->GenSyncTokenCHROMIUM(m_gl->InsertFenceSyncCHROMIUM(), reinterpret_cast
<WGC3Dbyte*>(&waitSyncToken)); | 501 m_gl->GenSyncTokenCHROMIUM(m_gl->InsertFenceSyncCHROMIUM(), reinterpret_cast
<GLbyte*>(&waitSyncToken)); |
| 502 memcpy(mailbox.syncToken, &waitSyncToken, sizeof(waitSyncToken)); | 502 memcpy(mailbox.syncToken, &waitSyncToken, sizeof(waitSyncToken)); |
| 503 mailbox.validSyncToken = true; | 503 mailbox.validSyncToken = true; |
| 504 m_drawingBuffer->mailboxReleased(mailbox, false); | 504 m_drawingBuffer->mailboxReleased(mailbox, false); |
| 505 // m_drawingBuffer waits for the sync point because the destruction is in pr
ogress. | 505 // m_drawingBuffer waits for the sync point because the destruction is in pr
ogress. |
| 506 EXPECT_EQ(waitSyncToken, webContext()->mostRecentlyWaitedSyncToken()); | 506 EXPECT_EQ(waitSyncToken, webContext()->mostRecentlyWaitedSyncToken()); |
| 507 } | 507 } |
| 508 | 508 |
| 509 class DrawingBufferImageChromiumTest : public DrawingBufferTest { | 509 class DrawingBufferImageChromiumTest : public DrawingBufferTest { |
| 510 protected: | 510 protected: |
| 511 void SetUp() override | 511 void SetUp() override |
| (...skipping 19 matching lines...) Expand all Loading... |
| 531 GLuint m_imageId0; | 531 GLuint m_imageId0; |
| 532 }; | 532 }; |
| 533 | 533 |
| 534 TEST_F(DrawingBufferImageChromiumTest, verifyResizingReallocatesImages) | 534 TEST_F(DrawingBufferImageChromiumTest, verifyResizingReallocatesImages) |
| 535 { | 535 { |
| 536 WebExternalTextureMailbox mailbox; | 536 WebExternalTextureMailbox mailbox; |
| 537 | 537 |
| 538 IntSize initialSize(initialWidth, initialHeight); | 538 IntSize initialSize(initialWidth, initialHeight); |
| 539 IntSize alternateSize(initialWidth, alternateHeight); | 539 IntSize alternateSize(initialWidth, alternateHeight); |
| 540 | 540 |
| 541 WGC3Duint m_imageId1 = webContext()->nextImageIdToBeCreated(); | 541 GLuint m_imageId1 = webContext()->nextImageIdToBeCreated(); |
| 542 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId1)).Times(1); | 542 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId1)).Times(1); |
| 543 // Produce one mailbox at size 100x100. | 543 // Produce one mailbox at size 100x100. |
| 544 m_drawingBuffer->markContentsChanged(); | 544 m_drawingBuffer->markContentsChanged(); |
| 545 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); | 545 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); |
| 546 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); | 546 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); |
| 547 EXPECT_TRUE(mailbox.allowOverlay); | 547 EXPECT_TRUE(mailbox.allowOverlay); |
| 548 testing::Mock::VerifyAndClearExpectations(webContext()); | 548 testing::Mock::VerifyAndClearExpectations(webContext()); |
| 549 | 549 |
| 550 WGC3Duint m_imageId2 = webContext()->nextImageIdToBeCreated(); | 550 GLuint m_imageId2 = webContext()->nextImageIdToBeCreated(); |
| 551 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId2)).Times(1); | 551 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId2)).Times(1); |
| 552 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId0)).Times(1); | 552 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId0)).Times(1); |
| 553 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId0)).Times(1); | 553 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId0)).Times(1); |
| 554 // Resize to 100x50. | 554 // Resize to 100x50. |
| 555 m_drawingBuffer->reset(IntSize(initialWidth, alternateHeight)); | 555 m_drawingBuffer->reset(IntSize(initialWidth, alternateHeight)); |
| 556 m_drawingBuffer->mailboxReleased(mailbox, false); | 556 m_drawingBuffer->mailboxReleased(mailbox, false); |
| 557 testing::Mock::VerifyAndClearExpectations(webContext()); | 557 testing::Mock::VerifyAndClearExpectations(webContext()); |
| 558 | 558 |
| 559 WGC3Duint m_imageId3 = webContext()->nextImageIdToBeCreated(); | 559 GLuint m_imageId3 = webContext()->nextImageIdToBeCreated(); |
| 560 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId3)).Times(1); | 560 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId3)).Times(1); |
| 561 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId1)).Times(1); | 561 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId1)).Times(1); |
| 562 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId1)).Times(1); | 562 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId1)).Times(1); |
| 563 // Produce a mailbox at this size. | 563 // Produce a mailbox at this size. |
| 564 m_drawingBuffer->markContentsChanged(); | 564 m_drawingBuffer->markContentsChanged(); |
| 565 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); | 565 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); |
| 566 EXPECT_EQ(alternateSize, webContext()->mostRecentlyProducedSize()); | 566 EXPECT_EQ(alternateSize, webContext()->mostRecentlyProducedSize()); |
| 567 EXPECT_TRUE(mailbox.allowOverlay); | 567 EXPECT_TRUE(mailbox.allowOverlay); |
| 568 testing::Mock::VerifyAndClearExpectations(webContext()); | 568 testing::Mock::VerifyAndClearExpectations(webContext()); |
| 569 | 569 |
| 570 WGC3Duint m_imageId4 = webContext()->nextImageIdToBeCreated(); | 570 GLuint m_imageId4 = webContext()->nextImageIdToBeCreated(); |
| 571 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId4)).Times(1); | 571 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId4)).Times(1); |
| 572 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId2)).Times(1); | 572 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId2)).Times(1); |
| 573 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId2)).Times(1); | 573 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId2)).Times(1); |
| 574 // Reset to initial size. | 574 // Reset to initial size. |
| 575 m_drawingBuffer->reset(IntSize(initialWidth, initialHeight)); | 575 m_drawingBuffer->reset(IntSize(initialWidth, initialHeight)); |
| 576 m_drawingBuffer->mailboxReleased(mailbox, false); | 576 m_drawingBuffer->mailboxReleased(mailbox, false); |
| 577 testing::Mock::VerifyAndClearExpectations(webContext()); | 577 testing::Mock::VerifyAndClearExpectations(webContext()); |
| 578 | 578 |
| 579 WGC3Duint m_imageId5 = webContext()->nextImageIdToBeCreated(); | 579 GLuint m_imageId5 = webContext()->nextImageIdToBeCreated(); |
| 580 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId5)).Times(1); | 580 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId5)).Times(1); |
| 581 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId3)).Times(1); | 581 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId3)).Times(1); |
| 582 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId3)).Times(1); | 582 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId3)).Times(1); |
| 583 // Prepare another mailbox and verify that it's the correct size. | 583 // Prepare another mailbox and verify that it's the correct size. |
| 584 m_drawingBuffer->markContentsChanged(); | 584 m_drawingBuffer->markContentsChanged(); |
| 585 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); | 585 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); |
| 586 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); | 586 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); |
| 587 EXPECT_TRUE(mailbox.allowOverlay); | 587 EXPECT_TRUE(mailbox.allowOverlay); |
| 588 testing::Mock::VerifyAndClearExpectations(webContext()); | 588 testing::Mock::VerifyAndClearExpectations(webContext()); |
| 589 | 589 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 | 670 |
| 671 class DepthStencilTrackingContext : public MockWebGraphicsContext3D { | 671 class DepthStencilTrackingContext : public MockWebGraphicsContext3D { |
| 672 public: | 672 public: |
| 673 DepthStencilTrackingContext(DepthStencilTrackingGLES2Interface* gl) | 673 DepthStencilTrackingContext(DepthStencilTrackingGLES2Interface* gl) |
| 674 : m_contextGL(gl) | 674 : m_contextGL(gl) |
| 675 { | 675 { |
| 676 } | 676 } |
| 677 ~DepthStencilTrackingContext() override {} | 677 ~DepthStencilTrackingContext() override {} |
| 678 | 678 |
| 679 size_t numAllocatedRenderBuffer() const { return m_contextGL->numAllocatedRe
nderBuffer(); } | 679 size_t numAllocatedRenderBuffer() const { return m_contextGL->numAllocatedRe
nderBuffer(); } |
| 680 WebGLId stencilAttachment() const { return m_contextGL->stencilAttachment();
} | 680 GLuint stencilAttachment() const { return m_contextGL->stencilAttachment();
} |
| 681 WebGLId depthAttachment() const { return m_contextGL->depthAttachment(); } | 681 GLuint depthAttachment() const { return m_contextGL->depthAttachment(); } |
| 682 WebGLId depthStencilAttachment() const { return m_contextGL->depthStencilAtt
achment(); } | 682 GLuint depthStencilAttachment() const { return m_contextGL->depthStencilAtta
chment(); } |
| 683 | 683 |
| 684 private: | 684 private: |
| 685 DepthStencilTrackingGLES2Interface* m_contextGL; | 685 DepthStencilTrackingGLES2Interface* m_contextGL; |
| 686 }; | 686 }; |
| 687 | 687 |
| 688 struct DepthStencilTestCase { | 688 struct DepthStencilTestCase { |
| 689 DepthStencilTestCase(bool requestStencil, bool requestDepth, int expectedRen
derBuffers, const char* const testCaseName) | 689 DepthStencilTestCase(bool requestStencil, bool requestDepth, int expectedRen
derBuffers, const char* const testCaseName) |
| 690 : requestStencil(requestStencil) | 690 : requestStencil(requestStencil) |
| 691 , requestDepth(requestDepth) | 691 , requestDepth(requestDepth) |
| 692 , expectedRenderBuffers(expectedRenderBuffers) | 692 , expectedRenderBuffers(expectedRenderBuffers) |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 // Produce mailboxes. | 764 // Produce mailboxes. |
| 765 m_drawingBuffer->markContentsChanged(); | 765 m_drawingBuffer->markContentsChanged(); |
| 766 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); | 766 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); |
| 767 | 767 |
| 768 m_gl->GenSyncTokenCHROMIUM(m_gl->InsertFenceSyncCHROMIUM(), mailbox.syncToke
n); | 768 m_gl->GenSyncTokenCHROMIUM(m_gl->InsertFenceSyncCHROMIUM(), mailbox.syncToke
n); |
| 769 mailbox.validSyncToken = true; | 769 mailbox.validSyncToken = true; |
| 770 m_drawingBuffer->setIsHidden(true); | 770 m_drawingBuffer->setIsHidden(true); |
| 771 m_drawingBuffer->mailboxReleased(mailbox); | 771 m_drawingBuffer->mailboxReleased(mailbox); |
| 772 // m_drawingBuffer deletes mailbox immediately when hidden. | 772 // m_drawingBuffer deletes mailbox immediately when hidden. |
| 773 | 773 |
| 774 WGC3Duint waitSyncToken = 0; | 774 GLuint waitSyncToken = 0; |
| 775 memcpy(&waitSyncToken, mailbox.syncToken, sizeof(waitSyncToken)); | 775 memcpy(&waitSyncToken, mailbox.syncToken, sizeof(waitSyncToken)); |
| 776 EXPECT_EQ(waitSyncToken, webContext()->mostRecentlyWaitedSyncToken()); | 776 EXPECT_EQ(waitSyncToken, webContext()->mostRecentlyWaitedSyncToken()); |
| 777 | 777 |
| 778 m_drawingBuffer->beginDestruction(); | 778 m_drawingBuffer->beginDestruction(); |
| 779 } | 779 } |
| 780 | 780 |
| 781 class DrawingBufferImageChromiumFallbackTest : public DrawingBufferTest { | 781 class DrawingBufferImageChromiumFallbackTest : public DrawingBufferTest { |
| 782 protected: | 782 protected: |
| 783 void SetUp() override | 783 void SetUp() override |
| 784 { | 784 { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 807 m_drawingBuffer->markContentsChanged(); | 807 m_drawingBuffer->markContentsChanged(); |
| 808 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); | 808 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); |
| 809 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); | 809 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); |
| 810 EXPECT_FALSE(mailbox.allowOverlay); | 810 EXPECT_FALSE(mailbox.allowOverlay); |
| 811 | 811 |
| 812 m_drawingBuffer->mailboxReleased(mailbox, false); | 812 m_drawingBuffer->mailboxReleased(mailbox, false); |
| 813 m_drawingBuffer->beginDestruction(); | 813 m_drawingBuffer->beginDestruction(); |
| 814 } | 814 } |
| 815 | 815 |
| 816 } // namespace blink | 816 } // namespace blink |
| OLD | NEW |