[Mesa-dev] [PATCH] [RFC] mesa/st: create a front buffer renderbuffer

Dave Airlie airlied at gmail.com
Mon Aug 17 14:34:52 PDT 2015


On 17 August 2015 at 20:25, Marek Olšák <maraeo at gmail.com> wrote:
> Gallium does create the front buffer (with DRI2 at least), but it's
> created only when it's used. glDrawBuffer(GL_FRONT) creates it
> usually.

So the problem is OpenGL conformance seems to assume the front buffer
will exist for querying even if it isn't going to draw to it.

So waiting until glDrawBuffer(GL_FRONT) doesn't cut the mustard.

The other option I came up with, was if we don't have a FRONT_LEFT attachment
we just read the values from the BACK_LEFT attachment under the assumption
they should be the same. This would be a mesa level change, and a bit
of a layering
violation I think.

Dave.
>
> Marek
>
> On Mon, Aug 17, 2015 at 5:23 AM, Dave Airlie <airlied at gmail.com> wrote:
>> From: Dave Airlie <airlied at redhat.com>
>>
>> It appears CTS does a lot of
>>
>> glGetFrameBufferAttachmentParameteriv with GL_FRONT_LEFT,
>>
>> but gallium doesn't create a GL_FRONT_LEFT attachment,
>> so these all fail badly, now I'd like to argue the test suite
>> should probably only hit GL_BACK_LEFT but I'm guessing that
>> won't go down well.
>>
>> I'm not really sure about this solution so just RFC it for now.
>>
>> Signed-off-by: Dave Airlie <airlied at redhat.com>
>> ---
>>  src/mesa/state_tracker/st_manager.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
>> index 2e2c8ff..5836a50 100644
>> --- a/src/mesa/state_tracker/st_manager.c
>> +++ b/src/mesa/state_tracker/st_manager.c
>> @@ -324,6 +324,12 @@ st_framebuffer_add_renderbuffer(struct st_framebuffer *stfb,
>>
>>     if (idx != BUFFER_DEPTH) {
>>        _mesa_add_renderbuffer(&stfb->Base, idx, rb);
>> +      if (idx == BUFFER_BACK_LEFT) {
>> +         rb = st_new_renderbuffer_fb(format, stfb->iface->visual->samples, sw);
>> +         if (!rb)
>> +            return FALSE;
>> +         _mesa_add_renderbuffer(&stfb->Base, BUFFER_FRONT_LEFT, rb);
>> +      }
>>     }
>>     else {
>>        if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 0))
>> --
>> 2.4.3
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list