llvmpipe: simplify framebuffer state code
authorBrian Paul <brianp@vmware.com>
Fri, 4 Dec 2009 21:22:08 +0000 (14:22 -0700)
committerBrian Paul <brianp@vmware.com>
Fri, 4 Dec 2009 21:22:08 +0000 (14:22 -0700)
src/gallium/drivers/llvmpipe/lp_setup.c
src/gallium/drivers/llvmpipe/lp_setup.h
src/gallium/drivers/llvmpipe/lp_setup_context.h
src/gallium/drivers/llvmpipe/lp_state_surface.c

index 7f31df6ae502cbeeede4d4fcf1f8bc6f59b56404..38609ec88a2a0c2dbb3d389b3da7364f5381a4cc 100644 (file)
@@ -241,12 +241,12 @@ rasterize_bins( struct setup_context *setup,
    LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
 
    lp_rast_begin( rast,
-                  setup->fb.cbuf
-                  setup->fb.zsbuf,
-                  setup->fb.cbuf != NULL,
-                  setup->fb.zsbuf != NULL && write_depth,
-                  setup->fb.width,
-                  setup->fb.height );
+                  setup->fb->cbufs[0]
+                  setup->fb->zsbuf,
+                  setup->fb->cbufs[0] != NULL,
+                  setup->fb->zsbuf != NULL && write_depth,
+                  setup->fb->width,
+                  setup->fb->height );
                        
    /* loop over tile bins, rasterize each */
    for (i = 0; i < setup->tiles_x; i++) {
@@ -271,7 +271,7 @@ begin_binning( struct setup_context *setup )
 {
    LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
 
-   if (setup->fb.cbuf) {
+   if (setup->fb->cbufs[0]) {
       if (setup->clear.flags & PIPE_CLEAR_COLOR)
          bin_everywhere( setup, 
                          lp_rast_clear_color, 
@@ -280,7 +280,7 @@ begin_binning( struct setup_context *setup )
          bin_everywhere( setup, lp_rast_load_color, lp_rast_arg_null() );
    }
 
-   if (setup->fb.zsbuf) {
+   if (setup->fb->zsbuf) {
       if (setup->clear.flags & PIPE_CLEAR_DEPTHSTENCIL)
          bin_everywhere( setup, 
                          lp_rast_clear_zstencil, 
@@ -355,13 +355,13 @@ lp_setup_flush( struct setup_context *setup,
 
 void
 lp_setup_bind_framebuffer( struct setup_context *setup,
-                           struct pipe_surface *color,
-                           struct pipe_surface *zstencil )
+                           const struct pipe_framebuffer_state *fb )
 {
    LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
 
    set_state( setup, SETUP_FLUSHED );
 
+#if 0
    pipe_surface_reference( &setup->fb.cbuf, color );
    pipe_surface_reference( &setup->fb.zsbuf, zstencil );
 
@@ -386,9 +386,14 @@ lp_setup_bind_framebuffer( struct setup_context *setup,
       setup->fb.height = MIN2(setup->fb.cbuf->height,
                               setup->fb.zsbuf->height);
    }
-
    setup->tiles_x = align(setup->fb.width, TILE_SIZE) / TILE_SIZE;
    setup->tiles_y = align(setup->fb.height, TILE_SIZE) / TILE_SIZE;
+#else
+   setup->fb = fb;
+   setup->tiles_x = align(setup->fb->width, TILE_SIZE) / TILE_SIZE;
+   setup->tiles_y = align(setup->fb->height, TILE_SIZE) / TILE_SIZE;
+#endif
+
 }
 
 
@@ -411,7 +416,7 @@ lp_setup_clear( struct setup_context *setup,
 
    if (flags & PIPE_CLEAR_DEPTHSTENCIL) {
       setup->clear.zstencil.clear_zstencil = 
-         util_pack_z_stencil(setup->fb.zsbuf->format, 
+         util_pack_z_stencil(setup->fb->zsbuf->format, 
                              depth,
                              stencil);
    }
index 1edd7410fc0262e08a49b4cb97b3f024d0ab2e0c..66a7f29f1e7da5ed34b64d44cc4a404b11a16582 100644 (file)
@@ -53,7 +53,7 @@ struct pipe_surface;
 struct pipe_buffer;
 struct pipe_blend_color;
 struct pipe_screen;
-struct setup_context;
+struct pipe_framebuffer_state;
 struct lp_fragment_shader;
 struct lp_jit_context;
 
@@ -90,8 +90,7 @@ lp_setup_flush( struct setup_context *setup,
 
 void
 lp_setup_bind_framebuffer( struct setup_context *setup,
-                           struct pipe_surface *color,
-                           struct pipe_surface *zstencil );
+                           const struct pipe_framebuffer_state *fb );
 
 void 
 lp_setup_set_triangle_state( struct setup_context *setup,
index 180b8f6e880c7512f8b5b2d9ebebd604843cafb2..dc12eb78471eaa5272899f0f7716330a0f2b2f28 100644 (file)
@@ -79,12 +79,7 @@ struct setup_context {
    boolean ccw_is_frontface;
    unsigned cullmode;
 
-   struct {
-      struct pipe_surface *cbuf;
-      struct pipe_surface *zsbuf;
-      unsigned width;
-      unsigned height;
-   } fb;
+   const struct pipe_framebuffer_state *fb;
 
    struct {
       unsigned flags;
index 909ca9f11703306662c3b63587846efca6319dd5..3eff40e3f19cf88cf1c7b78e73f3d08302a50e6e 100644 (file)
@@ -83,9 +83,7 @@ llvmpipe_set_framebuffer_state(struct pipe_context *pipe,
    }
 
    if (dirty) {
-      lp_setup_bind_framebuffer( lp->setup,
-                                 fb->cbufs[0],
-                                 fb->zsbuf );
+      lp_setup_bind_framebuffer( lp->setup, fb );
 
       lp->dirty |= LP_NEW_FRAMEBUFFER;
    }