summaryrefslogtreecommitdiff
path: root/src/gallium/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.c21
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.h54
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast_tri.c4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c63
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_context.h6
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_tri.c17
6 files changed, 98 insertions, 67 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index 9825099c94..de15ddbb2e 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -87,9 +87,9 @@ void lp_rast_start_tile( struct lp_rasterizer *rast,
}
void lp_rast_clear_color( struct lp_rasterizer *rast,
- const union lp_rast_cmd_arg *arg )
+ const union lp_rast_cmd_arg arg )
{
- const uint8_t *clear_color = arg->clear_color;
+ const uint8_t *clear_color = arg.clear_color;
if (clear_color[0] == clear_color[1] &&
clear_color[1] == clear_color[2] &&
@@ -106,25 +106,24 @@ void lp_rast_clear_color( struct lp_rasterizer *rast,
}
void lp_rast_clear_zstencil( struct lp_rasterizer *rast,
- const union lp_rast_cmd_arg *arg)
+ const union lp_rast_cmd_arg arg)
{
- const unsigned clear_zstencil = arg->clear_zstencil;
unsigned i, j;
for (i = 0; i < TILE_SIZE; i++)
for (j = 0; j < TILE_SIZE; j++)
- rast->tile.depth[i*TILE_SIZE + j] = clear_zstencil;
+ rast->tile.depth[i*TILE_SIZE + j] = arg.clear_zstencil;
}
void lp_rast_load_color( struct lp_rasterizer *rast,
- const union lp_rast_cmd_arg *arg)
+ 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,
- const union lp_rast_cmd_arg *arg )
+ const union lp_rast_cmd_arg arg )
{
/* call u_tile func to load depth (and stencil?) from surface */
}
@@ -132,17 +131,17 @@ void lp_rast_load_zstencil( struct lp_rasterizer *rast,
/* Within a tile:
*/
void lp_rast_set_state( struct lp_rasterizer *rast,
- const union lp_rast_cmd_arg *arg )
+ const union lp_rast_cmd_arg arg )
{
- rast->shader_state = arg->set_state;
+ rast->shader_state = arg.set_state;
}
void lp_rast_shade_tile( struct lp_rasterizer *rast,
- const union lp_rast_cmd_arg *arg,
- const struct lp_rast_shader_inputs *inputs )
+ const union lp_rast_cmd_arg arg )
{
+ const struct lp_rast_shader_inputs *inputs = arg.shade_tile;
const unsigned masks[4] = {~0, ~0, ~0, ~0};
unsigned x, y;
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h
index aa50fba5a6..44cb4032da 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.h
+++ b/src/gallium/drivers/llvmpipe/lp_rast.h
@@ -134,34 +134,70 @@ union lp_rast_cmd_arg {
const struct lp_rast_shader_inputs *shade_tile;
const struct lp_rast_triangle *triangle;
const struct lp_rast_state *set_state;
- const uint8_t clear_color[4];
+ uint8_t clear_color[4];
unsigned clear_zstencil;
};
+/* Cast wrappers. Hopefully these compile to noops!
+ */
+static INLINE const union lp_rast_cmd_arg
+lp_rast_arg_inputs( const struct lp_rast_shader_inputs *shade_tile )
+{
+ union lp_rast_cmd_arg arg;
+ arg.shade_tile = shade_tile;
+ return arg;
+}
+
+static INLINE const union lp_rast_cmd_arg
+lp_rast_arg_triangle( const struct lp_rast_triangle *triangle )
+{
+ union lp_rast_cmd_arg arg;
+ arg.triangle = triangle;
+ return arg;
+}
+
+static INLINE const union lp_rast_cmd_arg
+lp_rast_arg_state( const struct lp_rast_state *state )
+{
+ union lp_rast_cmd_arg arg;
+ arg.set_state = state;
+ return arg;
+}
+
+static INLINE const union lp_rast_cmd_arg
+lp_rast_arg_null( void )
+{
+ union lp_rast_cmd_arg arg;
+ arg.set_state = NULL;
+ return arg;
+}
+
+
+
+
/* Binnable Commands:
*/
void lp_rast_clear_color( struct lp_rasterizer *,
- const union lp_rast_cmd_arg *);
+ const union lp_rast_cmd_arg );
void lp_rast_clear_zstencil( struct lp_rasterizer *,
- const union lp_rast_cmd_arg *);
+ const union lp_rast_cmd_arg );
void lp_rast_load_color( struct lp_rasterizer *,
- const union lp_rast_cmd_arg *);
+ const union lp_rast_cmd_arg );
void lp_rast_load_zstencil( struct lp_rasterizer *,
- const union lp_rast_cmd_arg *);
+ const union lp_rast_cmd_arg );
void lp_rast_set_state( struct lp_rasterizer *,
- const union lp_rast_cmd_arg * );
+ const union lp_rast_cmd_arg );
void lp_rast_triangle( struct lp_rasterizer *,
- const union lp_rast_cmd_arg * );
+ const union lp_rast_cmd_arg );
void lp_rast_shade_tile( struct lp_rasterizer *,
- const union lp_rast_cmd_arg *,
- const struct lp_rast_shader_inputs *);
+ const union lp_rast_cmd_arg );
/* End of tile:
diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri.c b/src/gallium/drivers/llvmpipe/lp_rast_tri.c
index 8cd3fcc360..efc635bffe 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast_tri.c
@@ -155,9 +155,9 @@ do_block( struct lp_rasterizer *rast,
* for this triangle:
*/
void lp_rast_triangle( struct lp_rasterizer *rast,
- const union lp_rast_cmd_arg *arg )
+ const union lp_rast_cmd_arg arg )
{
- const struct lp_rast_triangle *tri = arg->triangle;
+ const struct lp_rast_triangle *tri = arg.triangle;
int minx, maxx, miny, maxy;
/* Clamp to tile dimensions:
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index 13b40f1494..c0c294fbe3 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -143,7 +143,7 @@ static void reset_context( struct setup_context *setup )
*/
static void bin_everywhere( struct setup_context *setup,
lp_rast_cmd cmd,
- const union lp_rast_cmd_arg *arg )
+ const union lp_rast_cmd_arg arg )
{
unsigned i, j;
for (i = 0; i < setup->tiles_x; i++)
@@ -232,18 +232,18 @@ begin_binning( struct setup_context *setup )
if (setup->clear.flags & PIPE_CLEAR_COLOR)
bin_everywhere( setup,
lp_rast_clear_color,
- &setup->clear.color );
+ setup->clear.color );
else
- bin_everywhere( setup, lp_rast_load_color, NULL );
+ bin_everywhere( setup, lp_rast_load_color, lp_rast_arg_null() );
}
if (setup->fb.zsbuf) {
if (setup->clear.flags & PIPE_CLEAR_DEPTHSTENCIL)
bin_everywhere( setup,
lp_rast_clear_zstencil,
- &setup->clear.zstencil );
+ setup->clear.zstencil );
else
- bin_everywhere( setup, lp_rast_load_zstencil, NULL );
+ bin_everywhere( setup, lp_rast_load_zstencil, lp_rast_arg_null() );
}
}
@@ -329,32 +329,34 @@ lp_setup_clear( struct setup_context *setup,
unsigned stencil,
unsigned flags )
{
+ if (flags & PIPE_CLEAR_COLOR) {
+ util_pack_color(color,
+ setup->fb.cbuf->format,
+ &setup->clear.color.clear_color );
+ }
+
+ if (flags & PIPE_CLEAR_DEPTHSTENCIL) {
+ setup->clear.zstencil.clear_zstencil =
+ util_pack_z_stencil(setup->fb.zsbuf->format,
+ depth,
+ stencil);
+ }
+
if (setup->state == SETUP_ACTIVE) {
/* Add the clear to existing bins. In the unusual case where
* both color and depth-stencilare being cleared, we could
* discard the currently binned scene and start again, but I
* don't see that as being a common usage.
*/
- if (flags & PIPE_CLEAR_COLOR) {
- union lp_rast_cmd_arg *arg = get_data( &setup->data, sizeof *arg );
-
- util_pack_color(color,
- setup->fb.cbuf->format,
- &arg->clear_color );
-
- bin_everywhere(setup, lp_rast_clear_color, arg );
- }
-
- if (flags & PIPE_CLEAR_DEPTHSTENCIL) {
- union lp_rast_cmd_arg *arg = get_data( &setup->data, sizeof *arg );
+ if (flags & PIPE_CLEAR_COLOR)
+ bin_everywhere( setup,
+ lp_rast_clear_color,
+ setup->clear.color );
- arg->clear_zstencil =
- util_pack_z_stencil(setup->fb.zsbuf->format,
- depth,
- stencil);
-
- bin_everywhere(setup, lp_rast_clear_zstencil, arg );
- }
+ if (setup->clear.flags & PIPE_CLEAR_DEPTHSTENCIL)
+ bin_everywhere( setup,
+ lp_rast_clear_zstencil,
+ setup->clear.zstencil );
}
else {
/* Put ourselves into the 'pre-clear' state, specifically to try
@@ -365,19 +367,6 @@ lp_setup_clear( struct setup_context *setup,
set_state( setup, SETUP_CLEARED );
setup->clear.flags |= flags;
-
- if (flags & PIPE_CLEAR_COLOR) {
- util_pack_color(color,
- setup->fb.cbuf->format,
- &setup->clear.color.clear_color );
- }
-
- if (flags & PIPE_CLEAR_DEPTHSTENCIL) {
- setup->clear.zstencil.clear_zstencil =
- util_pack_z_stencil(setup->fb.zsbuf->format,
- depth,
- stencil);
- }
}
}
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h
index 9411f14cfb..b29fec8ef0 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_context.h
+++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h
@@ -45,11 +45,11 @@
/* switch to a non-pointer value for this:
*/
-typedef void (*lp_rast_cmd)( struct lp_rasterizer *, const union lp_rast_cmd_arg * );
+typedef void (*lp_rast_cmd)( struct lp_rasterizer *, const union lp_rast_cmd_arg );
struct cmd_block {
lp_rast_cmd cmd[CMD_BLOCK_MAX];
- const union lp_rast_cmd_arg *arg[CMD_BLOCK_MAX];
+ union lp_rast_cmd_arg arg[CMD_BLOCK_MAX];
unsigned count;
struct cmd_block *next;
};
@@ -152,7 +152,7 @@ static INLINE void *get_data( struct data_block_list *list,
*/
static INLINE void bin_command( struct cmd_block_list *list,
lp_rast_cmd cmd,
- const union lp_rast_cmd_arg *arg )
+ 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_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
index d3b8ce9434..f927f9df91 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
@@ -230,7 +230,10 @@ static inline float subpixel_snap( float a )
}
-
+static INLINE void bin_triangle( struct cmd_block_list *list,
+ const struct lp_rast_triangle arg )
+{
+}
/* to avoid having to allocate power-of-four, square render targets,
@@ -363,7 +366,8 @@ 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,
+ lp_rast_arg_triangle(tri) );
}
else
{
@@ -412,12 +416,15 @@ 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,
+ lp_rast_arg_inputs(&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,
+ lp_rast_arg_triangle(tri) );
}
/* Iterate cx values across the region:
@@ -481,7 +488,7 @@ static void triangle_nop( struct setup_context *setup,
void
lp_setup_choose_triangle( struct setup_context *setup )
{
- switch (setup->cull_mode) {
+ switch (setup->cullmode) {
case PIPE_WINDING_NONE:
setup->triangle = triangle_both;
break;