llvmpipe: remove some old sampler support structs

This commit is contained in:
Keith Whitwell 2009-10-08 17:20:40 +01:00
parent 921584181e
commit d0c918b87a
8 changed files with 45 additions and 107 deletions

View File

@ -44,6 +44,7 @@
#include "lp_texture.h" #include "lp_texture.h"
#include "lp_winsys.h" #include "lp_winsys.h"
#include "lp_query.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) unsigned face, unsigned level)
{ {
struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe ); struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe );
unsigned i;
if (lp_setup_is_active(llvmpipe->setup)) { return lp_setup_is_texture_referenced(llvmpipe->setup, texture);
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;
} }
static unsigned int static unsigned int
@ -112,7 +101,6 @@ struct pipe_context *
llvmpipe_create( struct pipe_screen *screen ) llvmpipe_create( struct pipe_screen *screen )
{ {
struct llvmpipe_context *llvmpipe; struct llvmpipe_context *llvmpipe;
uint i;
llvmpipe = align_malloc(sizeof(struct llvmpipe_context), 16); llvmpipe = align_malloc(sizeof(struct llvmpipe_context), 16);
if (!llvmpipe) if (!llvmpipe)
@ -178,20 +166,6 @@ llvmpipe_create( struct pipe_screen *screen )
llvmpipe_init_query_funcs( llvmpipe ); llvmpipe_init_query_funcs( llvmpipe );
llvmpipe_init_texture_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. * Create drawing context and plug our rendering stage into it.
*/ */
@ -199,14 +173,16 @@ llvmpipe_create( struct pipe_screen *screen )
if (!llvmpipe->draw) if (!llvmpipe->draw)
goto fail; goto fail;
draw_texture_samplers(llvmpipe->draw, /* FIXME: vertex sampler state
PIPE_MAX_SAMPLERS, */
(struct tgsi_sampler **)
llvmpipe->tgsi.vert_samplers_list);
if (debug_get_bool_option( "LP_NO_RAST", FALSE )) if (debug_get_bool_option( "LP_NO_RAST", FALSE ))
llvmpipe->no_rast = TRUE; llvmpipe->no_rast = TRUE;
llvmpipe->setup = lp_setup_create();
if (!llvmpipe->setup)
goto fail;
llvmpipe->vbuf_backend = lp_create_vbuf_backend(llvmpipe); llvmpipe->vbuf_backend = lp_create_vbuf_backend(llvmpipe);
if (!llvmpipe->vbuf_backend) if (!llvmpipe->vbuf_backend)
goto fail; goto fail;

View File

@ -45,7 +45,7 @@ struct draw_stage;
struct lp_fragment_shader; struct lp_fragment_shader;
struct lp_vertex_shader; struct lp_vertex_shader;
struct lp_blend_state; struct lp_blend_state;
struct lp_setup_context; struct setup_context;
struct llvmpipe_context { struct llvmpipe_context {
struct pipe_context pipe; /**< base class */ struct pipe_context pipe; /**< base class */
@ -110,16 +110,8 @@ struct llvmpipe_context {
/** Derived from scissor and surface bounds: */ /** Derived from scissor and surface bounds: */
struct pipe_scissor_state cliprect; 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 */ /** The tiling engine */
struct lp_setup_context *setup; struct setup_context *setup;
/** The primitive drawing context */ /** The primitive drawing context */
struct draw_context *draw; struct draw_context *draw;

View File

@ -91,7 +91,7 @@ lp_jit_init_globals(struct llvmpipe_screen *screen)
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, constants, LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, constants,
screen->target, context_type, 0); 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); screen->target, context_type, 1);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, alpha_ref_value, LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, alpha_ref_value,
screen->target, context_type, 2); screen->target, context_type, 2);

View File

