Commit 34771622 by Jamie Madill

Revert "Remove non-const FBO attachment queries."

Compile errors on Mac: In file included from ../../third_party/angle/src/libANGLE/Framebuffer.cpp:10: In file included from ../../third_party/angle/src/libANGLE/Framebuffer.h:13: In file included from /Applications/Xcode5.1.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/vector:68: /Applications/Xcode5.1.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/bits/stl_construct.h:81:38: error: call to implicitly-deleted copy constructor of 'gl::FramebufferAttachment' ::new(static_cast<void*>(__p)) _T1(__value); ^ ~~~~~~~ This reverts commit ed61a5f6. Change-Id: I602bffc96f77cffa217cb63a5cc3caf334fd9879 Reviewed-on: https://chromium-review.googlesource.com/266652Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent ed61a5f6
......@@ -84,7 +84,7 @@ const FramebufferAttachment *Framebuffer::Data::getDepthOrStencilAttachment() co
return nullptr;
}
const FramebufferAttachment *Framebuffer::Data::getColorAttachment(unsigned int colorAttachment) const
FramebufferAttachment *Framebuffer::Data::getColorAttachment(unsigned int colorAttachment)
{
ASSERT(colorAttachment < mColorAttachments.size());
return mColorAttachments[colorAttachment].isAttached() ?
......@@ -92,17 +92,32 @@ const FramebufferAttachment *Framebuffer::Data::getColorAttachment(unsigned int
nullptr;
}
const FramebufferAttachment *Framebuffer::Data::getDepthAttachment() const
const FramebufferAttachment *Framebuffer::Data::getColorAttachment(unsigned int colorAttachment) const
{
return const_cast<Framebuffer::Data *>(this)->getColorAttachment(colorAttachment);
}
FramebufferAttachment *Framebuffer::Data::getDepthAttachment()
{
return mDepthAttachment.isAttached() ? &mDepthAttachment : nullptr;
}
const FramebufferAttachment *Framebuffer::Data::getStencilAttachment() const
const FramebufferAttachment *Framebuffer::Data::getDepthAttachment() const
{
return const_cast<Framebuffer::Data *>(this)->getDepthAttachment();
}
FramebufferAttachment *Framebuffer::Data::getStencilAttachment()
{
return mStencilAttachment.isAttached() ? &mStencilAttachment : nullptr;
}
const FramebufferAttachment *Framebuffer::Data::getDepthStencilAttachment() const
const FramebufferAttachment *Framebuffer::Data::getStencilAttachment() const
{
return const_cast<Framebuffer::Data *>(this)->getStencilAttachment();
}
FramebufferAttachment *Framebuffer::Data::getDepthStencilAttachment()
{
// A valid depth-stencil attachment has the same resource bound to both the
// depth and stencil attachment points.
......@@ -116,6 +131,11 @@ const FramebufferAttachment *Framebuffer::Data::getDepthStencilAttachment() cons
return nullptr;
}
const FramebufferAttachment *Framebuffer::Data::getDepthStencilAttachment() const
{
return const_cast<Framebuffer::Data *>(this)->getDepthStencilAttachment();
}
Framebuffer::Framebuffer(const Caps &caps, rx::ImplFactory *factory, GLuint id)
: mData(caps),
mImpl(nullptr),
......@@ -158,21 +178,41 @@ void Framebuffer::detachResourceById(GLenum resourceType, GLuint resourceId)
DetachMatchingAttachment(&mData.mStencilAttachment, resourceType, resourceId);
}
FramebufferAttachment *Framebuffer::getColorbuffer(unsigned int colorAttachment)
{
return mData.getColorAttachment(colorAttachment);
}
const FramebufferAttachment *Framebuffer::getColorbuffer(unsigned int colorAttachment) const
{
return mData.getColorAttachment(colorAttachment);
}
FramebufferAttachment *Framebuffer::getDepthbuffer()
{
return mData.getDepthAttachment();
}
const FramebufferAttachment *Framebuffer::getDepthbuffer() const
{
return mData.getDepthAttachment();
}
FramebufferAttachment *Framebuffer::getStencilbuffer()
{
return mData.getStencilAttachment();
}
const FramebufferAttachment *Framebuffer::getStencilbuffer() const
{
return mData.getStencilAttachment();
}
FramebufferAttachment *Framebuffer::getDepthStencilBuffer()
{
return mData.getDepthStencilAttachment();
}
const FramebufferAttachment *Framebuffer::getDepthStencilBuffer() const
{
return mData.getDepthStencilAttachment();
......@@ -203,7 +243,7 @@ const FramebufferAttachment *Framebuffer::getAttachment(GLenum attachment) const
{
if (attachment >= GL_COLOR_ATTACHMENT0 && attachment <= GL_COLOR_ATTACHMENT15)
{
return mData.getColorAttachment(attachment - GL_COLOR_ATTACHMENT0);
return getColorbuffer(attachment - GL_COLOR_ATTACHMENT0);
}
else
{
......@@ -211,13 +251,13 @@ const FramebufferAttachment *Framebuffer::getAttachment(GLenum attachment) const
{
case GL_COLOR:
case GL_BACK:
return mData.getColorAttachment(0);
return getColorbuffer(0);
case GL_DEPTH:
case GL_DEPTH_ATTACHMENT:
return mData.getDepthAttachment();
return getDepthbuffer();
case GL_STENCIL:
case GL_STENCIL_ATTACHMENT:
return mData.getStencilAttachment();
return getStencilbuffer();
case GL_DEPTH_STENCIL:
case GL_DEPTH_STENCIL_ATTACHMENT:
return getDepthStencilBuffer();
......
......@@ -66,6 +66,10 @@ class Framebuffer
private:
friend class Framebuffer;
FramebufferAttachment *getColorAttachment(unsigned int colorAttachment);
FramebufferAttachment *getDepthAttachment();
FramebufferAttachment *getStencilAttachment();
FramebufferAttachment *getDepthStencilAttachment();
std::vector<FramebufferAttachment> mColorAttachments;
FramebufferAttachment mDepthAttachment;
......@@ -92,9 +96,13 @@ class Framebuffer
void detachTexture(GLuint texture);
void detachRenderbuffer(GLuint renderbuffer);
FramebufferAttachment *getColorbuffer(unsigned int colorAttachment);
const FramebufferAttachment *getColorbuffer(unsigned int colorAttachment) const;
FramebufferAttachment *getDepthbuffer();
const FramebufferAttachment *getDepthbuffer() const;
FramebufferAttachment *getStencilbuffer();
const FramebufferAttachment *getStencilbuffer() const;
FramebufferAttachment *getDepthStencilBuffer();
const FramebufferAttachment *getDepthStencilBuffer() const;
const FramebufferAttachment *getDepthOrStencilbuffer() const;
const FramebufferAttachment *getReadColorbuffer() const;
......
......@@ -1275,8 +1275,8 @@ void State::getIntegerv(const gl::Data &data, GLenum pname, GLint *params)
break;
case GL_DEPTH_BITS:
{
const gl::Framebuffer *framebuffer = getDrawFramebuffer();
const gl::FramebufferAttachment *depthbuffer = framebuffer->getDepthbuffer();
gl::Framebuffer *framebuffer = getDrawFramebuffer();
gl::FramebufferAttachment *depthbuffer = framebuffer->getDepthbuffer();
if (depthbuffer)
{
......@@ -1290,8 +1290,8 @@ void State::getIntegerv(const gl::Data &data, GLenum pname, GLint *params)
break;
case GL_STENCIL_BITS:
{
const gl::Framebuffer *framebuffer = getDrawFramebuffer();
const gl::FramebufferAttachment *stencilbuffer = framebuffer->getStencilbuffer();
gl::Framebuffer *framebuffer = getDrawFramebuffer();
gl::FramebufferAttachment *stencilbuffer = framebuffer->getStencilbuffer();
if (stencilbuffer)
{
......
......@@ -498,8 +498,8 @@ bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint
return false;
}
const gl::Framebuffer *readFramebuffer = context->getState().getReadFramebuffer();
const gl::Framebuffer *drawFramebuffer = context->getState().getDrawFramebuffer();
gl::Framebuffer *readFramebuffer = context->getState().getReadFramebuffer();
gl::Framebuffer *drawFramebuffer = context->getState().getDrawFramebuffer();
if (!readFramebuffer || !drawFramebuffer)
{
......@@ -597,7 +597,7 @@ bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint
{
if (drawFramebuffer->isEnabledColorAttachment(colorAttachment))
{
const FramebufferAttachment *attachment = drawFramebuffer->getColorbuffer(colorAttachment);
FramebufferAttachment *attachment = drawFramebuffer->getColorbuffer(colorAttachment);
ASSERT(attachment);
if (!(attachment->type() == GL_TEXTURE && attachment->getTextureImageIndex().type == GL_TEXTURE_2D) &&
......
......@@ -1922,7 +1922,7 @@ void GL_APIENTRY GetFramebufferAttachmentParameteriv(GLenum target, GLenum attac
break;
}
const Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target);
Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target);
ASSERT(framebuffer);
if (framebuffer->id() == 0)
......
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