diff options
author | José Fonseca <[email protected]> | 2012-11-06 11:35:31 +0000 |
---|---|---|
committer | José Fonseca <[email protected]> | 2012-11-09 13:43:19 +0000 |
commit | b7283834dcd8ee5573b791fa95991f5117fa7352 (patch) | |
tree | 6fdff2a1913dee3776a82fae3c776ff3a6985b87 /src/gallium/drivers/softpipe | |
parent | 5d12c7b755cd405c41d44ef9102e826a366323e3 (diff) |
softpipe: Handle adjacency primitives.
Not fully tested.
Based on diagrams from
http://msdn.microsoft.com/en-us/library/windows/desktop/bb205124.aspx#Primitive_Adjacency
v2: Fix based on Brian's feedback.
Reviewed-by: Brian Paul <[email protected]>
Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/gallium/drivers/softpipe')
-rw-r--r-- | src/gallium/drivers/softpipe/sp_prim_vbuf.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c index a142118f31e..bb5ebcc7aee 100644 --- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c +++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c @@ -380,6 +380,14 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } break; + case PIPE_PRIM_LINES_ADJACENCY: + for (i = 3; i < nr; i += 4) { + sp_setup_line( setup, + get_vert(vertex_buffer, i-2, stride), + get_vert(vertex_buffer, i-1, stride) ); + } + break; + case PIPE_PRIM_LINE_STRIP: for (i = 1; i < nr; i ++) { sp_setup_line( setup, @@ -388,6 +396,14 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } break; + case PIPE_PRIM_LINE_STRIP_ADJACENCY: + for (i = 3; i < nr; i++) { + sp_setup_line( setup, + get_vert(vertex_buffer, i-2, stride), + get_vert(vertex_buffer, i-1, stride) ); + } + break; + case PIPE_PRIM_LINE_LOOP: for (i = 1; i < nr; i ++) { sp_setup_line( setup, @@ -410,6 +426,15 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } break; + case PIPE_PRIM_TRIANGLES_ADJACENCY: + for (i = 5; i < nr; i += 6) { + sp_setup_tri( setup, + get_vert(vertex_buffer, i-5, stride), + get_vert(vertex_buffer, i-3, stride), + get_vert(vertex_buffer, i-1, stride) ); + } + break; + case PIPE_PRIM_TRIANGLE_STRIP: if (flatshade_first) { for (i = 2; i < nr; i++) { @@ -431,6 +456,27 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } break; + case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: + if (flatshade_first) { + for (i = 5; i < nr; i += 2) { + /* emit first triangle vertex as first triangle vertex */ + sp_setup_tri( setup, + get_vert(vertex_buffer, i-5, stride), + get_vert(vertex_buffer, i+(i&1)*2-3, stride), + get_vert(vertex_buffer, i-(i&1)*2-1, stride) ); + } + } + else { + for (i = 5; i < nr; i += 2) { + /* emit last triangle vertex as last triangle vertex */ + sp_setup_tri( setup, + get_vert(vertex_buffer, i+(i&1)*2-5, stride), + get_vert(vertex_buffer, i-(i&1)*2-3, stride), + get_vert(vertex_buffer, i-1, stride) ); + } + } + break; + case PIPE_PRIM_TRIANGLE_FAN: if (flatshade_first) { for (i = 2; i < nr; i += 1) { |