Commit 699e4fdf authored by qiankun.miao's avatar qiankun.miao Committed by Commit bot

Check framebuffer texture attachments are cube complete

BUG=559362
TEST=conformance/textures/misc/cube-incomplete-fbo.html

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

Cr-Commit-Position: refs/heads/master@{#361397}
parent 04b1c397
......@@ -50,6 +50,7 @@ private:
GLsizei height() const override;
GLenum format() const override;
GLenum type() const override;
bool isCubeComplete() const override;
WebGLSharedObject* object() const override;
bool isSharedObject(WebGLSharedObject*) const override;
bool valid() const override;
......@@ -143,6 +144,12 @@ GLenum WebGLRenderbufferAttachment::type() const
return WebGLTexture::getValidTypeForInternalFormat(m_renderbuffer->internalFormat());
}
bool WebGLRenderbufferAttachment::isCubeComplete() const
{
ASSERT_NOT_REACHED();
return false;
}
class WebGLTextureAttachment final : public WebGLFramebuffer::WebGLAttachment {
public:
static WebGLFramebuffer::WebGLAttachment* create(WebGLTexture*, GLenum target, GLint level, GLint layer);
......@@ -157,6 +164,7 @@ private:
GLsizei height() const override;
GLenum format() const override;
GLenum type() const override;
bool isCubeComplete() const override;
WebGLSharedObject* object() const override;
bool isSharedObject(WebGLSharedObject*) const override;
bool valid() const override;
......@@ -254,6 +262,11 @@ GLenum WebGLTextureAttachment::type() const
return m_texture->getType(m_target, m_level);
}
bool WebGLTextureAttachment::isCubeComplete() const
{
return m_texture->isCubeComplete();
}
bool isColorRenderable(GLenum internalformat, bool includesFloat)
{
switch (internalformat) {
......@@ -450,6 +463,12 @@ bool WebGLFramebuffer::isAttachmentComplete(WebGLAttachment* attachedObject, GLe
*reason = "attachment has a 0 dimension";
return false;
}
if (attachedObject->object()->isTexture() && !attachedObject->isCubeComplete()) {
*reason = "attachment is not cube complete";
return false;
}
return true;
}
......
......@@ -49,6 +49,7 @@ public:
// To avoid confusion, it would be better to not implement type() for renderbuffer attachment and
// we should always use the internalformat of the renderbuffer and avoid using type() API.
virtual GLenum type() const = 0;
virtual bool isCubeComplete() const = 0;
virtual WebGLSharedObject* object() const = 0;
virtual bool isSharedObject(WebGLSharedObject*) const = 0;
virtual bool valid() const = 0;
......
......@@ -68,6 +68,8 @@ public:
static GLenum getValidFormatForInternalFormat(GLenum);
bool isCubeComplete() const { return m_isCubeComplete; }
// Whether width/height is NotPowerOfTwo.
static bool isNPOT(GLsizei, GLsizei);
......
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