@ -78,7 +78,7 @@ struct lp_jit_context
{ {
const float *constants; const float *constants;
struct tgsi_sampler **samplers; void *dummy; /* remove me */
float alpha_ref_value; float alpha_ref_value;

View File

@ -136,9 +136,8 @@ static boolean
lp_vbuf_set_primitive(struct vbuf_render *vbr, unsigned prim) lp_vbuf_set_primitive(struct vbuf_render *vbr, unsigned prim)
{ {
struct llvmpipe_vbuf_render *cvbr = llvmpipe_vbuf_render(vbr); 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->llvmpipe->reduced_prim = u_reduced_prim(prim);
cvbr->prim = prim; cvbr->prim = prim;
@ -524,9 +523,7 @@ lp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr)
static void static void
lp_vbuf_destroy(struct vbuf_render *vbr) lp_vbuf_destroy(struct vbuf_render *vbr)
{ {
struct llvmpipe_vbuf_render *cvbr = llvmpipe_vbuf_render(vbr); FREE(vbr);
lp_setup_destroy_context(cvbr->setup);
FREE(cvbr);
} }
@ -539,6 +536,7 @@ lp_create_vbuf_backend(struct llvmpipe_context *lp)
struct llvmpipe_vbuf_render *cvbr = CALLOC_STRUCT(llvmpipe_vbuf_render); struct llvmpipe_vbuf_render *cvbr = CALLOC_STRUCT(llvmpipe_vbuf_render);
assert(lp->draw); assert(lp->draw);
assert(lp->setup);
cvbr->base.max_indices = LP_MAX_VBUF_INDEXES; 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->base.destroy = lp_vbuf_destroy;
cvbr->llvmpipe = lp; cvbr->llvmpipe = lp;
cvbr->setup = lp->setup;
cvbr->setup = lp_setup_create_context(cvbr->llvmpipe);
return &cvbr->base; return &cvbr->base;
} }

View File

@ -40,7 +40,7 @@ struct lp_rasterizer *lp_rast_create( void )
return CALLOC_STRUCT(lp_rasterizer); 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 *color,
struct pipe_surface *zstencil, struct pipe_surface *zstencil,
const float *clear_color, 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.color, color);
pipe_surface_reference(&rast->state.depth, depth); 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: /* Begining of each tile:
*/ */
void lp_rast_start_tile( struct lp_rasterizer *, void lp_rast_start_tile( struct lp_rasterizer *,
@ -64,9 +62,10 @@ void lp_rast_start_tile( struct lp_rasterizer *,
rast->y = y; 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; unsigned i, j;
for (i = 0; i < TILESIZE; i++) 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; 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; unsigned i, j;
for (i = 0; i < TILESIZE; i++) 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; 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,
} const union lp_rast_cmd_arg *arg)
void lp_rast_load_color( struct lp_rasterizer *rast )
{ {
/* call u_tile func to load colors from surface */ /* 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 */ /* 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: /* Within a tile:
*/ */
void lp_rast_set_state( struct lp_rasterizer *rast, 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; rast->shader_state = arg->state;
lp->quad.first->begin( lp->quad.first );
} }
void lp_rast_shade_tile( struct lp_rasterizer *rast, void lp_rast_shade_tile( struct lp_rasterizer *rast,
const union lp_rast_cmd_arg *arg )
const struct lp_rast_shader_inputs *inputs ) const struct lp_rast_shader_inputs *inputs )
{ {
/* Set up the silly quad coef pointers /* 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: /* 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 */ /* call u_tile func to store colors to surface */
}
void lp_rast_store_zstencil( struct lp_rasterizer *rast ) if (write_depth) {
{
/* call u_tile func to store depth/stencil to surface */ /* call u_tile func to store depth/stencil to surface */
}
} }
/* Shutdown: /* Shutdown:

View File

@ -50,7 +50,7 @@ lp_setup_clear(struct setup_context *setup,
unsigned flags); unsigned flags);
void void
lp_setup_triangle(struct setup_context *setup, lp_setup_tri(struct setup_context *setup,
const float (*v0)[4], const float (*v0)[4],
const float (*v1)[4], const float (*v1)[4],
const float (*v2)[4]); const float (*v2)[4]);
@ -74,6 +74,11 @@ lp_setup_set_fs_inputs( struct setup_context *setup,
const enum lp_interp *interp, const enum lp_interp *interp,
unsigned nr ); unsigned nr );
boolean
lp_setup_is_texture_referenced( struct setup_context *setup,
const struct pipe_texture *texture );
void void
lp_setup_destroy( struct setup_context *setup ); lp_setup_destroy( struct setup_context *setup );

View File

@ -37,34 +37,6 @@
struct lp_sampler_static_state; 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 extern void
lp_get_samples(struct tgsi_sampler *tgsi_sampler, lp_get_samples(struct tgsi_sampler *tgsi_sampler,