[Mesa-dev] [PATCH 2/4] mesa: rewrite accum buffer support

Brian Paul brianp at vmware.com
Sun Dec 4 19:16:59 PST 2011


On 12/04/2011 03:45 PM, Eric Anholt wrote:
> On Sat,  3 Dec 2011 10:07:36 -0700, Brian Paul<brianp at vmware.com>  wrote:
>> Implemented in terms of renderbuffer mapping/unmapping and format
>> packing/unpacking functions.
>>
>> The swrast and state tracker code for implementing accumulation are
>> unused and will be removed in the next commit.
>
>> +   ctx->Driver.MapRenderbuffer(ctx, accRb, x, y, width, height,
>> +                               GL_MAP_READ_BIT | GL_MAP_WRITE_BIT,
>> +&accMap,&accRowStride);
>> +
>> +   if (!accMap) {
>> +      _mesa_error(ctx, GL_OUT_OF_MEMORY, "glAccum");
>> +      return;
>> +   }
>> +
>> +   if (accRb->Format == MESA_FORMAT_SIGNED_RGBA_16) {
>> +      const GLshort clearR = FLOAT_TO_SHORT(ctx->Accum.ClearColor[0]);
>> +      const GLshort clearG = FLOAT_TO_SHORT(ctx->Accum.ClearColor[1]);
>> +      const GLshort clearB = FLOAT_TO_SHORT(ctx->Accum.ClearColor[2]);
>> +      const GLshort clearA = FLOAT_TO_SHORT(ctx->Accum.ClearColor[3]);
>> +      GLshort *firstRow = (GLshort *) accMap;
>> +      GLuint i, j;
>
>> +      /* and memcpy the first row to the other rows to clear them */
>> +      for (j = 1; j<  height; j++) {
>> +         memcpy(accMap, firstRow, 4 * width * sizeof(GLshort));
>> +         accMap += accRowStride;
>> +      }
>
> memcpy out of a renderbuffer mapping is likely to be worst-case
> performance for a GPU driver.  Could we get a temporary instead?

I'll fix that.

>
> Also, looks like we have no testing of accum in piglit at all.

I tested the changes with conform and some OpenGL demos.  I think 
that's sufficient.

-Brian


More information about the mesa-dev mailing list