summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-12-09 12:28:54 -0700
committerBrian Paul <[email protected]>2009-12-09 12:28:59 -0700
commit22b07b8be4c2939b00e10f17fa91e68682808594 (patch)
tree32ac9821058bad0140104e509d4606e4c4c19e7f
parent88e62b33dc5ed4a4ab0c668e627c7e85991c74a1 (diff)
llvmpipe: use new lp_setup_get_current_bins() function
This stub function will interface to the queue system...
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c46
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_context.h3
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_tri.c20
3 files changed, 44 insertions, 25 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index 4935d5b5407..484a609e6eb 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -47,6 +47,13 @@
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,
@@ -88,7 +95,7 @@ static void reset_context( struct setup_context *setup )
setup->fs.stored = NULL;
setup->dirty = ~0;
- lp_reset_bins( &setup->bins );
+ lp_reset_bins( setup->bins );
/* Reset some state:
*/
@@ -108,8 +115,10 @@ static void
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);
@@ -123,26 +132,28 @@ rasterize_bins( struct setup_context *setup,
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() );
}
@@ -215,6 +226,7 @@ void
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__);
@@ -226,7 +238,7 @@ lp_setup_bind_framebuffer( struct setup_context *setup,
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);
}
@@ -237,6 +249,7 @@ lp_setup_clear( struct setup_context *setup,
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);
@@ -261,12 +274,12 @@ lp_setup_clear( struct setup_context *setup,
* 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 );
}
@@ -407,6 +420,8 @@ lp_setup_is_texture_referenced( struct setup_context *setup,
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);
@@ -415,7 +430,7 @@ lp_setup_update_shader_state( struct setup_context *setup )
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) {
@@ -447,7 +462,7 @@ lp_setup_update_shader_state( struct setup_context *setup )
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,
@@ -477,7 +492,7 @@ lp_setup_update_shader_state( struct setup_context *setup )
* 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,
@@ -485,7 +500,7 @@ lp_setup_update_shader_state( struct setup_context *setup )
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) );
}
@@ -537,9 +552,10 @@ lp_setup_destroy( struct setup_context *setup )
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 );
}
@@ -557,7 +573,7 @@ lp_setup_create( struct pipe_screen *screen )
if (!setup->rast)
goto fail;
- lp_init_bins(&setup->bins);
+ setup->bins = lp_bins_create();
setup->triangle = first_triangle;
setup->line = first_line;
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h
index 9b47b595c62..782c05122ca 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_context.h
+++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h
@@ -55,7 +55,7 @@ struct setup_context {
struct lp_rasterizer *rast;
- struct lp_bins bins;
+ struct lp_bins *bins;
boolean ccw_is_frontface;
unsigned cullmode;
@@ -113,5 +113,6 @@ void lp_setup_choose_triangle( struct setup_context *setup );
void lp_setup_choose_line( struct setup_context *setup );
void lp_setup_choose_point( struct setup_context *setup );
+struct lp_bins *lp_setup_get_current_bins(struct setup_context *setup);
#endif
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
index b8f79849e8b..80617120b1c 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
@@ -178,6 +178,7 @@ static void setup_tri_coefficients( struct setup_context *setup,
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
@@ -185,9 +186,9 @@ static void setup_tri_coefficients( struct setup_context *setup,
{
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:
@@ -263,7 +264,8 @@ do_triangle_ccw(struct setup_context *setup,
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;
@@ -283,7 +285,7 @@ do_triangle_ccw(struct setup_context *setup,
* XXX: subject to overflow??
*/
if (area <= 0) {
- lp_bin_putback_data( &setup->bins, sizeof *tri );
+ lp_bin_putback_data( bins, sizeof *tri );
return;
}
@@ -295,7 +297,7 @@ do_triangle_ccw(struct setup_context *setup,
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;
}
@@ -405,7 +407,7 @@ do_triangle_ccw(struct setup_context *setup,
{
/* 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
@@ -464,7 +466,7 @@ do_triangle_ccw(struct setup_context *setup,
{
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) );
}
@@ -472,7 +474,7 @@ do_triangle_ccw(struct setup_context *setup,
{
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) );
}