}
-
-
-
-
-
+/** This tells the draw module about our desired vertex layout */
static const struct vertex_info *
sp_vbuf_get_vertex_info(struct vbuf_render *vbr)
{
return cvbr->vertex_buffer != NULL;
}
+
static void
sp_vbuf_release_vertices(struct vbuf_render *vbr)
{
/* keep the old allocation for next time */
}
+
static void *
sp_vbuf_map_vertices(struct vbuf_render *vbr)
{
return cvbr->vertex_buffer;
}
+
static void
sp_vbuf_unmap_vertices(struct vbuf_render *vbr,
ushort min_index,
cvbr->softpipe->reduced_prim = u_reduced_prim(prim);
cvbr->prim = prim;
return TRUE;
-
}
case PIPE_PRIM_POINTS:
for (i = 0; i < nr; i++) {
sp_setup_point( setup_ctx,
- get_vert(vertex_buffer, indices[i-0], stride) );
+ get_vert(vertex_buffer, indices[i-0], stride) );
}
break;
case PIPE_PRIM_LINES:
for (i = 1; i < nr; i += 2) {
sp_setup_line( setup_ctx,
- get_vert(vertex_buffer, indices[i-1], stride),
- get_vert(vertex_buffer, indices[i-0], stride) );
+ get_vert(vertex_buffer, indices[i-1], stride),
+ get_vert(vertex_buffer, indices[i-0], stride) );
}
break;
case PIPE_PRIM_LINE_STRIP:
for (i = 1; i < nr; i ++) {
sp_setup_line( setup_ctx,
- get_vert(vertex_buffer, indices[i-1], stride),
- get_vert(vertex_buffer, indices[i-0], stride) );
+ get_vert(vertex_buffer, indices[i-1], stride),
+ get_vert(vertex_buffer, indices[i-0], stride) );
}
break;
case PIPE_PRIM_LINE_LOOP:
for (i = 1; i < nr; i ++) {
sp_setup_line( setup_ctx,
- get_vert(vertex_buffer, indices[i-1], stride),
- get_vert(vertex_buffer, indices[i-0], stride) );
+ get_vert(vertex_buffer, indices[i-1], stride),
+ get_vert(vertex_buffer, indices[i-0], stride) );
}
if (nr) {
sp_setup_line( setup_ctx,
- get_vert(vertex_buffer, indices[nr-1], stride),
- get_vert(vertex_buffer, indices[0], stride) );
+ get_vert(vertex_buffer, indices[nr-1], stride),
+ get_vert(vertex_buffer, indices[0], stride) );
}
break;
if (softpipe->rasterizer->flatshade_first) {
for (i = 2; i < nr; i += 3) {
sp_setup_tri( setup_ctx,
- get_vert(vertex_buffer, indices[i-1], stride),
- get_vert(vertex_buffer, indices[i-0], stride),
- get_vert(vertex_buffer, indices[i-2], stride) );
+ get_vert(vertex_buffer, indices[i-1], stride),
+ get_vert(vertex_buffer, indices[i-0], stride),
+ get_vert(vertex_buffer, indices[i-2], stride) );
}
}
else {
for (i = 2; i < nr; i += 3) {
sp_setup_tri( setup_ctx,
- get_vert(vertex_buffer, indices[i-2], stride),
- get_vert(vertex_buffer, indices[i-1], stride),
- get_vert(vertex_buffer, indices[i-0], stride) );
+ get_vert(vertex_buffer, indices[i-2], stride),
+ get_vert(vertex_buffer, indices[i-1], stride),
+ get_vert(vertex_buffer, indices[i-0], stride) );
}
}
break;
if (softpipe->rasterizer->flatshade_first) {
for (i = 2; i < nr; i += 1) {
sp_setup_tri( setup_ctx,
- get_vert(vertex_buffer, indices[i+(i&1)-1], stride),
- get_vert(vertex_buffer, indices[i-(i&1)], stride),
- get_vert(vertex_buffer, indices[i-2], stride) );
+ get_vert(vertex_buffer, indices[i+(i&1)-1], stride),
+ get_vert(vertex_buffer, indices[i-(i&1)], stride),
+ get_vert(vertex_buffer, indices[i-2], stride) );
}
}
else {
for (i = 2; i < nr; i += 1) {
sp_setup_tri( setup_ctx,
- get_vert(vertex_buffer, indices[i+(i&1)-2], stride),
- get_vert(vertex_buffer, indices[i-(i&1)-1], stride),
- get_vert(vertex_buffer, indices[i-0], stride) );
+ get_vert(vertex_buffer, indices[i+(i&1)-2], stride),
+ get_vert(vertex_buffer, indices[i-(i&1)-1], stride),
+ get_vert(vertex_buffer, indices[i-0], stride) );
}
}
break;
if (softpipe->rasterizer->flatshade_first) {
for (i = 2; i < nr; i += 1) {
sp_setup_tri( setup_ctx,
- get_vert(vertex_buffer, indices[i-0], stride),
- get_vert(vertex_buffer, indices[0], stride),
- get_vert(vertex_buffer, indices[i-1], stride) );
+ get_vert(vertex_buffer, indices[i-0], stride),
+ get_vert(vertex_buffer, indices[0], stride),
+ get_vert(vertex_buffer, indices[i-1], stride) );
}
}
else {
for (i = 2; i < nr; i += 1) {
sp_setup_tri( setup_ctx,
- get_vert(vertex_buffer, indices[0], stride),
- get_vert(vertex_buffer, indices[i-1], stride),
- get_vert(vertex_buffer, indices[i-0], stride) );
+ get_vert(vertex_buffer, indices[0], stride),
+ get_vert(vertex_buffer, indices[i-1], stride),
+ get_vert(vertex_buffer, indices[i-0], stride) );
}
}
break;
*/
for (i = 2; i < nr; i += 1) {
sp_setup_tri( setup_ctx,
- get_vert(vertex_buffer, indices[i-0], stride),
- get_vert(vertex_buffer, indices[i-1], stride),
- get_vert(vertex_buffer, indices[0], stride) );
+ get_vert(vertex_buffer, indices[i-0], stride),
+ get_vert(vertex_buffer, indices[i-1], stride),
+ get_vert(vertex_buffer, indices[0], stride) );
}
break;
case PIPE_PRIM_POINTS:
for (i = 0; i < nr; i++) {
sp_setup_point( setup_ctx,
- get_vert(vertex_buffer, i-0, stride) );
+ get_vert(vertex_buffer, i-0, stride) );
}
break;
case PIPE_PRIM_LINES:
for (i = 1; i < nr; i += 2) {
sp_setup_line( setup_ctx,
- get_vert(vertex_buffer, i-1, stride),
- get_vert(vertex_buffer, i-0, stride) );
+ get_vert(vertex_buffer, i-1, stride),
+ get_vert(vertex_buffer, i-0, stride) );
}
break;
case PIPE_PRIM_LINE_LOOP:
for (i = 1; i < nr; i ++) {
sp_setup_line( setup_ctx,
- get_vert(vertex_buffer, i-1, stride),
- get_vert(vertex_buffer, i-0, stride) );
+ get_vert(vertex_buffer, i-1, stride),
+ get_vert(vertex_buffer, i-0, stride) );
}
if (nr) {
sp_setup_line( setup_ctx,
- get_vert(vertex_buffer, nr-1, stride),
- get_vert(vertex_buffer, 0, stride) );
+ get_vert(vertex_buffer, nr-1, stride),
+ get_vert(vertex_buffer, 0, stride) );
}
break;
if (softpipe->rasterizer->flatshade_first) {
for (i = 2; i < nr; i += 3) {
sp_setup_tri( setup_ctx,
- get_vert(vertex_buffer, i-1, stride),
- get_vert(vertex_buffer, i-0, stride),
- get_vert(vertex_buffer, i-2, stride) );
+ get_vert(vertex_buffer, i-1, stride),
+ get_vert(vertex_buffer, i-0, stride),
+ get_vert(vertex_buffer, i-2, stride) );
}
}
else {
for (i = 2; i < nr; i += 3) {
sp_setup_tri( setup_ctx,
- get_vert(vertex_buffer, i-2, stride),
- get_vert(vertex_buffer, i-1, stride),
- get_vert(vertex_buffer, i-0, stride) );
+ get_vert(vertex_buffer, i-2, stride),
+ get_vert(vertex_buffer, i-1, stride),
+ get_vert(vertex_buffer, i-0, stride) );
}
}
break;
if (softpipe->rasterizer->flatshade_first) {
for (i = 2; i < nr; i++) {
sp_setup_tri( setup_ctx,
- get_vert(vertex_buffer, i+(i&1)-1, stride),
- get_vert(vertex_buffer, i-(i&1), stride),
- get_vert(vertex_buffer, i-2, stride) );
+ get_vert(vertex_buffer, i+(i&1)-1, stride),
+ get_vert(vertex_buffer, i-(i&1), stride),
+ get_vert(vertex_buffer, i-2, stride) );
}
}
else {
for (i = 2; i < nr; i++) {
sp_setup_tri( setup_ctx,
- get_vert(vertex_buffer, i+(i&1)-2, stride),
- get_vert(vertex_buffer, i-(i&1)-1, stride),
- get_vert(vertex_buffer, i-0, stride) );
+ get_vert(vertex_buffer, i+(i&1)-2, stride),
+ get_vert(vertex_buffer, i-(i&1)-1, stride),
+ get_vert(vertex_buffer, i-0, stride) );
}
}
break;
if (softpipe->rasterizer->flatshade_first) {
for (i = 2; i < nr; i += 1) {
sp_setup_tri( setup_ctx,
- get_vert(vertex_buffer, i-0, stride),
- get_vert(vertex_buffer, 0, stride),
- get_vert(vertex_buffer, i-1, stride) );
+ get_vert(vertex_buffer, i-0, stride),
+ get_vert(vertex_buffer, 0, stride),
+ get_vert(vertex_buffer, i-1, stride) );
}
}
else {
for (i = 2; i < nr; i += 1) {
sp_setup_tri( setup_ctx,
- get_vert(vertex_buffer, 0, stride),
- get_vert(vertex_buffer, i-1, stride),
- get_vert(vertex_buffer, i-0, stride) );
+ get_vert(vertex_buffer, 0, stride),
+ get_vert(vertex_buffer, i-1, stride),
+ get_vert(vertex_buffer, i-0, stride) );
}
}
break;
*/
for (i = 2; i < nr; i += 1) {
sp_setup_tri( setup_ctx,
- get_vert(vertex_buffer, i-1, stride),
- get_vert(vertex_buffer, i-0, stride),
- get_vert(vertex_buffer, 0, stride) );
+ get_vert(vertex_buffer, i-1, stride),
+ get_vert(vertex_buffer, i-0, stride),
+ get_vert(vertex_buffer, 0, stride) );
}
break;
}
-
static void
sp_vbuf_destroy(struct vbuf_render *vbr)
{
struct softpipe_vbuf_render *cvbr = softpipe_vbuf_render(vbr);
- if(cvbr->vertex_buffer)
+ if (cvbr->vertex_buffer)
align_free(cvbr->vertex_buffer);
sp_setup_destroy_context(cvbr->setup);
FREE(cvbr);