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

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

Issue 1852533002: Remove alpha/depth/stencil/antialias from WGC3D::Attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@premul
Patch Set: rm-alphadepthetc: notruelies Created 4 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 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 static const int initialWidth = 100; 230 static const int initialWidth = 100;
231 static const int initialHeight = 100; 231 static const int initialHeight = 100;
232 static const int alternateHeight = 50; 232 static const int alternateHeight = 50;
233 233
234 class DrawingBufferForTests : public DrawingBuffer { 234 class DrawingBufferForTests : public DrawingBuffer {
235 public: 235 public:
236 static PassRefPtr<DrawingBufferForTests> create(PassOwnPtr<WebGraphicsContex t3DProvider> contextProvider, const IntSize& size, PreserveDrawingBuffer preserv e) 236 static PassRefPtr<DrawingBufferForTests> create(PassOwnPtr<WebGraphicsContex t3DProvider> contextProvider, const IntSize& size, PreserveDrawingBuffer preserv e)
237 { 237 {
238 OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(conte xtProvider->contextGL()); 238 OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(conte xtProvider->contextGL());
239 RefPtr<DrawingBufferForTests> drawingBuffer = adoptRef(new DrawingBuffer ForTests(contextProvider, extensionsUtil.release(), preserve)); 239 RefPtr<DrawingBufferForTests> drawingBuffer = adoptRef(new DrawingBuffer ForTests(contextProvider, extensionsUtil.release(), preserve));
240 if (!drawingBuffer->initialize(size)) { 240 bool wantDepthBuffer = false;
241 bool wantStencilBuffer = false;
242 bool multisampleExtensionSupported = false;
243 if (!drawingBuffer->initialize(size, wantDepthBuffer, wantStencilBuffer, multisampleExtensionSupported)) {
241 drawingBuffer->beginDestruction(); 244 drawingBuffer->beginDestruction();
242 return PassRefPtr<DrawingBufferForTests>(); 245 return nullptr;
243 } 246 }
244 return drawingBuffer.release(); 247 return drawingBuffer.release();
245 } 248 }
246 249
247 DrawingBufferForTests(PassOwnPtr<WebGraphicsContext3DProvider> contextProvid er, PassOwnPtr<Extensions3DUtil> extensionsUtil, PreserveDrawingBuffer preserve) 250 DrawingBufferForTests(PassOwnPtr<WebGraphicsContext3DProvider> contextProvid er, PassOwnPtr<Extensions3DUtil> extensionsUtil, PreserveDrawingBuffer preserve)
248 : DrawingBuffer(contextProvider, extensionsUtil, false /* multisampleExt ensionSupported */, false /* discardFramebufferSupported */, false /* premultipl iedAlpha */, preserve, WebGraphicsContext3D::Attributes()) 251 : DrawingBuffer(contextProvider, extensionsUtil, false /* discardFramebu fferSupported */, true /* wantAlphaChannel */, false /* premultipliedAlpha */, p reserve)
249 , m_live(0) 252 , m_live(0)
250 { } 253 { }
251 254
252 ~DrawingBufferForTests() override 255 ~DrawingBufferForTests() override
253 { 256 {
254 if (m_live) 257 if (m_live)
255 *m_live = false; 258 *m_live = false;
256 } 259 }
257 260
258 bool* m_live; 261 bool* m_live;
(...skipping 21 matching lines...) Expand all
280 class DrawingBufferTest : public Test { 283 class DrawingBufferTest : public Test {
281 protected: 284 protected:
282 void SetUp() override 285 void SetUp() override
283 { 286 {
284 OwnPtr<GLES2InterfaceForTests> gl = adoptPtr(new GLES2InterfaceForTests) ; 287 OwnPtr<GLES2InterfaceForTests> gl = adoptPtr(new GLES2InterfaceForTests) ;
285 m_gl = gl.get(); 288 m_gl = gl.get();
286 OwnPtr<WebGraphicsContext3DForTests> context = adoptPtr(new WebGraphicsC ontext3DForTests(m_gl)); 289 OwnPtr<WebGraphicsContext3DForTests> context = adoptPtr(new WebGraphicsC ontext3DForTests(m_gl));
287 m_context = context.get(); 290 m_context = context.get();
288 OwnPtr<WebGraphicsContext3DProviderForTests> provider = adoptPtr(new Web GraphicsContext3DProviderForTests(context.release(), gl.release())); 291 OwnPtr<WebGraphicsContext3DProviderForTests> provider = adoptPtr(new Web GraphicsContext3DProviderForTests(context.release(), gl.release()));
289 m_drawingBuffer = DrawingBufferForTests::create(provider.release(), IntS ize(initialWidth, initialHeight), DrawingBuffer::Preserve); 292 m_drawingBuffer = DrawingBufferForTests::create(provider.release(), IntS ize(initialWidth, initialHeight), DrawingBuffer::Preserve);
293 CHECK(m_drawingBuffer);
290 } 294 }
291 295
292 WebGraphicsContext3DForTests* webContext() 296 WebGraphicsContext3DForTests* webContext()
293 { 297 {
294 return m_context; 298 return m_context;
295 } 299 }
296 300
297 WebGraphicsContext3DForTests* m_context; 301 WebGraphicsContext3DForTests* m_context;
298 GLES2InterfaceForTests* m_gl; 302 GLES2InterfaceForTests* m_gl;
299 RefPtr<DrawingBufferForTests> m_drawingBuffer; 303 RefPtr<DrawingBufferForTests> m_drawingBuffer;
300 }; 304 };
301 305
302 TEST_F(DrawingBufferTest, verifyResizingProperlyAffectsMailboxes) 306 TEST_F(DrawingBufferTest, verifyResizingProperlyAffectsMailboxes)
303 { 307 {
304 WebExternalTextureMailbox mailbox; 308 WebExternalTextureMailbox mailbox;
305 309
306 IntSize initialSize(initialWidth, initialHeight); 310 IntSize initialSize(initialWidth, initialHeight);
307 IntSize alternateSize(initialWidth, alternateHeight); 311 IntSize alternateSize(initialWidth, alternateHeight);
308 312
309 // Produce one mailbox at size 100x100. 313 // Produce one mailbox at size 100x100.
310 m_drawingBuffer->markContentsChanged(); 314 m_drawingBuffer->markContentsChanged();
311 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); 315 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
312 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); 316 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize());
313 317
314 // Resize to 100x50. 318 // Resize to 100x50.
315 m_drawingBuffer->reset(IntSize(initialWidth, alternateHeight)); 319 m_drawingBuffer->reset(IntSize(initialWidth, alternateHeight), false);
316 m_drawingBuffer->mailboxReleased(mailbox, false); 320 m_drawingBuffer->mailboxReleased(mailbox, false);
317 321
318 // Produce a mailbox at this size. 322 // Produce a mailbox at this size.
319 m_drawingBuffer->markContentsChanged(); 323 m_drawingBuffer->markContentsChanged();
320 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); 324 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
321 EXPECT_EQ(alternateSize, webContext()->mostRecentlyProducedSize()); 325 EXPECT_EQ(alternateSize, webContext()->mostRecentlyProducedSize());
322 326
323 // Reset to initial size. 327 // Reset to initial size.
324 m_drawingBuffer->reset(IntSize(initialWidth, initialHeight)); 328 m_drawingBuffer->reset(IntSize(initialWidth, initialHeight), false);
325 m_drawingBuffer->mailboxReleased(mailbox, false); 329 m_drawingBuffer->mailboxReleased(mailbox, false);
326 330
327 // Prepare another mailbox and verify that it's the correct size. 331 // Prepare another mailbox and verify that it's the correct size.
328 m_drawingBuffer->markContentsChanged(); 332 m_drawingBuffer->markContentsChanged();
329 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); 333 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
330 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); 334 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize());
331 335
332 // Prepare one final mailbox and verify that it's the correct size. 336 // Prepare one final mailbox and verify that it's the correct size.
333 m_drawingBuffer->mailboxReleased(mailbox, false); 337 m_drawingBuffer->mailboxReleased(mailbox, false);
334 m_drawingBuffer->markContentsChanged(); 338 m_drawingBuffer->markContentsChanged();
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 OwnPtr<GLES2InterfaceForTests> gl = adoptPtr(new GLES2InterfaceForTests) ; 517 OwnPtr<GLES2InterfaceForTests> gl = adoptPtr(new GLES2InterfaceForTests) ;
514 m_gl = gl.get(); 518 m_gl = gl.get();
515 OwnPtr<WebGraphicsContext3DForTests> context = adoptPtr(new WebGraphicsC ontext3DForTests(m_gl)); 519 OwnPtr<WebGraphicsContext3DForTests> context = adoptPtr(new WebGraphicsC ontext3DForTests(m_gl));
516 m_context = context.get(); 520 m_context = context.get();
517 OwnPtr<WebGraphicsContext3DProviderForTests> provider = adoptPtr(new Web GraphicsContext3DProviderForTests(context.release(), gl.release())); 521 OwnPtr<WebGraphicsContext3DProviderForTests> provider = adoptPtr(new Web GraphicsContext3DProviderForTests(context.release(), gl.release()));
518 RuntimeEnabledFeatures::setWebGLImageChromiumEnabled(true); 522 RuntimeEnabledFeatures::setWebGLImageChromiumEnabled(true);
519 m_imageId0 = webContext()->nextImageIdToBeCreated(); 523 m_imageId0 = webContext()->nextImageIdToBeCreated();
520 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId0)).Times(1); 524 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId0)).Times(1);
521 m_drawingBuffer = DrawingBufferForTests::create(provider.release(), 525 m_drawingBuffer = DrawingBufferForTests::create(provider.release(),
522 IntSize(initialWidth, initialHeight), DrawingBuffer::Preserve); 526 IntSize(initialWidth, initialHeight), DrawingBuffer::Preserve);
527 CHECK(m_drawingBuffer);
523 testing::Mock::VerifyAndClearExpectations(webContext()); 528 testing::Mock::VerifyAndClearExpectations(webContext());
524 } 529 }
525 530
526 void TearDown() override 531 void TearDown() override
527 { 532 {
528 RuntimeEnabledFeatures::setWebGLImageChromiumEnabled(false); 533 RuntimeEnabledFeatures::setWebGLImageChromiumEnabled(false);
529 } 534 }
530 535
531 GLuint m_imageId0; 536 GLuint m_imageId0;
532 }; 537 };
(...skipping 12 matching lines...) Expand all
545 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); 550 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
546 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); 551 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize());
547 EXPECT_TRUE(mailbox.allowOverlay); 552 EXPECT_TRUE(mailbox.allowOverlay);
548 testing::Mock::VerifyAndClearExpectations(webContext()); 553 testing::Mock::VerifyAndClearExpectations(webContext());
549 554
550 GLuint m_imageId2 = webContext()->nextImageIdToBeCreated(); 555 GLuint m_imageId2 = webContext()->nextImageIdToBeCreated();
551 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId2)).Times(1); 556 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId2)).Times(1);
552 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId0)).Times(1); 557 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId0)).Times(1);
553 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId0)).Times(1); 558 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId0)).Times(1);
554 // Resize to 100x50. 559 // Resize to 100x50.
555 m_drawingBuffer->reset(IntSize(initialWidth, alternateHeight)); 560 m_drawingBuffer->reset(IntSize(initialWidth, alternateHeight), false);
556 m_drawingBuffer->mailboxReleased(mailbox, false); 561 m_drawingBuffer->mailboxReleased(mailbox, false);
557 testing::Mock::VerifyAndClearExpectations(webContext()); 562 testing::Mock::VerifyAndClearExpectations(webContext());
558 563
559 GLuint m_imageId3 = webContext()->nextImageIdToBeCreated(); 564 GLuint m_imageId3 = webContext()->nextImageIdToBeCreated();
560 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId3)).Times(1); 565 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId3)).Times(1);
561 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId1)).Times(1); 566 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId1)).Times(1);
562 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId1)).Times(1); 567 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId1)).Times(1);
563 // Produce a mailbox at this size. 568 // Produce a mailbox at this size.
564 m_drawingBuffer->markContentsChanged(); 569 m_drawingBuffer->markContentsChanged();
565 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); 570 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
566 EXPECT_EQ(alternateSize, webContext()->mostRecentlyProducedSize()); 571 EXPECT_EQ(alternateSize, webContext()->mostRecentlyProducedSize());
567 EXPECT_TRUE(mailbox.allowOverlay); 572 EXPECT_TRUE(mailbox.allowOverlay);
568 testing::Mock::VerifyAndClearExpectations(webContext()); 573 testing::Mock::VerifyAndClearExpectations(webContext());
569 574
570 GLuint m_imageId4 = webContext()->nextImageIdToBeCreated(); 575 GLuint m_imageId4 = webContext()->nextImageIdToBeCreated();
571 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId4)).Times(1); 576 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId4)).Times(1);
572 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId2)).Times(1); 577 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId2)).Times(1);
573 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId2)).Times(1); 578 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId2)).Times(1);
574 // Reset to initial size. 579 // Reset to initial size.
575 m_drawingBuffer->reset(IntSize(initialWidth, initialHeight)); 580 m_drawingBuffer->reset(IntSize(initialWidth, initialHeight), false);
576 m_drawingBuffer->mailboxReleased(mailbox, false); 581 m_drawingBuffer->mailboxReleased(mailbox, false);
577 testing::Mock::VerifyAndClearExpectations(webContext()); 582 testing::Mock::VerifyAndClearExpectations(webContext());
578 583
579 GLuint m_imageId5 = webContext()->nextImageIdToBeCreated(); 584 GLuint m_imageId5 = webContext()->nextImageIdToBeCreated();
580 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId5)).Times(1); 585 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId5)).Times(1);
581 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId3)).Times(1); 586 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId3)).Times(1);
582 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId3)).Times(1); 587 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId3)).Times(1);
583 // Prepare another mailbox and verify that it's the correct size. 588 // Prepare another mailbox and verify that it's the correct size.
584 m_drawingBuffer->markContentsChanged(); 589 m_drawingBuffer->markContentsChanged();
585 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); 590 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 } 629 }
625 630
626 GLenum CheckFramebufferStatus(GLenum target) override 631 GLenum CheckFramebufferStatus(GLenum target) override
627 { 632 {
628 return GL_FRAMEBUFFER_COMPLETE; 633 return GL_FRAMEBUFFER_COMPLETE;
629 } 634 }
630 635
631 void GetIntegerv(GLenum ptype, GLint* value) override 636 void GetIntegerv(GLenum ptype, GLint* value) override
632 { 637 {
633 switch (ptype) { 638 switch (ptype) {
634 case GL_DEPTH_BITS:
635 *value = (m_depthAttachment || m_depthStencilAttachment) ? 24 : 0;
636 return;
637 case GL_STENCIL_BITS:
638 *value = (m_stencilAttachment || m_depthStencilAttachment) ? 8 : 0;
639 return;
640 case GL_MAX_TEXTURE_SIZE: 639 case GL_MAX_TEXTURE_SIZE:
641 *value = 1024; 640 *value = 1024;
642 return; 641 return;
643 } 642 }
644 } 643 }
645 644
646 const GLubyte* GetString(GLenum type) override 645 const GLubyte* GetString(GLenum type) override
647 { 646 {
648 if (type == GL_EXTENSIONS) 647 if (type == GL_EXTENSIONS)
649 return reinterpret_cast<const GLubyte*>("GL_OES_packed_depth_stencil "); 648 return reinterpret_cast<const GLubyte*>("GL_OES_packed_depth_stencil ");
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 const char* const testCaseName; 697 const char* const testCaseName;
699 }; 698 };
700 699
701 // This tests that when the packed depth+stencil extension is supported DrawingB uffer always allocates 700 // This tests that when the packed depth+stencil extension is supported DrawingB uffer always allocates
702 // a single packed renderbuffer if either is requested and properly computes the actual context attributes 701 // a single packed renderbuffer if either is requested and properly computes the actual context attributes
703 // as defined by WebGL. We always allocate a packed buffer in this case since ma ny desktop OpenGL drivers 702 // as defined by WebGL. We always allocate a packed buffer in this case since ma ny desktop OpenGL drivers
704 // that support this extension do not consider a framebuffer with only a depth o r a stencil buffer attached 703 // that support this extension do not consider a framebuffer with only a depth o r a stencil buffer attached
705 // to be complete. 704 // to be complete.
706 TEST(DrawingBufferDepthStencilTest, packedDepthStencilSupported) 705 TEST(DrawingBufferDepthStencilTest, packedDepthStencilSupported)
707 { 706 {
707 // When we request a depth or a stencil buffer, we will get both.
708 DepthStencilTestCase cases[] = { 708 DepthStencilTestCase cases[] = {
709 DepthStencilTestCase(false, false, 0, "neither"), 709 DepthStencilTestCase(false, false, 0, "neither"),
710 DepthStencilTestCase(true, false, 1, "stencil only"), 710 DepthStencilTestCase(true, true, 1, "stencil only"),
711 DepthStencilTestCase(false, true, 1, "depth only"), 711 DepthStencilTestCase(true, true, 1, "depth only"),
piman 2016/04/01 01:40:28 Are we testing 3 times the same thing? Should we f
danakj 2016/04/01 02:08:08 Err.. haha oops. I read this as the expectations b
danakj 2016/04/01 02:10:58 Done.
712 DepthStencilTestCase(true, true, 1, "both"), 712 DepthStencilTestCase(true, true, 1, "both"),
713 }; 713 };
714 714
715 for (size_t i = 0; i < WTF_ARRAY_LENGTH(cases); i++) { 715 for (size_t i = 0; i < WTF_ARRAY_LENGTH(cases); i++) {
716 SCOPED_TRACE(cases[i].testCaseName); 716 SCOPED_TRACE(cases[i].testCaseName);
717 OwnPtr<DepthStencilTrackingGLES2Interface> gl = adoptPtr(new DepthStenci lTrackingGLES2Interface); 717 OwnPtr<DepthStencilTrackingGLES2Interface> gl = adoptPtr(new DepthStenci lTrackingGLES2Interface);
718 DepthStencilTrackingGLES2Interface* trackingGL = gl.get(); 718 DepthStencilTrackingGLES2Interface* trackingGL = gl.get();
719 OwnPtr<DepthStencilTrackingContext> context = adoptPtr(new DepthStencilT rackingContext(trackingGL)); 719 OwnPtr<DepthStencilTrackingContext> context = adoptPtr(new DepthStencilT rackingContext(trackingGL));
720 DepthStencilTrackingContext* trackingContext = context.get(); 720 DepthStencilTrackingContext* trackingContext = context.get();
721 OwnPtr<WebGraphicsContext3DProviderForTests> provider = adoptPtr(new Web GraphicsContext3DProviderForTests(context.release(), gl.release())); 721 OwnPtr<WebGraphicsContext3DProviderForTests> provider = adoptPtr(new Web GraphicsContext3DProviderForTests(context.release(), gl.release()));
722 DrawingBuffer::PreserveDrawingBuffer preserve = DrawingBuffer::Preserve; 722 DrawingBuffer::PreserveDrawingBuffer preserve = DrawingBuffer::Preserve;
723 723
724 WebGraphicsContext3D::Attributes requestedAttributes; 724 bool premultipliedAlpha = false;
725 requestedAttributes.stencil = cases[i].requestStencil; 725 bool wantAlphaChannel = true;
726 requestedAttributes.depth = cases[i].requestDepth; 726 bool wantDepthBuffer = cases[i].requestDepth;
727 RefPtr<DrawingBuffer> drawingBuffer = DrawingBuffer::create(provider.rel ease(), IntSize(10, 10), false /* premultipliedAlpha */, preserve, requestedAttr ibutes); 727 bool wantStencilBuffer = cases[i].requestStencil;
728 bool wantAntialiasing = false;
729 RefPtr<DrawingBuffer> drawingBuffer = DrawingBuffer::create(
730 provider.release(),
731 IntSize(10, 10),
732 premultipliedAlpha,
733 wantAlphaChannel,
734 wantDepthBuffer,
735 wantStencilBuffer,
736 wantAntialiasing,
737 preserve);
728 738
729 EXPECT_EQ(cases[i].requestDepth, drawingBuffer->getActualAttributes().de pth); 739 EXPECT_EQ(cases[i].requestDepth, drawingBuffer->hasDepthBuffer());
730 EXPECT_EQ(cases[i].requestStencil, drawingBuffer->getActualAttributes(). stencil); 740 EXPECT_EQ(cases[i].requestStencil, drawingBuffer->hasStencilBuffer());
731 EXPECT_EQ(cases[i].expectedRenderBuffers, trackingContext->numAllocatedR enderBuffer()); 741 EXPECT_EQ(cases[i].expectedRenderBuffers, trackingContext->numAllocatedR enderBuffer());
732 if (cases[i].requestDepth || cases[i].requestStencil) { 742 if (cases[i].requestDepth || cases[i].requestStencil) {
733 EXPECT_NE(0u, trackingContext->depthStencilAttachment()); 743 EXPECT_NE(0u, trackingContext->depthStencilAttachment());
734 EXPECT_EQ(0u, trackingContext->depthAttachment()); 744 EXPECT_EQ(0u, trackingContext->depthAttachment());
735 EXPECT_EQ(0u, trackingContext->stencilAttachment()); 745 EXPECT_EQ(0u, trackingContext->stencilAttachment());
736 } else { 746 } else {
737 EXPECT_EQ(0u, trackingContext->depthStencilAttachment()); 747 EXPECT_EQ(0u, trackingContext->depthStencilAttachment());
738 EXPECT_EQ(0u, trackingContext->depthAttachment()); 748 EXPECT_EQ(0u, trackingContext->depthAttachment());
739 EXPECT_EQ(0u, trackingContext->stencilAttachment()); 749 EXPECT_EQ(0u, trackingContext->stencilAttachment());
740 } 750 }
741 751
742 drawingBuffer->reset(IntSize(10, 20)); 752 drawingBuffer->reset(IntSize(10, 20), false);
743 EXPECT_EQ(cases[i].requestDepth, drawingBuffer->getActualAttributes().de pth); 753 EXPECT_EQ(cases[i].requestDepth, drawingBuffer->hasDepthBuffer());
744 EXPECT_EQ(cases[i].requestStencil, drawingBuffer->getActualAttributes(). stencil); 754 EXPECT_EQ(cases[i].requestStencil, drawingBuffer->hasStencilBuffer());
745 EXPECT_EQ(cases[i].expectedRenderBuffers, trackingContext->numAllocatedR enderBuffer()); 755 EXPECT_EQ(cases[i].expectedRenderBuffers, trackingContext->numAllocatedR enderBuffer());
746 if (cases[i].requestDepth || cases[i].requestStencil) { 756 if (cases[i].requestDepth || cases[i].requestStencil) {
747 EXPECT_NE(0u, trackingContext->depthStencilAttachment()); 757 EXPECT_NE(0u, trackingContext->depthStencilAttachment());
748 EXPECT_EQ(0u, trackingContext->depthAttachment()); 758 EXPECT_EQ(0u, trackingContext->depthAttachment());
749 EXPECT_EQ(0u, trackingContext->stencilAttachment()); 759 EXPECT_EQ(0u, trackingContext->stencilAttachment());
750 } else { 760 } else {
751 EXPECT_EQ(0u, trackingContext->depthStencilAttachment()); 761 EXPECT_EQ(0u, trackingContext->depthStencilAttachment());
752 EXPECT_EQ(0u, trackingContext->depthAttachment()); 762 EXPECT_EQ(0u, trackingContext->depthAttachment());
753 EXPECT_EQ(0u, trackingContext->stencilAttachment()); 763 EXPECT_EQ(0u, trackingContext->stencilAttachment());
754 } 764 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 m_drawingBuffer->markContentsChanged(); 817 m_drawingBuffer->markContentsChanged();
808 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); 818 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
809 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); 819 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize());
810 EXPECT_FALSE(mailbox.allowOverlay); 820 EXPECT_FALSE(mailbox.allowOverlay);
811 821
812 m_drawingBuffer->mailboxReleased(mailbox, false); 822 m_drawingBuffer->mailboxReleased(mailbox, false);
813 m_drawingBuffer->beginDestruction(); 823 m_drawingBuffer->beginDestruction();
814 } 824 }
815 825
816 } // namespace blink 826 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698