1 | /* $Id: copy_tmp.h,v 1.1 2000-02-29 00:48:27 sandervl Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Mesa 3-D graphics library
|
---|
5 | * Version: 3.1
|
---|
6 | *
|
---|
7 | * Copyright (C) 1999 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 | const GLubyte mask[] ) \
|
---|
35 | { \
|
---|
36 | GLfloat (*t)[4] = (GLfloat (*)[4])to->start; \
|
---|
37 | GLfloat *from = f->start; \
|
---|
38 | GLuint stride = f->stride; \
|
---|
39 | GLuint count = f->count; \
|
---|
40 | GLuint i; \
|
---|
41 | (void) mask; \
|
---|
42 | \
|
---|
43 | if (BITS) \
|
---|
44 | STRIDE_LOOP { \
|
---|
45 | CULL_CHECK { \
|
---|
46 | if (BITS&1) t[i][0] = from[0]; \
|
---|
47 | if (BITS&2) t[i][1] = from[1]; \
|
---|
48 | if (BITS&4) t[i][2] = from[2]; \
|
---|
49 | if (BITS&8) t[i][3] = from[3]; \
|
---|
50 | } \
|
---|
51 | } \
|
---|
52 | }
|
---|
53 |
|
---|
54 |
|
---|
55 |
|
---|
56 | /* static void TAG2(clean, BITS)(GLvector4f *to ) */
|
---|
57 | /* { */
|
---|
58 | /* GLfloat (*t)[4] = to->data; */
|
---|
59 | /* GLuint i; */
|
---|
60 |
|
---|
61 | /* if (BITS) */
|
---|
62 | /* for (i = 0 ; i < VB_SIZE ; i++) { */
|
---|
63 | /* if (BITS&1) t[i][0] = 0; */
|
---|
64 | /* if (BITS&2) t[i][1] = 0; */
|
---|
65 | /* if (BITS&4) t[i][2] = 0; */
|
---|
66 | /* if (BITS&8) t[i][3] = 1; */
|
---|
67 | /* } */
|
---|
68 | /* to->flags &= ~BITS; */
|
---|
69 | /* } */
|
---|
70 |
|
---|
71 |
|
---|
72 | /* We got them all here:
|
---|
73 | */
|
---|
74 | COPY_FUNC( 0x0 ) /* noop */
|
---|
75 | COPY_FUNC( 0x1 )
|
---|
76 | COPY_FUNC( 0x2 )
|
---|
77 | COPY_FUNC( 0x3 )
|
---|
78 | COPY_FUNC( 0x4 )
|
---|
79 | COPY_FUNC( 0x5 )
|
---|
80 | COPY_FUNC( 0x6 )
|
---|
81 | COPY_FUNC( 0x7 )
|
---|
82 | COPY_FUNC( 0x8 )
|
---|
83 | COPY_FUNC( 0x9 )
|
---|
84 | COPY_FUNC( 0xa )
|
---|
85 | COPY_FUNC( 0xb )
|
---|
86 | COPY_FUNC( 0xc )
|
---|
87 | COPY_FUNC( 0xd )
|
---|
88 | COPY_FUNC( 0xe )
|
---|
89 | COPY_FUNC( 0xf )
|
---|
90 |
|
---|
91 | static void TAG2(init_copy, 0 ) ( void )
|
---|
92 | {
|
---|
93 | gl_copy_tab[IDX][0x0] = TAG2(copy, 0x0);
|
---|
94 | gl_copy_tab[IDX][0x1] = TAG2(copy, 0x1);
|
---|
95 | gl_copy_tab[IDX][0x2] = TAG2(copy, 0x2);
|
---|
96 | gl_copy_tab[IDX][0x3] = TAG2(copy, 0x3);
|
---|
97 | gl_copy_tab[IDX][0x4] = TAG2(copy, 0x4);
|
---|
98 | gl_copy_tab[IDX][0x5] = TAG2(copy, 0x5);
|
---|
99 | gl_copy_tab[IDX][0x6] = TAG2(copy, 0x6);
|
---|
100 | gl_copy_tab[IDX][0x7] = TAG2(copy, 0x7);
|
---|
101 | gl_copy_tab[IDX][0x8] = TAG2(copy, 0x8);
|
---|
102 | gl_copy_tab[IDX][0x9] = TAG2(copy, 0x9);
|
---|
103 | gl_copy_tab[IDX][0xa] = TAG2(copy, 0xa);
|
---|
104 | gl_copy_tab[IDX][0xb] = TAG2(copy, 0xb);
|
---|
105 | gl_copy_tab[IDX][0xc] = TAG2(copy, 0xc);
|
---|
106 | gl_copy_tab[IDX][0xd] = TAG2(copy, 0xd);
|
---|
107 | gl_copy_tab[IDX][0xe] = TAG2(copy, 0xe);
|
---|
108 | gl_copy_tab[IDX][0xf] = TAG2(copy, 0xf);
|
---|
109 |
|
---|
110 | /* gl_clean_tab[IDX][0x0] = TAG2(clean, 0x0); */
|
---|
111 | /* gl_clean_tab[IDX][0x1] = TAG2(clean, 0x1); */
|
---|
112 | /* gl_clean_tab[IDX][0x2] = TAG2(clean, 0x2); */
|
---|
113 | /* gl_clean_tab[IDX][0x3] = TAG2(clean, 0x3); */
|
---|
114 | /* gl_clean_tab[IDX][0x4] = TAG2(clean, 0x4); */
|
---|
115 | /* gl_clean_tab[IDX][0x5] = TAG2(clean, 0x5); */
|
---|
116 | /* gl_clean_tab[IDX][0x6] = TAG2(clean, 0x6); */
|
---|
117 | /* gl_clean_tab[IDX][0x7] = TAG2(clean, 0x7); */
|
---|
118 | /* gl_clean_tab[IDX][0x8] = TAG2(clean, 0x8); */
|
---|
119 | /* gl_clean_tab[IDX][0x9] = TAG2(clean, 0x9); */
|
---|
120 | /* gl_clean_tab[IDX][0xa] = TAG2(clean, 0xa); */
|
---|
121 | /* gl_clean_tab[IDX][0xb] = TAG2(clean, 0xb); */
|
---|
122 | /* gl_clean_tab[IDX][0xc] = TAG2(clean, 0xc); */
|
---|
123 | /* gl_clean_tab[IDX][0xd] = TAG2(clean, 0xd); */
|
---|
124 | /* gl_clean_tab[IDX][0xe] = TAG2(clean, 0xe); */
|
---|
125 | /* gl_clean_tab[IDX][0xf] = TAG2(clean, 0xf); */
|
---|
126 | }
|
---|