llvmpipe: hook up some state, add stub line and point functions
authorKeith Whitwell <keithw@vmware.com>
Fri, 9 Oct 2009 09:44:07 +0000 (10:44 +0100)
committerKeith Whitwell <keithw@vmware.com>
Fri, 9 Oct 2009 09:44:07 +0000 (10:44 +0100)
src/gallium/drivers/llvmpipe/SConscript
src/gallium/drivers/llvmpipe/lp_setup.c
src/gallium/drivers/llvmpipe/lp_setup_context.h
src/gallium/drivers/llvmpipe/lp_setup_line.c [new file with mode: 0644]
src/gallium/drivers/llvmpipe/lp_setup_point.c [new file with mode: 0644]
src/gallium/drivers/llvmpipe/lp_setup_tri.c

index f6945535cad6757e5252e509662f5952c7efcc9c..3530e739cc462515b2a34dce04d27e6758b4f3bd 100644 (file)
@@ -48,6 +48,9 @@ llvmpipe = env.ConvenienceLibrary(
                'lp_prim_vbuf.c',
         'lp_query.c',
                'lp_setup.c',
+               'lp_setup_tri.c',
+               'lp_setup_line.c',
+               'lp_setup_point.c',
                'lp_screen.c',
                'lp_state_blend.c',
                'lp_state_clip.c',
index 4f100808165512c636b720b267904eab41273172..13b40f14942a83da1af66e1a94fd1d769ff3e531 100644 (file)
@@ -148,7 +148,7 @@ static void bin_everywhere( struct setup_context *setup,
    unsigned i, j;
    for (i = 0; i < setup->tiles_x; i++)
       for (j = 0; j < setup->tiles_y; j++)
-         bin_cmd( &setup->tile[i][j], cmd, arg );
+         bin_command( &setup->tile[i][j], cmd, arg );
 }
 
 
@@ -382,6 +382,19 @@ lp_setup_clear( struct setup_context *setup,
 }
 
 
+
+void 
+lp_setup_set_tri_state( struct setup_context *setup,
+                        unsigned cull_mode,
+                        boolean ccw_is_frontface)
+{
+   setup->ccw_is_frontface = ccw_is_frontface;
+   setup->cullmode = cull_mode;
+   setup->triangle = first_triangle;
+}
+
+
+
 void
 lp_setup_set_fs_inputs( struct setup_context *setup,
                         const struct lp_shader_input *input,
@@ -432,6 +445,14 @@ lp_setup_tri(struct setup_context *setup,
 void 
 lp_setup_destroy( struct setup_context *setup )
 {
+   unsigned i, j;
+
+   reset_context( setup );
+
+   for (i = 0; i < TILES_X; i++)
+      for (j = 0; j < TILES_Y; j++)
+         FREE(setup->tile[i][j].head);
+
    lp_rast_destroy( setup->rast );
    FREE( setup );
 }
index 7410ac70b8166ce28f11d9cb9cfe0bbfcb79c629..9411f14cfbb232e74dc2849bb81c369750be4d0d 100644 (file)
@@ -83,6 +83,9 @@ struct setup_context {
 
    unsigned tiles_x;
    unsigned tiles_y;
+   
+   boolean ccw_is_frontface;
+   unsigned cullmode;
 
    struct {
       struct pipe_surface *cbuf;
@@ -147,9 +150,9 @@ static INLINE void *get_data( struct data_block_list *list,
 
 /* Add a command to a given bin.
  */
-static INLINE void bin_cmd( struct cmd_block_list *list,
-                            lp_rast_cmd cmd,
-                            const union lp_rast_cmd_arg *arg )
+static INLINE void bin_command( struct cmd_block_list *list,
+                                lp_rast_cmd cmd,
+                                const union lp_rast_cmd_arg *arg )
 {
    if (list->tail->count == CMD_BLOCK_MAX) {
       lp_setup_new_cmd_block( list );
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c
new file mode 100644 (file)
index 0000000..feea79d
--- /dev/null
@@ -0,0 +1,47 @@
+/**************************************************************************
+ *
+ * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/*
+ * Binning code for lines
+ */
+
+#include "lp_setup_context.h"
+
+static void line_nop( struct setup_context *setup,
+                      const float (*v0)[4],
+                      const float (*v1)[4] )
+{
+}
+
+
+void 
+lp_setup_choose_line( struct setup_context *setup )
+{
+   setup->line = line_nop;
+}
+
+
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c
new file mode 100644 (file)
index 0000000..f03ca72
--- /dev/null
@@ -0,0 +1,46 @@
+/**************************************************************************
+ *
+ * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/*
+ * Binning code for points
+ */
+
+#include "lp_setup_context.h"
+
+static void point_nop( struct setup_context *setup,
+                       const float (*v0)[4] )
+{
+}
+
+
+void 
+lp_setup_choose_point( struct setup_context *setup )
+{
+   setup->point = point_nop;
+}
+
+
index 382a52e951907f2760cf485f4987758796b920c7..d3b8ce94345a040a69242cf6b625f41ff005da69 100644 (file)
@@ -30,6 +30,7 @@
  */
 
 #include "lp_setup_context.h"
+#include "lp_rast.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 
@@ -263,10 +264,9 @@ do_triangle_ccw(struct setup_context *setup,
    const float x2 = subpixel_snap(v2[0][0]);
    const float x3 = subpixel_snap(v3[0][0]);
    
-   struct lp_setup_triangle *tri = get_data( setup, sizeof *tri );
+   struct lp_rast_triangle *tri = get_data( &setup->data, sizeof *tri );
    float area;
    float c1, c2, c3;
-   int i;
    int minx, maxx, miny, maxy;
 
    tri->dx12 = x1 - x2;
@@ -363,7 +363,7 @@ do_triangle_ccw(struct setup_context *setup,
    {
       /* Triangle is contained in a single tile:
        */
-      bin_command(setup->tile[minx][miny], lp_rast_triangle, tri );
+      bin_command( &setup->tile[minx][miny], lp_rast_triangle, tri );
    }
    else 
    {
@@ -412,12 +412,12 @@ do_triangle_ccw(struct setup_context *setup,
                     cx3 + ei3 > 0) 
            {
                /* shade whole tile */
-               bin_command(setup->tile[x][y], lp_rast_shade_tile, &tri->inputs );
+               bin_command( &setup->tile[x][y], lp_rast_shade_tile, &tri->inputs );
            }
            else 
            {
                /* shade partial tile */
-              bin_command(setup->tile[x][y], lp_rast_triangle, tri );
+              bin_command( &setup->tile[x][y], lp_rast_triangle, tri );
            }
 
            /* Iterate cx values across the region:
@@ -477,13 +477,11 @@ static void triangle_nop( struct setup_context *setup,
 {
 }
 
-void setup_set_tri_state( struct setup_context *setup,
-                          unsigned cull_mode,
-                          boolean ccw_is_frontface)
-{
-   setup->ccw_is_frontface = ccw_is_frontface;
 
-   switch (cull_mode) {
+void 
+lp_setup_choose_triangle( struct setup_context *setup )
+{
+   switch (setup->cull_mode) {
    case PIPE_WINDING_NONE:
       setup->triangle = triangle_both;
       break;