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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp

Issue 1814263004: Remove create/delete methods from WebGraphicsContext3D. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@complex-casts
Patch Set: Created 4 years, 9 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 unified diff | Download patch
OLDNEW
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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 return; 612 return;
613 case GL_STENCIL_BITS: 613 case GL_STENCIL_BITS:
614 *value = (m_stencilAttachment || m_depthStencilAttachment) ? 8 : 0; 614 *value = (m_stencilAttachment || m_depthStencilAttachment) ? 8 : 0;
615 return; 615 return;
616 case GL_MAX_TEXTURE_SIZE: 616 case GL_MAX_TEXTURE_SIZE:
617 *value = 1024; 617 *value = 1024;
618 return; 618 return;
619 } 619 }
620 } 620 }
621 621
622 void GenRenderbuffers(GLsizei n, GLuint* renderbuffers) override
623 {
624 for (GLsizei i = 0; i < n; ++i)
625 renderbuffers[i] = m_nextGenRenderbufferId++;
626 }
627
622 uint32_t stencilAttachment() const { return m_stencilAttachment; } 628 uint32_t stencilAttachment() const { return m_stencilAttachment; }
623 uint32_t depthAttachment() const { return m_depthAttachment; } 629 uint32_t depthAttachment() const { return m_depthAttachment; }
624 uint32_t depthStencilAttachment() const { return m_depthStencilAttachment; } 630 uint32_t depthStencilAttachment() const { return m_depthStencilAttachment; }
631 size_t numAllocatedRenderBuffer() const { return m_nextGenRenderbufferId - 1 ; }
625 632
626 private: 633 private:
634 uint32_t m_nextGenRenderbufferId = 1;
627 uint32_t m_depthAttachment = 0; 635 uint32_t m_depthAttachment = 0;
628 uint32_t m_stencilAttachment = 0; 636 uint32_t m_stencilAttachment = 0;
629 uint32_t m_depthStencilAttachment = 0; 637 uint32_t m_depthStencilAttachment = 0;
630 }; 638 };
631 639
632 class DepthStencilTrackingContext : public MockWebGraphicsContext3D { 640 class DepthStencilTrackingContext : public MockWebGraphicsContext3D {
633 public: 641 public:
634 DepthStencilTrackingContext() : m_nextRenderBufferId(1) {}
635 ~DepthStencilTrackingContext() override {} 642 ~DepthStencilTrackingContext() override {}
636 643
637 int numAllocatedRenderBuffer() const { return m_nextRenderBufferId - 1; } 644 size_t numAllocatedRenderBuffer() const { return m_contextGL.numAllocatedRen derBuffer(); }
638 WebGLId stencilAttachment() const { return m_contextGL.stencilAttachment(); } 645 WebGLId stencilAttachment() const { return m_contextGL.stencilAttachment(); }
639 WebGLId depthAttachment() const { return m_contextGL.depthAttachment(); } 646 WebGLId depthAttachment() const { return m_contextGL.depthAttachment(); }
640 WebGLId depthStencilAttachment() const { return m_contextGL.depthStencilAtta chment(); } 647 WebGLId depthStencilAttachment() const { return m_contextGL.depthStencilAtta chment(); }
641 648
642 WebString getString(WGC3Denum type) override 649 WebString getString(WGC3Denum type) override
643 { 650 {
644 if (type == GL_EXTENSIONS) { 651 if (type == GL_EXTENSIONS) {
645 return WebString::fromUTF8("GL_OES_packed_depth_stencil"); 652 return WebString::fromUTF8("GL_OES_packed_depth_stencil");
646 } 653 }
647 return WebString(); 654 return WebString();
648 } 655 }
649 656
650 WebGLId createRenderbuffer() override
651 {
652 return ++m_nextRenderBufferId;
653 }
654
655 gpu::gles2::GLES2Interface* getGLES2Interface() override { return &m_context GL; } 657 gpu::gles2::GLES2Interface* getGLES2Interface() override { return &m_context GL; }
656 658
657 private: 659 private:
658 WebGLId m_nextRenderBufferId;
659 DepthStencilTrackingGLES2Interface m_contextGL; 660 DepthStencilTrackingGLES2Interface m_contextGL;
660 }; 661 };
661 662
662 struct DepthStencilTestCase { 663 struct DepthStencilTestCase {
663 DepthStencilTestCase(bool requestStencil, bool requestDepth, int expectedRen derBuffers, const char* const testCaseName) 664 DepthStencilTestCase(bool requestStencil, bool requestDepth, int expectedRen derBuffers, const char* const testCaseName)
664 : requestStencil(requestStencil) 665 : requestStencil(requestStencil)
665 , requestDepth(requestDepth) 666 , requestDepth(requestDepth)
666 , expectedRenderBuffers(expectedRenderBuffers) 667 , expectedRenderBuffers(expectedRenderBuffers)
667 , testCaseName(testCaseName) { } 668 , testCaseName(testCaseName) { }
668 669
669 bool requestStencil; 670 bool requestStencil;
670 bool requestDepth; 671 bool requestDepth;
671 int expectedRenderBuffers; 672 size_t expectedRenderBuffers;
672 const char* const testCaseName; 673 const char* const testCaseName;
673 }; 674 };
674 675
675 // This tests that when the packed depth+stencil extension is supported DrawingB uffer always allocates 676 // This tests that when the packed depth+stencil extension is supported DrawingB uffer always allocates
676 // a single packed renderbuffer if either is requested and properly computes the actual context attributes 677 // a single packed renderbuffer if either is requested and properly computes the actual context attributes
677 // as defined by WebGL. We always allocate a packed buffer in this case since ma ny desktop OpenGL drivers 678 // as defined by WebGL. We always allocate a packed buffer in this case since ma ny desktop OpenGL drivers
678 // that support this extension do not consider a framebuffer with only a depth o r a stencil buffer attached 679 // that support this extension do not consider a framebuffer with only a depth o r a stencil buffer attached
679 // to be complete. 680 // to be complete.
680 TEST(DrawingBufferDepthStencilTest, packedDepthStencilSupported) 681 TEST(DrawingBufferDepthStencilTest, packedDepthStencilSupported)
681 { 682 {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 m_drawingBuffer->markContentsChanged(); 777 m_drawingBuffer->markContentsChanged();
777 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); 778 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
778 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); 779 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize());
779 EXPECT_FALSE(mailbox.allowOverlay); 780 EXPECT_FALSE(mailbox.allowOverlay);
780 781
781 m_drawingBuffer->mailboxReleased(mailbox, false); 782 m_drawingBuffer->mailboxReleased(mailbox, false);
782 m_drawingBuffer->beginDestruction(); 783 m_drawingBuffer->beginDestruction();
783 } 784 }
784 785
785 } // namespace blink 786 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698