1848b8605Smrg 2848b8605Smrg/* 3848b8605Smrg * Mesa 3-D graphics library 4848b8605Smrg * 5848b8605Smrg * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. 6848b8605Smrg * 7848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a 8848b8605Smrg * copy of this software and associated documentation files (the "Software"), 9848b8605Smrg * to deal in the Software without restriction, including without limitation 10848b8605Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11848b8605Smrg * and/or sell copies of the Software, and to permit persons to whom the 12848b8605Smrg * Software is furnished to do so, subject to the following conditions: 13848b8605Smrg * 14848b8605Smrg * The above copyright notice and this permission notice shall be included 15848b8605Smrg * in all copies or substantial portions of the Software. 16848b8605Smrg * 17848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18848b8605Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19848b8605Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20848b8605Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 21848b8605Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 22848b8605Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23848b8605Smrg * OTHER DEALINGS IN THE SOFTWARE. 24848b8605Smrg */ 25848b8605Smrg 26848b8605Smrg/* 27848b8605Smrg * New (3.1) transformation code written by Keith Whitwell. 28848b8605Smrg */ 29848b8605Smrg 30848b8605Smrg 31848b8605Smrg#define COPY_FUNC( BITS ) \ 32848b8605Smrgstatic void TAG2(copy, BITS)( GLvector4f *to, const GLvector4f *f ) \ 33848b8605Smrg{ \ 34848b8605Smrg GLfloat (*t)[4] = (GLfloat (*)[4])to->start; \ 35848b8605Smrg GLfloat *from = f->start; \ 36848b8605Smrg GLuint stride = f->stride; \ 37848b8605Smrg GLuint count = to->count; \ 38848b8605Smrg GLuint i; \ 39848b8605Smrg \ 40848b8605Smrg if (BITS) \ 41848b8605Smrg STRIDE_LOOP { \ 42848b8605Smrg if (BITS&1) t[i][0] = from[0]; \ 43848b8605Smrg if (BITS&2) t[i][1] = from[1]; \ 44848b8605Smrg if (BITS&4) t[i][2] = from[2]; \ 45848b8605Smrg if (BITS&8) t[i][3] = from[3]; \ 46848b8605Smrg } \ 47848b8605Smrg} 48848b8605Smrg 49848b8605Smrg/* We got them all here: 50848b8605Smrg */ 51848b8605SmrgCOPY_FUNC( 0x0 ) /* noop */ 52848b8605SmrgCOPY_FUNC( 0x1 ) 53848b8605SmrgCOPY_FUNC( 0x2 ) 54848b8605SmrgCOPY_FUNC( 0x3 ) 55848b8605SmrgCOPY_FUNC( 0x4 ) 56848b8605SmrgCOPY_FUNC( 0x5 ) 57848b8605SmrgCOPY_FUNC( 0x6 ) 58848b8605SmrgCOPY_FUNC( 0x7 ) 59848b8605SmrgCOPY_FUNC( 0x8 ) 60848b8605SmrgCOPY_FUNC( 0x9 ) 61848b8605SmrgCOPY_FUNC( 0xa ) 62848b8605SmrgCOPY_FUNC( 0xb ) 63848b8605SmrgCOPY_FUNC( 0xc ) 64848b8605SmrgCOPY_FUNC( 0xd ) 65848b8605SmrgCOPY_FUNC( 0xe ) 66848b8605SmrgCOPY_FUNC( 0xf ) 67848b8605Smrg 68848b8605Smrgstatic void TAG2(init_copy, 0)( void ) 69848b8605Smrg{ 70848b8605Smrg _mesa_copy_tab[0x0] = TAG2(copy, 0x0); 71848b8605Smrg _mesa_copy_tab[0x1] = TAG2(copy, 0x1); 72848b8605Smrg _mesa_copy_tab[0x2] = TAG2(copy, 0x2); 73848b8605Smrg _mesa_copy_tab[0x3] = TAG2(copy, 0x3); 74848b8605Smrg _mesa_copy_tab[0x4] = TAG2(copy, 0x4); 75848b8605Smrg _mesa_copy_tab[0x5] = TAG2(copy, 0x5); 76848b8605Smrg _mesa_copy_tab[0x6] = TAG2(copy, 0x6); 77848b8605Smrg _mesa_copy_tab[0x7] = TAG2(copy, 0x7); 78848b8605Smrg _mesa_copy_tab[0x8] = TAG2(copy, 0x8); 79848b8605Smrg _mesa_copy_tab[0x9] = TAG2(copy, 0x9); 80848b8605Smrg _mesa_copy_tab[0xa] = TAG2(copy, 0xa); 81848b8605Smrg _mesa_copy_tab[0xb] = TAG2(copy, 0xb); 82848b8605Smrg _mesa_copy_tab[0xc] = TAG2(copy, 0xc); 83848b8605Smrg _mesa_copy_tab[0xd] = TAG2(copy, 0xd); 84848b8605Smrg _mesa_copy_tab[0xe] = TAG2(copy, 0xe); 85848b8605Smrg _mesa_copy_tab[0xf] = TAG2(copy, 0xf); 86848b8605Smrg} 87