gallium: need to set/save framebuffer state in st_context since we use it elsewhere
authorBrian Paul <brian.paul@tungstengraphics.com>
Wed, 19 Mar 2008 23:04:49 +0000 (17:04 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Wed, 19 Mar 2008 23:15:14 +0000 (17:15 -0600)
src/mesa/state_tracker/st_atom_framebuffer.c

index c8fa0cbdfb6150d65d3fe0197b103317e56325a8..43259c3ecb198aa9f3359544636466799161b74c 100644 (file)
 static void
 update_framebuffer_state( struct st_context *st )
 {
-   struct pipe_framebuffer_state framebuffer;
+   struct pipe_framebuffer_state *framebuffer = &st->state.framebuffer;
    struct gl_framebuffer *fb = st->ctx->DrawBuffer;
    struct st_renderbuffer *strb;
    GLuint i;
 
-   memset(&framebuffer, 0, sizeof(framebuffer));
+   memset(framebuffer, 0, sizeof(*framebuffer));
 
    /* Examine Mesa's ctx->DrawBuffer->_ColorDrawBuffers state
     * to determine which surfaces to draw to
     */
-   framebuffer.num_cbufs = fb->_NumColorDrawBuffers[0];
-   for (i = 0; i < framebuffer.num_cbufs; i++) {
+   framebuffer->num_cbufs = fb->_NumColorDrawBuffers[0];
+   for (i = 0; i < framebuffer->num_cbufs; i++) {
       strb = st_renderbuffer(fb->_ColorDrawBuffers[0][i]);
       assert(strb->surface);
-      framebuffer.cbufs[i] = strb->surface;
+      framebuffer->cbufs[i] = strb->surface;
    }
 
    strb = st_renderbuffer(fb->Attachment[BUFFER_DEPTH].Renderbuffer);
    if (strb) {
       strb = st_renderbuffer(strb->Base.Wrapped);
       assert(strb->surface);
-      framebuffer.zsbuf = strb->surface;
+      framebuffer->zsbuf = strb->surface;
    }
    else {
       strb = st_renderbuffer(fb->Attachment[BUFFER_STENCIL].Renderbuffer);
       if (strb) {
          strb = st_renderbuffer(strb->Base.Wrapped);
          assert(strb->surface);
-         framebuffer.zsbuf = strb->surface;
+         framebuffer->zsbuf = strb->surface;
       }
    }
 
-   cso_set_framebuffer(st->cso_context, &framebuffer);
+   cso_set_framebuffer(st->cso_context, framebuffer);
 }