X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fllvmpipe%2Flp_scene.h;h=b602b1e8a05c31569d8c25ddeca0bd8391adcce8;hb=2ab737557258148d52d9b9e983e4b18560b7a460;hp=796fc516ccc5e9eb71394a3ed3a195815557ed80;hpb=080c40ab32b2abd6d8381b4a0cc143d36a1652b2;p=mesa.git diff --git a/src/gallium/drivers/llvmpipe/lp_scene.h b/src/gallium/drivers/llvmpipe/lp_scene.h index 796fc516ccc..b602b1e8a05 100644 --- a/src/gallium/drivers/llvmpipe/lp_scene.h +++ b/src/gallium/drivers/llvmpipe/lp_scene.h @@ -35,10 +35,11 @@ #ifndef LP_SCENE_H #define LP_SCENE_H -#include "pipe/p_thread.h" +#include "os/os_thread.h" #include "lp_tile_soa.h" #include "lp_rast.h" +struct lp_scene_queue; /* We're limited to 2K by 2K for 32bit fixed point rasterization. * Will need a 64-bit version for larger framebuffers. @@ -56,8 +57,7 @@ /* switch to a non-pointer value for this: */ -typedef void (*lp_rast_cmd)( struct lp_rasterizer *, - unsigned thread_index, +typedef void (*lp_rast_cmd)( struct lp_rasterizer_task *, const union lp_rast_cmd_arg ); struct cmd_block { @@ -97,6 +97,13 @@ struct data_block_list { }; +/** List of texture references */ +struct texture_ref { + struct pipe_texture *texture; + struct texture_ref *prev, *next; /**< linked list w/ u_simple_list.h */ +}; + + /** * All bins and bin data are contained here. * Per-bin data goes into the 'tile' bins. @@ -106,12 +113,19 @@ struct data_block_list { * scenes: */ struct lp_scene { - struct cmd_bin tile[TILES_X][TILES_Y]; - struct data_block_list data; + struct pipe_context *pipe; + + /* Scene's buffers are mapped at the time the scene is enqueued: + */ + void *cbuf_map[PIPE_MAX_COLOR_BUFS]; + uint8_t *zsbuf_map; /** the framebuffer to render the scene into */ struct pipe_framebuffer_state fb; + /** list of textures referenced by the scene commands */ + struct texture_ref textures; + boolean write_depth; /** @@ -122,23 +136,28 @@ struct lp_scene { int curr_x, curr_y; /**< for iterating over bins */ pipe_mutex mutex; + + /* Where to place this scene once it has been rasterized: + */ + struct lp_scene_queue *empty_queue; + + struct cmd_bin tile[TILES_X][TILES_Y]; + struct data_block_list data; }; -struct lp_scene *lp_scene_create(void); +struct lp_scene *lp_scene_create(struct pipe_context *pipe, + struct lp_scene_queue *empty_queue); void lp_scene_destroy(struct lp_scene *scene); -void lp_scene_init(struct lp_scene *scene); -void lp_scene_reset(struct lp_scene *scene ); +boolean lp_scene_is_empty(struct lp_scene *scene ); -void lp_scene_free_bin_data(struct lp_scene *scene); +void lp_scene_reset(struct lp_scene *scene ); -void lp_scene_set_framebuffer_size( struct lp_scene *scene, - unsigned width, unsigned height ); void lp_bin_new_data_block( struct data_block_list *list ); @@ -148,6 +167,12 @@ unsigned lp_scene_data_size( const struct lp_scene *scene ); unsigned lp_scene_bin_size( const struct lp_scene *scene, unsigned x, unsigned y ); +void lp_scene_texture_reference( struct lp_scene *scene, + struct pipe_texture *texture ); + +boolean lp_scene_is_texture_referenced( const struct lp_scene *scene, + const struct pipe_texture *texture ); + /** * Allocate space for a command/data in the bin's data buffer. @@ -213,6 +238,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]. */ @@ -225,6 +254,9 @@ lp_scene_bin_command( struct lp_scene *scene, struct cmd_bin *bin = lp_scene_get_bin(scene, x, y); struct cmd_block_list *list = &bin->commands; + assert(x < scene->tiles_x); + assert(y < scene->tiles_y); + if (list->tail->count == CMD_BLOCK_MAX) { lp_bin_new_cmd_block( list ); } @@ -272,5 +304,13 @@ lp_scene_bin_iter_begin( struct lp_scene *scene ); struct cmd_bin * lp_scene_bin_iter_next( struct lp_scene *scene, int *bin_x, int *bin_y ); +void +lp_scene_rasterize( struct lp_scene *scene, + struct lp_rasterizer *rast, + boolean write_depth ); + +void +lp_scene_begin_binning( struct lp_scene *scene, + struct pipe_framebuffer_state *fb ); #endif /* LP_BIN_H */