llvmpipe: remove some old sampler support structs
authorKeith Whitwell <keithw@vmware.com>
Thu, 8 Oct 2009 16:20:40 +0000 (17:20 +0100)
committerKeith Whitwell <keithw@vmware.com>
Thu, 8 Oct 2009 16:53:12 +0000 (17:53 +0100)
src/gallium/drivers/llvmpipe/lp_context.c
src/gallium/drivers/llvmpipe/lp_context.h
src/gallium/drivers/llvmpipe/lp_jit.c
src/gallium/drivers/llvmpipe/lp_jit.h
src/gallium/drivers/llvmpipe/lp_prim_vbuf.c
src/gallium/drivers/llvmpipe/lp_rast.c
src/gallium/drivers/llvmpipe/lp_setup.h
src/gallium/drivers/llvmpipe/lp_tex_sample.h

index f087b6532199b06e4e1b85ab390ccf0d42fcdc19..7f7b04412c225e74a6893de189cc33c9cc8701a0 100644 (file)
@@ -44,6 +44,7 @@
 #include "lp_texture.h"
 #include "lp_winsys.h"
 #include "lp_query.h"
+#include "lp_setup.h"
 
 
 
@@ -85,20 +86,8 @@ llvmpipe_is_texture_referenced( struct pipe_context *pipe,
                                unsigned face, unsigned level)
 {
    struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe );
-   unsigned i;
 
-   if (lp_setup_is_active(llvmpipe->setup)) {
-      for (i = 0; i < llvmpipe->framebuffer.nr_cbufs; i++) {
-         if(llvmpipe->framebuffer.cbufs[i] && 
-            llvmpipe->framebuffer.cbufs[i]->texture == texture)
-            return PIPE_REFERENCED_FOR_WRITE;
-      }
-      if(llvmpipe->framebuffer.zsbuf && 
-         llvmpipe->framebuffer.zsbuf->texture == texture)
-         return PIPE_REFERENCED_FOR_WRITE;
-   }
-   
-   return PIPE_UNREFERENCED;
+   return lp_setup_is_texture_referenced(llvmpipe->setup, texture);
 }
 
 static unsigned int
@@ -112,7 +101,6 @@ struct pipe_context *
 llvmpipe_create( struct pipe_screen *screen )
 {
    struct llvmpipe_context *llvmpipe;
-   uint i;
 
    llvmpipe = align_malloc(sizeof(struct llvmpipe_context), 16);
    if (!llvmpipe)
@@ -178,20 +166,6 @@ llvmpipe_create( struct pipe_screen *screen )
    llvmpipe_init_query_funcs( llvmpipe );
    llvmpipe_init_texture_funcs( llvmpipe );
 
-   /* vertex shader samplers */
-   for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
-      llvmpipe->tgsi.vert_samplers[i].base.get_samples = lp_get_samples;
-      llvmpipe->tgsi.vert_samplers[i].processor = TGSI_PROCESSOR_VERTEX;
-      llvmpipe->tgsi.vert_samplers_list[i] = &llvmpipe->tgsi.vert_samplers[i];
-   }
-
-   /* fragment shader samplers */
-   for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
-      llvmpipe->tgsi.frag_samplers[i].base.get_samples = lp_get_samples;
-      llvmpipe->tgsi.frag_samplers[i].processor = TGSI_PROCESSOR_FRAGMENT;
-      llvmpipe->tgsi.frag_samplers_list[i] = &llvmpipe->tgsi.frag_samplers[i];
-   }
-
    /*
     * Create drawing context and plug our rendering stage into it.
     */
@@ -199,14 +173,16 @@ llvmpipe_create( struct pipe_screen *screen )
    if (!llvmpipe->draw) 
       goto fail;
 
-   draw_texture_samplers(llvmpipe->draw,
-                         PIPE_MAX_SAMPLERS,
-                         (struct tgsi_sampler **)
-                            llvmpipe->tgsi.vert_samplers_list);
+   /* FIXME: vertex sampler state
+    */
 
    if (debug_get_bool_option( "LP_NO_RAST", FALSE ))
       llvmpipe->no_rast = TRUE;
 
+   llvmpipe->setup = lp_setup_create();
+   if (!llvmpipe->setup)
+      goto fail;
+
    llvmpipe->vbuf_backend = lp_create_vbuf_backend(llvmpipe);
    if (!llvmpipe->vbuf_backend)
       goto fail;
index 17e889754632cbc0087184fb66697f2262181a76..852f7a1d05c767a91ec4c54b0065b0693a1adff8 100644 (file)
@@ -45,7 +45,7 @@ struct draw_stage;
 struct lp_fragment_shader;
 struct lp_vertex_shader;
 struct lp_blend_state;
