Commit e3ef715d by Jamie Madill

Revert "Revert "Remove non-const FBO attachment queries.""

Fixed build errors in prior patch. This reverts commit 34771622. Change-Id: I909b455f2c632a3df7d97149972e167c2adb058f Reviewed-on: https://chromium-review.googlesource.com/267599Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 3fe36ebd
......@@ -84,7 +84,7 @@ const FramebufferAttachment *Framebuffer::Data::getDepthOrStencilAttachment() co
return nullptr;
}
FramebufferAttachment *Framebuffer::Data::getColorAttachment(unsigned int colorAttachment)
const FramebufferAttachment *Framebuffer::Data::getColorAttachment(unsigned int colorAttachment) const
{
ASSERT(colorAttachment < mColorAttachments.size());
return mColorAttachments[colorAttachment].isAttached() ?
......@@ -92,32 +92,17 @@ FramebufferAttachment *Framebuffer::Data::getColorAttachment(unsigned int colorA
nullptr;
}
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::getDepthAttachment() const
{
return const_cast<Framebuffer::Data *>(this)->getDepthAttachment();
}
FramebufferAttachment *Framebuffer::Data::getStencilAttachment()
{
return mStencilAttachment.isAttached() ? &mStencilAttachment : nullptr;
return mDepthAttachment.isAttached() ? &mDepthAttachment : nullptr;
}
const FramebufferAttachment *Framebuffer::Data::getStencilAttachment() const
{
return const_cast<Framebuffer::Data *>(this)->getStencilAttachment();
return mStencilAttachment.isAttached() ? &mStencilAttachment : nullptr;
}
FramebufferAttachment *Framebuffer::Data::getDepthStencilAttachment()
const FramebufferAttachment *Framebuffer::Data::getDepthStencilAttachment() const
{
// A valid depth-stencil attachment has the same resource bound to both the
// depth and stencil attachment points.
......@@ -131,11 +116,6 @@ FramebufferAttachment *Framebuffer::Data::getDepthStencilAttachment()
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),
......@@ -178,41 +158,21 @@ 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();
......@@ -243,7 +203,7 @@ const FramebufferAttachment *Framebuffer::getAttachment(GLenum attachment) const
{
if (attachment >= GL_COLOR_ATTACHMENT0 && attachment <= GL_COLOR_ATTACHMENT15)
{
return getColorbuffer(attachment - GL_COLOR_ATTACHMENT0);
return mData.getColorAttachment(attachment - GL_COLOR_ATTACHMENT0);
}
else
{
......@@ -251,13 +211,13 @@ const FramebufferAttachment *Framebuffer::getAttachment(GLenum attachment) const
{
case GL_COLOR:
case GL_BACK:
return getColorbuffer(0);
return mData.getColorAttachment(0);
case GL_DEPTH:
case GL_DEPTH_ATTACHMENT:
return getDepthbuffer();
return mData.getDepthAttachment();
case GL_STENCIL:
case GL_STENCIL_ATTACHMENT:
return getStencilbuffer();
return mData.getStencilAttachment();
case GL_DEPTH_STENCIL:
case GL_DEPTH_STENCIL_ATTACHMENT:
return getDepthStencilBuffer();
......
......@@ -66,10 +66,6 @@ class Framebuffer
private:
friend class Framebuffer;
FramebufferAttachment *getColorAttachment(unsigned int colorAttachment);
FramebufferAttachment *getDepthAttachment();
FramebufferAttachment *getStencilAttachment();
FramebufferAttachment *getDepthStencilAttachment();
std::vector<FramebufferAttachment> mColorAttachments;
FramebufferAttachment mDepthAttachment;
......@@ -96,13 +92,9 @@ 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;
......
......@@ -1286,8 +1286,8 @@ void State::getIntegerv(const gl::Data &data, GLenum pname, GLint *params)
break;
case GL_DEPTH_BITS:
{
gl::Framebuffer *framebuffer = getDrawFramebuffer();
gl::FramebufferAttachment *depthbuffer = framebuffer->getDepthbuffer();
const gl::Framebuffer *framebuffer = getDrawFramebuffer();
const gl::FramebufferAttachment *depthbuffer = framebuffer->getDepthbuffer();
if (depthbuffer)
{
......@@ -1301,8 +1301,8 @@ void State::getIntegerv(const gl::Data &data, GLenum pname, GLint *params)
break;
case GL_STENCIL_BITS:
{
gl::Framebuffer *framebuffer = getDrawFramebuffer();
gl::FramebufferAttachment *stencilbuffer = framebuffer->getStencilbuffer();
const gl::Framebuffer *framebuffer = getDrawFramebuffer();
const gl::FramebufferAttachment *stencilbuffer = framebuffer->getStencilbuffer();
if (stencilbuffer)
{
......
......@@ -498,8 +498,8 @@ bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint
return false;
}
gl::Framebuffer *readFramebuffer = context->getState().getReadFramebuffer();
gl::Framebuffer *drawFramebuffer = context->getState().getDrawFramebuffer();
const gl::Framebuffer *readFramebuffer = context->getState().getReadFramebuffer();
const 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))
{
FramebufferAttachment *attachment = drawFramebuffer->getColorbuffer(colorAttachment);
const 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;
}
Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target);
const 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