| 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 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 m_drawingBuffer->mailboxReleased(mailbox, false); | 560 m_drawingBuffer->mailboxReleased(mailbox, false); |
| 561 | 561 |
| 562 EXPECT_CALL(*webContext(), destroyImageMock(m_imageId5)).Times(1); | 562 EXPECT_CALL(*webContext(), destroyImageMock(m_imageId5)).Times(1); |
| 563 EXPECT_CALL(*webContext(), releaseTexImage2DMock(m_imageId5)).Times(1); | 563 EXPECT_CALL(*webContext(), releaseTexImage2DMock(m_imageId5)).Times(1); |
| 564 EXPECT_CALL(*webContext(), destroyImageMock(m_imageId4)).Times(1); | 564 EXPECT_CALL(*webContext(), destroyImageMock(m_imageId4)).Times(1); |
| 565 EXPECT_CALL(*webContext(), releaseTexImage2DMock(m_imageId4)).Times(1); | 565 EXPECT_CALL(*webContext(), releaseTexImage2DMock(m_imageId4)).Times(1); |
| 566 m_drawingBuffer->beginDestruction(); | 566 m_drawingBuffer->beginDestruction(); |
| 567 testing::Mock::VerifyAndClearExpectations(webContext()); | 567 testing::Mock::VerifyAndClearExpectations(webContext()); |
| 568 } | 568 } |
| 569 | 569 |
| 570 class DepthStencilTrackingGLES2Interface : public gpu::gles2::GLES2InterfaceStub
{ |
| 571 public: |
| 572 void FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum render
buffertarget, GLuint renderbuffer) override |
| 573 { |
| 574 switch (attachment) { |
| 575 case GL_DEPTH_ATTACHMENT: |
| 576 m_depthAttachment = renderbuffer; |
| 577 break; |
| 578 case GL_STENCIL_ATTACHMENT: |
| 579 m_stencilAttachment = renderbuffer; |
| 580 break; |
| 581 case GL_DEPTH_STENCIL_ATTACHMENT: |
| 582 m_depthStencilAttachment = renderbuffer; |
| 583 break; |
| 584 default: |
| 585 ASSERT_NOT_REACHED(); |
| 586 break; |
| 587 } |
| 588 } |
| 589 |
| 590 uint32_t stencilAttachment() const { return m_stencilAttachment; } |
| 591 uint32_t depthAttachment() const { return m_depthAttachment; } |
| 592 uint32_t depthStencilAttachment() const { return m_depthStencilAttachment; } |
| 593 |
| 594 private: |
| 595 uint32_t m_depthAttachment = 0; |
| 596 uint32_t m_stencilAttachment = 0; |
| 597 uint32_t m_depthStencilAttachment = 0; |
| 598 }; |
| 599 |
| 570 class DepthStencilTrackingContext : public MockWebGraphicsContext3D { | 600 class DepthStencilTrackingContext : public MockWebGraphicsContext3D { |
| 571 public: | 601 public: |
| 572 DepthStencilTrackingContext() | 602 DepthStencilTrackingContext() : m_nextRenderBufferId(1) {} |
| 573 : m_nextRenderBufferId(1) | |
| 574 , m_stencilAttachment(0) | |
| 575 , m_depthAttachment(0) | |
| 576 , m_depthStencilAttachment(0) {} | |
| 577 ~DepthStencilTrackingContext() override {} | 603 ~DepthStencilTrackingContext() override {} |
| 578 | 604 |
| 579 int numAllocatedRenderBuffer() const { return m_nextRenderBufferId - 1; } | 605 int numAllocatedRenderBuffer() const { return m_nextRenderBufferId - 1; } |
| 580 WebGLId stencilAttachment() const { return m_stencilAttachment; } | 606 WebGLId stencilAttachment() const { return m_contextGL.stencilAttachment();
} |
| 581 WebGLId depthAttachment() const { return m_depthAttachment; } | 607 WebGLId depthAttachment() const { return m_contextGL.depthAttachment(); } |
| 582 WebGLId depthStencilAttachment() const { return m_depthStencilAttachment; } | 608 WebGLId depthStencilAttachment() const { return m_contextGL.depthStencilAtta
chment(); } |
| 583 | 609 |
| 584 WebString getString(WGC3Denum type) override | 610 WebString getString(WGC3Denum type) override |
| 585 { | 611 { |
| 586 if (type == GL_EXTENSIONS) { | 612 if (type == GL_EXTENSIONS) { |
| 587 return WebString::fromUTF8("GL_OES_packed_depth_stencil"); | 613 return WebString::fromUTF8("GL_OES_packed_depth_stencil"); |
| 588 } | 614 } |
| 589 return WebString(); | 615 return WebString(); |
| 590 } | 616 } |
| 591 | 617 |
| 592 WebGLId createRenderbuffer() override | 618 WebGLId createRenderbuffer() override |
| 593 { | 619 { |
| 594 return ++m_nextRenderBufferId; | 620 return ++m_nextRenderBufferId; |
| 595 } | 621 } |
| 596 | 622 |
| 597 void framebufferRenderbuffer(WGC3Denum target, WGC3Denum attachment, WGC3Den
um renderbuffertarget, WebGLId renderbuffer) override | |
| 598 { | |
| 599 switch (attachment) { | |
| 600 case GL_DEPTH_ATTACHMENT: | |
| 601 m_depthAttachment = renderbuffer; | |
| 602 break; | |
| 603 case GL_STENCIL_ATTACHMENT: | |
| 604 m_stencilAttachment = renderbuffer; | |
| 605 break; | |
| 606 case GL_DEPTH_STENCIL_ATTACHMENT: | |
| 607 m_depthStencilAttachment = renderbuffer; | |
| 608 break; | |
| 609 default: | |
| 610 ASSERT_NOT_REACHED(); | |
| 611 break; | |
| 612 } | |
| 613 } | |
| 614 | |
| 615 void getIntegerv(WGC3Denum ptype, WGC3Dint* value) override | 623 void getIntegerv(WGC3Denum ptype, WGC3Dint* value) override |
| 616 { | 624 { |
| 617 switch (ptype) { | 625 switch (ptype) { |
| 618 case GL_DEPTH_BITS: | 626 case GL_DEPTH_BITS: |
| 619 *value = (m_depthAttachment || m_depthStencilAttachment) ? 24 : 0; | 627 *value = (depthAttachment() || depthStencilAttachment()) ? 24 : 0; |
| 620 return; | 628 return; |
| 621 case GL_STENCIL_BITS: | 629 case GL_STENCIL_BITS: |
| 622 *value = (m_stencilAttachment || m_depthStencilAttachment) ? 8 : 0; | 630 *value = (stencilAttachment() || depthStencilAttachment()) ? 8 : 0; |
| 623 return; | 631 return; |
| 624 } | 632 } |
| 625 MockWebGraphicsContext3D::getIntegerv(ptype, value); | 633 MockWebGraphicsContext3D::getIntegerv(ptype, value); |
| 626 } | 634 } |
| 627 | 635 |
| 628 gpu::gles2::GLES2Interface* getGLES2Interface() override { return &m_context
GL; } | 636 gpu::gles2::GLES2Interface* getGLES2Interface() override { return &m_context
GL; } |
| 629 | 637 |
| 630 private: | 638 private: |
| 631 WebGLId m_nextRenderBufferId; | 639 WebGLId m_nextRenderBufferId; |
| 632 WebGLId m_stencilAttachment; | 640 DepthStencilTrackingGLES2Interface m_contextGL; |
| 633 WebGLId m_depthAttachment; | |
| 634 WebGLId m_depthStencilAttachment; | |
| 635 gpu::gles2::GLES2InterfaceStub m_contextGL; | |
| 636 }; | 641 }; |
| 637 | 642 |
| 638 struct DepthStencilTestCase { | 643 struct DepthStencilTestCase { |
| 639 DepthStencilTestCase(bool requestStencil, bool requestDepth, int expectedRen
derBuffers, const char* const testCaseName) | 644 DepthStencilTestCase(bool requestStencil, bool requestDepth, int expectedRen
derBuffers, const char* const testCaseName) |
| 640 : requestStencil(requestStencil) | 645 : requestStencil(requestStencil) |
| 641 , requestDepth(requestDepth) | 646 , requestDepth(requestDepth) |
| 642 , expectedRenderBuffers(expectedRenderBuffers) | 647 , expectedRenderBuffers(expectedRenderBuffers) |
| 643 , testCaseName(testCaseName) { } | 648 , testCaseName(testCaseName) { } |
| 644 | 649 |
| 645 bool requestStencil; | 650 bool requestStencil; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 m_drawingBuffer->markContentsChanged(); | 757 m_drawingBuffer->markContentsChanged(); |
| 753 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); | 758 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); |
| 754 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); | 759 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); |
| 755 EXPECT_FALSE(mailbox.allowOverlay); | 760 EXPECT_FALSE(mailbox.allowOverlay); |
| 756 | 761 |
| 757 m_drawingBuffer->mailboxReleased(mailbox, false); | 762 m_drawingBuffer->mailboxReleased(mailbox, false); |
| 758 m_drawingBuffer->beginDestruction(); | 763 m_drawingBuffer->beginDestruction(); |
| 759 } | 764 } |
| 760 | 765 |
| 761 } // namespace blink | 766 } // namespace blink |
| OLD | NEW |