-struct lp_setup_context;
+struct setup_context;
 
 struct llvmpipe_context {
    struct pipe_context pipe;  /**< base class */
@@ -110,16 +110,8 @@ struct llvmpipe_context {
    /** Derived from scissor and surface bounds: */
    struct pipe_scissor_state cliprect;
 
-   /** TGSI exec things */
-   struct {
-      struct lp_shader_sampler vert_samplers[PIPE_MAX_SAMPLERS];
-      struct lp_shader_sampler *vert_samplers_list[PIPE_MAX_SAMPLERS];
-      struct lp_shader_sampler frag_samplers[PIPE_MAX_SAMPLERS];
-      struct lp_shader_sampler *frag_samplers_list[PIPE_MAX_SAMPLERS];
-   } tgsi;
-
    /** The tiling engine */
-   struct lp_setup_context *setup;
+   struct setup_context *setup;
 
    /** The primitive drawing context */
    struct draw_context *draw;
index 1126bf90b96b03e9a0d770f04753b481ccda2dc6..a03eb874acb7c560b02e2414f509c6ea2947151d 100644 (file)
@@ -91,7 +91,7 @@ lp_jit_init_globals(struct llvmpipe_screen *screen)
 
       LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, constants,
                              screen->target, context_type, 0);
-      LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, samplers,
+      LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, dummy,
                              screen->target, context_type, 1);
       LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, alpha_ref_value,
                              screen->target, context_type, 2);
index 643e85be20083804de80c3045452c69c94f71aa8..207dfbfde10db04a7f8ca45611adf6aa9e744a72 100644 (file)
@@ -78,7 +78,7 @@ struct lp_jit_context
 {
    const float *constants;
 
-   struct tgsi_sampler **samplers;
+   void *dummy;                 /* remove me */
 
    float alpha_ref_value;
 
index 6c51d40a8f4ae23b3ef528616957e46b97eba01c..925e6f8b3bd71d09533355bbba2011ad500a9c0d 100644 (file)
@@ -136,9 +136,8 @@ static boolean
 lp_vbuf_set_primitive(struct vbuf_render *vbr, unsigned prim)
 {
    struct llvmpipe_vbuf_render *cvbr = llvmpipe_vbuf_render(vbr);
-   struct setup_context *setup_ctx = cvbr->setup;
 
-   llvmpipe_update_state( setup_ctx->llvmpipe );
+   llvmpipe_update_derived( cvbr->llvmpipe );
 
    cvbr->llvmpipe->reduced_prim = u_reduced_prim(prim);
    cvbr->prim = prim;
@@ -524,9 +523,7 @@ lp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr)
 static void
 lp_vbuf_destroy(struct vbuf_render *vbr)
 {
-   struct llvmpipe_vbuf_render *cvbr = llvmpipe_vbuf_render(vbr);
-   lp_setup_destroy_context(cvbr->setup);
-   FREE(cvbr);
+   FREE(vbr);
 }
 
 
@@ -539,6 +536,7 @@ lp_create_vbuf_backend(struct llvmpipe_context *lp)
    struct llvmpipe_vbuf_render *cvbr = CALLOC_STRUCT(llvmpipe_vbuf_render);
 
    assert(lp->draw);
+   assert(lp->setup);
 
 
    cvbr->base.max_indices = LP_MAX_VBUF_INDEXES;
@@ -555,8 +553,7 @@ lp_create_vbuf_backend(struct llvmpipe_context *lp)
    cvbr->base.destroy = lp_vbuf_destroy;
 
    cvbr->llvmpipe = lp;
-
-   cvbr->setup = lp_setup_create_context(cvbr->llvmpipe);
+   cvbr->setup = lp->setup;
 
    return &cvbr->base;
 }
index e3d1cd56e0aa1483c7c038f80bd46a8165989741..498879e4cf9bac469aeb666a7fc03f8ffc79f656 100644 (file)
@@ -40,7 +40,7 @@ struct lp_rasterizer *lp_rast_create( void )
    return CALLOC_STRUCT(lp_rasterizer);
 }
 
