123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell 223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell/* 323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * Mesa 3-D graphics library 422144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes * Version: 3.5 523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * 622144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. 723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * 823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * Permission is hereby granted, free of charge, to any person obtaining a 923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * copy of this software and associated documentation files (the "Software"), 1023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * to deal in the Software without restriction, including without limitation 1123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * the rights to use, copy, modify, merge, publish, distribute, sublicense, 1223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * and/or sell copies of the Software, and to permit persons to whom the 1323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * Software is furnished to do so, subject to the following conditions: 1423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * 1523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * The above copyright notice and this permission notice shall be included 1623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * in all copies or substantial portions of the Software. 1723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * 1823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 1923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 2123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 2223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 2323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 2423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell */ 2523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell 2623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell/* 2723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * New (3.1) transformation code written by Keith Whitwell. 2823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell */ 2923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell 3023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell 3123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell#define COPY_FUNC( BITS ) \ 325e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughesstatic void TAG2(copy, BITS)( GLvector4f *to, const GLvector4f *f ) \ 3323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{ \ 3423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell GLfloat (*t)[4] = (GLfloat (*)[4])to->start; \ 3523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell GLfloat *from = f->start; \ 3623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell GLuint stride = f->stride; \ 375911d8731564e6bdadcb011b949dd6cde5b46f64Keith Whitwell GLuint count = to->count; \ 3823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell GLuint i; \ 3923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell \ 4023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell if (BITS) \ 4123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell STRIDE_LOOP { \ 425e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes if (BITS&1) t[i][0] = from[0]; \ 435e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes if (BITS&2) t[i][1] = from[1]; \ 445e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes if (BITS&4) t[i][2] = from[2]; \ 455e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes if (BITS&8) t[i][3] = from[3]; \ 4623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell } \ 4723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell} 4823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell 4923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell/* We got them all here: 5023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell */ 5123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellCOPY_FUNC( 0x0 ) /* noop */ 5223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellCOPY_FUNC( 0x1 ) 5323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellCOPY_FUNC( 0x2 ) 5423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellCOPY_FUNC( 0x3 ) 5523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellCOPY_FUNC( 0x4 ) 5623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellCOPY_FUNC( 0x5 ) 5723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellCOPY_FUNC( 0x6 ) 5823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellCOPY_FUNC( 0x7 ) 5923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellCOPY_FUNC( 0x8 ) 6023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellCOPY_FUNC( 0x9 ) 6123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellCOPY_FUNC( 0xa ) 6223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellCOPY_FUNC( 0xb ) 6323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellCOPY_FUNC( 0xc ) 6423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellCOPY_FUNC( 0xd ) 6523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellCOPY_FUNC( 0xe ) 6623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellCOPY_FUNC( 0xf ) 6723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell 685e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughesstatic void TAG2(init_copy, 0)( void ) 6923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{ 705e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes _mesa_copy_tab[0x0] = TAG2(copy, 0x0); 715e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes _mesa_copy_tab[0x1] = TAG2(copy, 0x1); 725e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes _mesa_copy_tab[0x2] = TAG2(copy, 0x2); 735e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes _mesa_copy_tab[0x3] = TAG2(copy, 0x3); 745e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes _mesa_copy_tab[0x4] = TAG2(copy, 0x4); 755e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes _mesa_copy_tab[0x5] = TAG2(copy, 0x5); 765e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes _mesa_copy_tab[0x6] = TAG2(copy, 0x6); 775e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes _mesa_copy_tab[0x7] = TAG2(copy, 0x7); 785e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes _mesa_copy_tab[0x8] = TAG2(copy, 0x8); 795e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes _mesa_copy_tab[0x9] = TAG2(copy, 0x9); 805e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes _mesa_copy_tab[0xa] = TAG2(copy, 0xa); 815e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes _mesa_copy_tab[0xb] = TAG2(copy, 0xb); 825e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes _mesa_copy_tab[0xc] = TAG2(copy, 0xc); 835e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes _mesa_copy_tab[0xd] = TAG2(copy, 0xd); 845e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes _mesa_copy_tab[0xe] = TAG2(copy, 0xe); 855e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes _mesa_copy_tab[0xf] = TAG2(copy, 0xf); 8623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell} 87