aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2010-07-10 16:40:34 +0100
committerJosé Fonseca <[email protected]>2010-07-13 17:28:54 +0100
commite21e7ab4da859198dfa9845b4a7207c49db54771 (patch)
tree8945e35c358bd5d0e5f00328a93fc4168c8c160c
parentd4b64167b56f780d0dea73193c345622888fbc16 (diff)
llvmpipe: eliminate the set_state rasterizer command
Just put a pointer to the state in the tri->inputs struct. Remove some complex logic for eliminating unused statechanges in bins at the expense of a slightly larger triangle struct.
-rw-r--r--src/gallium/drivers/llvmpipe/lp_memory.c6
-rw-r--r--src/gallium/drivers/llvmpipe/lp_memory.h2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.c23
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.h5
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast_priv.h15
-rw-r--r--src/gallium/drivers/llvmpipe/lp_scene.c54
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c5
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_tri.c4
8 files changed, 22 insertions, 92 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_memory.c b/src/gallium/drivers/llvmpipe/lp_memory.c
index f2e41f3a71d..61d16668eb9 100644
--- a/src/gallium/drivers/llvmpipe/lp_memory.c
+++ b/src/gallium/drivers/llvmpipe/lp_memory.c
@@ -45,6 +45,12 @@ lp_get_dummy_tile(void)
return lp_dummy_tile;
}
+uint8_t *
+lp_get_dummy_tile_silent(void)
+{
+ return lp_dummy_tile;
+}
+
boolean
lp_is_dummy_tile(void *tile)
diff --git a/src/gallium/drivers/llvmpipe/lp_memory.h b/src/gallium/drivers/llvmpipe/lp_memory.h
index aca7970b469..1d0e5ebdb69 100644
--- a/src/gallium/drivers/llvmpipe/lp_memory.h
+++ b/src/gallium/drivers/llvmpipe/lp_memory.h
@@ -35,6 +35,8 @@
extern uint8_t *
lp_get_dummy_tile(void);
+uint8_t *
+lp_get_dummy_tile_silent(void);
extern boolean
lp_is_dummy_tile(void *tile);
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index 0130e39fd8c..a023d2b668e 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -383,21 +383,6 @@ lp_rast_store_linear_color( struct lp_rasterizer_task *task,
}
-/**
- * This is a bin command called during bin processing.
- */
-void
-lp_rast_set_state(struct lp_rasterizer_task *task,
- const union lp_rast_cmd_arg arg)
-{
- const struct lp_rast_state *state = arg.set_state;
-
- LP_DBG(DEBUG_RAST, "%s %p\n", __FUNCTION__, (void *) state);
-
- /* just set the current state pointer for this rasterizer */
- task->current_state = state;
-}
-
/**
* Run the shader on all blocks in a tile. This is used when a tile is
@@ -409,8 +394,8 @@ lp_rast_shade_tile(struct lp_rasterizer_task *task,
const union lp_rast_cmd_arg arg)
{
struct lp_rasterizer *rast = task->rast;
- const struct lp_rast_state *state = task->current_state;
const struct lp_rast_shader_inputs *inputs = arg.shade_tile;
+ const struct lp_rast_state *state = inputs->state;
struct lp_fragment_shader_variant *variant = state->variant;
const unsigned tile_x = task->x, tile_y = task->y;
unsigned x, y;
@@ -483,7 +468,7 @@ lp_rast_shade_quads_mask(struct lp_rasterizer_task *task,
unsigned x, unsigned y,
unsigned mask)
{
- const struct lp_rast_state *state = task->current_state;
+ const struct lp_rast_state *state = inputs->state;
struct lp_fragment_shader_variant *variant = state->variant;
struct lp_rasterizer *rast = task->rast;
uint8_t *color[PIPE_MAX_COLOR_BUFS];
@@ -730,7 +715,6 @@ static struct {
RAST(triangle_7),
RAST(shade_tile),
RAST(shade_tile_opaque),
- RAST(set_state),
RAST(store_linear_color),
RAST(fence),
RAST(begin_query),
@@ -786,8 +770,7 @@ is_empty_bin( const struct cmd_bin *bin )
}
for (i = 0; i < head->count; i++)
- if (head->cmd[i] != lp_rast_set_state &&
- head->cmd[i] != lp_rast_store_linear_color) {
+ if (head->cmd[i] != lp_rast_store_linear_color) {
return FALSE;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h
index ae73e6d8c92..0991344cce9 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.h
+++ b/src/gallium/drivers/llvmpipe/lp_rast.h
@@ -83,6 +83,8 @@ struct lp_rast_shader_inputs {
float (*a0)[4];
float (*dadx)[4];
float (*dady)[4];
+
+ const struct lp_rast_state *state;
};
struct lp_rast_clearzs {
@@ -225,9 +227,6 @@ void lp_rast_clear_color( struct lp_rasterizer_task *,
void lp_rast_clear_zstencil( struct lp_rasterizer_task *,
const union lp_rast_cmd_arg );
-void lp_rast_set_state( struct lp_rasterizer_task *,
- const union lp_rast_cmd_arg );
-
void lp_rast_triangle_1( struct lp_rasterizer_task *,
const union lp_rast_cmd_arg );
void lp_rast_triangle_2( struct lp_rasterizer_task *,
diff --git a/src/gallium/drivers/llvmpipe/lp_rast_priv.h b/src/gallium/drivers/llvmpipe/lp_rast_priv.h
index 024a28be599..8a884177c12 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast_priv.h
+++ b/src/gallium/drivers/llvmpipe/lp_rast_priv.h
@@ -53,8 +53,6 @@ struct lp_rasterizer_task
uint8_t *color_tiles[PIPE_MAX_COLOR_BUFS];
uint8_t *depth_tile;
- const struct lp_rast_state *current_state;
-
/** "back" pointer */
struct lp_rasterizer *rast;
@@ -144,10 +142,13 @@ lp_rast_get_depth_block_pointer(struct lp_rasterizer_task *task,
assert((x % TILE_VECTOR_WIDTH) == 0);
assert((y % TILE_VECTOR_HEIGHT) == 0);
- if (!rast->zsbuf.map && (task->current_state->variant->key.depth.enabled ||
- task->current_state->variant->key.stencil[0].enabled)) {
- /* out of memory - use dummy tile memory */
- return lp_get_dummy_tile();
+ if (!rast->zsbuf.map) {
+ /* Either out of memory or no zsbuf. Can't tell without access
+ * to the state. Just use dummy tile memory, but don't print
+ * the oom warning as this most likely because there is no
+ * zsbuf.
+ */
+ return lp_get_dummy_tile_silent();
}
depth = (rast->zsbuf.map +
@@ -240,7 +241,7 @@ lp_rast_shade_quads_all( struct lp_rasterizer_task *task,
unsigned x, unsigned y )
{
const struct lp_rasterizer *rast = task->rast;
- const struct lp_rast_state *state = task->current_state;
+ const struct lp_rast_state *state = inputs->state;
struct lp_fragment_shader_variant *variant = state->variant;
uint8_t *color[PIPE_MAX_COLOR_BUFS];
void *depth;
diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c
index f2226a538a5..f88a759fe70 100644
--- a/src/gallium/drivers/llvmpipe/lp_scene.c
+++ b/src/gallium/drivers/llvmpipe/lp_scene.c
@@ -306,60 +306,6 @@ lp_scene_is_resource_referenced(const struct lp_scene *scene,
}
-/**
- * Return last command in the bin
- */
-static lp_rast_cmd
-lp_get_last_command( const struct cmd_bin *bin )
-{
- const struct cmd_block *tail = bin->commands.tail;
- const unsigned i = tail->count;
- if (i > 0)
- return tail->cmd[i - 1];
- else
- return NULL;
-}
-
-
-/**
- * Replace the arg of the last command in the bin.
- */
-static void
-lp_replace_last_command_arg( struct cmd_bin *bin,
- const union lp_rast_cmd_arg arg )
-{
- struct cmd_block *tail = bin->commands.tail;
- const unsigned i = tail->count;
- assert(i > 0);
- tail->arg[i - 1] = arg;
-}
-
-
-
-/**
- * Put a state-change command into all bins.
- * If we find that the last command in a bin was also a state-change
- * command, we can simply replace that one with the new one.
- */
-void
-lp_scene_bin_state_command( struct lp_scene *scene,
- lp_rast_cmd cmd,
- const union lp_rast_cmd_arg arg )
-{
- unsigned i, j;
- for (i = 0; i < scene->tiles_x; i++) {
- for (j = 0; j < scene->tiles_y; j++) {
- struct cmd_bin *bin = lp_scene_get_bin(scene, i, j);
- lp_rast_cmd last_cmd = lp_get_last_command(bin);
- if (last_cmd == cmd) {
- lp_replace_last_command_arg(bin, arg);
- }
- else {
- lp_scene_bin_command( scene, i, j, cmd, arg );
- }
- }
- }
-}
/** advance curr_x,y to the next bin */
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index 40959e62084..c429f4be0dc 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -805,11 +805,6 @@ lp_setup_update_state( struct lp_setup_context *setup )
&setup->fs.current,
sizeof setup->fs.current);
setup->fs.stored = stored;
-
- /* put the state-set command into all bins */
- lp_scene_bin_state_command( scene,
- lp_rast_set_state,
- lp_rast_arg_state(setup->fs.stored) );
}
/* The scene now references the textures in the rasterization
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
index 036b5497faa..4ceb789b775 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
@@ -535,6 +535,7 @@ do_triangle_ccw(struct lp_setup_context *setup,
setup_tri_coefficients( setup, tri, &info );
tri->inputs.facing = frontfacing ? 1.0F : -1.0F;
+ tri->inputs.state = setup->fs.stored;
@@ -774,9 +775,6 @@ do_triangle_ccw(struct lp_setup_context *setup,
if (variant->opaque &&
!setup->fb.zsbuf) {
lp_scene_bin_reset( scene, x, y );
- lp_scene_bin_command( scene, x, y,
- lp_rast_set_state,
- lp_rast_arg_state(setup->fs.stored) );
}
lp_scene_bin_command( scene, x, y,
lp_rast_shade_tile,