meta: Only clear the requested color buffers.
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 2 May 2014 08:10:17 +0000 (01:10 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 6 May 2014 18:31:31 +0000 (11:31 -0700)
commit9701c6984d8d6570d90a15f86872b16bdba117f2
tree3ba98963411a71a1aa929ecd1bdc9b449be29689
parentc1c1cf5f92f692c8894bd97e7139a0ec78648f29
meta: Only clear the requested color buffers.

This path is used to implement both glClear and glClearBuffer; the
latter is only supposed to clear particular buffers.  Core Mesa provides
us that information in the buffers bitmask; we must only clear buffers
mentioned there.

To accomplish this, we save/restore the color draw buffers state, and
use glDrawBuffers to restrict drawing to the relevant buffers.

Fixes Piglit's spec/!OpenGL 3.0/clearbuffer-mixed-formats and
spec/ARB_framebuffer_object/fbo-drawbuffers-none glClearBuffer tests
for drivers using meta clears (such as Broadwell).

Cc: "10.2" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77852
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77856
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/common/meta.c