Bug 1049960 - WebGL generate invalid operation errors when copyTex[Sub]Image2D is called with a format that is not a subset of the FBO format. r=jgilbert

This commit is contained in:
Walter Litwinczyk
2014-08-20 13:38:42 -07:00
parent a189bdc696
commit 80768080f8
7 changed files with 146 additions and 41 deletions

View File

@@ -76,6 +76,26 @@ WebGLFramebuffer::Attachment::HasAlpha() const
return FormatHasAlpha(format);
}
GLenum
WebGLFramebuffer::GetFormatForAttachment(const WebGLFramebuffer::Attachment& attachment) const
{
MOZ_ASSERT(attachment.IsDefined());
MOZ_ASSERT(attachment.Texture() || attachment.Renderbuffer());
if (attachment.Texture()) {
const WebGLTexture& tex = *attachment.Texture();
MOZ_ASSERT(tex.HasImageInfoAt(tex.Target(), 0));
const WebGLTexture::ImageInfo& imgInfo = tex.ImageInfoAt(tex.Target(), 0);
return imgInfo.WebGLFormat();
}
if (attachment.Renderbuffer())
return attachment.Renderbuffer()->InternalFormat();
return LOCAL_GL_NONE;
}
bool
WebGLFramebuffer::Attachment::IsReadableFloat() const
{