Commit a97737c7 authored by ccameron@chromium.org's avatar ccameron@chromium.org

Do not call glDrawBuffersARB when the extension is absent

The function Framebuffer::ChangeDrawBuffersHelper was assuming
that binding of an FBO with no GL_COLOR_ATTACHMENT0 was
accompanied by setting the first draw buffer to GL_NONE with
glDrawBuffersARB in the fix introduced in:
https://codereview.chromium.org/315283002

When the extension is not present, it can be assumed that the
glDrawBuffersARB state need not be set and restored.

BUG=(wrangling)
NOTRY=True

Review URL: https://codereview.chromium.org/375413003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282393 0039d316-1c4b-4281-b951-d872f2087c98
parent ffae320d
...@@ -374,6 +374,11 @@ bool Framebuffer::HasUnclearedColorAttachments() const { ...@@ -374,6 +374,11 @@ bool Framebuffer::HasUnclearedColorAttachments() const {
} }
void Framebuffer::ChangeDrawBuffersHelper(bool recover) const { void Framebuffer::ChangeDrawBuffersHelper(bool recover) const {
// There will always be only one buffer, GL_COLOR_ATTACHMENT0, if
// GL_ARB_draw_buffers is not present, even if this FBO has no attachment.
if (!gfx::g_driver_gl.ext.b_GL_ARB_draw_buffers)
return;
scoped_ptr<GLenum[]> buffers(new GLenum[manager_->max_draw_buffers_]); scoped_ptr<GLenum[]> buffers(new GLenum[manager_->max_draw_buffers_]);
for (uint32 i = 0; i < manager_->max_draw_buffers_; ++i) for (uint32 i = 0; i < manager_->max_draw_buffers_; ++i)
buffers[i] = GL_NONE; buffers[i] = GL_NONE;
......
...@@ -3122,6 +3122,7 @@ bool GLES2DecoderImpl::CheckFramebufferValid( ...@@ -3122,6 +3122,7 @@ bool GLES2DecoderImpl::CheckFramebufferValid(
bool reset_draw_buffer = false; bool reset_draw_buffer = false;
if ((backbuffer_needs_clear_bits_ | GL_COLOR_BUFFER_BIT) != 0 && if ((backbuffer_needs_clear_bits_ | GL_COLOR_BUFFER_BIT) != 0 &&
group_->draw_buffer() == GL_NONE) { group_->draw_buffer() == GL_NONE) {
DCHECK(gfx::g_driver_gl.ext.b_GL_ARB_draw_buffers);
reset_draw_buffer = true; reset_draw_buffer = true;
GLenum buf = GL_BACK; GLenum buf = GL_BACK;
if (GetBackbufferServiceId() != 0) // emulated backbuffer if (GetBackbufferServiceId() != 0) // emulated backbuffer
......
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