Commit d89c4e01 authored by zmo's avatar zmo Committed by Commit bot

Clean up drawing buffer code.

Since we no longer support the path where packed_depth_stencil isn't
supported.

BUG=570453
TEST=build, no behavior change
R=kbr@chromium.org

Review URL: https://codereview.chromium.org/1683213002

Cr-Commit-Position: refs/heads/master@{#374711}
parent fc221f4f
...@@ -116,7 +116,6 @@ PassRefPtr<DrawingBuffer> DrawingBuffer::create(PassOwnPtr<WebGraphicsContext3D> ...@@ -116,7 +116,6 @@ PassRefPtr<DrawingBuffer> DrawingBuffer::create(PassOwnPtr<WebGraphicsContext3D>
else else
extensionsUtil->ensureExtensionEnabled("GL_EXT_multisampled_render_to_texture"); extensionsUtil->ensureExtensionEnabled("GL_EXT_multisampled_render_to_texture");
} }
exts.packedDepthStencil = true;
exts.depth24 = extensionsUtil->supportsExtension("GL_OES_depth24"); exts.depth24 = extensionsUtil->supportsExtension("GL_OES_depth24");
if (exts.depth24) if (exts.depth24)
extensionsUtil->ensureExtensionEnabled("GL_OES_depth24"); extensionsUtil->ensureExtensionEnabled("GL_OES_depth24");
...@@ -138,7 +137,7 @@ void DrawingBuffer::forceNextDrawingBufferCreationToFail() ...@@ -138,7 +137,7 @@ void DrawingBuffer::forceNextDrawingBufferCreationToFail()
} }
DrawingBuffer::SupportedExtensions::SupportedExtensions() : DrawingBuffer::SupportedExtensions::SupportedExtensions() :
multisample(false), packedDepthStencil(false), depth24(false), discardFramebuffer(false) {} multisample(false), depth24(false), discardFramebuffer(false) {}
DrawingBuffer::DrawingBuffer(PassOwnPtr<WebGraphicsContext3D> context, DrawingBuffer::DrawingBuffer(PassOwnPtr<WebGraphicsContext3D> context,
PassOwnPtr<Extensions3DUtil> extensionsUtil, PassOwnPtr<Extensions3DUtil> extensionsUtil,
...@@ -156,13 +155,11 @@ DrawingBuffer::DrawingBuffer(PassOwnPtr<WebGraphicsContext3D> context, ...@@ -156,13 +155,11 @@ DrawingBuffer::DrawingBuffer(PassOwnPtr<WebGraphicsContext3D> context,
, m_size(-1, -1) , m_size(-1, -1)
, m_requestedAttributes(requestedAttributes) , m_requestedAttributes(requestedAttributes)
, m_multisampleExtensionSupported(supportedExtensions.multisample) , m_multisampleExtensionSupported(supportedExtensions.multisample)
, m_packedDepthStencilExtensionSupported(supportedExtensions.packedDepthStencil)
, m_depth24ExtensionSupported(supportedExtensions.depth24) , m_depth24ExtensionSupported(supportedExtensions.depth24)
, m_discardFramebufferSupported(supportedExtensions.discardFramebuffer) , m_discardFramebufferSupported(supportedExtensions.discardFramebuffer)
, m_fbo(0) , m_fbo(0)
, m_depthStencilBuffer(0) , m_depthStencilBuffer(0)
, m_depthBuffer(0) , m_depthBuffer(0)
, m_stencilBuffer(0)
, m_multisampleFBO(0) , m_multisampleFBO(0)
, m_multisampleColorBuffer(0) , m_multisampleColorBuffer(0)
, m_contentsChanged(true) , m_contentsChanged(true)
...@@ -621,9 +618,6 @@ void DrawingBuffer::beginDestruction() ...@@ -621,9 +618,6 @@ void DrawingBuffer::beginDestruction()
if (m_depthBuffer) if (m_depthBuffer)
m_context->deleteRenderbuffer(m_depthBuffer); m_context->deleteRenderbuffer(m_depthBuffer);
if (m_stencilBuffer)
m_context->deleteRenderbuffer(m_stencilBuffer);
if (m_colorBuffer.textureId) { if (m_colorBuffer.textureId) {
deleteChromiumImageForTexture(&m_colorBuffer); deleteChromiumImageForTexture(&m_colorBuffer);
m_context->deleteTexture(m_colorBuffer.textureId); m_context->deleteTexture(m_colorBuffer.textureId);
...@@ -636,7 +630,6 @@ void DrawingBuffer::beginDestruction() ...@@ -636,7 +630,6 @@ void DrawingBuffer::beginDestruction()
m_multisampleColorBuffer = 0; m_multisampleColorBuffer = 0;
m_depthStencilBuffer = 0; m_depthStencilBuffer = 0;
m_depthBuffer = 0; m_depthBuffer = 0;
m_stencilBuffer = 0;
m_multisampleFBO = 0; m_multisampleFBO = 0;
m_fbo = 0; m_fbo = 0;
...@@ -716,7 +709,7 @@ void DrawingBuffer::resizeDepthStencil(const IntSize& size) ...@@ -716,7 +709,7 @@ void DrawingBuffer::resizeDepthStencil(const IntSize& size)
else else
m_context->renderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, size.width(), size.height()); m_context->renderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, size.width(), size.height());
m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthBuffer); m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthBuffer);
} else if (m_packedDepthStencilExtensionSupported) { } else {
if (!m_depthStencilBuffer) if (!m_depthStencilBuffer)
m_depthStencilBuffer = m_context->createRenderbuffer(); m_depthStencilBuffer = m_context->createRenderbuffer();
m_context->bindRenderbuffer(GL_RENDERBUFFER, m_depthStencilBuffer); m_context->bindRenderbuffer(GL_RENDERBUFFER, m_depthStencilBuffer);
...@@ -727,31 +720,6 @@ void DrawingBuffer::resizeDepthStencil(const IntSize& size) ...@@ -727,31 +720,6 @@ void DrawingBuffer::resizeDepthStencil(const IntSize& size)
else else
m_context->renderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES, size.width(), size.height()); m_context->renderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES, size.width(), size.height());
m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilBuffer); m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilBuffer);
} else {
if (m_requestedAttributes.depth) {
if (!m_depthBuffer)
m_depthBuffer = m_context->createRenderbuffer();
m_context->bindRenderbuffer(GL_RENDERBUFFER, m_depthBuffer);
if (m_antiAliasingMode == MSAAImplicitResolve)
m_context->renderbufferStorageMultisampleEXT(GL_RENDERBUFFER, m_sampleCount, GL_DEPTH_COMPONENT16, size.width(), size.height());
else if (m_antiAliasingMode == MSAAExplicitResolve)
m_context->renderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFER, m_sampleCount, GL_DEPTH_COMPONENT16, size.width(), size.height());
else
m_context->renderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, size.width(), size.height());
m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthBuffer);
}
if (m_requestedAttributes.stencil) {
if (!m_stencilBuffer)
m_stencilBuffer = m_context->createRenderbuffer();
m_context->bindRenderbuffer(GL_RENDERBUFFER, m_stencilBuffer);
if (m_antiAliasingMode == MSAAImplicitResolve)
m_context->renderbufferStorageMultisampleEXT(GL_RENDERBUFFER, m_sampleCount, GL_STENCIL_INDEX8, size.width(), size.height());
else if (m_antiAliasingMode == MSAAExplicitResolve)
m_context->renderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFER, m_sampleCount, GL_STENCIL_INDEX8, size.width(), size.height());
else
m_context->renderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, size.width(), size.height());
m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_stencilBuffer);
}
} }
m_context->bindRenderbuffer(GL_RENDERBUFFER, 0); m_context->bindRenderbuffer(GL_RENDERBUFFER, 0);
} }
......
...@@ -171,7 +171,6 @@ protected: // For unittests ...@@ -171,7 +171,6 @@ protected: // For unittests
SupportedExtensions(); SupportedExtensions();
bool multisample; bool multisample;
bool packedDepthStencil;
bool depth24; bool depth24;
bool discardFramebuffer; bool discardFramebuffer;
}; };
...@@ -305,7 +304,6 @@ private: ...@@ -305,7 +304,6 @@ private:
IntSize m_size; IntSize m_size;
WebGraphicsContext3D::Attributes m_requestedAttributes; WebGraphicsContext3D::Attributes m_requestedAttributes;
bool m_multisampleExtensionSupported; bool m_multisampleExtensionSupported;
bool m_packedDepthStencilExtensionSupported;
bool m_depth24ExtensionSupported; bool m_depth24ExtensionSupported;
bool m_discardFramebufferSupported; bool m_discardFramebufferSupported;
Platform3DObject m_fbo; Platform3DObject m_fbo;
...@@ -319,12 +317,10 @@ private: ...@@ -319,12 +317,10 @@ private:
OwnPtr<Closure> m_newMailboxCallback; OwnPtr<Closure> m_newMailboxCallback;
// This is used when we have OES_packed_depth_stencil.
Platform3DObject m_depthStencilBuffer; Platform3DObject m_depthStencilBuffer;
// These are used when we don't. // This is used when we only request depth and the OES_depth24 extension is available.
Platform3DObject m_depthBuffer; Platform3DObject m_depthBuffer;
Platform3DObject m_stencilBuffer;
// For multisampling. // For multisampling.
Platform3DObject m_multisampleFBO; Platform3DObject m_multisampleFBO;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment