static void fetch( struct pt_fetch *fetch, const struct draw_fetch_info *fetch_info, char *output) { if (fetch_info->linear) { draw_pt_fetch_run_linear( fetch, fetch_info->start, fetch_info->count, output ); } else { draw_pt_fetch_run( fetch, fetch_info->elts, fetch_info->count, output ); } }
static void fetch_pipeline_run( struct draw_pt_middle_end *middle, const unsigned *fetch_elts, unsigned fetch_count, const ushort *draw_elts, unsigned draw_count ) { struct fetch_pipeline_middle_end *fpme = (struct fetch_pipeline_middle_end *)middle; struct draw_context *draw = fpme->draw; struct draw_vertex_shader *vshader = draw->vs.vertex_shader; struct draw_geometry_shader *gshader = draw->gs.geometry_shader; unsigned opt = fpme->opt; unsigned alloc_count = align( fetch_count, 4 ); struct vertex_header *pipeline_verts = (struct vertex_header *)MALLOC(fpme->vertex_size * alloc_count); if (!pipeline_verts) { /* Not much we can do here - just skip the rendering. */ assert(0); return; } /* Fetch into our vertex buffer */ draw_pt_fetch_run( fpme->fetch, fetch_elts, fetch_count, (char *)pipeline_verts ); /* Run the shader, note that this overwrites the data[] parts of * the pipeline verts. */ if (opt & PT_SHADE) { vshader->run_linear(vshader, (const float (*)[4])pipeline_verts->data, ( float (*)[4])pipeline_verts->data, draw->pt.user.vs_constants, fetch_count, fpme->vertex_size, fpme->vertex_size); if (gshader) draw_geometry_shader_run(gshader, (const float (*)[4])pipeline_verts->data, ( float (*)[4])pipeline_verts->data, draw->pt.user.gs_constants, fetch_count, fpme->vertex_size, fpme->vertex_size); } if (draw_pt_post_vs_run( fpme->post_vs, pipeline_verts, fetch_count, fpme->vertex_size )) { opt |= PT_PIPELINE; } /* Do we need to run the pipeline? */ if (opt & PT_PIPELINE) { draw_pipeline_run( fpme->draw, fpme->prim, pipeline_verts, fetch_count, fpme->vertex_size, draw_elts, draw_count ); } else { draw_pt_emit( fpme->emit, (const float (*)[4])pipeline_verts->data, fetch_count, fpme->vertex_size, draw_elts, draw_count ); } FREE(pipeline_verts); }