st_cb_accum.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void st_clear_accum_buffer (GLcontext *ctx, struct gl_renderbuffer *rb)
void st_init_accum_functions (struct dd_function_table *functions)


Function Documentation

void st_clear_accum_buffer ( GLcontext *  ctx,
struct gl_renderbuffer *  rb 
)

Definition at line 95 of file acc2.c.

References acc_put_tile_rgba(), st_renderbuffer::format, pipe_screen::get_tex_surface, pipe_surface::height, PIPE_BUFFER_USAGE_CPU_WRITE, PIPE_FORMAT_R16G16B16A16_SNORM, pipe_surface_map(), pipe_surface_reference(), pipe_surface_unmap(), st_renderbuffer(), pipe_surface::stride, st_renderbuffer::surface, pipe_screen::surface_map, pipe_screen::surface_unmap, st_renderbuffer::texture, and pipe_surface::width.

00096 {
00097    struct pipe_context *pipe = ctx->st->pipe;
00098    struct st_renderbuffer *acc_strb = st_renderbuffer(rb);
00099    struct pipe_surface *acc_ps = acc_strb->surface;
00100    const GLint xpos = ctx->DrawBuffer->_Xmin;
00101    const GLint ypos = ctx->DrawBuffer->_Ymin;
00102    const GLint width = ctx->DrawBuffer->_Xmax - xpos;
00103    const GLint height = ctx->DrawBuffer->_Ymax - ypos;
00104    const GLfloat r = ctx->Accum.ClearColor[0];
00105    const GLfloat g = ctx->Accum.ClearColor[1];
00106    const GLfloat b = ctx->Accum.ClearColor[2];
00107    const GLfloat a = ctx->Accum.ClearColor[3];
00108    GLfloat *accBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
00109    int i;
00110 
00111 #if 1
00112    GLvoid *map;
00113 
00114    map = pipe_surface_map(acc_ps);
00115    switch (acc_strb->format) {
00116    case PIPE_FORMAT_R16G16B16A16_SNORM:
00117       {
00118          GLshort r = FLOAT_TO_SHORT(ctx->Accum.ClearColor[0]);
00119          GLshort g = FLOAT_TO_SHORT(ctx->Accum.ClearColor[1]);
00120          GLshort b = FLOAT_TO_SHORT(ctx->Accum.ClearColor[2]);
00121          GLshort a = FLOAT_TO_SHORT(ctx->Accum.ClearColor[3]);
00122          int i, j;
00123          for (i = 0; i < height; i++) {
00124             GLshort *dst = ((GLshort *) map
00125                             + ((ypos + i) * acc_ps->pitch + xpos) * 4);
00126             for (j = 0; j < width; j++) {
00127                dst[0] = r;
00128                dst[1] = g;
00129                dst[2] = b;
00130                dst[3] = a;
00131                dst += 4;
00132             }
00133          }
00134       }
00135       break;
00136    default:
00137       _mesa_problem(ctx, "unexpected format in st_clear_accum_buffer()");
00138    }
00139 
00140    pipe_surface_unmap(acc_ps);
00141 
00142 #else
00143    for (i = 0; i < width * height; i++) {
00144       accBuf[i*4+0] = r;
00145       accBuf[i*4+1] = g;
00146       accBuf[i*4+2] = b;
00147       accBuf[i*4+3] = a;
00148    }
00149 
00150    acc_put_tile_rgba(pipe, acc_ps, xpos, ypos, width, height, accBuf);
00151 #endif

void st_init_accum_functions ( struct dd_function_table *  functions  ) 

Definition at line 315 of file acc2.c.

References st_Accum().

00317 {
00318    functions->Accum = st_Accum;


Generated on Tue Sep 29 06:25:51 2009 for Gallium3D by  doxygen 1.5.4