1/* File automatically generated by u_unfilled_gen.py */ 2 3/* 4 * Copyright 2009 VMware, Inc. 5 * All Rights Reserved. 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a 8 * copy of this software and associated documentation files (the "Software"), 9 * to deal in the Software without restriction, including without limitation 10 * on the rights to use, copy, modify, merge, publish, distribute, sub 11 * license, and/or sell copies of the Software, and to permit persons to whom 12 * the Software is furnished to do so, subject to the following conditions: 13 * 14 * The above copyright notice and this permission notice (including the next 15 * paragraph) shall be included in all copies or substantial portions of the 16 * Software. 17 * 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 21 * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, 22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 24 * USE OR OTHER DEALINGS IN THE SOFTWARE. 25 */ 26 27 28 29/** 30 * @file 31 * Functions to translate and generate index lists 32 */ 33 34#include "indices/u_indices.h" 35#include "indices/u_indices_priv.h" 36#include "pipe/p_compiler.h" 37#include "util/u_debug.h" 38#include "pipe/p_defines.h" 39#include "util/u_memory.h" 40 41 42static unsigned out_size_idx( unsigned index_size ) 43{ 44 switch (index_size) { 45 case 4: return OUT_UINT; 46 case 2: return OUT_USHORT; 47 default: assert(0); return OUT_USHORT; 48 } 49} 50 51static unsigned in_size_idx( unsigned index_size ) 52{ 53 switch (index_size) { 54 case 4: return IN_UINT; 55 case 2: return IN_USHORT; 56 case 1: return IN_UBYTE; 57 default: assert(0); return IN_UBYTE; 58 } 59} 60 61 62static u_generate_func generate_line[OUT_COUNT][PRIM_COUNT]; 63static u_translate_func translate_line[IN_COUNT][OUT_COUNT][PRIM_COUNT]; 64 65 66static void generate_tris_ushort( 67 unsigned start, 68 unsigned out_nr, 69 void *_out ) 70{ 71 ushort *out = (ushort*)_out; 72 unsigned i, j; 73 (void)j; 74 for (i = start, j = 0; j < out_nr; j+=6, i+=3) { 75 (out+j)[0] = (ushort)(i); 76 (out+j)[1] = (ushort)(i+1); 77 (out+j+2)[0] = (ushort)(i+1); 78 (out+j+2)[1] = (ushort)(i+2); 79 (out+j+4)[0] = (ushort)(i+2); 80 (out+j+4)[1] = (ushort)(i); 81 } 82} 83static void generate_tristrip_ushort( 84 unsigned start, 85 unsigned out_nr, 86 void *_out ) 87{ 88 ushort *out = (ushort*)_out; 89 unsigned i, j; 90 (void)j; 91 for (i = start, j = 0; j < out_nr; j+=6, i++) { 92 (out+j)[0] = (ushort)(i); 93 (out+j)[1] = (ushort)(i+1/*+(i&1)*/); 94 (out+j+2)[0] = (ushort)(i+1/*+(i&1)*/); 95 (out+j+2)[1] = (ushort)(i+2/*-(i&1)*/); 96 (out+j+4)[0] = (ushort)(i+2/*-(i&1)*/); 97 (out+j+4)[1] = (ushort)(i); 98 } 99} 100static void generate_trifan_ushort( 101 unsigned start, 102 unsigned out_nr, 103 void *_out ) 104{ 105 ushort *out = (ushort*)_out; 106 unsigned i, j; 107 (void)j; 108 for (i = start, j = 0; j < out_nr; j+=6, i++) { 109 (out+j)[0] = (ushort)(0); 110 (out+j)[1] = (ushort)(i+1); 111 (out+j+2)[0] = (ushort)(i+1); 112 (out+j+2)[1] = (ushort)(i+2); 113 (out+j+4)[0] = (ushort)(i+2); 114 (out+j+4)[1] = (ushort)(0); 115 } 116} 117static void generate_quads_ushort( 118 unsigned start, 119 unsigned out_nr, 120 void *_out ) 121{ 122 ushort *out = (ushort*)_out; 123 unsigned i, j; 124 (void)j; 125 for (i = start, j = 0; j < out_nr; j+=8, i+=4) { 126 (out+j)[0] = (ushort)(i+0); 127 (out+j)[1] = (ushort)(i+1); 128 (out+j+2)[0] = (ushort)(i+1); 129 (out+j+2)[1] = (ushort)(i+2); 130 (out+j+4)[0] = (ushort)(i+2); 131 (out+j+4)[1] = (ushort)(i+3); 132 (out+j+6)[0] = (ushort)(i+3); 133 (out+j+6)[1] = (ushort)(i+0); 134 } 135} 136static void generate_quadstrip_ushort( 137 unsigned start, 138 unsigned out_nr, 139 void *_out ) 140{ 141 ushort *out = (ushort*)_out; 142 unsigned i, j; 143 (void)j; 144 for (i = start, j = 0; j < out_nr; j+=8, i+=2) { 145 (out+j)[0] = (ushort)(i+2); 146 (out+j)[1] = (ushort)(i+0); 147 (out+j+2)[0] = (ushort)(i+0); 148 (out+j+2)[1] = (ushort)(i+1); 149 (out+j+4)[0] = (ushort)(i+1); 150 (out+j+4)[1] = (ushort)(i+3); 151 (out+j+6)[0] = (ushort)(i+3); 152 (out+j+6)[1] = (ushort)(i+2); 153 } 154} 155static void generate_polygon_ushort( 156 unsigned start, 157 unsigned out_nr, 158 void *_out ) 159{ 160 ushort *out = (ushort*)_out; 161 unsigned i, j; 162 (void)j; 163 for (i = start, j = 0; j < out_nr; j+=2, i++) { 164 (out+j)[0] = (ushort)(i); 165 (out+j)[1] = (ushort)((i+1)%(out_nr/2)); 166 } 167} 168static void generate_trisadj_ushort( 169 unsigned start, 170 unsigned out_nr, 171 void *_out ) 172{ 173 ushort *out = (ushort*)_out; 174 unsigned i, j; 175 (void)j; 176 for (i = start, j = 0; j < out_nr; j+=6, i+=6) { 177 (out+j)[0] = (ushort)(i); 178 (out+j)[1] = (ushort)(i+2); 179 (out+j+2)[0] = (ushort)(i+2); 180 (out+j+2)[1] = (ushort)(i+4); 181 (out+j+4)[0] = (ushort)(i+4); 182 (out+j+4)[1] = (ushort)(i); 183 } 184} 185static void generate_tristripadj_ushort( 186 unsigned start, 187 unsigned out_nr, 188 void *_out ) 189{ 190 ushort *out = (ushort*)_out; 191 unsigned i, j; 192 (void)j; 193 for (i = start, j = 0; j < out_nr; j+=6, i+=2) { 194 (out+j)[0] = (ushort)(i); 195 (out+j)[1] = (ushort)(i+2); 196 (out+j+2)[0] = (ushort)(i+2); 197 (out+j+2)[1] = (ushort)(i+4); 198 (out+j+4)[0] = (ushort)(i+4); 199 (out+j+4)[1] = (ushort)(i); 200 } 201} 202static void generate_tris_uint( 203 unsigned start, 204 unsigned out_nr, 205 void *_out ) 206{ 207 uint *out = (uint*)_out; 208 unsigned i, j; 209 (void)j; 210 for (i = start, j = 0; j < out_nr; j+=6, i+=3) { 211 (out+j)[0] = (uint)(i); 212 (out+j)[1] = (uint)(i+1); 213 (out+j+2)[0] = (uint)(i+1); 214 (out+j+2)[1] = (uint)(i+2); 215 (out+j+4)[0] = (uint)(i+2); 216 (out+j+4)[1] = (uint)(i); 217 } 218} 219static void generate_tristrip_uint( 220 unsigned start, 221 unsigned out_nr, 222 void *_out ) 223{ 224 uint *out = (uint*)_out; 225 unsigned i, j; 226 (void)j; 227 for (i = start, j = 0; j < out_nr; j+=6, i++) { 228 (out+j)[0] = (uint)(i); 229 (out+j)[1] = (uint)(i+1/*+(i&1)*/); 230 (out+j+2)[0] = (uint)(i+1/*+(i&1)*/); 231 (out+j+2)[1] = (uint)(i+2/*-(i&1)*/); 232 (out+j+4)[0] = (uint)(i+2/*-(i&1)*/); 233 (out+j+4)[1] = (uint)(i); 234 } 235} 236static void generate_trifan_uint( 237 unsigned start, 238 unsigned out_nr, 239 void *_out ) 240{ 241 uint *out = (uint*)_out; 242 unsigned i, j; 243 (void)j; 244 for (i = start, j = 0; j < out_nr; j+=6, i++) { 245 (out+j)[0] = (uint)(0); 246 (out+j)[1] = (uint)(i+1); 247 (out+j+2)[0] = (uint)(i+1); 248 (out+j+2)[1] = (uint)(i+2); 249 (out+j+4)[0] = (uint)(i+2); 250 (out+j+4)[1] = (uint)(0); 251 } 252} 253static void generate_quads_uint( 254 unsigned start, 255 unsigned out_nr, 256 void *_out ) 257{ 258 uint *out = (uint*)_out; 259 unsigned i, j; 260 (void)j; 261 for (i = start, j = 0; j < out_nr; j+=8, i+=4) { 262 (out+j)[0] = (uint)(i+0); 263 (out+j)[1] = (uint)(i+1); 264 (out+j+2)[0] = (uint)(i+1); 265 (out+j+2)[1] = (uint)(i+2); 266 (out+j+4)[0] = (uint)(i+2); 267 (out+j+4)[1] = (uint)(i+3); 268 (out+j+6)[0] = (uint)(i+3); 269 (out+j+6)[1] = (uint)(i+0); 270 } 271} 272static void generate_quadstrip_uint( 273 unsigned start, 274 unsigned out_nr, 275 void *_out ) 276{ 277 uint *out = (uint*)_out; 278 unsigned i, j; 279 (void)j; 280 for (i = start, j = 0; j < out_nr; j+=8, i+=2) { 281 (out+j)[0] = (uint)(i+2); 282 (out+j)[1] = (uint)(i+0); 283 (out+j+2)[0] = (uint)(i+0); 284 (out+j+2)[1] = (uint)(i+1); 285 (out+j+4)[0] = (uint)(i+1); 286 (out+j+4)[1] = (uint)(i+3); 287 (out+j+6)[0] = (uint)(i+3); 288 (out+j+6)[1] = (uint)(i+2); 289 } 290} 291static void generate_polygon_uint( 292 unsigned start, 293 unsigned out_nr, 294 void *_out ) 295{ 296 uint *out = (uint*)_out; 297 unsigned i, j; 298 (void)j; 299 for (i = start, j = 0; j < out_nr; j+=2, i++) { 300 (out+j)[0] = (uint)(i); 301 (out+j)[1] = (uint)((i+1)%(out_nr/2)); 302 } 303} 304static void generate_trisadj_uint( 305 unsigned start, 306 unsigned out_nr, 307 void *_out ) 308{ 309 uint *out = (uint*)_out; 310 unsigned i, j; 311 (void)j; 312 for (i = start, j = 0; j < out_nr; j+=6, i+=6) { 313 (out+j)[0] = (uint)(i); 314 (out+j)[1] = (uint)(i+2); 315 (out+j+2)[0] = (uint)(i+2); 316 (out+j+2)[1] = (uint)(i+4); 317 (out+j+4)[0] = (uint)(i+4); 318 (out+j+4)[1] = (uint)(i); 319 } 320} 321static void generate_tristripadj_uint( 322 unsigned start, 323 unsigned out_nr, 324 void *_out ) 325{ 326 uint *out = (uint*)_out; 327 unsigned i, j; 328 (void)j; 329 for (i = start, j = 0; j < out_nr; j+=6, i+=2) { 330 (out+j)[0] = (uint)(i); 331 (out+j)[1] = (uint)(i+2); 332 (out+j+2)[0] = (uint)(i+2); 333 (out+j+2)[1] = (uint)(i+4); 334 (out+j+4)[0] = (uint)(i+4); 335 (out+j+4)[1] = (uint)(i); 336 } 337} 338static void translate_tris_ubyte2ushort( 339 const void * _in, 340 unsigned start, 341 unsigned in_nr, 342 unsigned out_nr, 343 unsigned restart_index, 344 void *_out ) 345{ 346 const ubyte*in = (const ubyte*)_in; 347 ushort *out = (ushort*)_out; 348 unsigned i, j; 349 (void)j; 350 for (i = start, j = 0; j < out_nr; j+=6, i+=3) { 351 (out+j)[0] = (ushort)in[i]; 352 (out+j)[1] = (ushort)in[i+1]; 353 (out+j+2)[0] = (ushort)in[i+1]; 354 (out+j+2)[1] = (ushort)in[i+2]; 355 (out+j+4)[0] = (ushort)in[i+2]; 356 (out+j+4)[1] = (ushort)in[i]; 357 } 358} 359static void translate_tristrip_ubyte2ushort( 360 const void * _in, 361 unsigned start, 362 unsigned in_nr, 363 unsigned out_nr, 364 unsigned restart_index, 365 void *_out ) 366{ 367 const ubyte*in = (const ubyte*)_in; 368 ushort *out = (ushort*)_out; 369 unsigned i, j; 370 (void)j; 371 for (i = start, j = 0; j < out_nr; j+=6, i++) { 372 (out+j)[0] = (ushort)in[i]; 373 (out+j)[1] = (ushort)in[i+1/*+(i&1)*/]; 374 (out+j+2)[0] = (ushort)in[i+1/*+(i&1)*/]; 375 (out+j+2)[1] = (ushort)in[i+2/*-(i&1)*/]; 376 (out+j+4)[0] = (ushort)in[i+2/*-(i&1)*/]; 377 (out+j+4)[1] = (ushort)in[i]; 378 } 379} 380static void translate_trifan_ubyte2ushort( 381 const void * _in, 382 unsigned start, 383 unsigned in_nr, 384 unsigned out_nr, 385 unsigned restart_index, 386 void *_out ) 387{ 388 const ubyte*in = (const ubyte*)_in; 389 ushort *out = (ushort*)_out; 390 unsigned i, j; 391 (void)j; 392 for (i = start, j = 0; j < out_nr; j+=6, i++) { 393 (out+j)[0] = (ushort)in[0]; 394 (out+j)[1] = (ushort)in[i+1]; 395 (out+j+2)[0] = (ushort)in[i+1]; 396 (out+j+2)[1] = (ushort)in[i+2]; 397 (out+j+4)[0] = (ushort)in[i+2]; 398 (out+j+4)[1] = (ushort)in[0]; 399 } 400} 401static void translate_quads_ubyte2ushort( 402 const void * _in, 403 unsigned start, 404 unsigned in_nr, 405 unsigned out_nr, 406 unsigned restart_index, 407 void *_out ) 408{ 409 const ubyte*in = (const ubyte*)_in; 410 ushort *out = (ushort*)_out; 411 unsigned i, j; 412 (void)j; 413 for (i = start, j = 0; j < out_nr; j+=8, i+=4) { 414 (out+j)[0] = (ushort)in[i+0]; 415 (out+j)[1] = (ushort)in[i+1]; 416 (out+j+2)[0] = (ushort)in[i+1]; 417 (out+j+2)[1] = (ushort)in[i+2]; 418 (out+j+4)[0] = (ushort)in[i+2]; 419 (out+j+4)[1] = (ushort)in[i+3]; 420 (out+j+6)[0] = (ushort)in[i+3]; 421 (out+j+6)[1] = (ushort)in[i+0]; 422 } 423} 424static void translate_quadstrip_ubyte2ushort( 425 const void * _in, 426 unsigned start, 427 unsigned in_nr, 428 unsigned out_nr, 429 unsigned restart_index, 430 void *_out ) 431{ 432 const ubyte*in = (const ubyte*)_in; 433 ushort *out = (ushort*)_out; 434 unsigned i, j; 435 (void)j; 436 for (i = start, j = 0; j < out_nr; j+=8, i+=2) { 437 (out+j)[0] = (ushort)in[i+2]; 438 (out+j)[1] = (ushort)in[i+0]; 439 (out+j+2)[0] = (ushort)in[i+0]; 440 (out+j+2)[1] = (ushort)in[i+1]; 441 (out+j+4)[0] = (ushort)in[i+1]; 442 (out+j+4)[1] = (ushort)in[i+3]; 443 (out+j+6)[0] = (ushort)in[i+3]; 444 (out+j+6)[1] = (ushort)in[i+2]; 445 } 446} 447static void translate_polygon_ubyte2ushort( 448 const void * _in, 449 unsigned start, 450 unsigned in_nr, 451 unsigned out_nr, 452 unsigned restart_index, 453 void *_out ) 454{ 455 const ubyte*in = (const ubyte*)_in; 456 ushort *out = (ushort*)_out; 457 unsigned i, j; 458 (void)j; 459 for (i = start, j = 0; j < out_nr; j+=2, i++) { 460 (out+j)[0] = (ushort)in[i]; 461 (out+j)[1] = (ushort)in[(i+1)%(out_nr/2)]; 462 } 463} 464static void translate_trisadj_ubyte2ushort( 465 const void * _in, 466 unsigned start, 467 unsigned in_nr, 468 unsigned out_nr, 469 unsigned restart_index, 470 void *_out ) 471{ 472 const ubyte*in = (const ubyte*)_in; 473 ushort *out = (ushort*)_out; 474 unsigned i, j; 475 (void)j; 476 for (i = start, j = 0; j < out_nr; j+=6, i+=6) { 477 (out+j)[0] = (ushort)in[i]; 478 (out+j)[1] = (ushort)in[i+2]; 479 (out+j+2)[0] = (ushort)in[i+2]; 480 (out+j+2)[1] = (ushort)in[i+4]; 481 (out+j+4)[0] = (ushort)in[i+4]; 482 (out+j+4)[1] = (ushort)in[i]; 483 } 484} 485static void translate_tristripadj_ubyte2ushort( 486 const void * _in, 487 unsigned start, 488 unsigned in_nr, 489 unsigned out_nr, 490 unsigned restart_index, 491 void *_out ) 492{ 493 const ubyte*in = (const ubyte*)_in; 494 ushort *out = (ushort*)_out; 495 unsigned i, j; 496 (void)j; 497 for (i = start, j = 0; j < out_nr; j+=6, i+=2) { 498 (out+j)[0] = (ushort)in[i]; 499 (out+j)[1] = (ushort)in[i+2]; 500 (out+j+2)[0] = (ushort)in[i+2]; 501 (out+j+2)[1] = (ushort)in[i+4]; 502 (out+j+4)[0] = (ushort)in[i+4]; 503 (out+j+4)[1] = (ushort)in[i]; 504 } 505} 506static void translate_tris_ubyte2uint( 507 const void * _in, 508 unsigned start, 509 unsigned in_nr, 510 unsigned out_nr, 511 unsigned restart_index, 512 void *_out ) 513{ 514 const ubyte*in = (const ubyte*)_in; 515 uint *out = (uint*)_out; 516 unsigned i, j; 517 (void)j; 518 for (i = start, j = 0; j < out_nr; j+=6, i+=3) { 519 (out+j)[0] = (uint)in[i]; 520 (out+j)[1] = (uint)in[i+1]; 521 (out+j+2)[0] = (uint)in[i+1]; 522 (out+j+2)[1] = (uint)in[i+2]; 523 (out+j+4)[0] = (uint)in[i+2]; 524 (out+j+4)[1] = (uint)in[i]; 525 } 526} 527static void translate_tristrip_ubyte2uint( 528 const void * _in, 529 unsigned start, 530 unsigned in_nr, 531 unsigned out_nr, 532 unsigned restart_index, 533 void *_out ) 534{ 535 const ubyte*in = (const ubyte*)_in; 536 uint *out = (uint*)_out; 537 unsigned i, j; 538 (void)j; 539 for (i = start, j = 0; j < out_nr; j+=6, i++) { 540 (out+j)[0] = (uint)in[i]; 541 (out+j)[1] = (uint)in[i+1/*+(i&1)*/]; 542 (out+j+2)[0] = (uint)in[i+1/*+(i&1)*/]; 543 (out+j+2)[1] = (uint)in[i+2/*-(i&1)*/]; 544 (out+j+4)[0] = (uint)in[i+2/*-(i&1)*/]; 545 (out+j+4)[1] = (uint)in[i]; 546 } 547} 548static void translate_trifan_ubyte2uint( 549 const void * _in, 550 unsigned start, 551 unsigned in_nr, 552 unsigned out_nr, 553 unsigned restart_index, 554 void *_out ) 555{ 556 const ubyte*in = (const ubyte*)_in; 557 uint *out = (uint*)_out; 558 unsigned i, j; 559 (void)j; 560 for (i = start, j = 0; j < out_nr; j+=6, i++) { 561 (out+j)[0] = (uint)in[0]; 562 (out+j)[1] = (uint)in[i+1]; 563 (out+j+2)[0] = (uint)in[i+1]; 564 (out+j+2)[1] = (uint)in[i+2]; 565 (out+j+4)[0] = (uint)in[i+2]; 566 (out+j+4)[1] = (uint)in[0]; 567 } 568} 569static void translate_quads_ubyte2uint( 570 const void * _in, 571 unsigned start, 572 unsigned in_nr, 573 unsigned out_nr, 574 unsigned restart_index, 575 void *_out ) 576{ 577 const ubyte*in = (const ubyte*)_in; 578 uint *out = (uint*)_out; 579 unsigned i, j; 580 (void)j; 581 for (i = start, j = 0; j < out_nr; j+=8, i+=4) { 582 (out+j)[0] = (uint)in[i+0]; 583 (out+j)[1] = (uint)in[i+1]; 584 (out+j+2)[0] = (uint)in[i+1]; 585 (out+j+2)[1] = (uint)in[i+2]; 586 (out+j+4)[0] = (uint)in[i+2]; 587 (out+j+4)[1] = (uint)in[i+3]; 588 (out+j+6)[0] = (uint)in[i+3]; 589 (out+j+6)[1] = (uint)in[i+0]; 590 } 591} 592static void translate_quadstrip_ubyte2uint( 593 const void * _in, 594 unsigned start, 595 unsigned in_nr, 596 unsigned out_nr, 597 unsigned restart_index, 598 void *_out ) 599{ 600 const ubyte*in = (const ubyte*)_in; 601 uint *out = (uint*)_out; 602 unsigned i, j; 603 (void)j; 604 for (i = start, j = 0; j < out_nr; j+=8, i+=2) { 605 (out+j)[0] = (uint)in[i+2]; 606 (out+j)[1] = (uint)in[i+0]; 607 (out+j+2)[0] = (uint)in[i+0]; 608 (out+j+2)[1] = (uint)in[i+1]; 609 (out+j+4)[0] = (uint)in[i+1]; 610 (out+j+4)[1] = (uint)in[i+3]; 611 (out+j+6)[0] = (uint)in[i+3]; 612 (out+j+6)[1] = (uint)in[i+2]; 613 } 614} 615static void translate_polygon_ubyte2uint( 616 const void * _in, 617 unsigned start, 618 unsigned in_nr, 619 unsigned out_nr, 620 unsigned restart_index, 621 void *_out ) 622{ 623 const ubyte*in = (const ubyte*)_in; 624 uint *out = (uint*)_out; 625 unsigned i, j; 626 (void)j; 627 for (i = start, j = 0; j < out_nr; j+=2, i++) { 628 (out+j)[0] = (uint)in[i]; 629 (out+j)[1] = (uint)in[(i+1)%(out_nr/2)]; 630 } 631} 632static void translate_trisadj_ubyte2uint( 633 const void * _in, 634 unsigned start, 635 unsigned in_nr, 636 unsigned out_nr, 637 unsigned restart_index, 638 void *_out ) 639{ 640 const ubyte*in = (const ubyte*)_in; 641 uint *out = (uint*)_out; 642 unsigned i, j; 643 (void)j; 644 for (i = start, j = 0; j < out_nr; j+=6, i+=6) { 645 (out+j)[0] = (uint)in[i]; 646 (out+j)[1] = (uint)in[i+2]; 647 (out+j+2)[0] = (uint)in[i+2]; 648 (out+j+2)[1] = (uint)in[i+4]; 649 (out+j+4)[0] = (uint)in[i+4]; 650 (out+j+4)[1] = (uint)in[i]; 651 } 652} 653static void translate_tristripadj_ubyte2uint( 654 const void * _in, 655 unsigned start, 656 unsigned in_nr, 657 unsigned out_nr, 658 unsigned restart_index, 659 void *_out ) 660{ 661 const ubyte*in = (const ubyte*)_in; 662 uint *out = (uint*)_out; 663 unsigned i, j; 664 (void)j; 665 for (i = start, j = 0; j < out_nr; j+=6, i+=2) { 666 (out+j)[0] = (uint)in[i]; 667 (out+j)[1] = (uint)in[i+2]; 668 (out+j+2)[0] = (uint)in[i+2]; 669 (out+j+2)[1] = (uint)in[i+4]; 670 (out+j+4)[0] = (uint)in[i+4]; 671 (out+j+4)[1] = (uint)in[i]; 672 } 673} 674static void translate_tris_ushort2ushort( 675 const void * _in, 676 unsigned start, 677 unsigned in_nr, 678 unsigned out_nr, 679 unsigned restart_index, 680 void *_out ) 681{ 682 const ushort*in = (const ushort*)_in; 683 ushort *out = (ushort*)_out; 684 unsigned i, j; 685 (void)j; 686 for (i = start, j = 0; j < out_nr; j+=6, i+=3) { 687 (out+j)[0] = (ushort)in[i]; 688 (out+j)[1] = (ushort)in[i+1]; 689 (out+j+2)[0] = (ushort)in[i+1]; 690 (out+j+2)[1] = (ushort)in[i+2]; 691 (out+j+4)[0] = (ushort)in[i+2]; 692 (out+j+4)[1] = (ushort)in[i]; 693 } 694} 695static void translate_tristrip_ushort2ushort( 696 const void * _in, 697 unsigned start, 698 unsigned in_nr, 699 unsigned out_nr, 700 unsigned restart_index, 701 void *_out ) 702{ 703 const ushort*in = (const ushort*)_in; 704 ushort *out = (ushort*)_out; 705 unsigned i, j; 706 (void)j; 707 for (i = start, j = 0; j < out_nr; j+=6, i++) { 708 (out+j)[0] = (ushort)in[i]; 709 (out+j)[1] = (ushort)in[i+1/*+(i&1)*/]; 710 (out+j+2)[0] = (ushort)in[i+1/*+(i&1)*/]; 711 (out+j+2)[1] = (ushort)in[i+2/*-(i&1)*/]; 712 (out+j+4)[0] = (ushort)in[i+2/*-(i&1)*/]; 713 (out+j+4)[1] = (ushort)in[i]; 714 } 715} 716static void translate_trifan_ushort2ushort( 717 const void * _in, 718 unsigned start, 719 unsigned in_nr, 720 unsigned out_nr, 721 unsigned restart_index, 722 void *_out ) 723{ 724 const ushort*in = (const ushort*)_in; 725 ushort *out = (ushort*)_out; 726 unsigned i, j; 727 (void)j; 728 for (i = start, j = 0; j < out_nr; j+=6, i++) { 729 (out+j)[0] = (ushort)in[0]; 730 (out+j)[1] = (ushort)in[i+1]; 731 (out+j+2)[0] = (ushort)in[i+1]; 732 (out+j+2)[1] = (ushort)in[i+2]; 733 (out+j+4)[0] = (ushort)in[i+2]; 734 (out+j+4)[1] = (ushort)in[0]; 735 } 736} 737static void translate_quads_ushort2ushort( 738 const void * _in, 739 unsigned start, 740 unsigned in_nr, 741 unsigned out_nr, 742 unsigned restart_index, 743 void *_out ) 744{ 745 const ushort*in = (const ushort*)_in; 746 ushort *out = (ushort*)_out; 747 unsigned i, j; 748 (void)j; 749 for (i = start, j = 0; j < out_nr; j+=8, i+=4) { 750 (out+j)[0] = (ushort)in[i+0]; 751 (out+j)[1] = (ushort)in[i+1]; 752 (out+j+2)[0] = (ushort)in[i+1]; 753 (out+j+2)[1] = (ushort)in[i+2]; 754 (out+j+4)[0] = (ushort)in[i+2]; 755 (out+j+4)[1] = (ushort)in[i+3]; 756 (out+j+6)[0] = (ushort)in[i+3]; 757 (out+j+6)[1] = (ushort)in[i+0]; 758 } 759} 760static void translate_quadstrip_ushort2ushort( 761 const void * _in, 762 unsigned start, 763 unsigned in_nr, 764 unsigned out_nr, 765 unsigned restart_index, 766 void *_out ) 767{ 768 const ushort*in = (const ushort*)_in; 769 ushort *out = (ushort*)_out; 770 unsigned i, j; 771 (void)j; 772 for (i = start, j = 0; j < out_nr; j+=8, i+=2) { 773 (out+j)[0] = (ushort)in[i+2]; 774 (out+j)[1] = (ushort)in[i+0]; 775 (out+j+2)[0] = (ushort)in[i+0]; 776 (out+j+2)[1] = (ushort)in[i+1]; 777 (out+j+4)[0] = (ushort)in[i+1]; 778 (out+j+4)[1] = (ushort)in[i+3]; 779 (out+j+6)[0] = (ushort)in[i+3]; 780 (out+j+6)[1] = (ushort)in[i+2]; 781 } 782} 783static void translate_polygon_ushort2ushort( 784 const void * _in, 785 unsigned start, 786 unsigned in_nr, 787 unsigned out_nr, 788 unsigned restart_index, 789 void *_out ) 790{ 791 const ushort*in = (const ushort*)_in; 792 ushort *out = (ushort*)_out; 793 unsigned i, j; 794 (void)j; 795 for (i = start, j = 0; j < out_nr; j+=2, i++) { 796 (out+j)[0] = (ushort)in[i]; 797 (out+j)[1] = (ushort)in[(i+1)%(out_nr/2)]; 798 } 799} 800static void translate_trisadj_ushort2ushort( 801 const void * _in, 802 unsigned start, 803 unsigned in_nr, 804 unsigned out_nr, 805 unsigned restart_index, 806 void *_out ) 807{ 808 const ushort*in = (const ushort*)_in; 809 ushort *out = (ushort*)_out; 810 unsigned i, j; 811 (void)j; 812 for (i = start, j = 0; j < out_nr; j+=6, i+=6) { 813 (out+j)[0] = (ushort)in[i]; 814 (out+j)[1] = (ushort)in[i+2]; 815 (out+j+2)[0] = (ushort)in[i+2]; 816 (out+j+2)[1] = (ushort)in[i+4]; 817 (out+j+4)[0] = (ushort)in[i+4]; 818 (out+j+4)[1] = (ushort)in[i]; 819 } 820} 821static void translate_tristripadj_ushort2ushort( 822 const void * _in, 823 unsigned start, 824 unsigned in_nr, 825 unsigned out_nr, 826 unsigned restart_index, 827 void *_out ) 828{ 829 const ushort*in = (const ushort*)_in; 830 ushort *out = (ushort*)_out; 831 unsigned i, j; 832 (void)j; 833 for (i = start, j = 0; j < out_nr; j+=6, i+=2) { 834 (out+j)[0] = (ushort)in[i]; 835 (out+j)[1] = (ushort)in[i+2]; 836 (out+j+2)[0] = (ushort)in[i+2]; 837 (out+j+2)[1] = (ushort)in[i+4]; 838 (out+j+4)[0] = (ushort)in[i+4]; 839 (out+j+4)[1] = (ushort)in[i]; 840 } 841} 842static void translate_tris_ushort2uint( 843 const void * _in, 844 unsigned start, 845 unsigned in_nr, 846 unsigned out_nr, 847 unsigned restart_index, 848 void *_out ) 849{ 850 const ushort*in = (const ushort*)_in; 851 uint *out = (uint*)_out; 852 unsigned i, j; 853 (void)j; 854 for (i = start, j = 0; j < out_nr; j+=6, i+=3) { 855 (out+j)[0] = (uint)in[i]; 856 (out+j)[1] = (uint)in[i+1]; 857 (out+j+2)[0] = (uint)in[i+1]; 858 (out+j+2)[1] = (uint)in[i+2]; 859 (out+j+4)[0] = (uint)in[i+2]; 860 (out+j+4)[1] = (uint)in[i]; 861 } 862} 863static void translate_tristrip_ushort2uint( 864 const void * _in, 865 unsigned start, 866 unsigned in_nr, 867 unsigned out_nr, 868 unsigned restart_index, 869 void *_out ) 870{ 871 const ushort*in = (const ushort*)_in; 872 uint *out = (uint*)_out; 873 unsigned i, j; 874 (void)j; 875 for (i = start, j = 0; j < out_nr; j+=6, i++) { 876 (out+j)[0] = (uint)in[i]; 877 (out+j)[1] = (uint)in[i+1/*+(i&1)*/]; 878 (out+j+2)[0] = (uint)in[i+1/*+(i&1)*/]; 879 (out+j+2)[1] = (uint)in[i+2/*-(i&1)*/]; 880 (out+j+4)[0] = (uint)in[i+2/*-(i&1)*/]; 881 (out+j+4)[1] = (uint)in[i]; 882 } 883} 884static void translate_trifan_ushort2uint( 885 const void * _in, 886 unsigned start, 887 unsigned in_nr, 888 unsigned out_nr, 889 unsigned restart_index, 890 void *_out ) 891{ 892 const ushort*in = (const ushort*)_in; 893 uint *out = (uint*)_out; 894 unsigned i, j; 895 (void)j; 896 for (i = start, j = 0; j < out_nr; j+=6, i++) { 897 (out+j)[0] = (uint)in[0]; 898 (out+j)[1] = (uint)in[i+1]; 899 (out+j+2)[0] = (uint)in[i+1]; 900 (out+j+2)[1] = (uint)in[i+2]; 901 (out+j+4)[0] = (uint)in[i+2]; 902 (out+j+4)[1] = (uint)in[0]; 903 } 904} 905static void translate_quads_ushort2uint( 906 const void * _in, 907 unsigned start, 908 unsigned in_nr, 909 unsigned out_nr, 910 unsigned restart_index, 911 void *_out ) 912{ 913 const ushort*in = (const ushort*)_in; 914 uint *out = (uint*)_out; 915 unsigned i, j; 916 (void)j; 917 for (i = start, j = 0; j < out_nr; j+=8, i+=4) { 918 (out+j)[0] = (uint)in[i+0]; 919 (out+j)[1] = (uint)in[i+1]; 920 (out+j+2)[0] = (uint)in[i+1]; 921 (out+j+2)[1] = (uint)in[i+2]; 922 (out+j+4)[0] = (uint)in[i+2]; 923 (out+j+4)[1] = (uint)in[i+3]; 924 (out+j+6)[0] = (uint)in[i+3]; 925 (out+j+6)[1] = (uint)in[i+0]; 926 } 927} 928static void translate_quadstrip_ushort2uint( 929 const void * _in, 930 unsigned start, 931 unsigned in_nr, 932 unsigned out_nr, 933 unsigned restart_index, 934 void *_out ) 935{ 936 const ushort*in = (const ushort*)_in; 937 uint *out = (uint*)_out; 938 unsigned i, j; 939 (void)j; 940 for (i = start, j = 0; j < out_nr; j+=8, i+=2) { 941 (out+j)[0] = (uint)in[i+2]; 942 (out+j)[1] = (uint)in[i+0]; 943 (out+j+2)[0] = (uint)in[i+0]; 944 (out+j+2)[1] = (uint)in[i+1]; 945 (out+j+4)[0] = (uint)in[i+1]; 946 (out+j+4)[1] = (uint)in[i+3]; 947 (out+j+6)[0] = (uint)in[i+3]; 948 (out+j+6)[1] = (uint)in[i+2]; 949 } 950} 951static void translate_polygon_ushort2uint( 952 const void * _in, 953 unsigned start, 954 unsigned in_nr, 955 unsigned out_nr, 956 unsigned restart_index, 957 void *_out ) 958{ 959 const ushort*in = (const ushort*)_in; 960 uint *out = (uint*)_out; 961 unsigned i, j; 962 (void)j; 963 for (i = start, j = 0; j < out_nr; j+=2, i++) { 964 (out+j)[0] = (uint)in[i]; 965 (out+j)[1] = (uint)in[(i+1)%(out_nr/2)]; 966 } 967} 968static void translate_trisadj_ushort2uint( 969 const void * _in, 970 unsigned start, 971 unsigned in_nr, 972 unsigned out_nr, 973 unsigned restart_index, 974 void *_out ) 975{ 976 const ushort*in = (const ushort*)_in; 977 uint *out = (uint*)_out; 978 unsigned i, j; 979 (void)j; 980 for (i = start, j = 0; j < out_nr; j+=6, i+=6) { 981 (out+j)[0] = (uint)in[i]; 982 (out+j)[1] = (uint)in[i+2]; 983 (out+j+2)[0] = (uint)in[i+2]; 984 (out+j+2)[1] = (uint)in[i+4]; 985 (out+j+4)[0] = (uint)in[i+4]; 986 (out+j+4)[1] = (uint)in[i]; 987 } 988} 989static void translate_tristripadj_ushort2uint( 990 const void * _in, 991 unsigned start, 992 unsigned in_nr, 993 unsigned out_nr, 994 unsigned restart_index, 995 void *_out ) 996{ 997 const ushort*in = (const ushort*)_in; 998 uint *out = (uint*)_out; 999 unsigned i, j; 1000 (void)j; 1001 for (i = start, j = 0; j < out_nr; j+=6, i+=2) { 1002 (out+j)[0] = (uint)in[i]; 1003 (out+j)[1] = (uint)in[i+2]; 1004 (out+j+2)[0] = (uint)in[i+2]; 1005 (out+j+2)[1] = (uint)in[i+4]; 1006 (out+j+4)[0] = (uint)in[i+4]; 1007 (out+j+4)[1] = (uint)in[i]; 1008 } 1009} 1010static void translate_tris_uint2ushort( 1011 const void * _in, 1012 unsigned start, 1013 unsigned in_nr, 1014 unsigned out_nr, 1015 unsigned restart_index, 1016 void *_out ) 1017{ 1018 const uint*in = (const uint*)_in; 1019 ushort *out = (ushort*)_out; 1020 unsigned i, j; 1021 (void)j; 1022 for (i = start, j = 0; j < out_nr; j+=6, i+=3) { 1023 (out+j)[0] = (ushort)in[i]; 1024 (out+j)[1] = (ushort)in[i+1]; 1025 (out+j+2)[0] = (ushort)in[i+1]; 1026 (out+j+2)[1] = (ushort)in[i+2]; 1027 (out+j+4)[0] = (ushort)in[i+2]; 1028 (out+j+4)[1] = (ushort)in[i]; 1029 } 1030} 1031static void translate_tristrip_uint2ushort( 1032 const void * _in, 1033 unsigned start, 1034 unsigned in_nr, 1035 unsigned out_nr, 1036 unsigned restart_index, 1037 void *_out ) 1038{ 1039 const uint*in = (const uint*)_in; 1040 ushort *out = (ushort*)_out; 1041 unsigned i, j; 1042 (void)j; 1043 for (i = start, j = 0; j < out_nr; j+=6, i++) { 1044 (out+j)[0] = (ushort)in[i]; 1045 (out+j)[1] = (ushort)in[i+1/*+(i&1)*/]; 1046 (out+j+2)[0] = (ushort)in[i+1/*+(i&1)*/]; 1047 (out+j+2)[1] = (ushort)in[i+2/*-(i&1)*/]; 1048 (out+j+4)[0] = (ushort)in[i+2/*-(i&1)*/]; 1049 (out+j+4)[1] = (ushort)in[i]; 1050 } 1051} 1052static void translate_trifan_uint2ushort( 1053 const void * _in, 1054 unsigned start, 1055 unsigned in_nr, 1056 unsigned out_nr, 1057 unsigned restart_index, 1058 void *_out ) 1059{ 1060 const uint*in = (const uint*)_in; 1061 ushort *out = (ushort*)_out; 1062 unsigned i, j; 1063 (void)j; 1064 for (i = start, j = 0; j < out_nr; j+=6, i++) { 1065 (out+j)[0] = (ushort)in[0]; 1066 (out+j)[1] = (ushort)in[i+1]; 1067 (out+j+2)[0] = (ushort)in[i+1]; 1068 (out+j+2)[1] = (ushort)in[i+2]; 1069 (out+j+4)[0] = (ushort)in[i+2]; 1070 (out+j+4)[1] = (ushort)in[0]; 1071 } 1072} 1073static void translate_quads_uint2ushort( 1074 const void * _in, 1075 unsigned start, 1076 unsigned in_nr, 1077 unsigned out_nr, 1078 unsigned restart_index, 1079 void *_out ) 1080{ 1081 const uint*in = (const uint*)_in; 1082 ushort *out = (ushort*)_out; 1083 unsigned i, j; 1084 (void)j; 1085 for (i = start, j = 0; j < out_nr; j+=8, i+=4) { 1086 (out+j)[0] = (ushort)in[i+0]; 1087 (out+j)[1] = (ushort)in[i+1]; 1088 (out+j+2)[0] = (ushort)in[i+1]; 1089 (out+j+2)[1] = (ushort)in[i+2]; 1090 (out+j+4)[0] = (ushort)in[i+2]; 1091 (out+j+4)[1] = (ushort)in[i+3]; 1092 (out+j+6)[0] = (ushort)in[i+3]; 1093 (out+j+6)[1] = (ushort)in[i+0]; 1094 } 1095} 1096static void translate_quadstrip_uint2ushort( 1097 const void * _in, 1098 unsigned start, 1099 unsigned in_nr, 1100 unsigned out_nr, 1101 unsigned restart_index, 1102 void *_out ) 1103{ 1104 const uint*in = (const uint*)_in; 1105 ushort *out = (ushort*)_out; 1106 unsigned i, j; 1107 (void)j; 1108 for (i = start, j = 0; j < out_nr; j+=8, i+=2) { 1109 (out+j)[0] = (ushort)in[i+2]; 1110 (out+j)[1] = (ushort)in[i+0]; 1111 (out+j+2)[0] = (ushort)in[i+0]; 1112 (out+j+2)[1] = (ushort)in[i+1]; 1113 (out+j+4)[0] = (ushort)in[i+1]; 1114 (out+j+4)[1] = (ushort)in[i+3]; 1115 (out+j+6)[0] = (ushort)in[i+3]; 1116 (out+j+6)[1] = (ushort)in[i+2]; 1117 } 1118} 1119static void translate_polygon_uint2ushort( 1120 const void * _in, 1121 unsigned start, 1122 unsigned in_nr, 1123 unsigned out_nr, 1124 unsigned restart_index, 1125 void *_out ) 1126{ 1127 const uint*in = (const uint*)_in; 1128 ushort *out = (ushort*)_out; 1129 unsigned i, j; 1130 (void)j; 1131 for (i = start, j = 0; j < out_nr; j+=2, i++) { 1132 (out+j)[0] = (ushort)in[i]; 1133 (out+j)[1] = (ushort)in[(i+1)%(out_nr/2)]; 1134 } 1135} 1136static void translate_trisadj_uint2ushort( 1137 const void * _in, 1138 unsigned start, 1139 unsigned in_nr, 1140 unsigned out_nr, 1141 unsigned restart_index, 1142 void *_out ) 1143{ 1144 const uint*in = (const uint*)_in; 1145 ushort *out = (ushort*)_out; 1146 unsigned i, j; 1147 (void)j; 1148 for (i = start, j = 0; j < out_nr; j+=6, i+=6) { 1149 (out+j)[0] = (ushort)in[i]; 1150 (out+j)[1] = (ushort)in[i+2]; 1151 (out+j+2)[0] = (ushort)in[i+2]; 1152 (out+j+2)[1] = (ushort)in[i+4]; 1153 (out+j+4)[0] = (ushort)in[i+4]; 1154 (out+j+4)[1] = (ushort)in[i]; 1155 } 1156} 1157static void translate_tristripadj_uint2ushort( 1158 const void * _in, 1159 unsigned start, 1160 unsigned in_nr, 1161 unsigned out_nr, 1162 unsigned restart_index, 1163 void *_out ) 1164{ 1165 const uint*in = (const uint*)_in; 1166 ushort *out = (ushort*)_out; 1167 unsigned i, j; 1168 (void)j; 1169 for (i = start, j = 0; j < out_nr; j+=6, i+=2) { 1170 (out+j)[0] = (ushort)in[i]; 1171 (out+j)[1] = (ushort)in[i+2]; 1172 (out+j+2)[0] = (ushort)in[i+2]; 1173 (out+j+2)[1] = (ushort)in[i+4]; 1174 (out+j+4)[0] = (ushort)in[i+4]; 1175 (out+j+4)[1] = (ushort)in[i]; 1176 } 1177} 1178static void translate_tris_uint2uint( 1179 const void * _in, 1180 unsigned start, 1181 unsigned in_nr, 1182 unsigned out_nr, 1183 unsigned restart_index, 1184 void *_out ) 1185{ 1186 const uint*in = (const uint*)_in; 1187 uint *out = (uint*)_out; 1188 unsigned i, j; 1189 (void)j; 1190 for (i = start, j = 0; j < out_nr; j+=6, i+=3) { 1191 (out+j)[0] = (uint)in[i]; 1192 (out+j)[1] = (uint)in[i+1]; 1193 (out+j+2)[0] = (uint)in[i+1]; 1194 (out+j+2)[1] = (uint)in[i+2]; 1195 (out+j+4)[0] = (uint)in[i+2]; 1196 (out+j+4)[1] = (uint)in[i]; 1197 } 1198} 1199static void translate_tristrip_uint2uint( 1200 const void * _in, 1201 unsigned start, 1202 unsigned in_nr, 1203 unsigned out_nr, 1204 unsigned restart_index, 1205 void *_out ) 1206{ 1207 const uint*in = (const uint*)_in; 1208 uint *out = (uint*)_out; 1209 unsigned i, j; 1210 (void)j; 1211 for (i = start, j = 0; j < out_nr; j+=6, i++) { 1212 (out+j)[0] = (uint)in[i]; 1213 (out+j)[1] = (uint)in[i+1/*+(i&1)*/]; 1214 (out+j+2)[0] = (uint)in[i+1/*+(i&1)*/]; 1215 (out+j+2)[1] = (uint)in[i+2/*-(i&1)*/]; 1216 (out+j+4)[0] = (uint)in[i+2/*-(i&1)*/]; 1217 (out+j+4)[1] = (uint)in[i]; 1218 } 1219} 1220static void translate_trifan_uint2uint( 1221 const void * _in, 1222 unsigned start, 1223 unsigned in_nr, 1224 unsigned out_nr, 1225 unsigned restart_index, 1226 void *_out ) 1227{ 1228 const uint*in = (const uint*)_in; 1229 uint *out = (uint*)_out; 1230 unsigned i, j; 1231 (void)j; 1232 for (i = start, j = 0; j < out_nr; j+=6, i++) { 1233 (out+j)[0] = (uint)in[0]; 1234 (out+j)[1] = (uint)in[i+1]; 1235 (out+j+2)[0] = (uint)in[i+1]; 1236 (out+j+2)[1] = (uint)in[i+2]; 1237 (out+j+4)[0] = (uint)in[i+2]; 1238 (out+j+4)[1] = (uint)in[0]; 1239 } 1240} 1241static void translate_quads_uint2uint( 1242 const void * _in, 1243 unsigned start, 1244 unsigned in_nr, 1245 unsigned out_nr, 1246 unsigned restart_index, 1247 void *_out ) 1248{ 1249 const uint*in = (const uint*)_in; 1250 uint *out = (uint*)_out; 1251 unsigned i, j; 1252 (void)j; 1253 for (i = start, j = 0; j < out_nr; j+=8, i+=4) { 1254 (out+j)[0] = (uint)in[i+0]; 1255 (out+j)[1] = (uint)in[i+1]; 1256 (out+j+2)[0] = (uint)in[i+1]; 1257 (out+j+2)[1] = (uint)in[i+2]; 1258 (out+j+4)[0] = (uint)in[i+2]; 1259 (out+j+4)[1] = (uint)in[i+3]; 1260 (out+j+6)[0] = (uint)in[i+3]; 1261 (out+j+6)[1] = (uint)in[i+0]; 1262 } 1263} 1264static void translate_quadstrip_uint2uint( 1265 const void * _in, 1266 unsigned start, 1267 unsigned in_nr, 1268 unsigned out_nr, 1269 unsigned restart_index, 1270 void *_out ) 1271{ 1272 const uint*in = (const uint*)_in; 1273 uint *out = (uint*)_out; 1274 unsigned i, j; 1275 (void)j; 1276 for (i = start, j = 0; j < out_nr; j+=8, i+=2) { 1277 (out+j)[0] = (uint)in[i+2]; 1278 (out+j)[1] = (uint)in[i+0]; 1279 (out+j+2)[0] = (uint)in[i+0]; 1280 (out+j+2)[1] = (uint)in[i+1]; 1281 (out+j+4)[0] = (uint)in[i+1]; 1282 (out+j+4)[1] = (uint)in[i+3]; 1283 (out+j+6)[0] = (uint)in[i+3]; 1284 (out+j+6)[1] = (uint)in[i+2]; 1285 } 1286} 1287static void translate_polygon_uint2uint( 1288 const void * _in, 1289 unsigned start, 1290 unsigned in_nr, 1291 unsigned out_nr, 1292 unsigned restart_index, 1293 void *_out ) 1294{ 1295 const uint*in = (const uint*)_in; 1296 uint *out = (uint*)_out; 1297 unsigned i, j; 1298 (void)j; 1299 for (i = start, j = 0; j < out_nr; j+=2, i++) { 1300 (out+j)[0] = (uint)in[i]; 1301 (out+j)[1] = (uint)in[(i+1)%(out_nr/2)]; 1302 } 1303} 1304static void translate_trisadj_uint2uint( 1305 const void * _in, 1306 unsigned start, 1307 unsigned in_nr, 1308 unsigned out_nr, 1309 unsigned restart_index, 1310 void *_out ) 1311{ 1312 const uint*in = (const uint*)_in; 1313 uint *out = (uint*)_out; 1314 unsigned i, j; 1315 (void)j; 1316 for (i = start, j = 0; j < out_nr; j+=6, i+=6) { 1317 (out+j)[0] = (uint)in[i]; 1318 (out+j)[1] = (uint)in[i+2]; 1319 (out+j+2)[0] = (uint)in[i+2]; 1320 (out+j+2)[1] = (uint)in[i+4]; 1321 (out+j+4)[0] = (uint)in[i+4]; 1322 (out+j+4)[1] = (uint)in[i]; 1323 } 1324} 1325static void translate_tristripadj_uint2uint( 1326 const void * _in, 1327 unsigned start, 1328 unsigned in_nr, 1329 unsigned out_nr, 1330 unsigned restart_index, 1331 void *_out ) 1332{ 1333 const uint*in = (const uint*)_in; 1334 uint *out = (uint*)_out; 1335 unsigned i, j; 1336 (void)j; 1337 for (i = start, j = 0; j < out_nr; j+=6, i+=2) { 1338 (out+j)[0] = (uint)in[i]; 1339 (out+j)[1] = (uint)in[i+2]; 1340 (out+j+2)[0] = (uint)in[i+2]; 1341 (out+j+2)[1] = (uint)in[i+4]; 1342 (out+j+4)[0] = (uint)in[i+4]; 1343 (out+j+4)[1] = (uint)in[i]; 1344 } 1345} 1346void u_unfilled_init( void ) 1347{ 1348 static int firsttime = 1; 1349 if (!firsttime) return; 1350 firsttime = 0; 1351generate_line[OUT_USHORT][PIPE_PRIM_TRIANGLES] = generate_tris_ushort; 1352generate_line[OUT_USHORT][PIPE_PRIM_TRIANGLE_FAN] = generate_trifan_ushort; 1353generate_line[OUT_USHORT][PIPE_PRIM_TRIANGLE_STRIP] = generate_tristrip_ushort; 1354generate_line[OUT_USHORT][PIPE_PRIM_QUADS] = generate_quads_ushort; 1355generate_line[OUT_USHORT][PIPE_PRIM_QUAD_STRIP] = generate_quadstrip_ushort; 1356generate_line[OUT_USHORT][PIPE_PRIM_POLYGON] = generate_polygon_ushort; 1357generate_line[OUT_USHORT][PIPE_PRIM_TRIANGLES_ADJACENCY] = generate_trisadj_ushort; 1358generate_line[OUT_USHORT][PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY] = generate_tristripadj_ushort; 1359generate_line[OUT_UINT][PIPE_PRIM_TRIANGLES] = generate_tris_uint; 1360generate_line[OUT_UINT][PIPE_PRIM_TRIANGLE_FAN] = generate_trifan_uint; 1361generate_line[OUT_UINT][PIPE_PRIM_TRIANGLE_STRIP] = generate_tristrip_uint; 1362generate_line[OUT_UINT][PIPE_PRIM_QUADS] = generate_quads_uint; 1363generate_line[OUT_UINT][PIPE_PRIM_QUAD_STRIP] = generate_quadstrip_uint; 1364generate_line[OUT_UINT][PIPE_PRIM_POLYGON] = generate_polygon_uint; 1365generate_line[OUT_UINT][PIPE_PRIM_TRIANGLES_ADJACENCY] = generate_trisadj_uint; 1366generate_line[OUT_UINT][PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY] = generate_tristripadj_uint; 1367translate_line[IN_UBYTE][OUT_USHORT][PIPE_PRIM_TRIANGLES] = translate_tris_ubyte2ushort; 1368translate_line[IN_UBYTE][OUT_USHORT][PIPE_PRIM_TRIANGLE_FAN] = translate_trifan_ubyte2ushort; 1369translate_line[IN_UBYTE][OUT_USHORT][PIPE_PRIM_TRIANGLE_STRIP] = translate_tristrip_ubyte2ushort; 1370translate_line[IN_UBYTE][OUT_USHORT][PIPE_PRIM_QUADS] = translate_quads_ubyte2ushort; 1371translate_line[IN_UBYTE][OUT_USHORT][PIPE_PRIM_QUAD_STRIP] = translate_quadstrip_ubyte2ushort; 1372translate_line[IN_UBYTE][OUT_USHORT][PIPE_PRIM_POLYGON] = translate_polygon_ubyte2ushort; 1373translate_line[IN_UBYTE][OUT_USHORT][PIPE_PRIM_TRIANGLES_ADJACENCY] = translate_trisadj_ubyte2ushort; 1374translate_line[IN_UBYTE][OUT_USHORT][PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY] = translate_tristripadj_ubyte2ushort; 1375translate_line[IN_UBYTE][OUT_UINT][PIPE_PRIM_TRIANGLES] = translate_tris_ubyte2uint; 1376translate_line[IN_UBYTE][OUT_UINT][PIPE_PRIM_TRIANGLE_FAN] = translate_trifan_ubyte2uint; 1377translate_line[IN_UBYTE][OUT_UINT][PIPE_PRIM_TRIANGLE_STRIP] = translate_tristrip_ubyte2uint; 1378translate_line[IN_UBYTE][OUT_UINT][PIPE_PRIM_QUADS] = translate_quads_ubyte2uint; 1379translate_line[IN_UBYTE][OUT_UINT][PIPE_PRIM_QUAD_STRIP] = translate_quadstrip_ubyte2uint; 1380translate_line[IN_UBYTE][OUT_UINT][PIPE_PRIM_POLYGON] = translate_polygon_ubyte2uint; 1381translate_line[IN_UBYTE][OUT_UINT][PIPE_PRIM_TRIANGLES_ADJACENCY] = translate_trisadj_ubyte2uint; 1382translate_line[IN_UBYTE][OUT_UINT][PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY] = translate_tristripadj_ubyte2uint; 1383translate_line[IN_USHORT][OUT_USHORT][PIPE_PRIM_TRIANGLES] = translate_tris_ushort2ushort; 1384translate_line[IN_USHORT][OUT_USHORT][PIPE_PRIM_TRIANGLE_FAN] = translate_trifan_ushort2ushort; 1385translate_line[IN_USHORT][OUT_USHORT][PIPE_PRIM_TRIANGLE_STRIP] = translate_tristrip_ushort2ushort; 1386translate_line[IN_USHORT][OUT_USHORT][PIPE_PRIM_QUADS] = translate_quads_ushort2ushort; 1387translate_line[IN_USHORT][OUT_USHORT][PIPE_PRIM_QUAD_STRIP] = translate_quadstrip_ushort2ushort; 1388translate_line[IN_USHORT][OUT_USHORT][PIPE_PRIM_POLYGON] = translate_polygon_ushort2ushort; 1389translate_line[IN_USHORT][OUT_USHORT][PIPE_PRIM_TRIANGLES_ADJACENCY] = translate_trisadj_ushort2ushort; 1390translate_line[IN_USHORT][OUT_USHORT][PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY] = translate_tristripadj_ushort2ushort; 1391translate_line[IN_USHORT][OUT_UINT][PIPE_PRIM_TRIANGLES] = translate_tris_ushort2uint; 1392translate_line[IN_USHORT][OUT_UINT][PIPE_PRIM_TRIANGLE_FAN] = translate_trifan_ushort2uint; 1393translate_line[IN_USHORT][OUT_UINT][PIPE_PRIM_TRIANGLE_STRIP] = translate_tristrip_ushort2uint; 1394translate_line[IN_USHORT][OUT_UINT][PIPE_PRIM_QUADS] = translate_quads_ushort2uint; 1395translate_line[IN_USHORT][OUT_UINT][PIPE_PRIM_QUAD_STRIP] = translate_quadstrip_ushort2uint; 1396translate_line[IN_USHORT][OUT_UINT][PIPE_PRIM_POLYGON] = translate_polygon_ushort2uint; 1397translate_line[IN_USHORT][OUT_UINT][PIPE_PRIM_TRIANGLES_ADJACENCY] = translate_trisadj_ushort2uint; 1398translate_line[IN_USHORT][OUT_UINT][PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY] = translate_tristripadj_ushort2uint; 1399translate_line[IN_UINT][OUT_USHORT][PIPE_PRIM_TRIANGLES] = translate_tris_uint2ushort; 1400translate_line[IN_UINT][OUT_USHORT][PIPE_PRIM_TRIANGLE_FAN] = translate_trifan_uint2ushort; 1401translate_line[IN_UINT][OUT_USHORT][PIPE_PRIM_TRIANGLE_STRIP] = translate_tristrip_uint2ushort; 1402translate_line[IN_UINT][OUT_USHORT][PIPE_PRIM_QUADS] = translate_quads_uint2ushort; 1403translate_line[IN_UINT][OUT_USHORT][PIPE_PRIM_QUAD_STRIP] = translate_quadstrip_uint2ushort; 1404translate_line[IN_UINT][OUT_USHORT][PIPE_PRIM_POLYGON] = translate_polygon_uint2ushort; 1405translate_line[IN_UINT][OUT_USHORT][PIPE_PRIM_TRIANGLES_ADJACENCY] = translate_trisadj_uint2ushort; 1406translate_line[IN_UINT][OUT_USHORT][PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY] = translate_tristripadj_uint2ushort; 1407translate_line[IN_UINT][OUT_UINT][PIPE_PRIM_TRIANGLES] = translate_tris_uint2uint; 1408translate_line[IN_UINT][OUT_UINT][PIPE_PRIM_TRIANGLE_FAN] = translate_trifan_uint2uint; 1409translate_line[IN_UINT][OUT_UINT][PIPE_PRIM_TRIANGLE_STRIP] = translate_tristrip_uint2uint; 1410translate_line[IN_UINT][OUT_UINT][PIPE_PRIM_QUADS] = translate_quads_uint2uint; 1411translate_line[IN_UINT][OUT_UINT][PIPE_PRIM_QUAD_STRIP] = translate_quadstrip_uint2uint; 1412translate_line[IN_UINT][OUT_UINT][PIPE_PRIM_POLYGON] = translate_polygon_uint2uint; 1413translate_line[IN_UINT][OUT_UINT][PIPE_PRIM_TRIANGLES_ADJACENCY] = translate_trisadj_uint2uint; 1414translate_line[IN_UINT][OUT_UINT][PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY] = translate_tristripadj_uint2uint; 1415} 1416#include "indices/u_unfilled_indices.c" 1417