Subversion Repositories shark

Rev

Rev 56 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
56 pj 1
/* $Id: m_copy_tmp.h,v 1.1 2003-02-28 11:48:04 pj Exp $ */
2
 
3
/*
4
 * Mesa 3-D graphics library
5
 * Version:  3.5
6
 *
7
 * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
8
 *
9
 * Permission is hereby granted, free of charge, to any person obtaining a
10
 * copy of this software and associated documentation files (the "Software"),
11
 * to deal in the Software without restriction, including without limitation
12
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13
 * and/or sell copies of the Software, and to permit persons to whom the
14
 * Software is furnished to do so, subject to the following conditions:
15
 *
16
 * The above copyright notice and this permission notice shall be included
17
 * in all copies or substantial portions of the Software.
18
 *
19
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
22
 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23
 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
 */
26
 
27
/*
28
 * New (3.1) transformation code written by Keith Whitwell.
29
 */
30
 
31
 
32
#define COPY_FUNC( BITS )                                               \
33
static void TAG2(copy, BITS)( GLvector4f *to, const GLvector4f *f )     \
34
{                                                                       \
35
   GLfloat (*t)[4] = (GLfloat (*)[4])to->start;                         \
36
   GLfloat *from = f->start;                                            \
37
   GLuint stride = f->stride;                                           \
38
   GLuint count = f->count;                                             \
39
   GLuint i;                                                            \
40
                                                                        \
41
   if (BITS)                                                            \
42
      STRIDE_LOOP {                                                     \
43
         if (BITS&1) t[i][0] = from[0];                                 \
44
         if (BITS&2) t[i][1] = from[1];                                 \
45
         if (BITS&4) t[i][2] = from[2];                                 \
46
         if (BITS&8) t[i][3] = from[3];                                 \
47
      }                                                                 \
48
}
49
 
50
/* We got them all here:
51
 */
52
COPY_FUNC( 0x0 )                /* noop */
53
COPY_FUNC( 0x1 )
54
COPY_FUNC( 0x2 )
55
COPY_FUNC( 0x3 )
56
COPY_FUNC( 0x4 )
57
COPY_FUNC( 0x5 )
58
COPY_FUNC( 0x6 )
59
COPY_FUNC( 0x7 )
60
COPY_FUNC( 0x8 )
61
COPY_FUNC( 0x9 )
62
COPY_FUNC( 0xa )
63
COPY_FUNC( 0xb )
64
COPY_FUNC( 0xc )
65
COPY_FUNC( 0xd )
66
COPY_FUNC( 0xe )
67
COPY_FUNC( 0xf )
68
 
69
static void TAG2(init_copy, 0)( void )
70
{
71
   _mesa_copy_tab[0x0] = TAG2(copy, 0x0);
72
   _mesa_copy_tab[0x1] = TAG2(copy, 0x1);
73
   _mesa_copy_tab[0x2] = TAG2(copy, 0x2);
74
   _mesa_copy_tab[0x3] = TAG2(copy, 0x3);
75
   _mesa_copy_tab[0x4] = TAG2(copy, 0x4);
76
   _mesa_copy_tab[0x5] = TAG2(copy, 0x5);
77
   _mesa_copy_tab[0x6] = TAG2(copy, 0x6);
78
   _mesa_copy_tab[0x7] = TAG2(copy, 0x7);
79
   _mesa_copy_tab[0x8] = TAG2(copy, 0x8);
80
   _mesa_copy_tab[0x9] = TAG2(copy, 0x9);
81
   _mesa_copy_tab[0xa] = TAG2(copy, 0xa);
82
   _mesa_copy_tab[0xb] = TAG2(copy, 0xb);
83
   _mesa_copy_tab[0xc] = TAG2(copy, 0xc);
84
   _mesa_copy_tab[0xd] = TAG2(copy, 0xd);
85
   _mesa_copy_tab[0xe] = TAG2(copy, 0xe);
86
   _mesa_copy_tab[0xf] = TAG2(copy, 0xf);
87
}