* - Translate from first provoking vertex to last provoking vertex and
* vice versa.
*
+ * Note that this function is used for indexed primitives.
+ *
* \param hw_mask mask of (1 << PIPE_PRIM_x) flags indicating which types
* of primitives are supported by the hardware.
* \param prim incoming PIPE_PRIM_x
*out_nr = (nr - 2) * 3;
break;
+ case PIPE_PRIM_LINES_ADJACENCY:
+ *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim];
+ *out_prim = PIPE_PRIM_LINES_ADJACENCY;
+ *out_nr = nr;
+ break;
+
+ case PIPE_PRIM_LINE_STRIP_ADJACENCY:
+ *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim];
+ *out_prim = PIPE_PRIM_LINES_ADJACENCY;
+ *out_nr = (nr - 3) * 4;
+ break;
+
+ case PIPE_PRIM_TRIANGLES_ADJACENCY:
+ *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim];
+ *out_prim = PIPE_PRIM_TRIANGLES_ADJACENCY;
+ *out_nr = nr;
+ break;
+
+ case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY:
+ *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim];
+ *out_prim = PIPE_PRIM_TRIANGLES_ADJACENCY;
+ *out_nr = ((nr - 4) / 2) * 6;
+ break;
+
default:
assert(0);
*out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim];
* The generator functions generates a number of ushort or uint indexes
* for drawing the new type of primitive.
*
+ * Note that this function is used for non-indexed primitives.
+ *
* \param hw_mask a bitmask of (1 << PIPE_PRIM_x) values that indicates
* kind of primitives are supported by the driver.
* \param prim the PIPE_PRIM_x that the user wants to draw
*out_nr = (nr - 2) * 3;
return U_GENERATE_REUSABLE;
+ case PIPE_PRIM_LINES_ADJACENCY:
+ *out_generate = generate[out_idx][in_pv][out_pv][prim];
+ *out_prim = PIPE_PRIM_LINES_ADJACENCY;
+ *out_nr = nr;
+ return U_GENERATE_REUSABLE;
+
+ case PIPE_PRIM_LINE_STRIP_ADJACENCY:
+ *out_generate = generate[out_idx][in_pv][out_pv][prim];
+ *out_prim = PIPE_PRIM_LINES_ADJACENCY;
+ *out_nr = (nr - 3) * 4;
+ return U_GENERATE_REUSABLE;
+
+ case PIPE_PRIM_TRIANGLES_ADJACENCY:
+ *out_generate = generate[out_idx][in_pv][out_pv][prim];
+ *out_prim = PIPE_PRIM_TRIANGLES_ADJACENCY;
+ *out_nr = nr;
+ return U_GENERATE_REUSABLE;
+
+ case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY:
+ *out_generate = generate[out_idx][in_pv][out_pv][prim];
+ *out_prim = PIPE_PRIM_TRIANGLES_ADJACENCY;
+ *out_nr = ((nr - 4) / 2) * 6;
+ return U_GENERATE_REUSABLE;
+
default:
assert(0);
*out_generate = generate[out_idx][in_pv][out_pv][PIPE_PRIM_POINTS];
'tristrip',
'quads',
'quadstrip',
- 'polygon')
+ 'polygon',
+ 'linesadj',
+ 'linestripadj',
+ 'trisadj',
+ 'tristripadj')
LONGPRIMS=('PIPE_PRIM_POINTS',
'PIPE_PRIM_LINES',
'PIPE_PRIM_TRIANGLE_STRIP',
'PIPE_PRIM_QUADS',
'PIPE_PRIM_QUAD_STRIP',
- 'PIPE_PRIM_POLYGON')
+ 'PIPE_PRIM_POLYGON',
+ 'PIPE_PRIM_LINES_ADJACENCY',
+ 'PIPE_PRIM_LINE_STRIP_ADJACENCY',
+ 'PIPE_PRIM_TRIANGLES_ADJACENCY',
+ 'PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY')
longprim = dict(zip(PRIMS, LONGPRIMS))
intype_idx = dict(ubyte='IN_UBYTE', ushort='IN_USHORT', uint='IN_UINT')
print ' (' + ptr + ')[1] = ' + vert( intype, outtype, v1 ) + ';'
print ' (' + ptr + ')[2] = ' + vert( intype, outtype, v2 ) + ';'
+def lineadj( intype, outtype, ptr, v0, v1, v2, v3 ):
+ print ' (' + ptr + ')[0] = ' + vert( intype, outtype, v0 ) + ';'
+ print ' (' + ptr + ')[1] = ' + vert( intype, outtype, v1 ) + ';'
+ print ' (' + ptr + ')[2] = ' + vert( intype, outtype, v2 ) + ';'
+ print ' (' + ptr + ')[3] = ' + vert( intype, outtype, v3 ) + ';'
+
+def triadj( intype, outtype, ptr, v0, v1, v2, v3, v4, v5 ):
+ print ' (' + ptr + ')[0] = ' + vert( intype, outtype, v0 ) + ';'
+ print ' (' + ptr + ')[1] = ' + vert( intype, outtype, v1 ) + ';'
+ print ' (' + ptr + ')[2] = ' + vert( intype, outtype, v2 ) + ';'
+ print ' (' + ptr + ')[3] = ' + vert( intype, outtype, v3 ) + ';'
+ print ' (' + ptr + ')[4] = ' + vert( intype, outtype, v4 ) + ';'
+ print ' (' + ptr + ')[5] = ' + vert( intype, outtype, v5 ) + ';'
+
def do_point( intype, outtype, ptr, v0 ):
point( intype, outtype, ptr, v0 )
do_tri( intype, outtype, ptr+'+0', v0, v1, v2, inpv, outpv );
do_tri( intype, outtype, ptr+'+3', v0, v2, v3, inpv, outpv );
+def do_lineadj( intype, outtype, ptr, v0, v1, v2, v3, inpv, outpv ):
+ if inpv == outpv:
+ lineadj( intype, outtype, ptr, v0, v1, v2, v3 )
+ else:
+ lineadj( intype, outtype, ptr, v3, v2, v1, v0 )
+
+def do_triadj( intype, outtype, ptr, v0, v1, v2, v3, v4, v5, inpv, outpv ):
+ if inpv == outpv:
+ triadj( intype, outtype, ptr, v0, v1, v2, v3, v4, v5 )
+ else:
+ triadj( intype, outtype, ptr, v4, v5, v0, v1, v2, v3 )
+
def name(intype, outtype, inpv, outpv, pr, prim):
if intype == GENERATE:
return 'generate_' + prim + '_' + outtype + '_' + inpv + '2' + outpv
postamble()
+def linesadj(intype, outtype, inpv, outpv, pr):
+ preamble(intype, outtype, inpv, outpv, pr, prim='linesadj')
+ print ' for (i = start; i < (out_nr+start); i+=4) { '
+ do_lineadj( intype, outtype, 'out+i', 'i+0', 'i+1', 'i+2', 'i+3', inpv, outpv )
+ print ' }'
+ postamble()
+
+
+def linestripadj(intype, outtype, inpv, outpv, pr):
+ preamble(intype, outtype, inpv, outpv, pr, prim='linestripadj')
+ print ' for (i = start, j = 0; j < out_nr; j+=4, i++) {'
+ do_lineadj( intype, outtype, 'out+j', 'i+0', 'i+1', 'i+2', 'i+3', inpv, outpv )
+ print ' }'
+ postamble()
+
+
+def trisadj(intype, outtype, inpv, outpv, pr):
+ preamble(intype, outtype, inpv, outpv, pr, prim='trisadj')
+ print ' for (i = start; i < (out_nr+start); i+=6) { '
+ do_triadj( intype, outtype, 'out+i', 'i+0', 'i+1', 'i+2', 'i+3',
+ 'i+4', 'i+5', inpv, outpv )
+ print ' }'
+ postamble()
+
+
+def tristripadj(intype, outtype, inpv, outpv, pr):
+ preamble(intype, outtype, inpv, outpv, pr, prim='tristripadj')
+ print ' for (i = start, j = 0; j < out_nr; i+=2, j+=6) { '
+ print ' if (i % 4 == 0) {'
+ print ' /* even triangle */'
+ do_triadj( intype, outtype, 'out+j',
+ 'i+0', 'i+1', 'i+2', 'i+3', 'i+4', 'i+5', inpv, outpv )
+ print ' } else {'
+ print ' /* odd triangle */'
+ do_triadj( intype, outtype, 'out+j',
+ 'i+2', 'i-2', 'i+0', 'i+3', 'i+4', 'i+6', inpv, outpv )
+ print ' }'
+ print ' }'
+ postamble()
+
+
def emit_funcs():
for intype in INTYPES:
for outtype in OUTTYPES:
quads(intype, outtype, inpv, outpv, pr)
quadstrip(intype, outtype, inpv, outpv, pr)
polygon(intype, outtype, inpv, outpv, pr)
+ linesadj(intype, outtype, inpv, outpv, pr)
+ linestripadj(intype, outtype, inpv, outpv, pr)
+ trisadj(intype, outtype, inpv, outpv, pr)
+ tristripadj(intype, outtype, inpv, outpv, pr)
def init(intype, outtype, inpv, outpv, pr, prim):
if intype == GENERATE: