| Index: Source/modules/webgl/WebGLFramebuffer.cpp
|
| diff --git a/Source/modules/webgl/WebGLFramebuffer.cpp b/Source/modules/webgl/WebGLFramebuffer.cpp
|
| index 2246d54f3d470b3e0c5c2cac7f7a6f1a74427216..e9dee4049417d46953014e526d414bf565c1c9bd 100644
|
| --- a/Source/modules/webgl/WebGLFramebuffer.cpp
|
| +++ b/Source/modules/webgl/WebGLFramebuffer.cpp
|
| @@ -36,283 +36,283 @@ namespace blink {
|
|
|
| namespace {
|
|
|
| - class WebGLRenderbufferAttachment final : public WebGLFramebuffer::WebGLAttachment {
|
| - public:
|
| - static PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> create(WebGLRenderbuffer*);
|
| -
|
| - DECLARE_VIRTUAL_TRACE();
|
| -
|
| - private:
|
| - explicit WebGLRenderbufferAttachment(WebGLRenderbuffer*);
|
| - WebGLRenderbufferAttachment() { }
|
| -
|
| - GLsizei width() const override;
|
| - GLsizei height() const override;
|
| - GLenum format() const override;
|
| - GLenum type() const override;
|
| - WebGLSharedObject* object() const override;
|
| - bool isSharedObject(WebGLSharedObject*) const override;
|
| - bool valid() const override;
|
| - void onDetached(WebGraphicsContext3D*) override;
|
| - void attach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override;
|
| - void unattach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override;
|
| -
|
| - RefPtrWillBeMember<WebGLRenderbuffer> m_renderbuffer;
|
| - };
|
| -
|
| - PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> WebGLRenderbufferAttachment::create(WebGLRenderbuffer* renderbuffer)
|
| - {
|
| - return adoptRefWillBeNoop(new WebGLRenderbufferAttachment(renderbuffer));
|
| - }
|
| +class WebGLRenderbufferAttachment final : public WebGLFramebuffer::WebGLAttachment {
|
| +public:
|
| + static PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> create(WebGLRenderbuffer*);
|
| +
|
| + DECLARE_VIRTUAL_TRACE();
|
| +
|
| +private:
|
| + explicit WebGLRenderbufferAttachment(WebGLRenderbuffer*);
|
| + WebGLRenderbufferAttachment() { }
|
| +
|
| + GLsizei width() const override;
|
| + GLsizei height() const override;
|
| + GLenum format() const override;
|
| + GLenum type() const override;
|
| + WebGLSharedObject* object() const override;
|
| + bool isSharedObject(WebGLSharedObject*) const override;
|
| + bool valid() const override;
|
| + void onDetached(WebGraphicsContext3D*) override;
|
| + void attach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override;
|
| + void unattach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override;
|
| +
|
| + RefPtrWillBeMember<WebGLRenderbuffer> m_renderbuffer;
|
| +};
|
| +
|
| +PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> WebGLRenderbufferAttachment::create(WebGLRenderbuffer* renderbuffer)
|
| +{
|
| + return adoptRefWillBeNoop(new WebGLRenderbufferAttachment(renderbuffer));
|
| +}
|
|
|
| - DEFINE_TRACE(WebGLRenderbufferAttachment)
|
| - {
|
| - visitor->trace(m_renderbuffer);
|
| - WebGLFramebuffer::WebGLAttachment::trace(visitor);
|
| - }
|
| +DEFINE_TRACE(WebGLRenderbufferAttachment)
|
| +{
|
| + visitor->trace(m_renderbuffer);
|
| + WebGLFramebuffer::WebGLAttachment::trace(visitor);
|
| +}
|
|
|
| - WebGLRenderbufferAttachment::WebGLRenderbufferAttachment(WebGLRenderbuffer* renderbuffer)
|
| - : m_renderbuffer(renderbuffer)
|
| - {
|
| - }
|
| +WebGLRenderbufferAttachment::WebGLRenderbufferAttachment(WebGLRenderbuffer* renderbuffer)
|
| + : m_renderbuffer(renderbuffer)
|
| +{
|
| +}
|
|
|
| - GLsizei WebGLRenderbufferAttachment::width() const
|
| - {
|
| - return m_renderbuffer->width();
|
| - }
|
| +GLsizei WebGLRenderbufferAttachment::width() const
|
| +{
|
| + return m_renderbuffer->width();
|
| +}
|
|
|
| - GLsizei WebGLRenderbufferAttachment::height() const
|
| - {
|
| - return m_renderbuffer->height();
|
| - }
|
| +GLsizei WebGLRenderbufferAttachment::height() const
|
| +{
|
| + return m_renderbuffer->height();
|
| +}
|
|
|
| - GLenum WebGLRenderbufferAttachment::format() const
|
| - {
|
| - GLenum format = m_renderbuffer->internalFormat();
|
| - if (format == GL_DEPTH_STENCIL_OES
|
| - && m_renderbuffer->emulatedStencilBuffer()
|
| - && m_renderbuffer->emulatedStencilBuffer()->internalFormat() != GL_STENCIL_INDEX8) {
|
| - return 0;
|
| - }
|
| - return format;
|
| +GLenum WebGLRenderbufferAttachment::format() const
|
| +{
|
| + GLenum format = m_renderbuffer->internalFormat();
|
| + if (format == GL_DEPTH_STENCIL_OES
|
| + && m_renderbuffer->emulatedStencilBuffer()
|
| + && m_renderbuffer->emulatedStencilBuffer()->internalFormat() != GL_STENCIL_INDEX8) {
|
| + return 0;
|
| }
|
| + return format;
|
| +}
|
|
|
| - WebGLSharedObject* WebGLRenderbufferAttachment::object() const
|
| - {
|
| - return m_renderbuffer->object() ? m_renderbuffer.get() : 0;
|
| - }
|
| +WebGLSharedObject* WebGLRenderbufferAttachment::object() const
|
| +{
|
| + return m_renderbuffer->object() ? m_renderbuffer.get() : 0;
|
| +}
|
|
|
| - bool WebGLRenderbufferAttachment::isSharedObject(WebGLSharedObject* object) const
|
| - {
|
| - return object == m_renderbuffer;
|
| - }
|
| +bool WebGLRenderbufferAttachment::isSharedObject(WebGLSharedObject* object) const
|
| +{
|
| + return object == m_renderbuffer;
|
| +}
|
|
|
| - bool WebGLRenderbufferAttachment::valid() const
|
| - {
|
| - return m_renderbuffer->object();
|
| - }
|
| +bool WebGLRenderbufferAttachment::valid() const
|
| +{
|
| + return m_renderbuffer->object();
|
| +}
|
|
|
| - void WebGLRenderbufferAttachment::onDetached(WebGraphicsContext3D* context)
|
| - {
|
| - m_renderbuffer->onDetached(context);
|
| - }
|
| +void WebGLRenderbufferAttachment::onDetached(WebGraphicsContext3D* context)
|
| +{
|
| + m_renderbuffer->onDetached(context);
|
| +}
|
|
|
| - void WebGLRenderbufferAttachment::attach(WebGraphicsContext3D* context, GLenum target, GLenum attachment)
|
| - {
|
| - Platform3DObject object = objectOrZero(m_renderbuffer.get());
|
| - if (attachment == GL_DEPTH_STENCIL_ATTACHMENT && m_renderbuffer->emulatedStencilBuffer()) {
|
| - context->framebufferRenderbuffer(target, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, object);
|
| - context->framebufferRenderbuffer(target, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, objectOrZero(m_renderbuffer->emulatedStencilBuffer()));
|
| - } else {
|
| - context->framebufferRenderbuffer(target, attachment, GL_RENDERBUFFER, object);
|
| - }
|
| +void WebGLRenderbufferAttachment::attach(WebGraphicsContext3D* context, GLenum target, GLenum attachment)
|
| +{
|
| + Platform3DObject object = objectOrZero(m_renderbuffer.get());
|
| + if (attachment == GL_DEPTH_STENCIL_ATTACHMENT && m_renderbuffer->emulatedStencilBuffer()) {
|
| + context->framebufferRenderbuffer(target, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, object);
|
| + context->framebufferRenderbuffer(target, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, objectOrZero(m_renderbuffer->emulatedStencilBuffer()));
|
| + } else {
|
| + context->framebufferRenderbuffer(target, attachment, GL_RENDERBUFFER, object);
|
| }
|
| +}
|
|
|
| - void WebGLRenderbufferAttachment::unattach(WebGraphicsContext3D* context, GLenum target, GLenum attachment)
|
| - {
|
| - if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
|
| - context->framebufferRenderbuffer(target, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0);
|
| - context->framebufferRenderbuffer(target, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0);
|
| - } else {
|
| - context->framebufferRenderbuffer(target, attachment, GL_RENDERBUFFER, 0);
|
| - }
|
| +void WebGLRenderbufferAttachment::unattach(WebGraphicsContext3D* context, GLenum target, GLenum attachment)
|
| +{
|
| + if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
|
| + context->framebufferRenderbuffer(target, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0);
|
| + context->framebufferRenderbuffer(target, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0);
|
| + } else {
|
| + context->framebufferRenderbuffer(target, attachment, GL_RENDERBUFFER, 0);
|
| }
|
| +}
|
|
|
| - GLenum WebGLRenderbufferAttachment::type() const
|
| - {
|
| - return 0;
|
| - }
|
| +GLenum WebGLRenderbufferAttachment::type() const
|
| +{
|
| + return 0;
|
| +}
|
|
|
| - class WebGLTextureAttachment final : public WebGLFramebuffer::WebGLAttachment {
|
| - public:
|
| - static PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> create(WebGLTexture*, GLenum target, GLint level);
|
| -
|
| - DECLARE_VIRTUAL_TRACE();
|
| -
|
| - private:
|
| - WebGLTextureAttachment(WebGLTexture*, GLenum target, GLint level);
|
| - WebGLTextureAttachment() { }
|
| -
|
| - GLsizei width() const override;
|
| - GLsizei height() const override;
|
| - GLenum format() const override;
|
| - GLenum type() const override;
|
| - WebGLSharedObject* object() const override;
|
| - bool isSharedObject(WebGLSharedObject*) const override;
|
| - bool valid() const override;
|
| - void onDetached(WebGraphicsContext3D*) override;
|
| - void attach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override;
|
| - void unattach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override;
|
| -
|
| - RefPtrWillBeMember<WebGLTexture> m_texture;
|
| - GLenum m_target;
|
| - GLint m_level;
|
| - };
|
| -
|
| - PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> WebGLTextureAttachment::create(WebGLTexture* texture, GLenum target, GLint level)
|
| - {
|
| - return adoptRefWillBeNoop(new WebGLTextureAttachment(texture, target, level));
|
| - }
|
| +class WebGLTextureAttachment final : public WebGLFramebuffer::WebGLAttachment {
|
| +public:
|
| + static PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> create(WebGLTexture*, GLenum target, GLint level);
|
| +
|
| + DECLARE_VIRTUAL_TRACE();
|
| +
|
| +private:
|
| + WebGLTextureAttachment(WebGLTexture*, GLenum target, GLint level);
|
| + WebGLTextureAttachment() { }
|
| +
|
| + GLsizei width() const override;
|
| + GLsizei height() const override;
|
| + GLenum format() const override;
|
| + GLenum type() const override;
|
| + WebGLSharedObject* object() const override;
|
| + bool isSharedObject(WebGLSharedObject*) const override;
|
| + bool valid() const override;
|
| + void onDetached(WebGraphicsContext3D*) override;
|
| + void attach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override;
|
| + void unattach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override;
|
| +
|
| + RefPtrWillBeMember<WebGLTexture> m_texture;
|
| + GLenum m_target;
|
| + GLint m_level;
|
| +};
|
| +
|
| +PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> WebGLTextureAttachment::create(WebGLTexture* texture, GLenum target, GLint level)
|
| +{
|
| + return adoptRefWillBeNoop(new WebGLTextureAttachment(texture, target, level));
|
| +}
|
|
|
| - DEFINE_TRACE(WebGLTextureAttachment)
|
| - {
|
| - visitor->trace(m_texture);
|
| - WebGLFramebuffer::WebGLAttachment::trace(visitor);
|
| - }
|
| +DEFINE_TRACE(WebGLTextureAttachment)
|
| +{
|
| + visitor->trace(m_texture);
|
| + WebGLFramebuffer::WebGLAttachment::trace(visitor);
|
| +}
|
|
|
| - WebGLTextureAttachment::WebGLTextureAttachment(WebGLTexture* texture, GLenum target, GLint level)
|
| - : m_texture(texture)
|
| - , m_target(target)
|
| - , m_level(level)
|
| - {
|
| - }
|
| +WebGLTextureAttachment::WebGLTextureAttachment(WebGLTexture* texture, GLenum target, GLint level)
|
| + : m_texture(texture)
|
| + , m_target(target)
|
| + , m_level(level)
|
| +{
|
| +}
|
|
|
| - GLsizei WebGLTextureAttachment::width() const
|
| - {
|
| - return m_texture->getWidth(m_target, m_level);
|
| - }
|
| +GLsizei WebGLTextureAttachment::width() const
|
| +{
|
| + return m_texture->getWidth(m_target, m_level);
|
| +}
|
|
|
| - GLsizei WebGLTextureAttachment::height() const
|
| - {
|
| - return m_texture->getHeight(m_target, m_level);
|
| - }
|
| +GLsizei WebGLTextureAttachment::height() const
|
| +{
|
| + return m_texture->getHeight(m_target, m_level);
|
| +}
|
|
|
| - GLenum WebGLTextureAttachment::format() const
|
| - {
|
| - return m_texture->getInternalFormat(m_target, m_level);
|
| - }
|
| +GLenum WebGLTextureAttachment::format() const
|
| +{
|
| + return m_texture->getInternalFormat(m_target, m_level);
|
| +}
|
|
|
| - WebGLSharedObject* WebGLTextureAttachment::object() const
|
| - {
|
| - return m_texture->object() ? m_texture.get() : 0;
|
| - }
|
| +WebGLSharedObject* WebGLTextureAttachment::object() const
|
| +{
|
| + return m_texture->object() ? m_texture.get() : 0;
|
| +}
|
|
|
| - bool WebGLTextureAttachment::isSharedObject(WebGLSharedObject* object) const
|
| - {
|
| - return object == m_texture;
|
| - }
|
| +bool WebGLTextureAttachment::isSharedObject(WebGLSharedObject* object) const
|
| +{
|
| + return object == m_texture;
|
| +}
|
|
|
| - bool WebGLTextureAttachment::valid() const
|
| - {
|
| - return m_texture->object();
|
| - }
|
| +bool WebGLTextureAttachment::valid() const
|
| +{
|
| + return m_texture->object();
|
| +}
|
|
|
| - void WebGLTextureAttachment::onDetached(WebGraphicsContext3D* context)
|
| - {
|
| - m_texture->onDetached(context);
|
| - }
|
| +void WebGLTextureAttachment::onDetached(WebGraphicsContext3D* context)
|
| +{
|
| + m_texture->onDetached(context);
|
| +}
|
|
|
| - void WebGLTextureAttachment::attach(WebGraphicsContext3D* context, GLenum target, GLenum attachment)
|
| - {
|
| - Platform3DObject object = objectOrZero(m_texture.get());
|
| - context->framebufferTexture2D(target, attachment, m_target, object, m_level);
|
| - }
|
| +void WebGLTextureAttachment::attach(WebGraphicsContext3D* context, GLenum target, GLenum attachment)
|
| +{
|
| + Platform3DObject object = objectOrZero(m_texture.get());
|
| + context->framebufferTexture2D(target, attachment, m_target, object, m_level);
|
| +}
|
|
|
| - void WebGLTextureAttachment::unattach(WebGraphicsContext3D* context, GLenum target, GLenum attachment)
|
| - {
|
| - if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
|
| - context->framebufferTexture2D(target, GL_DEPTH_ATTACHMENT, m_target, 0, m_level);
|
| - context->framebufferTexture2D(target, GL_STENCIL_ATTACHMENT, m_target, 0, m_level);
|
| - } else {
|
| - context->framebufferTexture2D(target, attachment, m_target, 0, m_level);
|
| - }
|
| +void WebGLTextureAttachment::unattach(WebGraphicsContext3D* context, GLenum target, GLenum attachment)
|
| +{
|
| + if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
|
| + context->framebufferTexture2D(target, GL_DEPTH_ATTACHMENT, m_target, 0, m_level);
|
| + context->framebufferTexture2D(target, GL_STENCIL_ATTACHMENT, m_target, 0, m_level);
|
| + } else {
|
| + context->framebufferTexture2D(target, attachment, m_target, 0, m_level);
|
| }
|
| +}
|
|
|
| - GLenum WebGLTextureAttachment::type() const
|
| - {
|
| - return m_texture->getType(m_target, m_level);
|
| - }
|
| +GLenum WebGLTextureAttachment::type() const
|
| +{
|
| + return m_texture->getType(m_target, m_level);
|
| +}
|
|
|
| - bool isColorRenderable(GLenum internalformat)
|
| - {
|
| - switch (internalformat) {
|
| - case GL_RGB:
|
| - case GL_RGBA:
|
| - case GL_SRGB_ALPHA_EXT:
|
| - case GL_R8:
|
| - case GL_R8UI:
|
| - case GL_R8I:
|
| - case GL_R16UI:
|
| - case GL_R16I:
|
| - case GL_R32UI:
|
| - case GL_R32I:
|
| - case GL_RG8:
|
| - case GL_RG8UI:
|
| - case GL_RG8I:
|
| - case GL_RG16UI:
|
| - case GL_RG16I:
|
| - case GL_RG32UI:
|
| - case GL_RG32I:
|
| - case GL_RGB8:
|
| - case GL_RGB565:
|
| - case GL_RGBA8:
|
| - case GL_SRGB8_ALPHA8:
|
| - case GL_RGB5_A1:
|
| - case GL_RGBA4:
|
| - case GL_RGB10_A2:
|
| - case GL_RGBA8UI:
|
| - case GL_RGBA8I:
|
| - case GL_RGB10_A2UI:
|
| - case GL_RGBA16UI:
|
| - case GL_RGBA16I:
|
| - case GL_RGBA32UI:
|
| - case GL_RGBA32I:
|
| - return true;
|
| - default:
|
| - return false;
|
| - }
|
| +bool isColorRenderable(GLenum internalformat)
|
| +{
|
| + switch (internalformat) {
|
| + case GL_RGB:
|
| + case GL_RGBA:
|
| + case GL_SRGB_ALPHA_EXT:
|
| + case GL_R8:
|
| + case GL_R8UI:
|
| + case GL_R8I:
|
| + case GL_R16UI:
|
| + case GL_R16I:
|
| + case GL_R32UI:
|
| + case GL_R32I:
|
| + case GL_RG8:
|
| + case GL_RG8UI:
|
| + case GL_RG8I:
|
| + case GL_RG16UI:
|
| + case GL_RG16I:
|
| + case GL_RG32UI:
|
| + case GL_RG32I:
|
| + case GL_RGB8:
|
| + case GL_RGB565:
|
| + case GL_RGBA8:
|
| + case GL_SRGB8_ALPHA8:
|
| + case GL_RGB5_A1:
|
| + case GL_RGBA4:
|
| + case GL_RGB10_A2:
|
| + case GL_RGBA8UI:
|
| + case GL_RGBA8I:
|
| + case GL_RGB10_A2UI:
|
| + case GL_RGBA16UI:
|
| + case GL_RGBA16I:
|
| + case GL_RGBA32UI:
|
| + case GL_RGBA32I:
|
| + return true;
|
| + default:
|
| + return false;
|
| }
|
| +}
|
|
|
| - bool isDepthRenderable(GLenum internalformat, bool includesDepthStencil)
|
| - {
|
| - switch (internalformat) {
|
| - case GL_DEPTH_COMPONENT:
|
| - case GL_DEPTH_COMPONENT16:
|
| - case GL_DEPTH_COMPONENT24:
|
| - case GL_DEPTH_COMPONENT32F:
|
| - return true;
|
| - case GL_DEPTH_STENCIL:
|
| - case GL_DEPTH24_STENCIL8:
|
| - case GL_DEPTH32F_STENCIL8:
|
| - return includesDepthStencil;
|
| - default:
|
| - return false;
|
| - }
|
| +bool isDepthRenderable(GLenum internalformat, bool includesDepthStencil)
|
| +{
|
| + switch (internalformat) {
|
| + case GL_DEPTH_COMPONENT:
|
| + case GL_DEPTH_COMPONENT16:
|
| + case GL_DEPTH_COMPONENT24:
|
| + case GL_DEPTH_COMPONENT32F:
|
| + return true;
|
| + case GL_DEPTH_STENCIL:
|
| + case GL_DEPTH24_STENCIL8:
|
| + case GL_DEPTH32F_STENCIL8:
|
| + return includesDepthStencil;
|
| + default:
|
| + return false;
|
| }
|
| +}
|
|
|
| - bool isStencilRenderable(GLenum internalformat, bool includesDepthStencil)
|
| - {
|
| - switch (internalformat) {
|
| - case GL_STENCIL_INDEX8:
|
| - return true;
|
| - case GL_DEPTH_STENCIL:
|
| - case GL_DEPTH24_STENCIL8:
|
| - case GL_DEPTH32F_STENCIL8:
|
| - return includesDepthStencil;
|
| - default:
|
| - return false;
|
| - }
|
| +bool isStencilRenderable(GLenum internalformat, bool includesDepthStencil)
|
| +{
|
| + switch (internalformat) {
|
| + case GL_STENCIL_INDEX8:
|
| + return true;
|
| + case GL_DEPTH_STENCIL:
|
| + case GL_DEPTH24_STENCIL8:
|
| + case GL_DEPTH32F_STENCIL8:
|
| + return includesDepthStencil;
|
| + default:
|
| + return false;
|
| }
|
| +}
|
|
|
| } // anonymous namespace
|
|
|
|
|