[Mesa-dev] dd_function_table::Clear()

Brian Paul brianp at vmware.com
Thu Jan 19 09:07:53 PST 2012


On 01/19/2012 09:58 AM, Dee Sharpe wrote:
> On 1/18/2012 11:19 AM, Brian Paul wrote:
>> On 01/18/2012 09:01 AM, Dee Sharpe wrote:
>>> While implementing Clear() for a platform, which buffers in
>>> GLContext need to be cleared out of the list of:
>>>
>>> DrawBuffer
>>> ReadBuffer
>>> WinSysDrawBuffer
>>> WinSysReadBuffer
>>>
>>> Or do they all need to be cleared?
>>
>> Clearing effects "draw" buffers, not "read" buffers.
>>
>> Unless a user-created FBO is bound, ctx->WinSysDrawBuffer ==
>> ctx->DrawBuffer.
>>
>> You need to clear the color buffers attached to ctx->DrawBuffer. The
>> number of buffers to clear is ctx->DrawBuffer->_NumColorDrawBuffers
>> and the indexes/pointers to the renderbuffers is in
>> _ColorDrawBufferIndexes[] and _ColorDrawBuffers[].
>>
>> I may actually get rid of the later (redundant) array and just write
>> a helper function that returns a pointer to a renderbuffer given a
>> buffer index.
>
> Thanks for the quick reply. So, if I want to directly access the
> renderbuffer that I designated as the front left buffer, then I need
> to use _ColorDrawBuffers[BUFFER_FRONT_LEFT], correct?

No.  The _ColorDrawBuffers[] array is indexed by an integer between 0 
and _NumColorDrawBuffers-1.  The contents of the array is updated by 
calls to glDrawBuffer() or glDrawBuffersARB().

If you specifically want the front-left buffer you'd use:

ctx->DrawBuffer->Attachment[BUFFER_FRONT_LEFT]->Renderbuffer.

-Brian


More information about the mesa-dev mailing list