diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/auxiliary/indices/u_indices.c | 36 | ||||
-rw-r--r-- | src/gallium/auxiliary/indices/u_indices.h | 9 | ||||
-rw-r--r-- | src/gallium/auxiliary/indices/u_indices_gen.py | 198 | ||||
-rw-r--r-- | src/gallium/auxiliary/indices/u_primconvert.c | 6 | ||||
-rw-r--r-- | src/gallium/auxiliary/indices/u_unfilled_gen.py | 20 | ||||
-rw-r--r-- | src/gallium/auxiliary/indices/u_unfilled_indices.c | 18 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_draw_elements.c | 3 |
7 files changed, 203 insertions, 87 deletions
diff --git a/src/gallium/auxiliary/indices/u_indices.c b/src/gallium/auxiliary/indices/u_indices.c index 1b33f413fc4..c25594b4b7a 100644 --- a/src/gallium/auxiliary/indices/u_indices.c +++ b/src/gallium/auxiliary/indices/u_indices.c @@ -27,18 +27,22 @@ static void translate_memcpy_ushort( const void *in, unsigned start, - unsigned nr, + unsigned in_nr, + unsigned out_nr, + unsigned restart_index, void *out ) { - memcpy(out, &((short *)in)[start], nr*sizeof(short)); + memcpy(out, &((short *)in)[start], out_nr*sizeof(short)); } static void translate_memcpy_uint( const void *in, unsigned start, - unsigned nr, + unsigned in_nr, + unsigned out_nr, + unsigned restart_index, void *out ) { - memcpy(out, &((int *)in)[start], nr*sizeof(int)); + memcpy(out, &((int *)in)[start], out_nr*sizeof(int)); } @@ -58,6 +62,7 @@ static void translate_memcpy_uint( const void *in, * \param nr number of incoming vertices * \param in_pv incoming provoking vertex convention (PV_FIRST or PV_LAST) * \param out_pv desired provoking vertex convention (PV_FIRST or PV_LAST) + * \param prim_restart whether primitive restart is disable or enabled * \param out_prim returns new PIPE_PRIM_x we'll translate to * \param out_index_size returns bytes per new index value (2 or 4) * \param out_nr returns number of new vertices @@ -69,6 +74,7 @@ int u_index_translator( unsigned hw_mask, unsigned nr, unsigned in_pv, unsigned out_pv, + unsigned prim_restart, unsigned *out_prim, unsigned *out_index_size, unsigned *out_nr, @@ -106,68 +112,68 @@ int u_index_translator( unsigned hw_mask, else { switch (prim) { case PIPE_PRIM_POINTS: - *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim]; + *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; *out_prim = PIPE_PRIM_POINTS; *out_nr = nr; break; case PIPE_PRIM_LINES: - *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim]; + *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; *out_prim = PIPE_PRIM_LINES; *out_nr = nr; break; case PIPE_PRIM_LINE_STRIP: - *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim]; + *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; *out_prim = PIPE_PRIM_LINES; *out_nr = (nr - 1) * 2; break; case PIPE_PRIM_LINE_LOOP: - *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim]; + *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; *out_prim = PIPE_PRIM_LINES; *out_nr = nr * 2; break; case PIPE_PRIM_TRIANGLES: - *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim]; + *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; *out_prim = PIPE_PRIM_TRIANGLES; *out_nr = nr; break; case PIPE_PRIM_TRIANGLE_STRIP: - *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim]; + *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; *out_prim = PIPE_PRIM_TRIANGLES; *out_nr = (nr - 2) * 3; break; case PIPE_PRIM_TRIANGLE_FAN: - *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim]; + *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; *out_prim = PIPE_PRIM_TRIANGLES; *out_nr = (nr - 2) * 3; break; case PIPE_PRIM_QUADS: - *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim]; + *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; *out_prim = PIPE_PRIM_TRIANGLES; *out_nr = (nr / 4) * 6; break; case PIPE_PRIM_QUAD_STRIP: - *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim]; + *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; *out_prim = PIPE_PRIM_TRIANGLES; *out_nr = (nr - 2) * 3; break; case PIPE_PRIM_POLYGON: - *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim]; + *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; *out_prim = PIPE_PRIM_TRIANGLES; *out_nr = (nr - 2) * 3; break; default: assert(0); - *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim]; + *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; *out_prim = PIPE_PRIM_POINTS; *out_nr = nr; return U_TRANSLATE_ERROR; diff --git a/src/gallium/auxiliary/indices/u_indices.h b/src/gallium/auxiliary/indices/u_indices.h index 54cd9441abc..e01201e4b04 100644 --- a/src/gallium/auxiliary/indices/u_indices.h +++ b/src/gallium/auxiliary/indices/u_indices.h @@ -31,6 +31,10 @@ #define PV_LAST 1 #define PV_COUNT 2 +/* primitive restart disable/enable flags */ +#define PR_DISABLE 0 +#define PR_ENABLE 1 +#define PR_COUNT 2 /** * Index translator function (for glDrawElements() case) * @@ -42,7 +46,9 @@ */ typedef void (*u_translate_func)( const void *in, unsigned start, - unsigned nr, + unsigned in_nr, + unsigned out_nr, + unsigned restart_index, void *out ); /** @@ -77,6 +83,7 @@ int u_index_translator( unsigned hw_mask, unsigned nr, unsigned in_pv, /* API */ unsigned out_pv, /* hardware */ + unsigned prim_restart, unsigned *out_prim, unsigned *out_index_size, unsigned *out_nr, diff --git a/src/gallium/auxiliary/indices/u_indices_gen.py b/src/gallium/auxiliary/indices/u_indices_gen.py index f05b70a67e3..687a717db9a 100644 --- a/src/gallium/auxiliary/indices/u_indices_gen.py +++ b/src/gallium/auxiliary/indices/u_indices_gen.py @@ -27,10 +27,12 @@ copyright = ''' GENERATE, UBYTE, USHORT, UINT = 'generate', 'ubyte', 'ushort', 'uint' FIRST, LAST = 'first', 'last' +PRDISABLE, PRENABLE = 'prdisable', 'prenable' INTYPES = (GENERATE, UBYTE, USHORT, UINT) OUTTYPES = (USHORT, UINT) PVS=(FIRST, LAST) +PRS=(PRDISABLE, PRENABLE) PRIMS=('points', 'lines', 'linestrip', @@ -57,7 +59,7 @@ longprim = dict(zip(PRIMS, LONGPRIMS)) intype_idx = dict(ubyte='IN_UBYTE', ushort='IN_USHORT', uint='IN_UINT') outtype_idx = dict(ushort='OUT_USHORT', uint='OUT_UINT') pv_idx = dict(first='PV_FIRST', last='PV_LAST') - +pr_idx = dict(prdisable='PR_DISABLE', prenable='PR_ENABLE') def prolog(): print '''/* File automatically generated by indices.py */''' @@ -97,7 +99,7 @@ static unsigned in_size_idx( unsigned index_size ) } -static u_translate_func translate[IN_COUNT][OUT_COUNT][PV_COUNT][PV_COUNT][PRIM_COUNT]; +static u_translate_func translate[IN_COUNT][OUT_COUNT][PV_COUNT][PV_COUNT][PR_COUNT][PRIM_COUNT]; static u_generate_func generate[OUT_COUNT][PV_COUNT][PV_COUNT][PRIM_COUNT]; @@ -143,18 +145,22 @@ def do_quad( intype, outtype, ptr, v0, v1, v2, v3, inpv, outpv ): do_tri( intype, outtype, ptr+'+0', v0, v1, v3, inpv, outpv ); do_tri( intype, outtype, ptr+'+3', v1, v2, v3, inpv, outpv ); -def name(intype, outtype, inpv, outpv, prim): +def name(intype, outtype, inpv, outpv, pr, prim): if intype == GENERATE: return 'generate_' + prim + '_' + outtype + '_' + inpv + '2' + outpv else: - return 'translate_' + prim + '_' + intype + '2' + outtype + '_' + inpv + '2' + outpv + return 'translate_' + prim + '_' + intype + '2' + outtype + '_' + inpv + '2' + outpv + '_' + pr -def preamble(intype, outtype, inpv, outpv, prim): - print 'static void ' + name( intype, outtype, inpv, outpv, prim ) + '(' +def preamble(intype, outtype, inpv, outpv, pr, prim): + print 'static void ' + name( intype, outtype, inpv, outpv, pr, prim ) + '(' if intype != GENERATE: print ' const void * _in,' print ' unsigned start,' - print ' unsigned nr,' + if intype != GENERATE: + print ' unsigned in_nr,' + print ' unsigned out_nr,' + if intype != GENERATE: + print ' unsigned restart_index,' print ' void *_out )' print '{' if intype != GENERATE: @@ -167,46 +173,46 @@ def postamble(): print '}' -def points(intype, outtype, inpv, outpv): - preamble(intype, outtype, inpv, outpv, prim='points') - print ' for (i = start; i < (nr+start); i++) { ' +def points(intype, outtype, inpv, outpv, pr): + preamble(intype, outtype, inpv, outpv, pr, prim='points') + print ' for (i = start; i < (out_nr+start); i++) { ' do_point( intype, outtype, 'out+i', 'i' ); print ' }' postamble() -def lines(intype, outtype, inpv, outpv): - preamble(intype, outtype, inpv, outpv, prim='lines') - print ' for (i = start; i < (nr+start); i+=2) { ' +def lines(intype, outtype, inpv, outpv, pr): + preamble(intype, outtype, inpv, outpv, pr, prim='lines') + print ' for (i = start; i < (out_nr+start); i+=2) { ' do_line( intype, outtype, 'out+i', 'i', 'i+1', inpv, outpv ); print ' }' postamble() -def linestrip(intype, outtype, inpv, outpv): - preamble(intype, outtype, inpv, outpv, prim='linestrip') - print ' for (i = start, j = 0; j < nr; j+=2, i++) { ' +def linestrip(intype, outtype, inpv, outpv, pr): + preamble(intype, outtype, inpv, outpv, pr, prim='linestrip') + print ' for (i = start, j = 0; j < out_nr; j+=2, i++) { ' do_line( intype, outtype, 'out+j', 'i', 'i+1', inpv, outpv ); print ' }' postamble() -def lineloop(intype, outtype, inpv, outpv): - preamble(intype, outtype, inpv, outpv, prim='lineloop') - print ' for (i = start, j = 0; j < nr - 2; j+=2, i++) { ' +def lineloop(intype, outtype, inpv, outpv, pr): + preamble(intype, outtype, inpv, outpv, pr, prim='lineloop') + print ' for (i = start, j = 0; j < out_nr - 2; j+=2, i++) { ' do_line( intype, outtype, 'out+j', 'i', 'i+1', inpv, outpv ); print ' }' do_line( intype, outtype, 'out+j', 'i', 'start', inpv, outpv ); postamble() -def tris(intype, outtype, inpv, outpv): - preamble(intype, outtype, inpv, outpv, prim='tris') - print ' for (i = start; i < (nr+start); i+=3) { ' +def tris(intype, outtype, inpv, outpv, pr): + preamble(intype, outtype, inpv, outpv, pr, prim='tris') + print ' for (i = start; i < (out_nr+start); i+=3) { ' do_tri( intype, outtype, 'out+i', 'i', 'i+1', 'i+2', inpv, outpv ); print ' }' postamble() -def tristrip(intype, outtype, inpv, outpv): - preamble(intype, outtype, inpv, outpv, prim='tristrip') - print ' for (i = start, j = 0; j < nr; j+=3, i++) { ' +def tristrip(intype, outtype, inpv, outpv, pr): + preamble(intype, outtype, inpv, outpv, pr, prim='tristrip') + print ' for (i = start, j = 0; j < out_nr; j+=3, i++) { ' if inpv == FIRST: do_tri( intype, outtype, 'out+j', 'i', 'i+1+(i&1)', 'i+2-(i&1)', inpv, outpv ); else: @@ -215,18 +221,42 @@ def tristrip(intype, outtype, inpv, outpv): postamble() -def trifan(intype, outtype, inpv, outpv): - preamble(intype, outtype, inpv, outpv, prim='trifan') - print ' for (i = start, j = 0; j < nr; j+=3, i++) { ' +def trifan(intype, outtype, inpv, outpv, pr): + preamble(intype, outtype, inpv, outpv, pr, prim='trifan') + print ' for (i = start, j = 0; j < out_nr; j+=3, i++) { ' do_tri( intype, outtype, 'out+j', 'start', 'i+1', 'i+2', inpv, outpv ); print ' }' postamble() -def polygon(intype, outtype, inpv, outpv): - preamble(intype, outtype, inpv, outpv, prim='polygon') - print ' for (i = start, j = 0; j < nr; j+=3, i++) { ' +def polygon(intype, outtype, inpv, outpv, pr): + preamble(intype, outtype, inpv, outpv, pr, prim='polygon') + print ' for (i = start, j = 0; j < out_nr; j+=3, i++) { ' + if pr == PRENABLE: + print 'restart:' + print ' if (i + 3 > in_nr) {' + print ' (out+j+0)[0] = restart_index;' + print ' (out+j+0)[1] = restart_index;' + print ' (out+j+0)[2] = restart_index;' + print ' continue;' + print ' }' + print ' if (in[i + 0] == restart_index) {' + print ' i += 1;' + print ' start = i;' + print ' goto restart;' + print ' }' + print ' if (in[i + 1] == restart_index) {' + print ' i += 2;' + print ' start = i;' + print ' goto restart;' + print ' }' + print ' if (in[i + 2] == restart_index) {' + print ' i += 3;' + print ' start = i;' + print ' goto restart;' + print ' }' + if inpv == FIRST: do_tri( intype, outtype, 'out+j', 'start', 'i+1', 'i+2', inpv, outpv ); else: @@ -235,17 +265,72 @@ def polygon(intype, outtype, inpv, outpv): postamble() -def quads(intype, outtype, inpv, outpv): - preamble(intype, outtype, inpv, outpv, prim='quads') - print ' for (i = start, j = 0; j < nr; j+=6, i+=4) { ' +def quads(intype, outtype, inpv, outpv, pr): + preamble(intype, outtype, inpv, outpv, pr, prim='quads') + print ' for (i = start, j = 0; j < out_nr; j+=6, i+=4) { ' + if pr == PRENABLE: + print 'restart:' + print ' if (i + 4 > in_nr) {' + print ' (out+j+0)[0] = restart_index;' + print ' (out+j+0)[1] = restart_index;' + print ' (out+j+0)[2] = restart_index;' + print ' (out+j+3)[0] = restart_index;' + print ' (out+j+3)[1] = restart_index;' + print ' (out+j+3)[2] = restart_index;' + print ' continue;' + print ' }' + print ' if (in[i + 0] == restart_index) {' + print ' i += 1;' + print ' goto restart;' + print ' }' + print ' if (in[i + 1] == restart_index) {' + print ' i += 2;' + print ' goto restart;' + print ' }' + print ' if (in[i + 2] == restart_index) {' + print ' i += 3;' + print ' goto restart;' + print ' }' + print ' if (in[i + 3] == restart_index) {' + print ' i += 4;' + print ' goto restart;' + print ' }' + do_quad( intype, outtype, 'out+j', 'i+0', 'i+1', 'i+2', 'i+3', inpv, outpv ); print ' }' postamble() -def quadstrip(intype, outtype, inpv, outpv): - preamble(intype, outtype, inpv, outpv, prim='quadstrip') - print ' for (i = start, j = 0; j < nr; j+=6, i+=2) { ' +def quadstrip(intype, outtype, inpv, outpv, pr): + preamble(intype, outtype, inpv, outpv, pr, prim='quadstrip') + print ' for (i = start, j = 0; j < out_nr; j+=6, i+=2) { ' + if pr == PRENABLE: + print 'restart:' + print ' if (i + 4 > in_nr) {' + print ' (out+j+0)[0] = restart_index;' + print ' (out+j+0)[1] = restart_index;' + print ' (out+j+0)[2] = restart_index;' + print ' (out+j+3)[0] = restart_index;' + print ' (out+j+3)[1] = restart_index;' + print ' (out+j+3)[2] = restart_index;' + print ' continue;' + print ' }' + print ' if (in[i + 0] == restart_index) {' + print ' i += 1;' + print ' goto restart;' + print ' }' + print ' if (in[i + 1] == restart_index) {' + print ' i += 2;' + print ' goto restart;' + print ' }' + print ' if (in[i + 2] == restart_index) {' + print ' i += 3;' + print ' goto restart;' + print ' }' + print ' if (in[i + 3] == restart_index) {' + print ' i += 4;' + print ' goto restart;' + print ' }' do_quad( intype, outtype, 'out+j', 'i+2', 'i+0', 'i+1', 'i+3', inpv, outpv ); print ' }' postamble() @@ -256,33 +341,37 @@ def emit_funcs(): for outtype in OUTTYPES: for inpv in (FIRST, LAST): for outpv in (FIRST, LAST): - points(intype, outtype, inpv, outpv) - lines(intype, outtype, inpv, outpv) - linestrip(intype, outtype, inpv, outpv) - lineloop(intype, outtype, inpv, outpv) - tris(intype, outtype, inpv, outpv) - tristrip(intype, outtype, inpv, outpv) - trifan(intype, outtype, inpv, outpv) - quads(intype, outtype, inpv, outpv) - quadstrip(intype, outtype, inpv, outpv) - polygon(intype, outtype, inpv, outpv) - -def init(intype, outtype, inpv, outpv, prim): + for pr in (PRDISABLE, PRENABLE): + if pr == PRENABLE and intype == GENERATE: + continue + points(intype, outtype, inpv, outpv, pr) + lines(intype, outtype, inpv, outpv, pr) + linestrip(intype, outtype, inpv, outpv, pr) + lineloop(intype, outtype, inpv, outpv, pr) + tris(intype, outtype, inpv, outpv, pr) + tristrip(intype, outtype, inpv, outpv, pr) + trifan(intype, outtype, inpv, outpv, pr) + quads(intype, outtype, inpv, outpv, pr) + quadstrip(intype, outtype, inpv, outpv, pr) + polygon(intype, outtype, inpv, outpv, pr) + +def init(intype, outtype, inpv, outpv, pr, prim): if intype == GENERATE: print ('generate[' + outtype_idx[outtype] + '][' + pv_idx[inpv] + '][' + pv_idx[outpv] + '][' + longprim[prim] + - '] = ' + name( intype, outtype, inpv, outpv, prim ) + ';') + '] = ' + name( intype, outtype, inpv, outpv, pr, prim ) + ';') else: print ('translate[' + intype_idx[intype] + '][' + outtype_idx[outtype] + '][' + pv_idx[inpv] + - '][' + pv_idx[outpv] + + '][' + pv_idx[outpv] + + '][' + pr_idx[pr] + '][' + longprim[prim] + - '] = ' + name( intype, outtype, inpv, outpv, prim ) + ';') + '] = ' + name( intype, outtype, inpv, outpv, pr, prim ) + ';') def emit_all_inits(): @@ -290,8 +379,9 @@ def emit_all_inits(): for outtype in OUTTYPES: for inpv in PVS: for outpv in PVS: - for prim in PRIMS: - init(intype, outtype, inpv, outpv, prim) + for pr in PRS: + for prim in PRIMS: + init(intype, outtype, inpv, outpv, pr, prim) def emit_init(): print 'void u_index_init( void )' diff --git a/src/gallium/auxiliary/indices/u_primconvert.c b/src/gallium/auxiliary/indices/u_primconvert.c index cebb81842d1..00e65aaea31 100644 --- a/src/gallium/auxiliary/indices/u_primconvert.c +++ b/src/gallium/auxiliary/indices/u_primconvert.c @@ -129,11 +129,13 @@ util_primconvert_draw_vbo(struct primconvert_context *pc, new_info.index_bias = info->index_bias; new_info.start_instance = info->start_instance; new_info.instance_count = info->instance_count; - + new_info.primitive_restart = info->primitive_restart; + new_info.restart_index = info->restart_index; if (info->indexed) { u_index_translator(pc->primtypes_mask, info->mode, pc->saved_ib.index_size, info->count, pc->api_pv, pc->api_pv, + info->primitive_restart ? PR_ENABLE : PR_DISABLE, &new_info.mode, &new_ib.index_size, &new_info.count, &trans_func); src = ib->user_buffer; @@ -159,7 +161,7 @@ util_primconvert_draw_vbo(struct primconvert_context *pc, &new_ib.offset, &new_ib.buffer, &dst); if (info->indexed) { - trans_func(src, info->start, new_info.count, dst); + trans_func(src, info->start, info->count, new_info.count, info->restart_index, dst); } else { gen_func(info->start, new_info.count, dst); diff --git a/src/gallium/auxiliary/indices/u_unfilled_gen.py b/src/gallium/auxiliary/indices/u_unfilled_gen.py index 88649724521..873e78173c5 100644 --- a/src/gallium/auxiliary/indices/u_unfilled_gen.py +++ b/src/gallium/auxiliary/indices/u_unfilled_gen.py @@ -128,7 +128,11 @@ def preamble(intype, outtype, prim): if intype != GENERATE: print ' const void * _in,' print ' unsigned start,' - print ' unsigned nr,' + if intype != GENERATE: + print ' unsigned in_nr,' + print ' unsigned out_nr,' + if intype != GENERATE: + print ' unsigned restart_index,' print ' void *_out )' print '{' if intype != GENERATE: @@ -143,7 +147,7 @@ def postamble(): def tris(intype, outtype): preamble(intype, outtype, prim='tris') - print ' for (i = start, j = 0; j < nr; j+=6, i+=3) { ' + print ' for (i = start, j = 0; j < out_nr; j+=6, i+=3) { ' do_tri( intype, outtype, 'out+j', 'i', 'i+1', 'i+2' ); print ' }' postamble() @@ -151,7 +155,7 @@ def tris(intype, outtype): def tristrip(intype, outtype): preamble(intype, outtype, prim='tristrip') - print ' for (i = start, j = 0; j < nr; j+=6, i++) { ' + print ' for (i = start, j = 0; j < out_nr; j+=6, i++) { ' do_tri( intype, outtype, 'out+j', 'i', 'i+1/*+(i&1)*/', 'i+2/*-(i&1)*/' ); print ' }' postamble() @@ -159,7 +163,7 @@ def tristrip(intype, outtype): def trifan(intype, outtype): preamble(intype, outtype, prim='trifan') - print ' for (i = start, j = 0; j < nr; j+=6, i++) { ' + print ' for (i = start, j = 0; j < out_nr; j+=6, i++) { ' do_tri( intype, outtype, 'out+j', '0', 'i+1', 'i+2' ); print ' }' postamble() @@ -168,15 +172,15 @@ def trifan(intype, outtype): def polygon(intype, outtype): preamble(intype, outtype, prim='polygon') - print ' for (i = start, j = 0; j < nr; j+=2, i++) { ' - line( intype, outtype, 'out+j', 'i', '(i+1)%(nr/2)' ) + print ' for (i = start, j = 0; j < out_nr; j+=2, i++) { ' + line( intype, outtype, 'out+j', 'i', '(i+1)%(out_nr/2)' ) print ' }' postamble() def quads(intype, outtype): preamble(intype, outtype, prim='quads') - print ' for (i = start, j = 0; j < nr; j+=8, i+=4) { ' + print ' for (i = start, j = 0; j < out_nr; j+=8, i+=4) { ' do_quad( intype, outtype, 'out+j', 'i+0', 'i+1', 'i+2', 'i+3' ); print ' }' postamble() @@ -184,7 +188,7 @@ def quads(intype, outtype): def quadstrip(intype, outtype): preamble(intype, outtype, prim='quadstrip') - print ' for (i = start, j = 0; j < nr; j+=8, i+=2) { ' + print ' for (i = start, j = 0; j < out_nr; j+=8, i+=2) { ' do_quad( intype, outtype, 'out+j', 'i+2', 'i+0', 'i+1', 'i+3' ); print ' }' postamble() diff --git a/src/gallium/auxiliary/indices/u_unfilled_indices.c b/src/gallium/auxiliary/indices/u_unfilled_indices.c index 7a74c39135e..121877a60fb 100644 --- a/src/gallium/auxiliary/indices/u_unfilled_indices.c +++ b/src/gallium/auxiliary/indices/u_unfilled_indices.c @@ -28,30 +28,36 @@ static void translate_ubyte_ushort( const void *in, unsigned start, - unsigned nr, + unsigned in_nr, + unsigned out_nr, + unsigned restart_index, void *out ) { const ubyte *in_ub = (const ubyte *)in; ushort *out_us = (ushort *)out; unsigned i; - for (i = 0; i < nr; i++) + for (i = 0; i < out_nr; i++) out_us[i] = (ushort) in_ub[i+start]; } static void translate_memcpy_ushort( const void *in, unsigned start, - unsigned nr, + unsigned in_nr, + unsigned out_nr, + unsigned restart_index, void *out ) { - memcpy(out, &((short *)in)[start], nr*sizeof(short)); + memcpy(out, &((short *)in)[start], out_nr*sizeof(short)); } static void translate_memcpy_uint( const void *in, unsigned start, - unsigned nr, + unsigned in_nr, + unsigned out_nr, + unsigned restart_index, void *out ) { - memcpy(out, &((int *)in)[start], nr*sizeof(int)); + memcpy(out, &((int *)in)[start], out_nr*sizeof(int)); } diff --git a/src/gallium/drivers/svga/svga_draw_elements.c b/src/gallium/drivers/svga/svga_draw_elements.c index 3384095e6f5..038500a35bd 100644 --- a/src/gallium/drivers/svga/svga_draw_elements.c +++ b/src/gallium/drivers/svga/svga_draw_elements.c @@ -70,7 +70,7 @@ translate_indices(struct svga_hwtnl *hwtnl, struct pipe_resource *src, if (dst_map == NULL) goto fail; - translate((const char *) src_map + offset, 0, nr, dst_map); + translate((const char *) src_map + offset, 0, 0, nr, 0, dst_map); pipe_buffer_unmap(pipe, src_transfer); pipe_buffer_unmap(pipe, dst_transfer); @@ -153,6 +153,7 @@ svga_hwtnl_draw_range_elements(struct svga_hwtnl *hwtnl, count, hwtnl->api_pv, hwtnl->hw_pv, + PR_DISABLE, &gen_prim, &gen_size, &gen_nr, &gen_func); } |