mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 21:40:08 +01:00
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.
This commit is contained in:
parent
d4b64167b5
commit
e21e7ab4da
8 changed files with 22 additions and 92 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 *,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue