summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2009-10-08 17:52:35 +0100
committerKeith Whitwell <[email protected]>2009-10-08 17:53:12 +0100
commit1caa26202c3bcc41ea5829b646128088e14d5dfd (patch)
tree04e7b808a06e3033138b59ec33ed03a164442da4 /src/gallium/drivers/llvmpipe
parentd0c918b87a9fb0e86d6b3efedf3ef505e04c527f (diff)
llvmpipe: start cleaning up
Diffstat (limited to 'src/gallium/drivers/llvmpipe')
-rw-r--r--src/gallium/drivers/llvmpipe/SConscript4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.h12
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c41
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.h1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_context.h26
5 files changed, 52 insertions, 32 deletions
diff --git a/src/gallium/drivers/llvmpipe/SConscript b/src/gallium/drivers/llvmpipe/SConscript
index b39bc76da0f..f6945535cad 100644
--- a/src/gallium/drivers/llvmpipe/SConscript
+++ b/src/gallium/drivers/llvmpipe/SConscript
@@ -47,8 +47,6 @@ llvmpipe = env.ConvenienceLibrary(
'lp_jit.c',
'lp_prim_vbuf.c',
'lp_query.c',
- 'lp_rast.c',
- 'lp_rast_tri.c',
'lp_setup.c',
'lp_screen.c',
'lp_state_blend.c',
@@ -61,6 +59,8 @@ llvmpipe = env.ConvenienceLibrary(
'lp_state_vertex.c',
'lp_state_vs.c',
'lp_surface.c',
+ 'lp_rast.c',
+ 'lp_rast_tri.c',
'lp_tex_sample_llvm.c',
'lp_texture.c',
'lp_tile_soa.c',
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h
index 33a6065b89c..f40208bbda9 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.h
+++ b/src/gallium/drivers/llvmpipe/lp_rast.h
@@ -28,6 +28,8 @@
#ifndef LP_RAST_H
#define LP_RAST_H
+#include "lp_jit.h"
+
/* Initially create and program a single rasterizer directly. Later
* will want multiple of these, one or two per core. At that stage
* will probably pass command buffers into the rasterizers rather than
@@ -35,6 +37,9 @@
*/
struct lp_rasterizer;
+#define TILESIZE 64
+
+
struct lp_rast_state {
/* State for the shader:
*/
@@ -55,10 +60,11 @@ struct lp_rast_shader_inputs {
*/
const struct lp_rast_state *state;
- /* Attribute interpolation:
+ /* Attribute interpolation: FIXME: reduce memory waste!
*/
- struct tgsi_interp_coef position_coef;
- struct tgsi_interp_coef *coef;
+ float a0[PIPE_MAX_ATTRIBS][4];
+ float dadx[PIPE_MAX_ATTRIBS][4];
+ float dady[PIPE_MAX_ATTRIBS][4];
};
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index 514366b71f0..43a4f5f0297 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -32,7 +32,7 @@
* lp_setup_flush().
*/
-#include "lp_setup.h"
+#include "lp_setup_context.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@@ -56,31 +56,33 @@ void lp_setup_new_data_block( struct data_block_list *list )
static void reset_context( struct setup_context *setup )
{
+ unsigned i, j;
+
for (i = 0; i < setup->tiles_x; i++) {
for (j = 0; j < setup->tiles_y; j++) {
- struct cmd_block_list *list = scene->tile[i][j];
+ struct cmd_block_list *list = &setup->tile[i][j];
struct cmd_block *block;
struct cmd_block *tmp;
- for (block = list->first; block != list->tail; block = tmp) {
+ for (block = list->head; block != list->tail; block = tmp) {
tmp = block->next;
FREE(block);
}
- list->first = list->tail;
+ list->head = list->tail;
}
}
{
- struct data_block_list *list = &scene->data;
+ struct data_block_list *list = &setup->data;
struct data_block *block, *tmp;
- for (block = list->first; block != list->tail; block = tmp) {
+ for (block = list->head; block != list->tail; block = tmp) {
tmp = block->next;
FREE(block);
}
- list->first = list->tail;
+ list->head = list->tail;
}
}
@@ -90,39 +92,42 @@ static void reset_context( struct setup_context *setup )
/* Add a command to all active bins.
*/
static void bin_everywhere( struct setup_context *setup,
- bin_cmd cmd,
+ lp_rast_cmd cmd,
const union lp_rast_cmd_arg *arg )
{
unsigned i, j;
for (i = 0; i < setup->tiles_x; i++)
for (j = 0; j < setup->tiles_y; j++)
- bin_cmd( setup, &setup->tile[i][j], cmd, arg );
+ bin_cmd( &setup->tile[i][j], cmd, arg );
}
static void
rasterize_bins( struct setup_context *setup,
- struct lp_rast *rast,
boolean write_depth )
{
+ struct lp_rasterizer *rast = setup->rast;
+ struct cmd_block *block;
+ unsigned i,j,k;
+
lp_rast_bind_color( rast,
- scene->fb.color,
+ setup->fb.color,
TRUE ); /* WRITE */
lp_rast_bind_depth( rast,
- scene->fb.depth,
+ setup->fb.zstencil,
write_depth ); /* WRITE */
- for (i = 0; i < scene->tiles_x; i++) {
- for (j = 0; j < scene->tiles_y; j++) {
+ for (i = 0; i < setup->tiles_x; i++) {
+ for (j = 0; j < setup->tiles_y; j++) {
lp_rast_start_tile( rast,
i * TILESIZE,
j * TILESIZE );
- for (block = scene->tile[i][j].first; block; block = block->next) {
- for (k = 0; k < block->nr_cmds; k++) {
- block->cmd[k].func( rast, block->cmd[k].arg );
+ for (block = setup->tile[i][j].head; block; block = block->next) {
+ for (k = 0; k < block->count; k++) {
+ block->cmd[k]( rast, block->arg[k] );
}
}
@@ -130,7 +135,7 @@ rasterize_bins( struct setup_context *setup,
}
}
- lp_setup_free_data( setup );
+ reset_context( setup );
}
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h b/src/gallium/drivers/llvmpipe/lp_setup.h
index 5151a174f26..6f560f5f931 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.h
+++ b/src/gallium/drivers/llvmpipe/lp_setup.h
@@ -37,6 +37,7 @@ enum lp_interp {
LP_INTERP_FACING
};
+struct pipe_texture;
struct setup_context;
struct setup_context *
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h
index eeee7159d93..19d163df8e5 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_context.h
+++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h
@@ -28,23 +28,25 @@
#ifndef LP_SETUP_CONTEXT_H
#define LP_SETUP_CONTEXT_H
+#include "lp_setup.h"
+#include "lp_rast.h"
#define CMD_BLOCK_MAX 128
#define DATA_BLOCK_SIZE (16 * 1024 - sizeof(unsigned) - sizeof(void *))
/* switch to a non-pointer value for this:
*/
-typedef void (*lp_rast_cmd)( struct lp_rast *, const union lp_rast_cmd_arg * );
+typedef void (*lp_rast_cmd)( struct lp_rasterizer *, const union lp_rast_cmd_arg * );
struct cmd_block {
- union lp_rast_arg *arg[CMD_BLOCK_MAX];
lp_rast_cmd cmd[CMD_BLOCK_MAX];
+ const union lp_rast_cmd_arg *arg[CMD_BLOCK_MAX];
unsigned count;
struct cmd_block *next;
};
struct data_block {
- ubyte data[DATA_BLOCK_SZ];
+ ubyte data[DATA_BLOCK_SIZE];
unsigned used;
struct data_block *next;
};
@@ -68,10 +70,12 @@ struct data_block_list {
struct setup_context {
+ struct lp_rasterizer *rast;
+
/* When there are multiple threads, will want to double-buffer the
* bin arrays:
*/
- struct cmd_block_list bin[MAXHEIGHT / TILESIZE][MAXWIDTH / TILESIZE];
+ struct cmd_block_list tile[MAXHEIGHT / TILESIZE][MAXWIDTH / TILESIZE];
struct data_block_list data;
unsigned tiles_x;
@@ -110,9 +114,12 @@ struct setup_context {
void (*triangle)( struct setup_context *,
const float (*v0)[4],
const float (*v1)[4],
- const float (*v1)[4]);
+ const float (*v2)[4]);
};
+void lp_setup_new_data_block( struct data_block_list *list );
+void lp_setup_new_cmd_block( struct cmd_block_list *list );
+
static INLINE void *get_data( struct data_block_list *list,
unsigned size)
{
@@ -123,7 +130,7 @@ static INLINE void *get_data( struct data_block_list *list,
{
struct data_block *tail = list->tail;
- char *data = tail->data + tail->used;
+ ubyte *data = tail->data + tail->used;
tail->used += size;
return data;
}
@@ -132,11 +139,11 @@ static INLINE void *get_data( struct data_block_list *list,
/* Add a command to a given bin.
*/
static INLINE void bin_cmd( struct cmd_block_list *list,
- bin_cmd cmd,
+ lp_rast_cmd cmd,
const union lp_rast_cmd_arg *arg )
{
- if (list->tail.count == CMD_BLOCK_MAX) {
- lp_setup_new_cmd_block( list )
+ if (list->tail->count == CMD_BLOCK_MAX) {
+ lp_setup_new_cmd_block( list );
}
{
@@ -150,3 +157,4 @@ static INLINE void bin_cmd( struct cmd_block_list *list,
+#endif