summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/llvmpipe/lp_context.c40
-rw-r--r--src/gallium/drivers/llvmpipe/lp_context.h12
-rw-r--r--src/gallium/drivers/llvmpipe/lp_jit.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_jit.h2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_prim_vbuf.c11
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.c44
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.h13
-rw-r--r--src/gallium/drivers/llvmpipe/lp_tex_sample.h28
8 files changed, 45 insertions, 107 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c
index f087b65321..7f7b04412c 100644
--- a/src/gallium/drivers/llvmpipe/lp_context.c
+++ b/src/gallium/drivers/llvmpipe/lp_context.c
@@ -44,6 +44,7 @@
#include "lp_texture.h"
#include "lp_winsys.h"
#include "lp_query.h"
+#include "lp_setup.h"
@@ -85,20 +86,8 @@ llvmpipe_is_texture_referenced( struct pipe_context *pipe,
unsigned face, unsigned level)
{
struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe );
- unsigned i;
- if (lp_setup_is_active(llvmpipe->setup)) {
- for (i = 0; i < llvmpipe->framebuffer.nr_cbufs; i++) {
- if(llvmpipe->framebuffer.cbufs[i] &&
- llvmpipe->framebuffer.cbufs[i]->texture == texture)
- return PIPE_REFERENCED_FOR_WRITE;
- }
- if(llvmpipe->framebuffer.zsbuf &&
- llvmpipe->framebuffer.zsbuf->texture == texture)
- return PIPE_REFERENCED_FOR_WRITE;
- }
-
- return PIPE_UNREFERENCED;
+ return lp_setup_is_texture_referenced(llvmpipe->setup, texture);
}
static unsigned int
@@ -112,7 +101,6 @@ struct pipe_context *
llvmpipe_create( struct pipe_screen *screen )
{
struct llvmpipe_context *llvmpipe;
- uint i;
llvmpipe = align_malloc(sizeof(struct llvmpipe_context), 16);
if (!llvmpipe)
@@ -178,20 +166,6 @@ llvmpipe_create( struct pipe_screen *screen )
llvmpipe_init_query_funcs( llvmpipe );
llvmpipe_init_texture_funcs( llvmpipe );
- /* vertex shader samplers */
- for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
- llvmpipe->tgsi.vert_samplers[i].base.get_samples = lp_get_samples;
- llvmpipe->tgsi.vert_samplers[i].processor = TGSI_PROCESSOR_VERTEX;
- llvmpipe->tgsi.vert_samplers_list[i] = &llvmpipe->tgsi.vert_samplers[i];
- }
-
- /* fragment shader samplers */
- for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
- llvmpipe->tgsi.frag_samplers[i].base.get_samples = lp_get_samples;
- llvmpipe->tgsi.frag_samplers[i].processor = TGSI_PROCESSOR_FRAGMENT;
- llvmpipe->tgsi.frag_samplers_list[i] = &llvmpipe->tgsi.frag_samplers[i];
- }
-
/*
* Create drawing context and plug our rendering stage into it.
*/
@@ -199,14 +173,16 @@ llvmpipe_create( struct pipe_screen *screen )
if (!llvmpipe->draw)
goto fail;
- draw_texture_samplers(llvmpipe->draw,
- PIPE_MAX_SAMPLERS,
- (struct tgsi_sampler **)
- llvmpipe->tgsi.vert_samplers_list);
+ /* FIXME: vertex sampler state
+ */
if (debug_get_bool_option( "LP_NO_RAST", FALSE ))
llvmpipe->no_rast = TRUE;
+ llvmpipe->setup = lp_setup_create();
+ if (!llvmpipe->setup)
+ goto fail;
+
llvmpipe->vbuf_backend = lp_create_vbuf_backend(llvmpipe);
if (!llvmpipe->vbuf_backend)
goto fail;
diff --git a/src/gallium/drivers/llvmpipe/lp_context.h b/src/gallium/drivers/llvmpipe/lp_context.h
index 17e8897546..852f7a1d05 100644
--- a/src/gallium/drivers/llvmpipe/lp_context.h
+++ b/src/gallium/drivers/llvmpipe/lp_context.h
@@ -45,7 +45,7 @@ struct draw_stage;
struct lp_fragment_shader;
struct lp_vertex_shader;
struct lp_blend_state;
-struct lp_setup_context;
+struct setup_context;
struct llvmpipe_context {
struct pipe_context pipe; /**< base class */
@@ -110,16 +110,8 @@ struct llvmpipe_context {
/** Derived from scissor and surface bounds: */
struct pipe_scissor_state cliprect;
- /** TGSI exec things */
- struct {
- struct lp_shader_sampler vert_samplers[PIPE_MAX_SAMPLERS];
- struct lp_shader_sampler *vert_samplers_list[PIPE_MAX_SAMPLERS];
- struct lp_shader_sampler frag_samplers[PIPE_MAX_SAMPLERS];
- struct lp_shader_sampler *frag_samplers_list[PIPE_MAX_SAMPLERS];
- } tgsi;
-
/** The tiling engine */
- struct lp_setup_context *setup;
+ struct setup_context *setup;
/** The primitive drawing context */
struct draw_context *draw;
diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c
index 1126bf90b9..a03eb874ac 100644
--- a/src/gallium/drivers/llvmpipe/lp_jit.c
+++ b/src/gallium/drivers/llvmpipe/lp_jit.c
@@ -91,7 +91,7 @@ lp_jit_init_globals(struct llvmpipe_screen *screen)
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, constants,
screen->target, context_type, 0);
- LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, samplers,
+ LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, dummy,
screen->target, context_type, 1);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, alpha_ref_value,
screen->target, context_type, 2);
diff --git a/src/gallium/drivers/llvmpipe/lp_jit.h b/src/gallium/drivers/llvmpipe/lp_jit.h
index 643e85be20..207dfbfde1 100644
--- a/src/gallium/drivers/llvmpipe/lp_jit.h
+++ b/src/gallium/drivers/llvmpipe/lp_jit.h
@@ -78,7 +78,7 @@ struct lp_jit_context
{
const float *constants;
- struct tgsi_sampler **samplers;
+ void *dummy; /* remove me */
float alpha_ref_value;
diff --git a/src/gallium/drivers/llvmpipe/lp_prim_vbuf.c b/src/gallium/drivers/llvmpipe/lp_prim_vbuf.c
index 6c51d40a8f..925e6f8b3b 100644
--- a/src/gallium/drivers/llvmpipe/lp_prim_vbuf.c
+++ b/src/gallium/drivers/llvmpipe/lp_prim_vbuf.c
@@ -136,9 +136,8 @@ static boolean
lp_vbuf_set_primitive(struct vbuf_render *vbr, unsigned prim)
{
struct llvmpipe_vbuf_render *cvbr = llvmpipe_vbuf_render(vbr);
- struct setup_context *setup_ctx = cvbr->setup;
- llvmpipe_update_state( setup_ctx->llvmpipe );
+ llvmpipe_update_derived( cvbr->llvmpipe );
cvbr->llvmpipe->reduced_prim = u_reduced_prim(prim);
cvbr->prim = prim;
@@ -524,9 +523,7 @@ lp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr)
static void
lp_vbuf_destroy(struct vbuf_render *vbr)
{
- struct llvmpipe_vbuf_render *cvbr = llvmpipe_vbuf_render(vbr);
- lp_setup_destroy_context(cvbr->setup);
- FREE(cvbr);
+ FREE(vbr);
}
@@ -539,6 +536,7 @@ lp_create_vbuf_backend(struct llvmpipe_context *lp)
struct llvmpipe_vbuf_render *cvbr = CALLOC_STRUCT(llvmpipe_vbuf_render);
assert(lp->draw);
+ assert(lp->setup);
cvbr->base.max_indices = LP_MAX_VBUF_INDEXES;
@@ -555,8 +553,7 @@ lp_create_vbuf_backend(struct llvmpipe_context *lp)
cvbr->base.destroy = lp_vbuf_destroy;
cvbr->llvmpipe = lp;
-
- cvbr->setup = lp_setup_create_context(cvbr->llvmpipe);
+ cvbr->setup = lp->setup;
return &cvbr->base;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index e3d1cd56e0..498879e4cf 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -40,7 +40,7 @@ struct lp_rasterizer *lp_rast_create( void )
return CALLOC_STRUCT(lp_rasterizer);
}
-void lp_rast_bind_surfaces( struct lp_rasterizer *,
+void lp_rast_bind_surfaces( struct lp_rasterizer *rast,
struct pipe_surface *color,
struct pipe_surface *zstencil,
const float *clear_color,
@@ -49,11 +49,9 @@ void lp_rast_bind_surfaces( struct lp_rasterizer *,
{
pipe_surface_reference(&rast->state.color, color);
pipe_surface_reference(&rast->state.depth, depth);
- rast->state.clear_color = util_pack_8888(clear_color);
- rast->state.clear_depth = clear_depth * 0xffffffff;
- rast->state.clear_stencil = clear_stencil;
}
+
/* Begining of each tile:
*/
void lp_rast_start_tile( struct lp_rasterizer *,
@@ -64,9 +62,10 @@ void lp_rast_start_tile( struct lp_rasterizer *,
rast->y = y;
}
-void lp_rast_clear_color( struct lp_rasterizer *rast )
+void lp_rast_clear_color( struct lp_rasterizer *rast,
+ const union lp_rast_cmd_arg *arg )
{
- const unsigned clear_color = rast->state.clear_color;
+ const unsigned clear_color = arg->clear.clear_color;
unsigned i, j;
for (i = 0; i < TILESIZE; i++)
@@ -74,9 +73,10 @@ void lp_rast_clear_color( struct lp_rasterizer *rast )
rast->tile[i][j] = clear_color;
}
-void lp_rast_clear_depth( struct lp_rasterizer *rast )
+void lp_rast_clear_zstencil( struct lp_rasterizer *rast,
+ const union lp_rast_cmd_arg *arg)
{
- const unsigned clear_depth = rast->state.clear_depth;
+ const unsigned clear_color = arg->clear.clear_zstencil;
unsigned i, j;
for (i = 0; i < TILESIZE; i++)
@@ -84,19 +84,15 @@ void lp_rast_clear_depth( struct lp_rasterizer *rast )
rast->tile[i][j] = clear_depth;
}
-void lp_rast_clear_stencil( struct lp_rasterizer *rast )
-{
- const unsigned clear_stencil = rast->state.clear_stencil;
-
- memset(rast->tile.stencil, clear_stencil, sizeof rast->tile.stencil );
-}
-void lp_rast_load_color( struct lp_rasterizer *rast )
+void lp_rast_load_color( struct lp_rasterizer *rast,
+ const union lp_rast_cmd_arg *arg)
{
/* call u_tile func to load colors from surface */
}
-void lp_rast_load_zstencil( struct lp_rasterizer *rast )
+void lp_rast_load_zstencil( struct lp_rasterizer *rast,
+ const union lp_rast_cmd_arg *arg )
{
/* call u_tile func to load depth (and stencil?) from surface */
}
@@ -104,15 +100,15 @@ void lp_rast_load_zstencil( struct lp_rasterizer *rast )
/* Within a tile:
*/
void lp_rast_set_state( struct lp_rasterizer *rast,
- const struct lp_rast_state *state )
+ const union lp_rast_cmd_arg *arg )
{
- rast->shader_state = state;
- lp->quad.first->begin( lp->quad.first );
+ rast->shader_state = arg->state;
}
void lp_rast_shade_tile( struct lp_rasterizer *rast,
+ const union lp_rast_cmd_arg *arg )
const struct lp_rast_shader_inputs *inputs )
{
/* Set up the silly quad coef pointers
@@ -193,14 +189,14 @@ void lp_rast_shade_quads( const struct lp_rast_state *state,
/* End of tile:
*/
-void lp_rast_store_color( struct lp_rasterizer *rast )
+void lp_rast_end_tile( struct lp_rasterizer *rast,
+ boolean write_depth )
{
/* call u_tile func to store colors to surface */
-}
-void lp_rast_store_zstencil( struct lp_rasterizer *rast )
-{
- /* call u_tile func to store depth/stencil to surface */
+ if (write_depth) {
+ /* call u_tile func to store depth/stencil to surface */
+ }
}
/* Shutdown:
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h b/src/gallium/drivers/llvmpipe/lp_setup.h
index 6d741f7271..5151a174f2 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.h
+++ b/src/gallium/drivers/llvmpipe/lp_setup.h
@@ -50,10 +50,10 @@ lp_setup_clear(struct setup_context *setup,
unsigned flags);
void
-lp_setup_triangle(struct setup_context *setup,
- const float (*v0)[4],
- const float (*v1)[4],
- const float (*v2)[4]);
+lp_setup_tri(struct setup_context *setup,
+ const float (*v0)[4],
+ const float (*v1)[4],
+ const float (*v2)[4]);
void
lp_setup_line(struct setup_context *setup,
@@ -74,6 +74,11 @@ lp_setup_set_fs_inputs( struct setup_context *setup,
const enum lp_interp *interp,
unsigned nr );
+boolean
+lp_setup_is_texture_referenced( struct setup_context *setup,
+ const struct pipe_texture *texture );
+
+
void
lp_setup_destroy( struct setup_context *setup );
diff --git a/src/gallium/drivers/llvmpipe/lp_tex_sample.h b/src/gallium/drivers/llvmpipe/lp_tex_sample.h
index 526ea100db..dfc9c0e6f0 100644
--- a/src/gallium/drivers/llvmpipe/lp_tex_sample.h
+++ b/src/gallium/drivers/llvmpipe/lp_tex_sample.h
@@ -37,34 +37,6 @@
struct lp_sampler_static_state;
-/**
- * Subclass of tgsi_sampler
- */
-struct lp_shader_sampler
-{
- struct tgsi_sampler base; /**< base class */
-
- unsigned processor;
-
- /* For lp_get_samples_2d_linear_POT:
- */
- unsigned xpot;
- unsigned ypot;
- unsigned level;
-
- const struct pipe_texture *texture;
- const struct pipe_sampler_state *sampler;
-};
-
-
-
-static INLINE struct lp_shader_sampler *
-lp_shader_sampler(const struct tgsi_sampler *sampler)
-{
- return (struct lp_shader_sampler *) sampler;
-}
-
-
extern void
lp_get_samples(struct tgsi_sampler *tgsi_sampler,