mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 08:58:02 +02:00
llvmpipe: Reset the bin when shading a whole tile with an opaque shader.
This commit is contained in:
parent
4231006e29
commit
a1acbff299
7 changed files with 48 additions and 16 deletions
|
|
@ -68,6 +68,8 @@ struct lp_rast_state {
|
|||
* the tile color/z/stencil data somehow:
|
||||
*/
|
||||
lp_jit_frag_func jit_function;
|
||||
|
||||
boolean opaque;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -88,6 +88,25 @@ lp_scene_is_empty(struct lp_scene *scene )
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
lp_scene_bin_reset(struct lp_scene *scene, unsigned x, unsigned y)
|
||||
{
|
||||
struct cmd_bin *bin = lp_scene_get_bin(scene, x, y);
|
||||
struct cmd_block_list *list = &bin->commands;
|
||||
struct cmd_block *block;
|
||||
struct cmd_block *tmp;
|
||||
|
||||
for (block = list->head; block != list->tail; block = tmp) {
|
||||
tmp = block->next;
|
||||
FREE(block);
|
||||
}
|
||||
|
||||
assert(list->tail->next == NULL);
|
||||
list->head = list->tail;
|
||||
list->head->count = 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set scene to empty state.
|
||||
*/
|
||||
|
|
@ -100,19 +119,7 @@ lp_scene_reset(struct lp_scene *scene )
|
|||
*/
|
||||
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);
|
||||
struct cmd_block_list *list = &bin->commands;
|
||||
struct cmd_block *block;
|
||||
struct cmd_block *tmp;
|
||||
|
||||
for (block = list->head; block != list->tail; block = tmp) {
|
||||
tmp = block->next;
|
||||
FREE(block);
|
||||
}
|
||||
|
||||
assert(list->tail->next == NULL);
|
||||
list->head = list->tail;
|
||||
list->head->count = 0;
|
||||
lp_scene_bin_reset(scene, i, j);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -215,6 +215,10 @@ lp_scene_get_bin(struct lp_scene *scene, unsigned x, unsigned y)
|
|||
}
|
||||
|
||||
|
||||
/** Remove all commands from a bin */
|
||||
void
|
||||
lp_scene_bin_reset(struct lp_scene *scene, unsigned x, unsigned y);
|
||||
|
||||
|
||||
/* Add a command to bin[x][y].
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -364,12 +364,14 @@ lp_setup_set_fs_inputs( struct setup_context *setup,
|
|||
|
||||
void
|
||||
lp_setup_set_fs_function( struct setup_context *setup,
|
||||
lp_jit_frag_func jit_function )
|
||||
lp_jit_frag_func jit_function,
|
||||
boolean opaque )
|
||||
{
|
||||
LP_DBG(DEBUG_SETUP, "%s %p\n", __FUNCTION__, (void *) jit_function);
|
||||
/* FIXME: reference count */
|
||||
|
||||
setup->fs.current.jit_function = jit_function;
|
||||
setup->fs.current.opaque = opaque;
|
||||
setup->dirty |= LP_SETUP_NEW_FS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,8 @@ lp_setup_set_fs_inputs( struct setup_context *setup,
|
|||
|
||||
void
|
||||
lp_setup_set_fs_function( struct setup_context *setup,
|
||||
lp_jit_frag_func jit_function );
|
||||
lp_jit_frag_func jit_function,
|
||||
boolean opaque );
|
||||
|
||||
void
|
||||
lp_setup_set_fs_constants(struct setup_context *setup,
|
||||
|
|
|
|||
|
|
@ -459,6 +459,12 @@ do_triangle_ccw(struct setup_context *setup,
|
|||
{
|
||||
in = 1;
|
||||
/* triangle covers the whole tile- shade whole tile */
|
||||
if(setup->fs.current.opaque) {
|
||||
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,
|
||||
lp_rast_arg_inputs(&tri->inputs) );
|
||||
|
|
|
|||
|
|
@ -1005,6 +1005,7 @@ llvmpipe_update_fs(struct llvmpipe_context *lp)
|
|||
struct lp_fragment_shader *shader = lp->fs;
|
||||
struct lp_fragment_shader_variant_key key;
|
||||
struct lp_fragment_shader_variant *variant;
|
||||
boolean opaque;
|
||||
|
||||
make_variant_key(lp, shader, &key);
|
||||
|
||||
|
|
@ -1021,6 +1022,15 @@ llvmpipe_update_fs(struct llvmpipe_context *lp)
|
|||
|
||||
shader->current = variant;
|
||||
|
||||
/* TODO: put this in the variant */
|
||||
opaque = !key.blend.logicop_enable &&
|
||||
!key.blend.blend_enable &&
|
||||
!key.alpha.enabled &&
|
||||
!key.depth.enabled &&
|
||||
!shader->info.uses_kill
|
||||
? TRUE : FALSE;
|
||||
|
||||
lp_setup_set_fs_function(lp->setup,
|
||||
shader->current->jit_function);
|
||||
shader->current->jit_function,
|
||||
opaque);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue