1 | /* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Mesa 3-D graphics library
|
---|
5 | * Version: 3.3
|
---|
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 | * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
|
---|
28 | * terms stated above.
|
---|
29 | *
|
---|
30 | * Thank you for your contribution, David!
|
---|
31 | *
|
---|
32 | * Please make note of the above copyright/license statement. If you
|
---|
33 | * contributed code or bug fixes to this code under the previous (GNU
|
---|
34 | * Library) license and object to the new license, your code will be
|
---|
35 | * removed at your request. Please see the Mesa docs/COPYRIGHT file
|
---|
36 | * for more information.
|
---|
37 | *
|
---|
38 | * Additional Mesa/3Dfx driver developers:
|
---|
39 | * Daryll Strauss <daryll@precisioninsight.com>
|
---|
40 | * Keith Whitwell <keith@precisioninsight.com>
|
---|
41 | *
|
---|
42 | * See fxapi.h for more revision/author details.
|
---|
43 | */
|
---|
44 |
|
---|
45 |
|
---|
46 | #if (IND & (SETUP_XY|SETUP_W|SETUP_Z))
|
---|
47 | #define V1 VARS_XY
|
---|
48 | #define I1 , INCR_XY
|
---|
49 | #else
|
---|
50 | #define V1
|
---|
51 | #define I1
|
---|
52 | #endif
|
---|
53 |
|
---|
54 | #if (IND & SETUP_XY)
|
---|
55 | #define S1 DO_SETUP_XY
|
---|
56 | #else
|
---|
57 | #define S1
|
---|
58 | #endif
|
---|
59 |
|
---|
60 | #if (IND & SETUP_W)
|
---|
61 | #define S2 S1 DO_SETUP_W
|
---|
62 | #define V2 V1 VARS_W
|
---|
63 | #else
|
---|
64 | #define S2 S1
|
---|
65 | #define V2 V1
|
---|
66 | #endif
|
---|
67 |
|
---|
68 | #if (IND & SETUP_Z)
|
---|
69 | #define S3 S2 DO_SETUP_Z
|
---|
70 | #else
|
---|
71 | #define S3 S2
|
---|
72 | #endif
|
---|
73 |
|
---|
74 | #if (IND & SETUP_RGBA)
|
---|
75 | #define V4 V2 VARS_RGBA
|
---|
76 | #define S4 S3 DO_SETUP_RGBA
|
---|
77 | #define I4 I1 , INCR_RGBA
|
---|
78 | #else
|
---|
79 | #define V4 V2
|
---|
80 | #define S4 S3
|
---|
81 | #define I4 I1
|
---|
82 | #endif
|
---|
83 |
|
---|
84 | #if (IND & SETUP_TMU0)
|
---|
85 | #define V5 V4 VARS_TMU0
|
---|
86 | #define S5 S4 DO_SETUP_TMU0
|
---|
87 | #define I5 I4 , INCR_TMU0
|
---|
88 | #define F5 FIXUP_TMU0
|
---|
89 | #else
|
---|
90 | #define V5 V4
|
---|
91 | #define S5 S4
|
---|
92 | #define I5 I4
|
---|
93 | #define F5
|
---|
94 | #endif
|
---|
95 |
|
---|
96 | #if (IND & SETUP_TMU1)
|
---|
97 | #define V6 V5 VARS_TMU1
|
---|
98 | #define S6 S5 DO_SETUP_TMU1
|
---|
99 | #define I6 I5 , INCR_TMU1
|
---|
100 | #define F6 F5 FIXUP_TMU1
|
---|
101 | #else
|
---|
102 | #define V6 V5
|
---|
103 | #define S6 S5
|
---|
104 | #define I6 I5
|
---|
105 | #define F6 F5
|
---|
106 | #endif
|
---|
107 |
|
---|
108 | #if (IND & SETUP_TMU0) && (IND & SETUP_TMU1)
|
---|
109 | #define F7 FIXUP_TMU01
|
---|
110 | #else
|
---|
111 | #define F7 F6
|
---|
112 | #endif
|
---|
113 |
|
---|
114 | #define VARS V6
|
---|
115 | #define DO_SETUP S6
|
---|
116 | #define INCR I6
|
---|
117 | #define FIXUP F7
|
---|
118 |
|
---|
119 | static void NAME(struct vertex_buffer *VB, GLuint start, GLuint end)
|
---|
120 | {
|
---|
121 | GLcontext *ctx = VB->ctx;
|
---|
122 | fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx;
|
---|
123 |
|
---|
124 | if (fxMesa->new_state)
|
---|
125 | fxSetupFXUnits( ctx );
|
---|
126 |
|
---|
127 | {
|
---|
128 | const float snapper = (3L<<18);
|
---|
129 | fxVertex *gWin = FX_DRIVER_DATA(VB)->verts;
|
---|
130 | GLfloat *v = gWin[start].f;
|
---|
131 | GLfloat *vend = gWin[end].f;
|
---|
132 | VARS;
|
---|
133 |
|
---|
134 | (void) gWin;
|
---|
135 | (void) fxMesa;
|
---|
136 | (void) snapper;
|
---|
137 |
|
---|
138 | if (VB->ClipOrMask) {
|
---|
139 | GLubyte *clipmask = &VB->ClipMask[start];
|
---|
140 | for (;v!=vend;v+=16,clipmask++ INCR) {
|
---|
141 | if (*clipmask == 0) {
|
---|
142 | DO_SETUP;
|
---|
143 | }
|
---|
144 | }
|
---|
145 | } else
|
---|
146 | for (;v!=vend;v+=16 INCR) {
|
---|
147 | DO_SETUP;
|
---|
148 | }
|
---|
149 |
|
---|
150 | /* rare - I hope */
|
---|
151 | FIXUP;
|
---|
152 | }
|
---|
153 | }
|
---|
154 |
|
---|
155 |
|
---|
156 | #undef V1
|
---|
157 | #undef V2
|
---|
158 | #undef V3
|
---|
159 | #undef V4
|
---|
160 | #undef V5
|
---|
161 | #undef V6
|
---|
162 | #undef VARS
|
---|
163 |
|
---|
164 | #undef S1
|
---|
165 | #undef S2
|
---|
166 | #undef S3
|
---|
167 | #undef S4
|
---|
168 | #undef S5
|
---|
169 | #undef S6
|
---|
170 | #undef DO_SETUP
|
---|
171 |
|
---|
172 | #undef I1
|
---|
173 | #undef I4
|
---|
174 | #undef I5
|
---|
175 | #undef I6
|
---|
176 | #undef INCR
|
---|
177 |
|
---|
178 | #undef F5
|
---|
179 | #undef F6
|
---|
180 | #undef F7
|
---|
181 | #undef FIXUP
|
---|
182 |
|
---|
183 |
|
---|
184 | #undef IND
|
---|
185 | #undef NAME
|
---|
186 |
|
---|