/* XXX This is too large */
#define MAX_VERTEX_SIZE ((2 + PIPE_MAX_SHADER_OUTPUTS) * 4 * sizeof(float))
+#define MAX_VERTEX_ALLOCATION ((MAX_VERTEX_SIZE + 0x0f) & ~0x0f)
struct draw_context *draw,
const unsigned *elts,
unsigned count,
- void *out );
+ void *out,
+ unsigned vertex_size);
void (*delete)( struct draw_vertex_shader * );
}
static INLINE struct vertex_header *
-draw_header_from_block(char *block, int num)
+draw_header_from_block(char *block, int size, int num)
{
- static const unsigned size = (MAX_VERTEX_SIZE + 0x0f) & ~0x0f;
return (struct vertex_header*)(block + num * size);
}
/* Shade
*/
shader->prepare(shader, draw);
- if (shader->run(shader, draw, fetch_elts, fetch_count, pipeline_verts)) {
+ if (shader->run(shader, draw, fetch_elts, fetch_count, pipeline_verts,
+ fpme->pipeline_vertex_size)) {
/* Run the pipeline */
draw_pt_run_pipeline( fpme->draw,
fpme->prim,
/*debug_printf("HIT %d %d\n", slot, i);*/
assert(draw->vcache.idx[slot].out < draw->vs.queue_nr);
return draw_header_from_block(draw->vs.vertex_cache,
+ MAX_VERTEX_ALLOCATION,
draw->vcache.idx[slot].out);
}
*/
assert(draw->vs.queue_nr < VS_QUEUE_LENGTH);
- header = draw_header_from_block(draw->vs.vertex_cache, out);
+ header = draw_header_from_block(draw->vs.vertex_cache, MAX_VERTEX_ALLOCATION,
+ out);
draw->vs.elts[out] = i;
header->clipmask = 0;
header->edgeflag = draw_get_edgeflag(draw, i);
*/
return draw_header_from_block(draw->vs.vertex_cache,
+ MAX_VERTEX_ALLOCATION,
draw->vcache.idx[slot].out);
}
}
for (i = 0; i < draw->vs.post_nr; i++) {
struct vertex_header * header =
- draw_header_from_block(draw->vs.vertex_cache, i);
+ draw_header_from_block(draw->vs.vertex_cache,
+ MAX_VERTEX_ALLOCATION, i);
header->vertex_id = UNDEFINED_VERTEX_ID;
}
}
unsigned elts[MAX_SHADER_VERTICES];
int j, n = MIN2(MAX_SHADER_VERTICES, draw->vs.queue_nr - i);
struct vertex_header *dests =
- draw_header_from_block(draw->vs.vertex_cache, i);
+ draw_header_from_block(draw->vs.vertex_cache,
+ MAX_VERTEX_ALLOCATION, i);
for (j = 0; j < n; j++) {
elts[j] = draw->vs.elts[i + j];
assert(n > 0);
assert(n <= MAX_SHADER_VERTICES);
- shader->run(shader, draw, elts, n, dests);
+ shader->run(shader, draw, elts, n, dests, MAX_VERTEX_ALLOCATION);
}
draw->vs.post_nr = draw->vs.queue_nr;
struct draw_context *draw,
const unsigned *elts,
unsigned count,
- void *vOut )
+ void *vOut,
+ unsigned vertex_size)
{
struct tgsi_exec_machine *machine = &draw->machine;
unsigned int i, j;
unsigned slot;
float x, y, z, w;
struct vertex_header *out =
- draw_header_from_block(vOut, i + j);
+ draw_header_from_block(vOut, vertex_size, i + j);
/* Handle attr[0] (position) specially:
*
struct draw_context *draw,
const unsigned *elts,
unsigned count,
- void *vOut )
+ void *vOut,
+ unsigned vertex_size )
{
struct draw_sse_vertex_shader *shader = (struct draw_sse_vertex_shader *)base;
struct tgsi_exec_machine *machine = &draw->machine;
unsigned slot;
float x, y, z, w;
struct vertex_header *out =
- draw_header_from_block(vOut, i + j);
+ draw_header_from_block(vOut, vertex_size, i + j);
x = out->clip[0] = machine->Outputs[0].xyzw[0].f[j];
y = out->clip[1] = machine->Outputs[0].xyzw[1].f[j];