*/
draw_do_flush( draw, DRAW_FLUSH_BACKEND );
- frontend->prepare( frontend, middle );
+ frontend->prepare( frontend, prim, middle );
frontend->run( frontend,
- prim,
draw_pt_elt_func( draw ),
draw_pt_elt_ptr( draw, start ),
count );
*/
struct draw_pt_front_end {
void (*prepare)( struct draw_pt_front_end *,
+ unsigned prim,
struct draw_pt_middle_end * );
void (*run)( struct draw_pt_front_end *,
- unsigned prim,
pt_elt_func elt_func,
const void *elt_ptr,
unsigned count );
* Currenly only using the passthrough version.
*/
struct draw_pt_middle_end {
- void (*prepare)( struct draw_pt_middle_end * );
+ void (*prepare)( struct draw_pt_middle_end *,
+ unsigned prim );
void (*run)( struct draw_pt_middle_end *,
- unsigned prim,
const unsigned *fetch_elts,
unsigned fetch_count,
const ushort *draw_elts,
-static void fetch_emit_prepare( struct draw_pt_middle_end *middle )
+static void fetch_emit_prepare( struct draw_pt_middle_end *middle,
+ unsigned prim )
{
static const float zero = 0;
struct fetch_emit_middle_end *feme = (struct fetch_emit_middle_end *)middle;
struct draw_context *draw = feme->draw;
- const struct vertex_info *vinfo = draw->render->get_vertex_info(draw->render);
- unsigned nr_attrs = vinfo->num_attribs;
+ const struct vertex_info *vinfo;
unsigned i;
+ boolean ok;
+
+
+ ok = draw->render->set_primitive( draw->render,
+ prim );
+ if (!ok) {
+ assert(0);
+ return;
+ }
+
+ /* Must do this after set_primitive() above:
+ */
+ vinfo = draw->render->get_vertex_info(draw->render);
- for (i = 0; i < nr_attrs; i++) {
+ for (i = 0; i < vinfo->num_attribs; i++) {
unsigned src_element = vinfo->src_index[i];
unsigned src_buffer = draw->vertex_element[src_element].vertex_buffer_index;
}
}
- feme->nr_fetch = nr_attrs;
+ feme->nr_fetch = vinfo->num_attribs;
feme->hw_vertex_size = vinfo->size * 4;
}
static void fetch_emit_run( struct draw_pt_middle_end *middle,
- unsigned prim,
const unsigned *fetch_elts,
unsigned fetch_count,
const ushort *draw_elts,
struct fetch_emit_middle_end *feme = (struct fetch_emit_middle_end *)middle;
struct draw_context *draw = feme->draw;
void *hw_verts;
- boolean ok;
-
- ok = draw->render->set_primitive( draw->render,
- prim );
- if (!ok) {
- assert(0);
- return;
- }
-
hw_verts = draw->render->allocate_vertices( draw->render,
(ushort)feme->hw_vertex_size,
(ushort)fetch_count );
const void *elt_ptr;
struct draw_pt_middle_end *middle;
+
+ unsigned input_prim;
unsigned output_prim;
};
if (vcache->draw_count) {
vcache->middle->run( vcache->middle,
- vcache->output_prim,
vcache->fetch_elts,
vcache->fetch_count,
vcache->draw_elts,
static void vcache_run_pv2( struct draw_pt_front_end *frontend,
- unsigned prim,
pt_elt_func get_elt,
const void *elts,
unsigned count )
*/
vcache->elt_func = get_elt;
vcache->elt_ptr = elts;
- vcache->output_prim = reduced_prim[prim];
- switch (prim) {
+ switch (vcache->input_prim) {
case PIPE_PRIM_POINTS:
for (i = 0; i < count; i ++) {
vcache_point( vcache,
static void vcache_run_pv0( struct draw_pt_front_end *frontend,
- unsigned prim,
pt_elt_func get_elt,
const void *elts,
unsigned count )
*/
vcache->elt_func = get_elt;
vcache->elt_ptr = elts;
- vcache->output_prim = reduced_prim[prim];
- switch (prim) {
+ switch (vcache->input_prim) {
case PIPE_PRIM_POINTS:
for (i = 0; i < count; i ++) {
vcache_point( vcache,
}
static void vcache_prepare( struct draw_pt_front_end *frontend,
+ unsigned prim,
struct draw_pt_middle_end *middle )
{
struct vcache_frontend *vcache = (struct vcache_frontend *)frontend;
else
vcache->base.run = vcache_run_pv2;
+ vcache->input_prim = prim;
+ vcache->output_prim = reduced_prim[prim];
+
vcache->middle = middle;
- middle->prepare( middle );
+ middle->prepare( middle, vcache->output_prim );
}