Commit 164d54eb by Geoff Lang

Set all the drawbuffer state at once instead of one buffer per call.

BUG=angle:841 Change-Id: I988c7c0cd45317c78b8fd16df8324028ff1cb25d Reviewed-on: https://chromium-review.googlesource.com/232391Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 05a49f68
......@@ -266,9 +266,11 @@ GLenum Framebuffer::getDrawBufferState(unsigned int colorAttachment) const
return mDrawBufferStates[colorAttachment];
}
void Framebuffer::setDrawBufferState(unsigned int colorAttachment, GLenum drawBuffer)
void Framebuffer::setDrawBuffers(size_t count, const GLenum *buffers)
{
mDrawBufferStates[colorAttachment] = drawBuffer;
ASSERT(count < ArraySize(mDrawBufferStates));
std::copy(buffers, buffers + count, mDrawBufferStates);
std::fill(mDrawBufferStates + count, mDrawBufferStates + ArraySize(mDrawBufferStates), GL_NONE);
}
bool Framebuffer::isEnabledColorAttachment(unsigned int colorAttachment) const
......
......@@ -69,7 +69,7 @@ class Framebuffer
FramebufferAttachment *getAttachment(GLenum attachment) const;
GLenum getDrawBufferState(unsigned int colorAttachment) const;
void setDrawBufferState(unsigned int colorAttachment, GLenum drawBuffer);
void setDrawBuffers(size_t count, const GLenum *buffers);
bool isEnabledColorAttachment(unsigned int colorAttachment) const;
bool hasEnabledColorAttachment() const;
......
......@@ -8551,15 +8551,7 @@ void GL_APIENTRY glDrawBuffersEXT(GLsizei n, const GLenum *bufs)
gl::Framebuffer *framebuffer = context->getState().getDrawFramebuffer();
ASSERT(framebuffer);
for (unsigned int colorAttachment = 0; colorAttachment < static_cast<unsigned int>(n); colorAttachment++)
{
framebuffer->setDrawBufferState(colorAttachment, bufs[colorAttachment]);
}
for (unsigned int colorAttachment = n; colorAttachment < context->getCaps().maxDrawBuffers; colorAttachment++)
{
framebuffer->setDrawBufferState(colorAttachment, GL_NONE);
}
framebuffer->setDrawBuffers(n, bufs);
}
}
......
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