-void lp_rast_bind_surfaces( struct lp_rasterizer *,
+void lp_rast_bind_surfaces( struct lp_rasterizer *rast,
                            struct pipe_surface *color,
                            struct pipe_surface *zstencil,
                            const float *clear_color,
@@ -49,11 +49,9 @@ void lp_rast_bind_surfaces( struct lp_rasterizer *,
 {
    pipe_surface_reference(&rast->state.color, color);
    pipe_surface_reference(&rast->state.depth, depth);
-   rast->state.clear_color = util_pack_8888(clear_color);
-   rast->state.clear_depth = clear_depth * 0xffffffff;
-   rast->state.clear_stencil = clear_stencil;
 }
 
+
 /* Begining of each tile:
  */
 void lp_rast_start_tile( struct lp_rasterizer *,
@@ -64,9 +62,10 @@ void lp_rast_start_tile( struct lp_rasterizer *,
    rast->y = y;
 }
 
-void lp_rast_clear_color( struct lp_rasterizer *rast )
+void lp_rast_clear_color( struct lp_rasterizer *rast,
+                          const union lp_rast_cmd_arg *arg )
 {
-   const unsigned clear_color = rast->state.clear_color;
+   const unsigned clear_color = arg->clear.clear_color;
    unsigned i, j;
    
    for (i = 0; i < TILESIZE; i++)
@@ -74,9 +73,10 @@ void lp_rast_clear_color( struct lp_rasterizer *rast )
         rast->tile[i][j] = clear_color;
 }
 
-void lp_rast_clear_depth( struct lp_rasterizer *rast )
+void lp_rast_clear_zstencil( struct lp_rasterizer *rast,
+                             const union lp_rast_cmd_arg *arg)
 {
-   const unsigned clear_depth = rast->state.clear_depth;
+   const unsigned clear_color = arg->clear.clear_zstencil;
    unsigned i, j;
    
    for (i = 0; i < TILESIZE; i++)
@@ -84,19 +84,15 @@ void lp_rast_clear_depth( struct lp_rasterizer *rast )
         rast->tile[i][j] = clear_depth;
 }
 
-void lp_rast_clear_stencil( struct lp_rasterizer *rast )
-{
-   const unsigned clear_stencil = rast->state.clear_stencil;
-
-   memset(rast->tile.stencil, clear_stencil, sizeof rast->tile.stencil );
-}
 
-void lp_rast_load_color( struct lp_rasterizer *rast )
+void lp_rast_load_color( struct lp_rasterizer *rast,
+                         const union lp_rast_cmd_arg *arg)
 {
    /* call u_tile func to load colors from surface */
 }
 
-void lp_rast_load_zstencil( struct lp_rasterizer *rast )
+void lp_rast_load_zstencil( struct lp_rasterizer *rast,
+                            const union lp_rast_cmd_arg *arg )
 {
    /* call u_tile func to load depth (and stencil?) from surface */
 }
@@ -104,15 +100,15 @@ void lp_rast_load_zstencil( struct lp_rasterizer *rast )
 /* Within a tile:
  */
 void lp_rast_set_state( struct lp_rasterizer *rast,
-                      const struct lp_rast_state *state )
+                        const union lp_rast_cmd_arg *arg )
 {
-   rast->shader_state = state;
-   lp->quad.first->begin( lp->quad.first );
+   rast->shader_state = arg->state;
 
 }
 
 
 void lp_rast_shade_tile( struct lp_rasterizer *rast,
+                            const union lp_rast_cmd_arg *arg )
                         const struct lp_rast_shader_inputs *inputs )
 {
    /* Set up the silly quad coef pointers
@@ -193,14 +189,14 @@ void lp_rast_shade_quads( const struct lp_rast_state *state,
 
 /* End of tile:
  */
-void lp_rast_store_color( struct lp_rasterizer *rast )
+void lp_rast_end_tile( struct lp_rasterizer *rast,
+                       boolean write_depth )
 {
    /* call u_tile func to store colors to surface */
-}
 
-void lp_rast_store_zstencil( struct lp_rasterizer *rast )
-{
-   /* call u_tile func to store depth/stencil to surface */
+   if (write_depth) {
+      /* call u_tile func to store depth/stencil to surface */
+   }
 }
 
 /* Shutdown:
index 6d741f72712a906e36307258110cf1174f8cfe3e..5151a174f26168a51ed893ee82b52fb59fb9d6ca 100644 (file)
@@ -50,10 +50,10 @@ lp_setup_clear(struct setup_context *setup,
                unsigned flags);
 
 void
-lp_setup_triangle(struct setup_context *setup,
-                  const float (*v0)[4],
-                  const float (*v1)[4],
-                  const float (*v2)[4]);
+lp_setup_tri(struct setup_context *setup,
+             const float (*v0)[4],
+             const float (*v1)[4],
+             const float (*v2)[4]);
 
 void
 lp_setup_line(struct setup_context *setup,
@@ -74,6 +74,11 @@ lp_setup_set_fs_inputs( struct setup_context *setup,
                         const enum lp_interp *interp,
                         unsigned nr );
 
+boolean
+lp_setup_is_texture_referenced( struct setup_context *setup,
+                                const struct pipe_texture *texture );
+
+
 void 
 lp_setup_destroy( struct setup_context *setup );
 
index 526ea100db6a101644ce81659baee91f19f0e25e..dfc9c0e6f0435a12a212ae7d54304e97b8f8bc07 100644 (file)
 struct lp_sampler_static_state;
 
 
-/**
- * Subclass of tgsi_sampler
- */
-struct lp_shader_sampler
-{
-   struct tgsi_sampler base;  /**< base class */
-
-   unsigned processor;
-
-   /* For lp_get_samples_2d_linear_POT:
-    */
-   unsigned xpot;
-   unsigned ypot;
-   unsigned level;
-
-   const struct pipe_texture *texture;
-   const struct pipe_sampler_state *sampler;
-};
-
-
-
-static INLINE struct lp_shader_sampler *
-lp_shader_sampler(const struct tgsi_sampler *sampler)
-{
-   return (struct lp_shader_sampler *) sampler;
-}
-
-
 
 extern void
 lp_get_samples(struct tgsi_sampler *tgsi_sampler,