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 ed61a5f673cefe1fac580e96adaa3da698d448e3.
Change-Id: I602bffc96f77cffa217cb63a5cc3caf334fd9879
Reviewed-on: https://chromium-review.googlesource.com/266652
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/Framebuffer.cpp b/src/libANGLE/Framebuffer.cpp
index 2aadbf6..3e005b3 100644
--- a/src/libANGLE/Framebuffer.cpp
+++ b/src/libANGLE/Framebuffer.cpp
@@ -84,7 +84,7 @@
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 @@
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 @@
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 @@
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 @@
{
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 @@
{
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();