This conformance test began failing with:
mesa: add GL_OES/EXT_draw_buffers_indexed support
This is the same ext as ARB_draw_buffers_blend (plus some core
functionality that already exists). Add the alias entrypoints.
Signed-off-by: Ilia Mirkin <firstname.lastname@example.org>
Reviewed-by: Dave Airlie <email@example.com>
Based on the commit message, the test probably skipped before the extension was enabled. However, it must be fixed.
This bug affects BDW, BSW, KBL, SKL. Those are all the platforms tested for ES3.1.
I believe I've tracked down the problem.
The application is binding multiple draw buffers. Each draw buffer has associated color mask and blending state. (In Mesa, ctx->Color.ColorMask[i] corresponds to the color mask for GL_DRAW_BUFFERi.)
It then calls glClearBufferfv to clear an individual draw buffer. This is handled by _mesa_meta_glsl_Clear (fast clears are skipped due to color masking). In order to clear a single draw buffer, _mesa_meta_drawbuffers_from_bitfield() calls glDrawBuffers() to try and disable any attachments that we don't want to clear. It also leaves the color masking in place, because it should take effect.
However, this has a problem: it binds all the same color attachments, but in a different order. So, what was GL_DRAW_BUFFER5 will now be bound as GL_DRAW_BUFFER0. This means that Meta uses ctx->Color.ColorMask instead of ctx->Color.ColorMask...which is the wrong state.
Although the problem is fairly simple, trying to set up drawbuffers correctly is immensely painful. I'm not currently working on a fix, so if someone else would like to step up and do it, that would be fantastic.
It might be worth refactoring the core Mesa color drawbuffer data structures, as they can be pretty awful to work with. Of course, if someone manages to find a solution without doing that...then we can limp along and put that off for another day.
I had a bit of inspiration today and ended up fixing it:
I think Ken fixed this with
Author: Kenneth Graunke <firstname.lastname@example.org>
Date: Tue Apr 12 10:19:09 2016 -0700
meta: Don't botch color masks when changing drawbuffers.
Ken, please confirm.
Yep, sorry, I forgot to close this. Since then we've also switched away from that code entirely in favor of BLORP, which also handles this correctly.
on Mar 30, 2017 at 04:50:44.
(provided by the Example extension).