static void set_state( struct setup_context *, unsigned );
+struct lp_bins *
+lp_setup_get_current_bins(struct setup_context *setup)
+{
+ /* XXX eventually get bin from queue */
+ return setup->bins;
+}
+
static void
first_triangle( struct setup_context *setup,
setup->fs.stored = NULL;
setup->dirty = ~0;
- lp_reset_bins( &setup->bins );
+ lp_reset_bins( setup->bins );
/* Reset some state:
*/
rasterize_bins( struct setup_context *setup,
boolean write_depth )
{
+ struct lp_bins *bins = lp_setup_get_current_bins(setup);
+
lp_rasterize_bins(setup->rast,
- &setup->bins,
+ bins,
setup->fb,
write_depth);
static void
begin_binning( struct setup_context *setup )
{
+ struct lp_bins *bins = lp_setup_get_current_bins(setup);
+
LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
if (setup->fb->cbufs[0]) {
if (setup->clear.flags & PIPE_CLEAR_COLOR)
- lp_bin_everywhere( &setup->bins,
+ lp_bin_everywhere( bins,
lp_rast_clear_color,
setup->clear.color );
else
- lp_bin_everywhere( &setup->bins,
+ lp_bin_everywhere( bins,
lp_rast_load_color,
lp_rast_arg_null() );
}
if (setup->fb->zsbuf) {
if (setup->clear.flags & PIPE_CLEAR_DEPTHSTENCIL)
- lp_bin_everywhere( &setup->bins,
+ lp_bin_everywhere( bins,
lp_rast_clear_zstencil,
setup->clear.zstencil );
else
- lp_bin_everywhere( &setup->bins,
+ lp_bin_everywhere( bins,
lp_rast_load_zstencil,
lp_rast_arg_null() );
}
lp_setup_bind_framebuffer( struct setup_context *setup,
const struct pipe_framebuffer_state *fb )
{
+ struct lp_bins *bins = lp_setup_get_current_bins(setup);
unsigned tiles_x, tiles_y;
LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
tiles_x = align(setup->fb->width, TILE_SIZE) / TILE_SIZE;
tiles_y = align(setup->fb->height, TILE_SIZE) / TILE_SIZE;
- lp_bin_set_num_bins(&setup->bins, tiles_x, tiles_y);
+ lp_bin_set_num_bins(bins, tiles_x, tiles_y);
}
unsigned stencil,
unsigned flags )
{
+ struct lp_bins *bins = lp_setup_get_current_bins(setup);
unsigned i;
LP_DBG(DEBUG_SETUP, "%s state %d\n", __FUNCTION__, setup->state);
* don't see that as being a common usage.
*/
if (flags & PIPE_CLEAR_COLOR)
- lp_bin_everywhere( &setup->bins,
+ lp_bin_everywhere( bins,
lp_rast_clear_color,
setup->clear.color );
if (setup->clear.flags & PIPE_CLEAR_DEPTHSTENCIL)
- lp_bin_everywhere( &setup->bins,
+ lp_bin_everywhere( bins,
lp_rast_clear_zstencil,
setup->clear.zstencil );
}
static INLINE void
lp_setup_update_shader_state( struct setup_context *setup )
{
+ struct lp_bins *bins = lp_setup_get_current_bins(setup);
+
LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
assert(setup->fs.current.jit_function);
uint8_t *stored;
unsigned i, j;
- stored = lp_bin_alloc_aligned(&setup->bins, 4 * 16, 16);
+ stored = lp_bin_alloc_aligned(bins, 4 * 16, 16);
/* smear each blend color component across 16 ubyte elements */
for (i = 0; i < 4; ++i) {
current_size) != 0) {
void *stored;
- stored = lp_bin_alloc(&setup->bins, current_size);
+ stored = lp_bin_alloc(bins, current_size);
if(stored) {
memcpy(stored,
current_data,
* and append it to the bin's setup data buffer.
*/
struct lp_rast_state *stored =
- (struct lp_rast_state *) lp_bin_alloc(&setup->bins, sizeof *stored);
+ (struct lp_rast_state *) lp_bin_alloc(bins, sizeof *stored);
if(stored) {
memcpy(stored,
&setup->fs.current,
setup->fs.stored = stored;
/* put the state-set command into all bins */
- lp_bin_state_command( &setup->bins,
+ lp_bin_state_command( bins,
lp_rast_set_state,
lp_rast_arg_state(setup->fs.stored) );
}
pipe_buffer_reference(&setup->constants.current, NULL);
- lp_free_bin_data(&setup->bins);
+ lp_bins_destroy(setup->bins);
lp_rast_destroy( setup->rast );
+
FREE( setup );
}
if (!setup->rast)
goto fail;
- lp_init_bins(&setup->bins);
+ setup->bins = lp_bins_create();
setup->triangle = first_triangle;
setup->line = first_line;
const float (*v3)[4],
boolean frontface)
{
+ struct lp_bins *bins = lp_setup_get_current_bins(setup);
unsigned slot;
/* Allocate space for the a0, dadx and dady arrays
{
unsigned bytes;
bytes = (setup->fs.nr_inputs + 1) * 4 * sizeof(float);
- tri->inputs.a0 = lp_bin_alloc_aligned( &setup->bins, bytes, 16 );
- tri->inputs.dadx = lp_bin_alloc_aligned( &setup->bins, bytes, 16 );
- tri->inputs.dady = lp_bin_alloc_aligned( &setup->bins, bytes, 16 );
+ tri->inputs.a0 = lp_bin_alloc_aligned( bins, bytes, 16 );
+ tri->inputs.dadx = lp_bin_alloc_aligned( bins, bytes, 16 );
+ tri->inputs.dady = lp_bin_alloc_aligned( bins, bytes, 16 );
}
/* The internal position input is in slot zero:
const int y2 = subpixel_snap(v2[0][1]);
const int y3 = subpixel_snap(v3[0][1]);
- struct lp_rast_triangle *tri = lp_bin_alloc( &setup->bins, sizeof *tri );
+ struct lp_bins *bins = lp_setup_get_current_bins(setup);
+ struct lp_rast_triangle *tri = lp_bin_alloc( bins, sizeof *tri );
float area, oneoverarea;
int minx, maxx, miny, maxy;
* XXX: subject to overflow??
*/
if (area <= 0) {
- lp_bin_putback_data( &setup->bins, sizeof *tri );
+ lp_bin_putback_data( bins, sizeof *tri );
return;
}
if (tri->miny == tri->maxy ||
tri->minx == tri->maxx) {
- lp_bin_putback_data( &setup->bins, sizeof *tri );
+ lp_bin_putback_data( bins, sizeof *tri );
return;
}
{
/* Triangle is contained in a single tile:
*/
- lp_bin_command( &setup->bins, minx, miny, lp_rast_triangle,
+ lp_bin_command( bins, minx, miny, lp_rast_triangle,
lp_rast_arg_triangle(tri) );
}
else
{
in = 1;
/* triangle covers the whole tile- shade whole tile */
- lp_bin_command( &setup->bins, x, y,
+ lp_bin_command( bins, x, y,
lp_rast_shade_tile,
lp_rast_arg_inputs(&tri->inputs) );
}
{
in = 1;
/* shade partial tile */
- lp_bin_command( &setup->bins, x, y,
+ lp_bin_command( bins, x, y,
lp_rast_triangle,
lp_rast_arg_triangle(tri) );
}