Commit 086d59ae by Corentin Wallez

In ES3, validate that depth and stencil are the same image

BUG=605775 Change-Id: I9508c70a588270dae871dde79fea1df1c3fd1558 Reviewed-on: https://chromium-review.googlesource.com/341440Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
parent 76287680
...@@ -575,6 +575,13 @@ GLenum Framebuffer::checkStatus(const ContextState &data) const ...@@ -575,6 +575,13 @@ GLenum Framebuffer::checkStatus(const ContextState &data) const
{ {
return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE; return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE;
} }
// Starting from ES 3.0 stencil and depth, if present, should be the same image
if (data.clientVersion >= 3 && depthAttachment.isAttached() &&
stencilAttachment != depthAttachment)
{
return GL_FRAMEBUFFER_UNSUPPORTED;
}
} }
// we need to have at least one attachment to be complete // we need to have at least one attachment to be complete
......
...@@ -205,4 +205,24 @@ const egl::Surface *FramebufferAttachment::getSurface() const ...@@ -205,4 +205,24 @@ const egl::Surface *FramebufferAttachment::getSurface() const
return rx::GetAs<egl::Surface>(mResource); return rx::GetAs<egl::Surface>(mResource);
} }
bool FramebufferAttachment::operator==(const FramebufferAttachment &other) const
{
if (mResource != other.mResource || mType != other.mType)
{
return false;
}
if (mType == GL_TEXTURE && getTextureImageIndex() != other.getTextureImageIndex())
{
return false;
}
return true;
}
bool FramebufferAttachment::operator!=(const FramebufferAttachment &other) const
{
return !(*this == other);
}
} }
...@@ -136,6 +136,9 @@ class FramebufferAttachment final ...@@ -136,6 +136,9 @@ class FramebufferAttachment final
return error; return error;
} }
bool operator==(const FramebufferAttachment &other) const;
bool operator!=(const FramebufferAttachment &other) const;
private: private:
gl::Error getRenderTarget(rx::FramebufferAttachmentRenderTarget **rtOut) const; gl::Error getRenderTarget(rx::FramebufferAttachmentRenderTarget **rtOut) const;
......
...@@ -78,6 +78,16 @@ bool ImageIndex::operator<(const ImageIndex &other) const ...@@ -78,6 +78,16 @@ bool ImageIndex::operator<(const ImageIndex &other) const
} }
} }
bool ImageIndex::operator==(const ImageIndex &other) const
{
return (type == other.type) && (mipIndex == other.mipIndex) && (layerIndex == other.layerIndex);
}
bool ImageIndex::operator!=(const ImageIndex &other) const
{
return !(*this == other);
}
ImageIndex::ImageIndex(GLenum typeIn, GLint mipIndexIn, GLint layerIndexIn) ImageIndex::ImageIndex(GLenum typeIn, GLint mipIndexIn, GLint layerIndexIn)
: type(typeIn), : type(typeIn),
mipIndex(mipIndexIn), mipIndex(mipIndexIn),
......
...@@ -40,6 +40,8 @@ struct ImageIndex ...@@ -40,6 +40,8 @@ struct ImageIndex
static const GLint ENTIRE_LEVEL = static_cast<GLint>(-1); static const GLint ENTIRE_LEVEL = static_cast<GLint>(-1);
bool operator<(const ImageIndex &other) const; bool operator<(const ImageIndex &other) const;
bool operator==(const ImageIndex &other) const;
bool operator!=(const ImageIndex &other) const;
private: private:
friend class ImageIndexIterator; friend class ImageIndexIterator;
......
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