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

Eric Anholt eric at anholt.net
Sun Dec 4 14:45:33 PST 2011


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?

Also, looks like we have no testing of accum in piglit at all.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20111204/e7f8f609/attachment.pgp>


More information about the mesa-dev mailing list