[Mesa-dev] [PATCH 2/3] swrast: rewrite color buffer clearing to use Map/UnmapRenderbuffer()

Brian Paul brian.e.paul at gmail.com
Mon Dec 12 10:36:54 PST 2011


On Mon, Dec 12, 2011 at 10:38 AM, Eric Anholt <eric at anholt.net> wrote:
> On Sat, 10 Dec 2011 12:00:53 -0700, Brian Paul <brianp at vmware.com> wrote:
>> -   /* Note that masking will change the color values, but only the
>> -    * channels for which the write mask is GL_FALSE.  The channels
>> -    * which which are write-enabled won't get modified.
>> -    */
>> -   for (i = 0; i < height; i++) {
>> -      span.x = x;
>> -      span.y = y + i;
>> -      _swrast_mask_rgba_span(ctx, rb, &span, buf);
>> -      /* write masked row */
>> -      rb->PutRow(ctx, rb, width, x, y + i, span.array->rgba, NULL);
>> +   if (doMasking) {
>> +      /* Convert the boolean mask to a color */
>
> I think this would be more informative as
>
> /* Convert the boolean mask to a color value that will be packed to
>  * produce the bitmask for the renderbuffer's format.
>  */
>
> but overall, this looks like a pretty nice (if tricky) way to handle all
> these formats.  Reviewed-by: Eric Anholt <eric at anholt.net>

Actually, I found a couple issues with the code when I was looking at
it yesterday.  I'll post an updated patch later.

I'll update the comments too.

-Brian


More information about the mesa-dev mailing list