summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2011-06-23 18:44:42 -0600
committerBrian Paul <[email protected]>2011-06-24 16:44:43 -0600
commit6b28b44d458177209705637f759d03a27fa100f1 (patch)
tree26af0c2e6ce2258125b93353a586372b69643f90 /src
parent95c2e0b601fd333cc73d7f214a3cd949f7e45aac (diff)
indices: fix conversion of PIPE_PRIM_POLYGON to lines
When the fill mode is PIPE_POLYGON_MODE_LINE we were basically converting the polygon into triangles, then drawing the outline of all the triangles. But we really only want to draw the lines around the perimeter of the polygon, not the interior lines. NOTE: This is a candidate for the 7.10 branch.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/indices/u_unfilled_gen.py4
-rw-r--r--src/gallium/auxiliary/indices/u_unfilled_indices.c7
2 files changed, 8 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/indices/u_unfilled_gen.py b/src/gallium/auxiliary/indices/u_unfilled_gen.py
index 36896ce605d..085c47a114a 100644
--- a/src/gallium/auxiliary/indices/u_unfilled_gen.py
+++ b/src/gallium/auxiliary/indices/u_unfilled_gen.py
@@ -167,8 +167,8 @@ def trifan(intype, outtype):
def polygon(intype, outtype):
preamble(intype, outtype, prim='polygon')
- print ' for (j = i = 0; j < nr; j+=6, i++) { '
- do_tri( intype, outtype, 'out+j', '0', 'i+1', 'i+2' );
+ print ' for (j = i = 0; j < nr; j+=2, i++) { '
+ line( intype, outtype, 'out+j', 'i', '(i+1)%(nr/2)' )
print ' }'
postamble()
diff --git a/src/gallium/auxiliary/indices/u_unfilled_indices.c b/src/gallium/auxiliary/indices/u_unfilled_indices.c
index 26c5d4d4c72..c353717d656 100644
--- a/src/gallium/auxiliary/indices/u_unfilled_indices.c
+++ b/src/gallium/auxiliary/indices/u_unfilled_indices.c
@@ -71,6 +71,11 @@ static void generate_linear_uint( unsigned nr,
}
+/**
+ * Given a primitive type and number of vertices, return the number of vertices
+ * needed to draw the primitive with fill mode = PIPE_POLYGON_MODE_LINE using
+ * separate lines (PIPE_PRIM_LINES).
+ */
static unsigned nr_lines( unsigned prim,
unsigned nr )
{
@@ -86,7 +91,7 @@ static unsigned nr_lines( unsigned prim,
case PIPE_PRIM_QUAD_STRIP:
return (nr - 2) / 2 * 8;
case PIPE_PRIM_POLYGON:
- return (nr - 2) * 6;
+ return 2 * nr; /* a line (two verts) for each polygon edge */
default:
assert(0);
return 0;