Commit b6bda4af by Jamie Madill

Make Framebuffer::Data members private.

This makes "Data" a proper class, and enforces access control when used in FramebufferImpl. This gives a cleaner refactor when we switch the internals of the class to use value types to store attachments instead of pointer types. BUG=angleproject:963 Change-Id: If825095458eaf9367f616f0bb54084025efb9882 Reviewed-on: https://chromium-review.googlesource.com/265937Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarBrandon Jones <bajones@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent ad0a486b
......@@ -56,7 +56,7 @@ Framebuffer::Data::~Data()
SafeDelete(mStencilAttachment);
}
FramebufferAttachment *Framebuffer::Data::getReadAttachment() const
const FramebufferAttachment *Framebuffer::Data::getReadAttachment() const
{
ASSERT(mReadBufferState == GL_BACK || (mReadBufferState >= GL_COLOR_ATTACHMENT0 && mReadBufferState <= GL_COLOR_ATTACHMENT15));
size_t readIndex = (mReadBufferState == GL_BACK ? 0 : static_cast<size_t>(mReadBufferState - GL_COLOR_ATTACHMENT0));
......@@ -64,7 +64,7 @@ FramebufferAttachment *Framebuffer::Data::getReadAttachment() const
return mColorAttachments[readIndex];
}
FramebufferAttachment *Framebuffer::Data::getFirstColorAttachment() const
const FramebufferAttachment *Framebuffer::Data::getFirstColorAttachment() const
{
for (FramebufferAttachment *colorAttachment : mColorAttachments)
{
......@@ -77,11 +77,61 @@ FramebufferAttachment *Framebuffer::Data::getFirstColorAttachment() const
return nullptr;
}
FramebufferAttachment *Framebuffer::Data::getDepthOrStencilAttachment() const
const FramebufferAttachment *Framebuffer::Data::getDepthOrStencilAttachment() const
{
return (mDepthAttachment != nullptr ? mDepthAttachment : mStencilAttachment);
}
FramebufferAttachment *Framebuffer::Data::getColorAttachment(unsigned int colorAttachment)
{
ASSERT(colorAttachment < mColorAttachments.size());
return mColorAttachments[colorAttachment];
}
const FramebufferAttachment *Framebuffer::Data::getColorAttachment(unsigned int colorAttachment) const
{
return const_cast<Framebuffer::Data *>(this)->getColorAttachment(colorAttachment);
}
FramebufferAttachment *Framebuffer::Data::getDepthAttachment()
{
return mDepthAttachment;
}
const FramebufferAttachment *Framebuffer::Data::getDepthAttachment() const
{
return const_cast<Framebuffer::Data *>(this)->getDepthAttachment();
}
FramebufferAttachment *Framebuffer::Data::getStencilAttachment()
{
return mStencilAttachment;
}
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.
if (mDepthAttachment && mStencilAttachment &&
mDepthAttachment->type() == mStencilAttachment->type() &&
mDepthAttachment->id() == mStencilAttachment->id())
{
return mDepthAttachment;
}
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),
......@@ -124,49 +174,68 @@ void Framebuffer::detachResourceById(GLenum resourceType, GLuint resourceId)
DeleteMatchingAttachment(mData.mStencilAttachment, resourceType, resourceId);
}
FramebufferAttachment *Framebuffer::getColorbuffer(unsigned int colorAttachment) const
FramebufferAttachment *Framebuffer::getColorbuffer(unsigned int colorAttachment)
{
ASSERT(colorAttachment < mData.mColorAttachments.size());
return mData.mColorAttachments[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();
}
FramebufferAttachment *Framebuffer::getDepthbuffer() const
const FramebufferAttachment *Framebuffer::getStencilbuffer() const
{
return mData.mDepthAttachment;
return mData.getStencilAttachment();
}
FramebufferAttachment *Framebuffer::getStencilbuffer() const
FramebufferAttachment *Framebuffer::getDepthStencilBuffer()
{
return mData.mStencilAttachment;
return mData.getDepthStencilAttachment();
}
FramebufferAttachment *Framebuffer::getDepthStencilBuffer() const
const FramebufferAttachment *Framebuffer::getDepthStencilBuffer() const
{
return (hasValidDepthStencil() ? mData.mDepthAttachment : NULL);
return mData.getDepthStencilAttachment();
}
FramebufferAttachment *Framebuffer::getDepthOrStencilbuffer() const
const FramebufferAttachment *Framebuffer::getDepthOrStencilbuffer() const
{
return mData.getDepthOrStencilAttachment();
}
FramebufferAttachment *Framebuffer::getReadColorbuffer() const
const FramebufferAttachment *Framebuffer::getReadColorbuffer() const
{
return mData.getReadAttachment();
}
GLenum Framebuffer::getReadColorbufferType() const
{
FramebufferAttachment *readAttachment = mData.getReadAttachment();
return (readAttachment ? readAttachment->type() : GL_NONE);
const FramebufferAttachment *readAttachment = mData.getReadAttachment();
return (readAttachment != nullptr ? readAttachment->type() : GL_NONE);
}
FramebufferAttachment *Framebuffer::getFirstColorbuffer() const
const FramebufferAttachment *Framebuffer::getFirstColorbuffer() const
{
return mData.getFirstColorAttachment();
}
FramebufferAttachment *Framebuffer::getAttachment(GLenum attachment) const
FramebufferAttachment *Framebuffer::getAttachment(GLenum attachment)
{
if (attachment >= GL_COLOR_ATTACHMENT0 && attachment <= GL_COLOR_ATTACHMENT15)
{
......@@ -190,11 +259,16 @@ FramebufferAttachment *Framebuffer::getAttachment(GLenum attachment) const
return getDepthStencilBuffer();
default:
UNREACHABLE();
return NULL;
return nullptr;
}
}
}
const FramebufferAttachment *Framebuffer::getAttachment(GLenum attachment) const
{
return const_cast<Framebuffer*>(this)->getAttachment(attachment);
}
GLenum Framebuffer::getDrawBufferState(unsigned int colorAttachment) const
{
ASSERT(colorAttachment < mData.mDrawBufferStates.size());
......@@ -547,11 +621,7 @@ int Framebuffer::getSamples(const gl::Data &data) const
bool Framebuffer::hasValidDepthStencil() const
{
// A valid depth-stencil attachment has the same resource bound to both the
// depth and stencil attachment points.
return (mData.mDepthAttachment && mData.mStencilAttachment &&
mData.mDepthAttachment->type() == mData.mStencilAttachment->type() &&
mData.mDepthAttachment->id() == mData.mStencilAttachment->id());
return mData.getDepthStencilAttachment() != nullptr;
}
void Framebuffer::setTextureAttachment(GLenum attachment, Texture *texture, const ImageIndex &imageIndex)
......
......@@ -43,7 +43,7 @@ struct Extensions;
struct ImageIndex;
struct Rectangle;
typedef std::vector<FramebufferAttachment *> AttachmentList;
typedef std::vector<const FramebufferAttachment *> AttachmentList;
class Framebuffer
{
......@@ -55,11 +55,25 @@ class Framebuffer
explicit Data(const Caps &caps);
~Data();
FramebufferAttachment *getReadAttachment() const;
FramebufferAttachment *getFirstColorAttachment() const;
FramebufferAttachment *getDepthOrStencilAttachment() const;
AttachmentList mColorAttachments;
const FramebufferAttachment *getReadAttachment() const;
const FramebufferAttachment *getFirstColorAttachment() const;
const FramebufferAttachment *getDepthOrStencilAttachment() const;
const FramebufferAttachment *getColorAttachment(unsigned int colorAttachment) const;
const FramebufferAttachment *getDepthAttachment() const;
const FramebufferAttachment *getStencilAttachment() const;
const FramebufferAttachment *getDepthStencilAttachment() const;
const std::vector<GLenum> &getDrawBufferStates() const { return mDrawBufferStates; }
const std::vector<FramebufferAttachment *> &getColorAttachments() const { return mColorAttachments; }
private:
friend class Framebuffer;
FramebufferAttachment *getColorAttachment(unsigned int colorAttachment);
FramebufferAttachment *getDepthAttachment();
FramebufferAttachment *getStencilAttachment();
FramebufferAttachment *getDepthStencilAttachment();
std::vector<FramebufferAttachment *> mColorAttachments;
FramebufferAttachment *mDepthAttachment;
FramebufferAttachment *mStencilAttachment;
......@@ -82,16 +96,21 @@ class Framebuffer
void detachTexture(GLuint texture);
void detachRenderbuffer(GLuint renderbuffer);
FramebufferAttachment *getColorbuffer(unsigned int colorAttachment) const;
FramebufferAttachment *getDepthbuffer() const;
FramebufferAttachment *getStencilbuffer() const;
FramebufferAttachment *getDepthStencilBuffer() const;
FramebufferAttachment *getDepthOrStencilbuffer() const;
FramebufferAttachment *getReadColorbuffer() const;
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;
GLenum getReadColorbufferType() const;
FramebufferAttachment *getFirstColorbuffer() const;
const FramebufferAttachment *getFirstColorbuffer() const;
FramebufferAttachment *getAttachment(GLenum attachment) const;
FramebufferAttachment *getAttachment(GLenum attachment);
const FramebufferAttachment *getAttachment(GLenum attachment) const;
GLenum getDrawBufferState(unsigned int colorAttachment) const;
void setDrawBuffers(size_t count, const GLenum *buffers);
......
......@@ -1255,7 +1255,7 @@ void State::getIntegerv(const gl::Data &data, GLenum pname, GLint *params)
case GL_ALPHA_BITS:
{
gl::Framebuffer *framebuffer = getDrawFramebuffer();
gl::FramebufferAttachment *colorbuffer = framebuffer->getFirstColorbuffer();
const gl::FramebufferAttachment *colorbuffer = framebuffer->getFirstColorbuffer();
if (colorbuffer)
{
......
......@@ -87,7 +87,7 @@ ClearParameters GetClearParameters(const gl::State &state, GLbitfield mask)
FramebufferD3D::FramebufferD3D(const gl::Framebuffer::Data &data, RendererD3D *renderer)
: FramebufferImpl(data),
mRenderer(renderer),
mColorAttachmentsForRender(mData.mColorAttachments.size(), nullptr),
mColorAttachmentsForRender(mData.getColorAttachments().size(), nullptr),
mInvalidateColorAttachmentCache(true)
{
ASSERT(mRenderer != nullptr);
......@@ -291,7 +291,7 @@ gl::Error FramebufferD3D::blit(const gl::State &state, const gl::Rectangle &sour
bool blitStencil = false;
if ((mask & GL_STENCIL_BUFFER_BIT) &&
sourceFramebuffer->getStencilbuffer() != nullptr &&
mData.mStencilAttachment != nullptr)
mData.getStencilAttachment() != nullptr)
{
blitStencil = true;
}
......@@ -299,7 +299,7 @@ gl::Error FramebufferD3D::blit(const gl::State &state, const gl::Rectangle &sour
bool blitDepth = false;
if ((mask & GL_DEPTH_BUFFER_BIT) &&
sourceFramebuffer->getDepthbuffer() != nullptr &&
mData.mDepthAttachment != nullptr)
mData.getDepthAttachment() != nullptr)
{
blitDepth = true;
}
......@@ -321,14 +321,15 @@ gl::Error FramebufferD3D::blit(const gl::State &state, const gl::Rectangle &sour
GLenum FramebufferD3D::checkStatus() const
{
// D3D11 does not allow for overlapping RenderTargetViews, so ensure uniqueness
for (size_t colorAttachment = 0; colorAttachment < mData.mColorAttachments.size(); colorAttachment++)
const auto &colorAttachments = mData.getColorAttachments();
for (size_t colorAttachment = 0; colorAttachment < colorAttachments.size(); colorAttachment++)
{
const gl::FramebufferAttachment *attachment = mData.mColorAttachments[colorAttachment];
const gl::FramebufferAttachment *attachment = colorAttachments[colorAttachment];
if (attachment != nullptr)
{
for (size_t prevColorAttachment = 0; prevColorAttachment < colorAttachment; prevColorAttachment++)
{
const gl::FramebufferAttachment *prevAttachment = mData.mColorAttachments[prevColorAttachment];
const gl::FramebufferAttachment *prevAttachment = colorAttachments[prevColorAttachment];
if (prevAttachment != nullptr &&
(attachment->id() == prevAttachment->id() &&
attachment->type() == prevAttachment->type()))
......@@ -344,11 +345,6 @@ GLenum FramebufferD3D::checkStatus() const
const gl::AttachmentList &FramebufferD3D::getColorAttachmentsForRender(const Workarounds &workarounds) const
{
if (!workarounds.mrtPerfWorkaround)
{
return mData.mColorAttachments;
}
if (!mInvalidateColorAttachmentCache)
{
return mColorAttachmentsForRender;
......@@ -357,16 +353,22 @@ const gl::AttachmentList &FramebufferD3D::getColorAttachmentsForRender(const Wor
// Does not actually free memory
mColorAttachmentsForRender.clear();
for (size_t attachmentIndex = 0; attachmentIndex < mData.mColorAttachments.size(); ++attachmentIndex)
const auto &colorAttachments = mData.getColorAttachments();
const auto &drawBufferStates = mData.getDrawBufferStates();
for (size_t attachmentIndex = 0; attachmentIndex < colorAttachments.size(); ++attachmentIndex)
{
GLenum drawBufferState = mData.mDrawBufferStates[attachmentIndex];
gl::FramebufferAttachment *colorAttachment = mData.mColorAttachments[attachmentIndex];
GLenum drawBufferState = drawBufferStates[attachmentIndex];
const gl::FramebufferAttachment *colorAttachment = colorAttachments[attachmentIndex];
if (colorAttachment != nullptr && drawBufferState != GL_NONE)
{
ASSERT(drawBufferState == GL_BACK || drawBufferState == (GL_COLOR_ATTACHMENT0_EXT + attachmentIndex));
mColorAttachmentsForRender.push_back(colorAttachment);
}
else if (!workarounds.mrtPerfWorkaround)
{
mColorAttachmentsForRender.push_back(nullptr);
}
}
mInvalidateColorAttachmentCache = false;
......
......@@ -30,7 +30,7 @@ ImageD3D::ImageD3D()
gl::Error ImageD3D::copy(const gl::Offset &destOffset, const gl::Rectangle &sourceArea, const gl::Framebuffer *source)
{
gl::FramebufferAttachment *colorbuffer = source->getReadColorbuffer();
const gl::FramebufferAttachment *colorbuffer = source->getReadColorbuffer();
ASSERT(colorbuffer);
RenderTargetD3D *renderTarget = NULL;
......
......@@ -516,7 +516,7 @@ size_t RendererD3D::getBoundFramebufferTextureSerials(const gl::Data &data,
const gl::Framebuffer *drawFramebuffer = data.state->getDrawFramebuffer();
for (unsigned int i = 0; i < data.caps->maxColorAttachments; i++)
{
gl::FramebufferAttachment *attachment = drawFramebuffer->getColorbuffer(i);
const gl::FramebufferAttachment *attachment = drawFramebuffer->getColorbuffer(i);
if (attachment && attachment->type() == GL_TEXTURE)
{
gl::Texture *texture = attachment->getTexture();
......@@ -524,7 +524,7 @@ size_t RendererD3D::getBoundFramebufferTextureSerials(const gl::Data &data,
}
}
gl::FramebufferAttachment *depthStencilAttachment = drawFramebuffer->getDepthOrStencilbuffer();
const gl::FramebufferAttachment *depthStencilAttachment = drawFramebuffer->getDepthOrStencilbuffer();
if (depthStencilAttachment && depthStencilAttachment->type() == GL_TEXTURE)
{
gl::Texture *depthStencilTexture = depthStencilAttachment->getTexture();
......
......@@ -179,10 +179,10 @@ Clear11::~Clear11()
gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams, const gl::Framebuffer::Data &fboData)
{
const auto &colorAttachments = fboData.mColorAttachments;
const auto &drawBufferStates = fboData.mDrawBufferStates;
const auto *depthAttachment = fboData.mDepthAttachment;
const auto *stencilAttachment = fboData.mStencilAttachment;
const auto &colorAttachments = fboData.getColorAttachments();
const auto &drawBufferStates = fboData.getDrawBufferStates();
const auto *depthAttachment = fboData.getDepthAttachment();
const auto *stencilAttachment = fboData.getStencilAttachment();
ASSERT(colorAttachments.size() == drawBufferStates.size());
......@@ -207,11 +207,11 @@ gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams, const gl
gl::Extents framebufferSize;
auto iter = std::find_if(colorAttachments.begin(), colorAttachments.end(), [](const gl::FramebufferAttachment *attachment) { return attachment != nullptr; });
if (iter != colorAttachments.end())
const gl::FramebufferAttachment *colorAttachment = fboData.getFirstColorAttachment();
if (colorAttachment != nullptr)
{
framebufferSize.width = (*iter)->getWidth();
framebufferSize.height = (*iter)->getHeight();
framebufferSize.width = colorAttachment->getWidth();
framebufferSize.height = colorAttachment->getHeight();
framebufferSize.depth = 1;
}
else if (depthAttachment != nullptr)
......
......@@ -64,7 +64,7 @@ static gl::Error InvalidateAttachmentSwizzles(const gl::FramebufferAttachment *a
gl::Error Framebuffer11::invalidateSwizzles() const
{
for (gl::FramebufferAttachment *colorAttachment : mData.mColorAttachments)
for (const auto *colorAttachment : mData.getColorAttachments())
{
gl::Error error = InvalidateAttachmentSwizzles(colorAttachment);
if (error.isError())
......@@ -73,13 +73,13 @@ gl::Error Framebuffer11::invalidateSwizzles() const
}
}
gl::Error error = InvalidateAttachmentSwizzles(mData.mDepthAttachment);
gl::Error error = InvalidateAttachmentSwizzles(mData.getDepthAttachment());
if (error.isError())
{
return error;
}
error = InvalidateAttachmentSwizzles(mData.mStencilAttachment);
error = InvalidateAttachmentSwizzles(mData.getStencilAttachment());
if (error.isError())
{
return error;
......@@ -193,12 +193,14 @@ gl::Error Framebuffer11::blit(const gl::Rectangle &sourceArea, const gl::Rectang
}
ASSERT(readRenderTarget);
for (size_t colorAttachment = 0; colorAttachment < mData.mColorAttachments.size(); colorAttachment++)
const auto &colorAttachments = mData.getColorAttachments();
const auto &drawBufferStates = mData.getDrawBufferStates();
for (size_t colorAttachment = 0; colorAttachment < colorAttachments.size(); colorAttachment++)
{
if (mData.mColorAttachments[colorAttachment] != nullptr &&
mData.mDrawBufferStates[colorAttachment] != GL_NONE)
if (colorAttachments[colorAttachment] != nullptr &&
drawBufferStates[colorAttachment] != GL_NONE)
{
const gl::FramebufferAttachment *drawBuffer = mData.mColorAttachments[colorAttachment];
const gl::FramebufferAttachment *drawBuffer = colorAttachments[colorAttachment];
RenderTargetD3D *drawRenderTarget = NULL;
error = GetAttachmentRenderTarget(drawBuffer, &drawRenderTarget);
......@@ -220,7 +222,7 @@ gl::Error Framebuffer11::blit(const gl::Rectangle &sourceArea, const gl::Rectang
if (blitDepth || blitStencil)
{
gl::FramebufferAttachment *readBuffer = sourceFramebuffer->getDepthOrStencilbuffer();
const gl::FramebufferAttachment *readBuffer = sourceFramebuffer->getDepthOrStencilbuffer();
ASSERT(readBuffer);
RenderTargetD3D *readRenderTarget = NULL;
......
......@@ -1277,7 +1277,7 @@ gl::Error Renderer11::applyRenderTarget(const gl::Framebuffer *framebuffer)
for (size_t colorAttachment = 0; colorAttachment < colorbuffers.size(); ++colorAttachment)
{
gl::FramebufferAttachment *colorbuffer = colorbuffers[colorAttachment];
const gl::FramebufferAttachment *colorbuffer = colorbuffers[colorAttachment];
if (colorbuffer)
{
......@@ -1326,7 +1326,7 @@ gl::Error Renderer11::applyRenderTarget(const gl::Framebuffer *framebuffer)
// Get the depth stencil buffers
ID3D11DepthStencilView* framebufferDSV = NULL;
gl::FramebufferAttachment *depthStencil = framebuffer->getDepthOrStencilbuffer();
const gl::FramebufferAttachment *depthStencil = framebuffer->getDepthOrStencilbuffer();
if (depthStencil)
{
RenderTarget11 *depthStencilRenderTarget = NULL;
......@@ -2422,7 +2422,7 @@ std::string Renderer11::getShaderModelSuffix() const
gl::Error Renderer11::copyImage2D(const gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
const gl::Offset &destOffset, TextureStorage *storage, GLint level)
{
gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer();
const gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer();
ASSERT(colorbuffer);
RenderTarget11 *sourceRenderTarget = NULL;
......@@ -2473,7 +2473,7 @@ gl::Error Renderer11::copyImage2D(const gl::Framebuffer *framebuffer, const gl::
gl::Error Renderer11::copyImageCube(const gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
const gl::Offset &destOffset, TextureStorage *storage, GLenum target, GLint level)
{
gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer();
const gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer();
ASSERT(colorbuffer);
RenderTarget11 *sourceRenderTarget = NULL;
......@@ -2524,7 +2524,7 @@ gl::Error Renderer11::copyImageCube(const gl::Framebuffer *framebuffer, const gl
gl::Error Renderer11::copyImage3D(const gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
const gl::Offset &destOffset, TextureStorage *storage, GLint level)
{
gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer();
const gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer();
ASSERT(colorbuffer);
RenderTarget11 *sourceRenderTarget = NULL;
......@@ -2575,7 +2575,7 @@ gl::Error Renderer11::copyImage3D(const gl::Framebuffer *framebuffer, const gl::
gl::Error Renderer11::copyImage2DArray(const gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
const gl::Offset &destOffset, TextureStorage *storage, GLint level)
{
gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer();
const gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer();
ASSERT(colorbuffer);
RenderTarget11 *sourceRenderTarget = NULL;
......
......@@ -236,7 +236,7 @@ gl::Error Blit9::copy2D(const gl::Framebuffer *framebuffer, const RECT &sourceRe
return error;
}
gl::FramebufferAttachment *colorbuffer = framebuffer->getColorbuffer(0);
const gl::FramebufferAttachment *colorbuffer = framebuffer->getColorbuffer(0);
ASSERT(colorbuffer);
RenderTarget9 *renderTarget9 = NULL;
......@@ -275,7 +275,7 @@ gl::Error Blit9::copyCube(const gl::Framebuffer *framebuffer, const RECT &source
return error;
}
gl::FramebufferAttachment *colorbuffer = framebuffer->getColorbuffer(0);
const gl::FramebufferAttachment *colorbuffer = framebuffer->getColorbuffer(0);
ASSERT(colorbuffer);
RenderTarget9 *renderTarget9 = NULL;
......
......@@ -34,7 +34,7 @@ Framebuffer9::~Framebuffer9()
gl::Error Framebuffer9::clear(const gl::State &state, const ClearParameters &clearParams)
{
const gl::FramebufferAttachment *colorAttachment = mData.mColorAttachments[0];
const gl::FramebufferAttachment *colorAttachment = mData.getColorAttachment(0);
const gl::FramebufferAttachment *depthStencilAttachment = mData.getDepthOrStencilAttachment();
gl::Error error = mRenderer->applyRenderTarget(colorAttachment, depthStencilAttachment);
......@@ -56,7 +56,7 @@ gl::Error Framebuffer9::readPixels(const gl::Rectangle &area, GLenum format, GLe
{
ASSERT(pack.pixelBuffer.get() == NULL);
const gl::FramebufferAttachment *colorbuffer = mData.mColorAttachments[0];
const gl::FramebufferAttachment *colorbuffer = mData.getColorAttachment(0);
ASSERT(colorbuffer);
RenderTarget9 *renderTarget = NULL;
......@@ -254,7 +254,7 @@ gl::Error Framebuffer9::blit(const gl::Rectangle &sourceArea, const gl::Rectangl
}
ASSERT(readRenderTarget);
const gl::FramebufferAttachment *drawBuffer = mData.mColorAttachments[0];
const gl::FramebufferAttachment *drawBuffer = mData.getColorAttachment(0);
ASSERT(drawBuffer);
RenderTarget9 *drawRenderTarget = NULL;
......
......@@ -963,7 +963,7 @@ gl::Error Renderer9::setBlendState(const gl::Framebuffer *framebuffer, const gl:
FIXME("Sample alpha to coverage is unimplemented.");
}
gl::FramebufferAttachment *attachment = framebuffer->getFirstColorbuffer();
const gl::FramebufferAttachment *attachment = framebuffer->getFirstColorbuffer();
GLenum internalFormat = attachment ? attachment->getInternalFormat() : GL_NONE;
// Set the color mask
......
......@@ -415,7 +415,7 @@ bool ValidateFramebufferRenderbufferParameters(gl::Context *context, GLenum targ
return true;
}
static bool IsPartialBlit(gl::Context *context, gl::FramebufferAttachment *readBuffer, gl::FramebufferAttachment *writeBuffer,
static bool IsPartialBlit(gl::Context *context, const gl::FramebufferAttachment *readBuffer, const gl::FramebufferAttachment *writeBuffer,
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1)
{
......@@ -529,8 +529,8 @@ bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint
if (mask & GL_COLOR_BUFFER_BIT)
{
gl::FramebufferAttachment *readColorBuffer = readFramebuffer->getReadColorbuffer();
gl::FramebufferAttachment *drawColorBuffer = drawFramebuffer->getFirstColorbuffer();
const gl::FramebufferAttachment *readColorBuffer = readFramebuffer->getReadColorbuffer();
const gl::FramebufferAttachment *drawColorBuffer = drawFramebuffer->getFirstColorbuffer();
if (readColorBuffer && drawColorBuffer)
{
......@@ -583,7 +583,7 @@ bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint
if (fromAngleExtension)
{
FramebufferAttachment *readColorAttachment = readFramebuffer->getReadColorbuffer();
const FramebufferAttachment *readColorAttachment = readFramebuffer->getReadColorbuffer();
if (!readColorAttachment ||
(!(readColorAttachment->type() == GL_TEXTURE && readColorAttachment->getTextureImageIndex().type == GL_TEXTURE_2D) &&
readColorAttachment->type() != GL_RENDERBUFFER &&
......@@ -1174,7 +1174,7 @@ bool ValidateStateQuery(gl::Context *context, GLenum pname, GLenum *nativeType,
return false;
}
FramebufferAttachment *attachment = framebuffer->getReadColorbuffer();
const FramebufferAttachment *attachment = framebuffer->getReadColorbuffer();
if (!attachment)
{
context->recordError(Error(GL_INVALID_OPERATION));
......
......@@ -822,7 +822,7 @@ bool ValidateES3CopyTexImageParameters(Context *context, GLenum target, GLint le
return false;
}
gl::FramebufferAttachment *source = framebuffer->getReadColorbuffer();
const gl::FramebufferAttachment *source = framebuffer->getReadColorbuffer();
GLenum colorbufferInternalFormat = source->getInternalFormat();
if (isSubImage)
......
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