diff options
author | Zack Rusin <[email protected]> | 2010-06-17 12:05:15 -0400 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2010-06-17 12:05:15 -0400 |
commit | f542a2770a5ac3eb487cd3723cf98a383779a98d (patch) | |
tree | cb3d5eaa692bb5ba4dc004a224a379a98d1dbdb8 | |
parent | 06b854752f8a550ddd299610e0e22c8f929109e2 (diff) |
draw: implement triangle lists with adjacency support in gs
-rw-r--r-- | src/gallium/auxiliary/draw/draw_gs.c | 24 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_gs_tmp.h | 8 |
2 files changed, 31 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c index 79b0a729bc0..881d8fc93ba 100644 --- a/src/gallium/auxiliary/draw/draw_gs.c +++ b/src/gallium/auxiliary/draw/draw_gs.c @@ -336,7 +336,6 @@ static void gs_line_adj(struct draw_geometry_shader *shader, gs_flush(shader, 1); } - static void gs_tri(struct draw_geometry_shader *shader, int i0, int i1, int i2) { @@ -352,7 +351,27 @@ static void gs_tri(struct draw_geometry_shader *shader, gs_flush(shader, 1); } +static void gs_tri_adj(struct draw_geometry_shader *shader, + int i0, int i1, int i2, + int i3, int i4, int i5) +{ + unsigned indices[6]; + + indices[0] = i0; + indices[1] = i1; + indices[2] = i2; + indices[3] = i3; + indices[4] = i4; + indices[5] = i5; + + draw_fetch_gs_input(shader, indices, 6, 0); + ++shader->in_prim_idx; + + gs_flush(shader, 1); +} + #define TRIANGLE(gs,i0,i1,i2) gs_tri(gs,i0,i1,i2) +#define TRI_ADJ(gs,i0,i1,i2,i3,i4,i5) gs_tri_adj(gs,i0,i1,i2,i3,i4,i5) #define LINE(gs,i0,i1) gs_line(gs,i0,i1) #define LINE_ADJ(gs,i0,i1,i2,i3) gs_line_adj(gs,i0,i1,i2,i3) #define POINT(gs,i0) gs_point(gs,i0) @@ -362,6 +381,9 @@ static void gs_tri(struct draw_geometry_shader *shader, #define TRIANGLE(gs,i0,i1,i2) gs_tri(gs,elts[i0],elts[i1],elts[i2]) +#define TRI_ADJ(gs,i0,i1,i2,i3,i4,i5) \ + gs_tri_adj(gs,elts[i0],elts[i1],elts[i2],elts[i3], \ + elts[i4],elts[i5]) #define LINE(gs,i0,i1) gs_line(gs,elts[i0],elts[i1]) #define LINE_ADJ(gs,i0,i1,i2,i3) gs_line_adj(gs,elts[i0], \ elts[i1], \ diff --git a/src/gallium/auxiliary/draw/draw_gs_tmp.h b/src/gallium/auxiliary/draw/draw_gs_tmp.h index e906f08aeb8..ff83cebb45a 100644 --- a/src/gallium/auxiliary/draw/draw_gs_tmp.h +++ b/src/gallium/auxiliary/draw/draw_gs_tmp.h @@ -118,6 +118,13 @@ static void FUNC( struct draw_geometry_shader *shader, } break; + case PIPE_PRIM_TRIANGLES_ADJACENCY: + for (i = 0; i+5 < count; i += 5) { + TRI_ADJ( shader, i + 0, i + 1, i + 2, + i + 3, i + 4, i + 5); + } + break; + default: debug_assert(!"Unsupported primitive in geometry shader"); break; @@ -126,6 +133,7 @@ static void FUNC( struct draw_geometry_shader *shader, #undef TRIANGLE +#undef TRI_ADJ #undef POINT #undef LINE #undef LINE_ADJ |