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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp
index 51eb26857f7c0153617518d6de7cc2cb90acd3f4..391a0362748615b251b3acde270e267c4998df0e 100644
--- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp
@@ -237,7 +237,11 @@ public:
{
OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(contextProvider->contextGL());
RefPtr<DrawingBufferForTests> drawingBuffer = adoptRef(new DrawingBufferForTests(contextProvider, extensionsUtil.release(), preserve));
- if (!drawingBuffer->initialize(size)) {
+ bool wantAlphaChannel = false;
+ bool wantDepthBuffer = false;
+ bool wantStencilBuffer = false;
+ bool multisampleExtensionSupported = false;
+ if (!drawingBuffer->initialize(size, wantAlphaChannel, wantDepthBuffer, wantStencilBuffer, multisampleExtensionSupported)) {
drawingBuffer->beginDestruction();
return PassRefPtr<DrawingBufferForTests>();
}
@@ -245,7 +249,7 @@ public:
}
DrawingBufferForTests(PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, PassOwnPtr<Extensions3DUtil> extensionsUtil, PreserveDrawingBuffer preserve)
- : DrawingBuffer(contextProvider, extensionsUtil, false /* multisampleExtensionSupported */, false /* discardFramebufferSupported */, false /* premultipliedAlpha */, preserve, WebGraphicsContext3D::Attributes())
+ : DrawingBuffer(contextProvider, extensionsUtil, false /* discardFramebufferSupported */, false /* premultipliedAlpha */, preserve)
, m_live(0)
{ }
@@ -312,7 +316,7 @@ TEST_F(DrawingBufferTest, verifyResizingProperlyAffectsMailboxes)
EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize());
// Resize to 100x50.
- m_drawingBuffer->reset(IntSize(initialWidth, alternateHeight));
+ m_drawingBuffer->reset(IntSize(initialWidth, alternateHeight), false, false);
m_drawingBuffer->mailboxReleased(mailbox, false);
// Produce a mailbox at this size.
@@ -321,7 +325,7 @@ TEST_F(DrawingBufferTest, verifyResizingProperlyAffectsMailboxes)
EXPECT_EQ(alternateSize, webContext()->mostRecentlyProducedSize());
// Reset to initial size.
- m_drawingBuffer->reset(IntSize(initialWidth, initialHeight));
+ m_drawingBuffer->reset(IntSize(initialWidth, initialHeight), false, false);
m_drawingBuffer->mailboxReleased(mailbox, false);
// Prepare another mailbox and verify that it's the correct size.
@@ -552,7 +556,7 @@ TEST_F(DrawingBufferImageChromiumTest, verifyResizingReallocatesImages)
EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId0)).Times(1);
EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId0)).Times(1);
// Resize to 100x50.
- m_drawingBuffer->reset(IntSize(initialWidth, alternateHeight));
+ m_drawingBuffer->reset(IntSize(initialWidth, alternateHeight), false, false);
m_drawingBuffer->mailboxReleased(mailbox, false);
testing::Mock::VerifyAndClearExpectations(webContext());
@@ -572,7 +576,7 @@ TEST_F(DrawingBufferImageChromiumTest, verifyResizingReallocatesImages)
EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId2)).Times(1);
EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId2)).Times(1);
// Reset to initial size.
- m_drawingBuffer->reset(IntSize(initialWidth, initialHeight));
+ m_drawingBuffer->reset(IntSize(initialWidth, initialHeight), false, false);
m_drawingBuffer->mailboxReleased(mailbox, false);
testing::Mock::VerifyAndClearExpectations(webContext());
@@ -721,13 +725,23 @@ TEST(DrawingBufferDepthStencilTest, packedDepthStencilSupported)
OwnPtr<WebGraphicsContext3DProviderForTests> provider = adoptPtr(new WebGraphicsContext3DProviderForTests(context.release(), gl.release()));
DrawingBuffer::PreserveDrawingBuffer preserve = DrawingBuffer::Preserve;
- WebGraphicsContext3D::Attributes requestedAttributes;
- requestedAttributes.stencil = cases[i].requestStencil;
- requestedAttributes.depth = cases[i].requestDepth;
- RefPtr<DrawingBuffer> drawingBuffer = DrawingBuffer::create(provider.release(), IntSize(10, 10), false /* premultipliedAlpha */, preserve, requestedAttributes);
-
- EXPECT_EQ(cases[i].requestDepth, drawingBuffer->getActualAttributes().depth);
- EXPECT_EQ(cases[i].requestStencil, drawingBuffer->getActualAttributes().stencil);
+ bool premultipliedAlpha = false;
+ bool wantAlphaChannel = false;
+ bool wantDepthBuffer = cases[i].requestDepth;
+ bool wantStencilBuffer = cases[i].requestStencil;
+ bool wantAntialiasing = false;
+ RefPtr<DrawingBuffer> drawingBuffer = DrawingBuffer::create(
+ provider.release(),
+ IntSize(10, 10),
+ premultipliedAlpha,
+ wantAlphaChannel,
+ wantDepthBuffer,
+ wantStencilBuffer,
+ wantAntialiasing,
+ preserve);
+
+ EXPECT_EQ(cases[i].requestDepth, drawingBuffer->hasDepthBuffer());
+ EXPECT_EQ(cases[i].requestStencil, drawingBuffer->hasStencilBuffer());
EXPECT_EQ(cases[i].expectedRenderBuffers, trackingContext->numAllocatedRenderBuffer());
if (cases[i].requestDepth || cases[i].requestStencil) {
EXPECT_NE(0u, trackingContext->depthStencilAttachment());
@@ -739,9 +753,9 @@ TEST(DrawingBufferDepthStencilTest, packedDepthStencilSupported)
EXPECT_EQ(0u, trackingContext->stencilAttachment());
}
- drawingBuffer->reset(IntSize(10, 20));
- EXPECT_EQ(cases[i].requestDepth, drawingBuffer->getActualAttributes().depth);
- EXPECT_EQ(cases[i].requestStencil, drawingBuffer->getActualAttributes().stencil);
+ drawingBuffer->reset(IntSize(10, 20), false, false);
+ EXPECT_EQ(cases[i].requestDepth, drawingBuffer->hasDepthBuffer());
+ EXPECT_EQ(cases[i].requestStencil, drawingBuffer->hasStencilBuffer());
EXPECT_EQ(cases[i].expectedRenderBuffers, trackingContext->numAllocatedRenderBuffer());
if (cases[i].requestDepth || cases[i].requestStencil) {
EXPECT_NE(0u, trackingContext->depthStencilAttachment());

Powered by Google App Engine
This is Rietveld 408576698