[Mesa-dev] [PATCH 1/2] st/mesa: Handle disabled draw buffers in st_Clear().

Henri Verbeet hverbeet at gmail.com
Wed Dec 25 13:37:45 PST 2013


On 25 December 2013 14:17, Marek Olšák <maraeo at gmail.com> wrote:
> This looks good, but it's only papering over the real problem, which
> is that st/mesa doesn't bind NULL colorbuffers and skips them instead.
> For example, if DRAWBUFFER0 is NONE, st/mesa binds DRAWBUFFER1 to
> cb[0], but then all writes to gl_FragData[1] are broken, because the
> draw buffer has been moved to cb[0] and the shader doesn't know about
> it.
>
That's a good point, although I think at least the first part of this
patch would be the same regardless. I.e., it would make the admittedly
not very pretty color_idx handling go away, but b being -1 would still
need to be explicitly handled.

> I think st/mesa should bind NULL colorbuffers and drivers should check
> for NULL colorbuffers and disable the writes accordingly. I think most
> drivers don't check for NULL colorbuffers, but at least fixing r600g
> and radeonsi should be very easy by just looking for NULL pointer
> dereferences and disabling colorbuffers by setting
> CB_COLORi_INFO.FORMAT=COLOR_INVALID.
>
Sounds good to me, although I can't realistically promise making it
happen in the short term. I originally wrote these patches in October
or so, and only got around to submitting them now.


More information about the mesa-dev mailing list