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 ...@@ -84,7 +84,7 @@ const FramebufferAttachment *Framebuffer::Data::getDepthOrStencilAttachment() co
return nullptr; return nullptr;
} }
FramebufferAttachment *Framebuffer::Data::getColorAttachment(unsigned int colorAttachment) const FramebufferAttachment *Framebuffer::Data::getColorAttachment(unsigned int colorAttachment) const
{ {
ASSERT(colorAttachment < mColorAttachments.size()); ASSERT(colorAttachment < mColorAttachments.size());
return mColorAttachments[colorAttachment].isAttached() ? return mColorAttachments[colorAttachment].isAttached() ?
...@@ -92,32 +92,17 @@ FramebufferAttachment *Framebuffer::Data::getColorAttachment(unsigned int colorA ...@@ -92,32 +92,17 @@ FramebufferAttachment *Framebuffer::Data::getColorAttachment(unsigned int colorA
nullptr; 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 const FramebufferAttachment *Framebuffer::Data::getDepthAttachment() const
{ {
return const_cast<Framebuffer::Data *>(this)->getDepthAttachment(); return mDepthAttachment.isAttached() ? &mDepthAttachment : nullptr;
}
FramebufferAttachment *Framebuffer::Data::getStencilAttachment()
{
return mStencilAttachment.isAttached() ? &mStencilAttachment : nullptr;
} }
const FramebufferAttachment *Framebuffer::Data::getStencilAttachment() const 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 // A valid depth-stencil attachment has the same resource bound to both the
// depth and stencil attachment points. // depth and stencil attachment points.
...@@ -131,11 +116,6 @@ FramebufferAttachment *Framebuffer::Data::getDepthStencilAttachment() ...@@ -131,11 +116,6 @@ FramebufferAttachment *Framebuffer::Data::getDepthStencilAttachment()
return nullptr; 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) Framebuffer::Framebuffer(const Caps &caps, rx::ImplFactory *factory, GLuint id)
: mData(caps), : mData(caps),
mImpl(nullptr), mImpl(nullptr),
...@@ -178,41 +158,21 @@ void Framebuffer::detachResourceById(GLenum resourceType, GLuint resourceId) ...@@ -178,41 +158,21 @@ void Framebuffer::detachResourceById(GLenum resourceType, GLuint resourceId)
DetachMatchingAttachment(&mData.mStencilAttachment, resourceType, resourceId); DetachMatchingAttachment(&mData.mStencilAttachment, resourceType, resourceId);
} }
FramebufferAttachment *Framebuffer::getColorbuffer(unsigned int colorAttachment)
{
return mData.getColorAttachment(colorAttachment);
}
const FramebufferAttachment *Framebuffer::getColorbuffer(unsigned int colorAttachment) const const FramebufferAttachment *Framebuffer::getColorbuffer(unsigned int colorAttachment) const
{ {
return mData.getColorAttachment(colorAttachment); return mData.getColorAttachment(colorAttachment);
} }
FramebufferAttachment *Framebuffer::getDepthbuffer()
{
return mData.getDepthAttachment();
}
const FramebufferAttachment *Framebuffer::getDepthbuffer() const const FramebufferAttachment *Framebuffer::getDepthbuffer() const
{ {
return mData.getDepthAttachment(); return mData.getDepthAttachment();
} }
FramebufferAttachment *Framebuffer::getStencilbuffer()
{
return mData.getStencilAttachment();
}
const FramebufferAttachment *Framebuffer::getStencilbuffer() const const FramebufferAttachment *Framebuffer::getStencilbuffer() const
{ {
return mData.getStencilAttachment(); return mData.getStencilAttachment();
} }
FramebufferAttachment *Framebuffer::getDepthStencilBuffer()
{
return mData.getDepthStencilAttachment();
}
const FramebufferAttachment *Framebuffer::getDepthStencilBuffer() const const FramebufferAttachment *Framebuffer::getDepthStencilBuffer() const
{ {
return mData.getDepthStencilAttachment(); return mData.getDepthStencilAttachment();
...@@ -243,7 +203,7 @@ const FramebufferAttachment *Framebuffer::getAttachment(GLenum attachment) const ...@@ -243,7 +203,7 @@ const FramebufferAttachment *Framebuffer::getAttachment(GLenum attachment) const
{ {
if (attachment >= GL_COLOR_ATTACHMENT0 && attachment <= GL_COLOR_ATTACHMENT15) if (attachment >= GL_COLOR_ATTACHMENT0 && attachment <= GL_COLOR_ATTACHMENT15)
{ {
return getColorbuffer(attachment - GL_COLOR_ATTACHMENT0); return mData.getColorAttachment(attachment - GL_COLOR_ATTACHMENT0);
} }
else else
{ {
...@@ -251,13 +211,13 @@ const FramebufferAttachment *Framebuffer::getAttachment(GLenum attachment) const ...@@ -251,13 +211,13 @@ const FramebufferAttachment *Framebuffer::getAttachment(GLenum attachment) const
{ {
case GL_COLOR: case GL_COLOR:
case GL_BACK: case GL_BACK:
return getColorbuffer(0); return mData.getColorAttachment(0);
case GL_DEPTH: case GL_DEPTH:
case GL_DEPTH_ATTACHMENT: case GL_DEPTH_ATTACHMENT:
return getDepthbuffer(); return mData.getDepthAttachment();
case GL_STENCIL: case GL_STENCIL:
case GL_STENCIL_ATTACHMENT: case GL_STENCIL_ATTACHMENT:
return getStencilbuffer(); return mData.getStencilAttachment();
case GL_DEPTH_STENCIL: case GL_DEPTH_STENCIL:
case GL_DEPTH_STENCIL_ATTACHMENT: case GL_DEPTH_STENCIL_ATTACHMENT:
return getDepthStencilBuffer(); return getDepthStencilBuffer();
......
...@@ -66,10 +66,6 @@ class Framebuffer ...@@ -66,10 +66,6 @@ class Framebuffer
private: private:
friend class Framebuffer; friend class Framebuffer;
FramebufferAttachment *getColorAttachment(unsigned int colorAttachment);
FramebufferAttachment *getDepthAttachment();
FramebufferAttachment *getStencilAttachment();
FramebufferAttachment *getDepthStencilAttachment();
std::vector<FramebufferAttachment> mColorAttachments; std::vector<FramebufferAttachment> mColorAttachments;
FramebufferAttachment mDepthAttachment; FramebufferAttachment mDepthAttachment;
...@@ -96,13 +92,9 @@ class Framebuffer ...@@ -96,13 +92,9 @@ class Framebuffer
void detachTexture(GLuint texture); void detachTexture(GLuint texture);
void detachRenderbuffer(GLuint renderbuffer); void detachRenderbuffer(GLuint renderbuffer);
FramebufferAttachment *getColorbuffer(unsigned int colorAttachment);
const FramebufferAttachment *getColorbuffer(unsigned int colorAttachment) const; const FramebufferAttachment *getColorbuffer(unsigned int colorAttachment) const;
FramebufferAttachment *getDepthbuffer();
const FramebufferAttachment *getDepthbuffer() const; const FramebufferAttachment *getDepthbuffer() const;
FramebufferAttachment *getStencilbuffer();
const FramebufferAttachment *getStencilbuffer() const; const FramebufferAttachment *getStencilbuffer() const;
FramebufferAttachment *getDepthStencilBuffer();
const FramebufferAttachment *getDepthStencilBuffer() const; const FramebufferAttachment *getDepthStencilBuffer() const;
const FramebufferAttachment *getDepthOrStencilbuffer() const; const FramebufferAttachment *getDepthOrStencilbuffer() const;
const FramebufferAttachment *getReadColorbuffer() const; const FramebufferAttachment *getReadColorbuffer() const;
......
...@@ -1286,8 +1286,8 @@ void State::getIntegerv(const gl::Data &data, GLenum pname, GLint *params) ...@@ -1286,8 +1286,8 @@ void State::getIntegerv(const gl::Data &data, GLenum pname, GLint *params)
break; break;
case GL_DEPTH_BITS: case GL_DEPTH_BITS:
{ {
gl::Framebuffer *framebuffer = getDrawFramebuffer(); const gl::Framebuffer *framebuffer = getDrawFramebuffer();
gl::FramebufferAttachment *depthbuffer = framebuffer->getDepthbuffer(); const gl::FramebufferAttachment *depthbuffer = framebuffer->getDepthbuffer();
if (depthbuffer) if (depthbuffer)
{ {
...@@ -1301,8 +1301,8 @@ void State::getIntegerv(const gl::Data &data, GLenum pname, GLint *params) ...@@ -1301,8 +1301,8 @@ void State::getIntegerv(const gl::Data &data, GLenum pname, GLint *params)
break; break;
case GL_STENCIL_BITS: case GL_STENCIL_BITS:
{ {
gl::Framebuffer *framebuffer = getDrawFramebuffer(); const gl::Framebuffer *framebuffer = getDrawFramebuffer();
gl::FramebufferAttachment *stencilbuffer = framebuffer->getStencilbuffer(); const gl::FramebufferAttachment *stencilbuffer = framebuffer->getStencilbuffer();
if (stencilbuffer) if (stencilbuffer)
{ {
......
...@@ -498,8 +498,8 @@ bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint ...@@ -498,8 +498,8 @@ bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint
return false; return false;
} }
gl::Framebuffer *readFramebuffer = context->getState().getReadFramebuffer(); const gl::Framebuffer *readFramebuffer = context->getState().getReadFramebuffer();
gl::Framebuffer *drawFramebuffer = context->getState().getDrawFramebuffer(); const gl::Framebuffer *drawFramebuffer = context->getState().getDrawFramebuffer();
if (!readFramebuffer || !drawFramebuffer) if (!readFramebuffer || !drawFramebuffer)
{ {
...@@ -597,7 +597,7 @@ bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint ...@@ -597,7 +597,7 @@ bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint
{ {
if (drawFramebuffer->isEnabledColorAttachment(colorAttachment)) if (drawFramebuffer->isEnabledColorAttachment(colorAttachment))
{ {
FramebufferAttachment *attachment = drawFramebuffer->getColorbuffer(colorAttachment); const FramebufferAttachment *attachment = drawFramebuffer->getColorbuffer(colorAttachment);
ASSERT(attachment); ASSERT(attachment);
if (!(attachment->type() == GL_TEXTURE && attachment->getTextureImageIndex().type == GL_TEXTURE_2D) && if (!(attachment->type() == GL_TEXTURE && attachment->getTextureImageIndex().type == GL_TEXTURE_2D) &&
......
...@@ -1922,7 +1922,7 @@ void GL_APIENTRY GetFramebufferAttachmentParameteriv(GLenum target, GLenum attac ...@@ -1922,7 +1922,7 @@ void GL_APIENTRY GetFramebufferAttachmentParameteriv(GLenum target, GLenum attac
break; break;
} }
Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); const Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target);
ASSERT(framebuffer); ASSERT(framebuffer);
if (framebuffer->id() == 0) 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