diff options
-rw-r--r-- | src/gallium/drivers/llvmpipe/SConscript | 3 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup.c | 23 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup_context.h | 9 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup_line.c | 47 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup_point.c | 46 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup_tri.c | 20 |
6 files changed, 133 insertions, 15 deletions
diff --git a/src/gallium/drivers/llvmpipe/SConscript b/src/gallium/drivers/llvmpipe/SConscript index f6945535cad..3530e739cc4 100644 --- a/src/gallium/drivers/llvmpipe/SConscript +++ b/src/gallium/drivers/llvmpipe/SConscript @@ -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', diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 4f100808165..13b40f14942 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -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 ); } diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h index 7410ac70b81..9411f14cfbb 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_context.h +++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h @@ -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 index 00000000000..feea79d3943 --- /dev/null +++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c @@ -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 index 00000000000..f03ca729b24 --- /dev/null +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -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; +} + + diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index 382a52e9519..d3b8ce94345 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -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; |