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 | #ifndef __FX_GLIDE_WARPER__
|
---|
47 | #define __FX_GLIDE_WARPER__
|
---|
48 |
|
---|
49 | #include <glide.h>
|
---|
50 |
|
---|
51 | /*
|
---|
52 | * General context:
|
---|
53 | */
|
---|
54 | #if !defined(FX_GLIDE3)
|
---|
55 | typedef FxU32 FX_GrContext_t; /* Not used in Glide2 */
|
---|
56 | #else
|
---|
57 | typedef GrContext_t FX_GrContext_t;
|
---|
58 | #endif
|
---|
59 |
|
---|
60 | /*
|
---|
61 | * Glide3 emulation on Glide2:
|
---|
62 | */
|
---|
63 | #if !defined(FX_GLIDE3)
|
---|
64 | /* Constanst for FX_grGetInteger( ) */
|
---|
65 | #define FX_FOG_TABLE_ENTRIES 0x0004 /* The number of entries in the hardware fog table. */
|
---|
66 | #define FX_GLIDE_STATE_SIZE 0x0006 /* Size of buffer, in bytes, needed to save Glide state. */
|
---|
67 | #define FX_LFB_PIXEL_PIPE 0x0009 /* 1 if LFB writes can go through the 3D pixel pipe. */
|
---|
68 | #define FX_PENDING_BUFFERSWAPS 0x0014 /* The number of buffer swaps pending. */
|
---|
69 | #define FX_TEXTURE_ALIGN 0x0024 /* The required alignment for textures */
|
---|
70 | #else
|
---|
71 | #define FX_FOG_TABLE_ENTRIES GR_FOG_TABLE_ENTRIES
|
---|
72 | #define FX_GLIDE_STATE_SIZE GR_GLIDE_STATE_SIZE
|
---|
73 | #define FX_LFB_PIXEL_PIPE GR_LFB_PIXEL_PIPE
|
---|
74 | #define FX_PENDING_BUFFERSWAPS GR_PENDING_BUFFERSWAPS
|
---|
75 | #define FX_TEXTURE_ALIGN GR_TEXTURE_ALIGN
|
---|
76 | #endif
|
---|
77 |
|
---|
78 | /*
|
---|
79 | * Genral warper functions for Glide2/Glide3:
|
---|
80 | */
|
---|
81 | extern FxI32 FX_grGetInteger(FxU32 pname);
|
---|
82 | extern FxI32 FX_grGetInteger_NoLock(FxU32 pname);
|
---|
83 |
|
---|
84 | /*
|
---|
85 | * Glide2 emulation on Glide3:
|
---|
86 | */
|
---|
87 | #if defined(FX_GLIDE3)
|
---|
88 |
|
---|
89 | #define GR_ASPECT_1x1 GR_ASPECT_LOG2_1x1
|
---|
90 | #define GR_ASPECT_2x1 GR_ASPECT_LOG2_2x1
|
---|
91 | #define GR_ASPECT_4x1 GR_ASPECT_LOG2_4x1
|
---|
92 | #define GR_ASPECT_8x1 GR_ASPECT_LOG2_8x1
|
---|
93 | #define GR_ASPECT_1x2 GR_ASPECT_LOG2_1x2
|
---|
94 | #define GR_ASPECT_1x4 GR_ASPECT_LOG2_1x4
|
---|
95 | #define GR_ASPECT_1x8 GR_ASPECT_LOG2_1x8
|
---|
96 |
|
---|
97 | #define GR_LOD_256 GR_LOD_LOG2_256
|
---|
98 | #define GR_LOD_128 GR_LOD_LOG2_128
|
---|
99 | #define GR_LOD_64 GR_LOD_LOG2_64
|
---|
100 | #define GR_LOD_32 GR_LOD_LOG2_32
|
---|
101 | #define GR_LOD_16 GR_LOD_LOG2_16
|
---|
102 | #define GR_LOD_8 GR_LOD_LOG2_8
|
---|
103 | #define GR_LOD_4 GR_LOD_LOG2_4
|
---|
104 | #define GR_LOD_2 GR_LOD_LOG2_2
|
---|
105 | #define GR_LOD_1 GR_LOD_LOG2_1
|
---|
106 |
|
---|
107 | #define GR_FOG_WITH_TABLE GR_FOG_WITH_TABLE_ON_Q
|
---|
108 |
|
---|
109 | typedef int GrSstType;
|
---|
110 |
|
---|
111 | #define MAX_NUM_SST 4
|
---|
112 |
|
---|
113 | #define GR_SSTTYPE_VOODOO 0
|
---|
114 | #define GR_SSTTYPE_SST96 1
|
---|
115 | #define GR_SSTTYPE_AT3D 2
|
---|
116 | #define GR_SSTTYPE_Voodoo2 3
|
---|
117 |
|
---|
118 | typedef struct GrTMUConfig_St {
|
---|
119 | int tmuRev; /* Rev of Texelfx chip */
|
---|
120 | int tmuRam; /* 1, 2, or 4 MB */
|
---|
121 | } GrTMUConfig_t;
|
---|
122 |
|
---|
123 | typedef struct GrVoodooConfig_St {
|
---|
124 | int fbRam; /* 1, 2, or 4 MB */
|
---|
125 | int fbiRev; /* Rev of Pixelfx chip */
|
---|
126 | int nTexelfx; /* How many texelFX chips are there? */
|
---|
127 | FxBool sliDetect; /* Is it a scan-line interleaved board? */
|
---|
128 | GrTMUConfig_t tmuConfig[GLIDE_NUM_TMU]; /* Configuration of the Texelfx chips */
|
---|
129 | } GrVoodooConfig_t;
|
---|
130 |
|
---|
131 | typedef struct GrSst96Config_St {
|
---|
132 | int fbRam; /* How much? */
|
---|
133 | int nTexelfx;
|
---|
134 | GrTMUConfig_t tmuConfig;
|
---|
135 | } GrSst96Config_t;
|
---|
136 |
|
---|
137 | typedef GrVoodooConfig_t GrVoodoo2Config_t;
|
---|
138 |
|
---|
139 | typedef struct GrAT3DConfig_St {
|
---|
140 | int rev;
|
---|
141 | } GrAT3DConfig_t;
|
---|
142 |
|
---|
143 | typedef struct {
|
---|
144 | int num_sst; /* # of HW units in the system */
|
---|
145 | struct {
|
---|
146 | GrSstType type; /* Which hardware is it? */
|
---|
147 | union SstBoard_u {
|
---|
148 | GrVoodooConfig_t VoodooConfig;
|
---|
149 | GrSst96Config_t SST96Config;
|
---|
150 | GrAT3DConfig_t AT3DConfig;
|
---|
151 | GrVoodoo2Config_t Voodoo2Config;
|
---|
152 | } sstBoard;
|
---|
153 | } SSTs[MAX_NUM_SST]; /* configuration for each board */
|
---|
154 | } GrHwConfiguration;
|
---|
155 |
|
---|
156 | typedef FxU32 GrHint_t;
|
---|
157 | #define GR_HINTTYPE_MIN 0
|
---|
158 | #define GR_HINT_STWHINT 0
|
---|
159 |
|
---|
160 | typedef FxU32 GrSTWHint_t;
|
---|
161 | #define GR_STWHINT_W_DIFF_FBI FXBIT(0)
|
---|
162 | #define GR_STWHINT_W_DIFF_TMU0 FXBIT(1)
|
---|
163 | #define GR_STWHINT_ST_DIFF_TMU0 FXBIT(2)
|
---|
164 | #define GR_STWHINT_W_DIFF_TMU1 FXBIT(3)
|
---|
165 | #define GR_STWHINT_ST_DIFF_TMU1 FXBIT(4)
|
---|
166 | #define GR_STWHINT_W_DIFF_TMU2 FXBIT(5)
|
---|
167 | #define GR_STWHINT_ST_DIFF_TMU2 FXBIT(6)
|
---|
168 |
|
---|
169 | #define GR_CONTROL_ACTIVATE 1
|
---|
170 | #define GR_CONTROL_DEACTIVATE 0
|
---|
171 |
|
---|
172 | #define GrState void
|
---|
173 |
|
---|
174 | /*
|
---|
175 | ** move the vertex layout defintion to application
|
---|
176 | */
|
---|
177 | typedef struct {
|
---|
178 | float sow; /* s texture ordinate (s over w) */
|
---|
179 | float tow; /* t texture ordinate (t over w) */
|
---|
180 | float oow; /* 1/w (used mipmapping - really 0xfff/w) */
|
---|
181 | } GrTmuVertex;
|
---|
182 |
|
---|
183 |
|
---|
184 | #if FX_USE_PARGB
|
---|
185 |
|
---|
186 | typedef struct
|
---|
187 | {
|
---|
188 | float x, y; /* X and Y in screen space */
|
---|
189 | float ooz; /* 65535/Z (used for Z-buffering) */
|
---|
190 | float oow; /* 1/W (used for W-buffering, texturing) */
|
---|
191 | FxU32 argb; /* R, G, B, A [0..255.0] */
|
---|
192 | GrTmuVertex tmuvtx[GLIDE_NUM_TMU];
|
---|
193 | float z; /* Z is ignored */
|
---|
194 | } GrVertex;
|
---|
195 |
|
---|
196 | #define GR_VERTEX_X_OFFSET 0
|
---|
197 | #define GR_VERTEX_Y_OFFSET 1
|
---|
198 | #define GR_VERTEX_OOZ_OFFSET 2
|
---|
199 | #define GR_VERTEX_OOW_OFFSET 3
|
---|
200 | #define GR_VERTEX_PARGB_OFFSET 4
|
---|
201 | #define GR_VERTEX_SOW_TMU0_OFFSET 5
|
---|
202 | #define GR_VERTEX_TOW_TMU0_OFFSET 6
|
---|
203 | #define GR_VERTEX_OOW_TMU0_OFFSET 7
|
---|
204 | #define GR_VERTEX_SOW_TMU1_OFFSET 8
|
---|
205 | #define GR_VERTEX_TOW_TMU1_OFFSET 9
|
---|
206 | #define GR_VERTEX_OOW_TMU1_OFFSET 10
|
---|
207 | #define GR_VERTEX_Z_OFFSET 11
|
---|
208 |
|
---|
209 | #define GET_PARGB(v) ((FxU32*)(v))[GR_VERTEX_PARGB_OFFSET]
|
---|
210 | /* GET_PA: returns the alpha component */
|
---|
211 | #if GLIDE_ENDIAN == GLIDE_ENDIAN_BIG
|
---|
212 | #define GET_PA(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4]
|
---|
213 | #else
|
---|
214 | #define GET_PA(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+3]
|
---|
215 | #endif
|
---|
216 | #define MESACOLOR2PARGB(c) (c[ACOMP] << 24 | c[GCOMP] << 16 | c[GCOMP] << 8 | c[BCOMP])
|
---|
217 | #define PACK_4F_ARGB(dest,a,r,g,b) { \
|
---|
218 | const GLuint cr = (int)r; \
|
---|
219 | const GLuint cg = (int)g; \
|
---|
220 | const GLuint ca = (int)a; \
|
---|
221 | const GLuint cb = (int)b; \
|
---|
222 | dest = ca << 24 | cr << 16 | cg << 8 | cb; \
|
---|
223 | }
|
---|
224 |
|
---|
225 | #else /* FX_USE_PARGB */
|
---|
226 |
|
---|
227 | typedef struct
|
---|
228 | {
|
---|
229 | float x, y, z; /* X, Y, and Z of scrn space -- Z is ignored */
|
---|
230 | float r, g, b; /* R, G, B, ([0..255.0]) */
|
---|
231 | float ooz; /* 65535/Z (used for Z-buffering) */
|
---|
232 | float a; /* Alpha [0..255.0] */
|
---|
233 | float oow; /* 1/W (used for W-buffering, texturing) */
|
---|
234 | GrTmuVertex tmuvtx[GLIDE_NUM_TMU];
|
---|
235 | } GrVertex;
|
---|
236 |
|
---|
237 | #define GR_VERTEX_X_OFFSET 0
|
---|
238 | #define GR_VERTEX_Y_OFFSET 1
|
---|
239 | #define GR_VERTEX_Z_OFFSET 2
|
---|
240 | #define GR_VERTEX_R_OFFSET 3
|
---|
241 | #define GR_VERTEX_G_OFFSET 4
|
---|
242 | #define GR_VERTEX_B_OFFSET 5
|
---|
243 | #define GR_VERTEX_OOZ_OFFSET 6
|
---|
244 | #define GR_VERTEX_A_OFFSET 7
|
---|
245 | #define GR_VERTEX_OOW_OFFSET 8
|
---|
246 | #define GR_VERTEX_SOW_TMU0_OFFSET 9
|
---|
247 | #define GR_VERTEX_TOW_TMU0_OFFSET 10
|
---|
248 | #define GR_VERTEX_OOW_TMU0_OFFSET 11
|
---|
249 | #define GR_VERTEX_SOW_TMU1_OFFSET 12
|
---|
250 | #define GR_VERTEX_TOW_TMU1_OFFSET 13
|
---|
251 | #define GR_VERTEX_OOW_TMU1_OFFSET 14
|
---|
252 | #endif /* FX_USE_PARGB */
|
---|
253 |
|
---|
254 | #endif
|
---|
255 |
|
---|
256 |
|
---|
257 | /*
|
---|
258 | * Glide2 functions for Glide3
|
---|
259 | */
|
---|
260 | #if defined(FX_GLIDE3)
|
---|
261 | #define FX_grTexDownloadTable(TMU,type,data) \
|
---|
262 | do { \
|
---|
263 | BEGIN_BOARD_LOCK(); \
|
---|
264 | grTexDownloadTable(type,data); \
|
---|
265 | END_BOARD_LOCK(); \
|
---|
266 | } while (0);
|
---|
267 | #define FX_grTexDownloadTable_NoLock(TMU,type,data) \
|
---|
268 | grTexDownloadTable(type, data)
|
---|
269 | #else
|
---|
270 | #define FX_grTexDownloadTable(TMU,type,data) \
|
---|
271 | do { \
|
---|
272 | BEGIN_BOARD_LOCK(); \
|
---|
273 | grTexDownloadTable(TMU,type,data); \
|
---|
274 | END_BOARD_LOCK(); \
|
---|
275 | } while (0);
|
---|
276 | #define FX_grTexDownloadTable_NoLock grTexDownloadTable
|
---|
277 | #endif
|
---|
278 |
|
---|
279 | /*
|
---|
280 | * Flush
|
---|
281 | */
|
---|
282 | #if defined(FX_GLIDE3)
|
---|
283 | #define FX_grFlush() \
|
---|
284 | do { \
|
---|
285 | BEGIN_BOARD_LOCK(); \
|
---|
286 | grFlush(); \
|
---|
287 | END_BOARD_LOCK(); \
|
---|
288 | } while (0)
|
---|
289 | #else
|
---|
290 | #define FX_grFlush() \
|
---|
291 | do { \
|
---|
292 | BEGIN_BOARD_LOCK(); \
|
---|
293 | grSstIdle(); \
|
---|
294 | END_BOARD_LOCK(); \
|
---|
295 | } while (0)
|
---|
296 | #endif
|
---|
297 |
|
---|
298 | #define FX_grFinish() \
|
---|
299 | do { \
|
---|
300 | BEGIN_BOARD_LOCK(); \
|
---|
301 | grFinish(); \
|
---|
302 | END_BOARD_LOCK(); \
|
---|
303 | } while (0)
|
---|
304 |
|
---|
305 | /*
|
---|
306 | * Write region: ToDo possible exploit the PixelPipe parameter.
|
---|
307 | */
|
---|
308 | #if defined(FX_GLIDE3)
|
---|
309 | #define FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
|
---|
310 | do { \
|
---|
311 | BEGIN_BOARD_LOCK(); \
|
---|
312 | grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,FXFALSE,src_stride,src_data); \
|
---|
313 | END_BOARD_LOCK(); \
|
---|
314 | } while(0)
|
---|
315 | #else
|
---|
316 | #define FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
|
---|
317 | do { \
|
---|
318 | BEGIN_BOARD_LOCK(); \
|
---|
319 | grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data); \
|
---|
320 | END_BOARD_LOCK(); \
|
---|
321 | } while (0)
|
---|
322 | #endif
|
---|
323 |
|
---|
324 | /*
|
---|
325 | * Read region
|
---|
326 | */
|
---|
327 | #define FX_grLfbReadRegion(src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data) \
|
---|
328 | do { \
|
---|
329 | BEGIN_BOARD_LOCK(); \
|
---|
330 | grLfbReadRegion(src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data); \
|
---|
331 | END_BOARD_LOCK(); \
|
---|
332 | } while (0);
|
---|
333 |
|
---|
334 | /*
|
---|
335 | * Draw triangle
|
---|
336 | */
|
---|
337 | #define FX_grDrawTriangle(a,b,c) \
|
---|
338 | do { \
|
---|
339 | BEGIN_CLIP_LOOP(); \
|
---|
340 | grDrawTriangle(a,b,c); \
|
---|
341 | END_CLIP_LOOP(); \
|
---|
342 | } while (0)
|
---|
343 |
|
---|
344 | /*
|
---|
345 | * For Lod/LodLog2 conversion.
|
---|
346 | */
|
---|
347 | #if defined(FX_GLIDE3)
|
---|
348 | #define FX_largeLodLog2(info) (info).largeLodLog2
|
---|
349 | #else
|
---|
350 | #define FX_largeLodLog2(info) (info).largeLod
|
---|
351 | #endif
|
---|
352 |
|
---|
353 | #if defined(FX_GLIDE3)
|
---|
354 | #define FX_aspectRatioLog2(info) (info).aspectRatioLog2
|
---|
355 | #else
|
---|
356 | #define FX_aspectRatioLog2(info) (info).aspectRatio
|
---|
357 | #endif
|
---|
358 |
|
---|
359 | #if defined(FX_GLIDE3)
|
---|
360 | #define FX_smallLodLog2(info) (info).smallLodLog2
|
---|
361 | #else
|
---|
362 | #define FX_smallLodLog2(info) (info).smallLod
|
---|
363 | #endif
|
---|
364 |
|
---|
365 | #if defined(FX_GLIDE3)
|
---|
366 | #define FX_lodToValue(val) ((int)(GR_LOD_256-val))
|
---|
367 | #else
|
---|
368 | #define FX_lodToValue(val) ((int)(val))
|
---|
369 | #endif
|
---|
370 |
|
---|
371 | #if defined(FX_GLIDE3)
|
---|
372 | #define FX_largeLodValue(info) ((int)(GR_LOD_256-(info).largeLodLog2))
|
---|
373 | #else
|
---|
374 | #define FX_largeLodValue(info) ((int)(info).largeLod)
|
---|
375 | #endif
|
---|
376 | #define FX_largeLodValue_NoLock FX_largeLodValue
|
---|
377 |
|
---|
378 | #if defined(FX_GLIDE3)
|
---|
379 | #define FX_smallLodValue(info) ((int)(GR_LOD_256-(info).smallLodLog2))
|
---|
380 | #else
|
---|
381 | #define FX_smallLodValue(info) ((int)(info).smallLod)
|
---|
382 | #endif
|
---|
383 | #define FX_smallLodValue_NoLock FX_smallLodValue
|
---|
384 |
|
---|
385 | #if defined(FX_GLIDE3)
|
---|
386 | #define FX_valueToLod(val) ((GrLOD_t)(GR_LOD_256-val))
|
---|
387 | #else
|
---|
388 | #define FX_valueToLod(val) ((GrLOD_t)(val))
|
---|
389 | #endif
|
---|
390 |
|
---|
391 | /*
|
---|
392 | * ScreenWidth/Height stuff.
|
---|
393 | */
|
---|
394 | extern int FX_grSstScreenWidth(void);
|
---|
395 | extern int FX_grSstScreenHeight(void);
|
---|
396 |
|
---|
397 |
|
---|
398 |
|
---|
399 | /*
|
---|
400 | * Version string.
|
---|
401 | */
|
---|
402 | #if defined(FX_GLIDE3)
|
---|
403 | extern void FX_grGlideGetVersion(char *buf);
|
---|
404 | #else
|
---|
405 | #define FX_grGlideGetVersion(b) \
|
---|
406 | do { \
|
---|
407 | BEGIN_BOARD_LOCK(); \
|
---|
408 | grGlideGetVersion(b); \
|
---|
409 | END_BOARD_LOCK(); \
|
---|
410 | } while (0)
|
---|
411 | #endif
|
---|
412 | /*
|
---|
413 | * Performance statistics
|
---|
414 | */
|
---|
415 | #if defined(FX_GLIDE3)
|
---|
416 | extern void FX_grSstPerfStats(GrSstPerfStats_t *st);
|
---|
417 | #else
|
---|
418 | #define FX_grSstPerfStats(s) \
|
---|
419 | do { \
|
---|
420 | BEGIN_BOARD_LOCK(); \
|
---|
421 | grSstPerfStats(s); \
|
---|
422 | END_BOARD_LOCK(); \
|
---|
423 | } while (0)
|
---|
424 | #endif
|
---|
425 |
|
---|
426 | /*
|
---|
427 | * Hardware Query
|
---|
428 | */
|
---|
429 | extern int FX_grSstQueryHardware(GrHwConfiguration *config);
|
---|
430 |
|
---|
431 | /*
|
---|
432 | * GrHints
|
---|
433 | */
|
---|
434 | #if defined(FX_GLIDE3)
|
---|
435 | extern void FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask);
|
---|
436 | extern void FX_grHints(GrHint_t hintType, FxU32 hintMask);
|
---|
437 | #else
|
---|
438 | #define FX_grHints(t,m) \
|
---|
439 | do { \
|
---|
440 | BEGIN_BOARD_LOCK(); \
|
---|
441 | grHints(t, m); \
|
---|
442 | END_BOARD_LOCK(); \
|
---|
443 | } while(0)
|
---|
444 | #define FX_grHints_NoLock grHints
|
---|
445 | #endif
|
---|
446 | /*
|
---|
447 | * Antialiashed line+point drawing.
|
---|
448 | */
|
---|
449 | #if defined(FX_GLIDE3)
|
---|
450 | extern void FX_grAADrawLine(GrVertex *a,GrVertex *b);
|
---|
451 | #else
|
---|
452 | #define FX_grAADrawLine(a,b) \
|
---|
453 | do { \
|
---|
454 | BEGIN_CLIP_LOOP(); \
|
---|
455 | grAADrawLine(a,b); \
|
---|
456 | END_CLIP_LOOP(); \
|
---|
457 | } while (0)
|
---|
458 | #endif
|
---|
459 |
|
---|
460 | #if defined(FX_GLIDE3)
|
---|
461 | extern void FX_grAADrawPoint(GrVertex *a);
|
---|
462 | #else
|
---|
463 | #define FX_grAADrawPoint(a) \
|
---|
464 | do { \
|
---|
465 | BEGIN_CLIP_LOOP(); \
|
---|
466 | grAADrawPoint(a); \
|
---|
467 | END_CLIP_LOOP(); \
|
---|
468 | } while (0)
|
---|
469 | #endif
|
---|
470 |
|
---|
471 | /*
|
---|
472 | * Needed for Glide3 only, to set up Glide2 compatible vertex layout.
|
---|
473 | */
|
---|
474 | #if defined(FX_GLIDE3)
|
---|
475 | extern void FX_setupGrVertexLayout(void);
|
---|
476 | #else
|
---|
477 | #define FX_setupGrVertexLayout() do {} while (0)
|
---|
478 | #endif
|
---|
479 | /*
|
---|
480 | * grSstControl stuff
|
---|
481 | */
|
---|
482 | extern FxBool FX_grSstControl(FxU32 code);
|
---|
483 |
|
---|
484 | /*
|
---|
485 | * grGammaCorrectionValue
|
---|
486 | */
|
---|
487 | #if defined(FX_GLIDE3)
|
---|
488 | extern void FX_grGammaCorrectionValue(float val);
|
---|
489 | #else
|
---|
490 | #define FX_grGammaCorrectionValue(v) \
|
---|
491 | do { \
|
---|
492 | BEGIN_BOARD_LOCK(); \
|
---|
493 | grGammaCorrectionValue(v) \
|
---|
494 | END_BOARD_LOCK(); \
|
---|
495 | } while (0)
|
---|
496 | #endif
|
---|
497 |
|
---|
498 | #if defined(FX_GLIDE3)
|
---|
499 | #define FX_grSstWinClose(w) \
|
---|
500 | do { \
|
---|
501 | BEGIN_BOARD_LOCK(); \
|
---|
502 | grSstWinClose(w); \
|
---|
503 | END_BOARD_LOCK(); \
|
---|
504 | } while (0)
|
---|
505 | #else
|
---|
506 | #define FX_grSstWinClose(w) \
|
---|
507 | do { \
|
---|
508 | BEGIN_BOARD_LOCK(); \
|
---|
509 | grSstWinClose(); \
|
---|
510 | END_BOARD_LOCK(); \
|
---|
511 | } while (0)
|
---|
512 | #endif
|
---|
513 |
|
---|
514 |
|
---|
515 | extern FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd,
|
---|
516 | GrScreenResolution_t screen_resolution,
|
---|
517 | GrScreenRefresh_t refresh_rate,
|
---|
518 | GrColorFormat_t color_format,
|
---|
519 | GrOriginLocation_t origin_location,
|
---|
520 | int nColBuffers,
|
---|
521 | int nAuxBuffers);
|
---|
522 |
|
---|
523 |
|
---|
524 | #define FX_grDrawLine(v1, v2) \
|
---|
525 | do { \
|
---|
526 | BEGIN_CLIP_LOOP(); \
|
---|
527 | grDrawLine(v1, v2); \
|
---|
528 | END_CLIP_LOOP(); \
|
---|
529 | } while (0)
|
---|
530 |
|
---|
531 | #define FX_grDrawPoint(p) \
|
---|
532 | do { \
|
---|
533 | BEGIN_CLIP_LOOP(); \
|
---|
534 | grDrawPoint(p); \
|
---|
535 | END_CLIP_LOOP(); \
|
---|
536 | } while (0)
|
---|
537 |
|
---|
538 | #if defined(FX_GLIDE3)
|
---|
539 | extern void FX_grDrawPolygonVertexList(int n, GrVertex *v);
|
---|
540 | #else
|
---|
541 | #define FX_grDrawPolygonVertexList(n, v) \
|
---|
542 | do { \
|
---|
543 | BEGIN_CLIP_LOOP(); \
|
---|
544 | grDrawPolygonVertexList(n, v); \
|
---|
545 | END_CLIP_LOOP(); \
|
---|
546 | } while (0)
|
---|
547 | #endif
|
---|
548 |
|
---|
549 | #define FX_grDitherMode(m) \
|
---|
550 | do { \
|
---|
551 | BEGIN_BOARD_LOCK(); \
|
---|
552 | grDitherMode(m); \
|
---|
553 | END_BOARD_LOCK(); \
|
---|
554 | } while (0)
|
---|
555 |
|
---|
556 | #define FX_grRenderBuffer(b) \
|
---|
557 | do { \
|
---|
558 | BEGIN_BOARD_LOCK(); \
|
---|
559 | grRenderBuffer(b); \
|
---|
560 | END_BOARD_LOCK(); \
|
---|
561 | } while (0)
|
---|
562 |
|
---|
563 | #define FX_grBufferClear(c, a, d) \
|
---|
564 | do { \
|
---|
565 | BEGIN_CLIP_LOOP(); \
|
---|
566 | grBufferClear(c, a, d); \
|
---|
567 | END_CLIP_LOOP(); \
|
---|
568 | } while (0)
|
---|
569 |
|
---|
570 | #define FX_grDepthMask(m) \
|
---|
571 | do { \
|
---|
572 | BEGIN_BOARD_LOCK(); \
|
---|
573 | grDepthMask(m); \
|
---|
574 | END_BOARD_LOCK(); \
|
---|
575 | } while (0)
|
---|
576 |
|
---|
577 | #define FX_grColorMask(c, a) \
|
---|
578 | do { \
|
---|
579 | BEGIN_BOARD_LOCK(); \
|
---|
580 | grColorMask(c, a); \
|
---|
581 | END_BOARD_LOCK(); \
|
---|
582 | } while (0)
|
---|
583 |
|
---|
584 | extern FxBool FX_grLfbLock(GrLock_t type, GrBuffer_t buffer,
|
---|
585 | GrLfbWriteMode_t writeMode,
|
---|
586 | GrOriginLocation_t origin, FxBool pixelPipeline,
|
---|
587 | GrLfbInfo_t *info );
|
---|
588 |
|
---|
589 | #define FX_grLfbUnlock(t, b) \
|
---|
590 | do { \
|
---|
591 | BEGIN_BOARD_LOCK(); \
|
---|
592 | grLfbUnlock(t, b); \
|
---|
593 | END_BOARD_LOCK(); \
|
---|
594 | } while (0)
|
---|
595 |
|
---|
596 | #define FX_grConstantColorValue(v) \
|
---|
597 | do { \
|
---|
598 | BEGIN_BOARD_LOCK(); \
|
---|
599 | grConstantColorValue(v); \
|
---|
600 | END_BOARD_LOCK(); \
|
---|
601 | } while (0)
|
---|
602 |
|
---|
603 | #define FX_grConstantColorValue_NoLock grConstantColorValue
|
---|
604 |
|
---|
605 | #define FX_grAADrawTriangle(a, b, c, ab, bc, ca) \
|
---|
606 | do { \
|
---|
607 | BEGIN_CLIP_LOOP(); \
|
---|
608 | grAADrawTriangle(a, b, c, ab, bc, ca); \
|
---|
609 | END_CLIP_LOOP(); \
|
---|
610 | } while (0)
|
---|
611 |
|
---|
612 | #define FX_grAlphaBlendFunction(rs, rd, as, ad) \
|
---|
613 | do { \
|
---|
614 | BEGIN_BOARD_LOCK(); \
|
---|
615 | grAlphaBlendFunction(rs, rd, as, ad); \
|
---|
616 | END_BOARD_LOCK(); \
|
---|
617 | } while (0)
|
---|
618 |
|
---|
619 | #define FX_grAlphaCombine(func, fact, loc, oth, inv) \
|
---|
620 | do { \
|
---|
621 | BEGIN_BOARD_LOCK(); \
|
---|
622 | grAlphaCombine(func, fact, loc, oth, inv); \
|
---|
623 | END_BOARD_LOCK(); \
|
---|
624 | } while (0)
|
---|
625 |
|
---|
626 | #define FX_grAlphaCombine_NoLock grAlphaCombine
|
---|
627 |
|
---|
628 | #define FX_grAlphaTestFunction(f) \
|
---|
629 | do { \
|
---|
630 | BEGIN_BOARD_LOCK(); \
|
---|
631 | grAlphaTestFunction(f); \
|
---|
632 | END_BOARD_LOCK(); \
|
---|
633 | } while (0)
|
---|
634 |
|
---|
635 | #define FX_grAlphaTestReferenceValue(v) \
|
---|
636 | do { \
|
---|
637 | BEGIN_BOARD_LOCK(); \
|
---|
638 | grAlphaTestReferenceValue(v); \
|
---|
639 | END_BOARD_LOCK(); \
|
---|
640 | } while (0)
|
---|
641 |
|
---|
642 | #define FX_grClipWindow(minx, miny, maxx, maxy) \
|
---|
643 | do { \
|
---|
644 | BEGIN_BOARD_LOCK(); \
|
---|
645 | grClipWindow(minx, miny, maxx, maxy); \
|
---|
646 | END_BOARD_LOCK(); \
|
---|
647 | } while (0)
|
---|
648 |
|
---|
649 | #define FX_grClipWindow_NoLock grClipWindow
|
---|
650 |
|
---|
651 | #define FX_grColorCombine(func, fact, loc, oth, inv) \
|
---|
652 | do { \
|
---|
653 | BEGIN_BOARD_LOCK(); \
|
---|
654 | grColorCombine(func, fact, loc, oth, inv); \
|
---|
655 | END_BOARD_LOCK(); \
|
---|
656 | } while (0)
|
---|
657 |
|
---|
658 | #define FX_grColorCombine_NoLock grColorCombine
|
---|
659 |
|
---|
660 | #define FX_grCullMode(m) \
|
---|
661 | do { \
|
---|
662 | BEGIN_BOARD_LOCK(); \
|
---|
663 | grCullMode(m); \
|
---|
664 | END_BOARD_LOCK(); \
|
---|
665 | } while (0)
|
---|
666 |
|
---|
667 | #define FX_grDepthBiasLevel(lev) \
|
---|
668 | do { \
|
---|
669 | BEGIN_BOARD_LOCK(); \
|
---|
670 | grDepthBiasLevel(lev); \
|
---|
671 | END_BOARD_LOCK(); \
|
---|
672 | } while (0)
|
---|
673 |
|
---|
674 | #define FX_grDepthBufferFunction(func) \
|
---|
675 | do { \
|
---|
676 | BEGIN_BOARD_LOCK(); \
|
---|
677 | grDepthBufferFunction(func); \
|
---|
678 | END_BOARD_LOCK(); \
|
---|
679 | } while (0)
|
---|
680 |
|
---|
681 | #define FX_grFogColorValue(c) \
|
---|
682 | do { \
|
---|
683 | BEGIN_BOARD_LOCK(); \
|
---|
684 | grFogColorValue(c); \
|
---|
685 | END_BOARD_LOCK(); \
|
---|
686 | } while (0)
|
---|
687 |
|
---|
688 | #define FX_grFogMode(m) \
|
---|
689 | do { \
|
---|
690 | BEGIN_BOARD_LOCK(); \
|
---|
691 | grFogMode(m); \
|
---|
692 | END_BOARD_LOCK(); \
|
---|
693 | } while (0)
|
---|
694 |
|
---|
695 | #define FX_grFogTable(t) \
|
---|
696 | do { \
|
---|
697 | BEGIN_BOARD_LOCK(); \
|
---|
698 | grFogTable(t); \
|
---|
699 | END_BOARD_LOCK(); \
|
---|
700 | } while (0)
|
---|
701 |
|
---|
702 | #define FX_grTexClampMode(t, sc, tc) \
|
---|
703 | do { \
|
---|
704 | BEGIN_BOARD_LOCK(); \
|
---|
705 | grTexClampMode(t, sc, tc); \
|
---|
706 | END_BOARD_LOCK(); \
|
---|
707 | } while (0)
|
---|
708 |
|
---|
709 | #define FX_grTexClampMode_NoLock grTexClampMode
|
---|
710 |
|
---|
711 | #define FX_grTexCombine(t, rfunc, rfact, afunc, afact, rinv, ainv) \
|
---|
712 | do { \
|
---|
713 | BEGIN_BOARD_LOCK(); \
|
---|
714 | grTexCombine(t, rfunc, rfact, afunc, afact, rinv, ainv); \
|
---|
715 | END_BOARD_LOCK(); \
|
---|
716 | } while (0)
|
---|
717 |
|
---|
718 | #define FX_grTexCombine_NoLock grTexCombine
|
---|
719 |
|
---|
720 | #define FX_grTexDownloadMipMapLevel(t, sa, tlod, llod, ar, f, eo, d) \
|
---|
721 | do { \
|
---|
722 | BEGIN_BOARD_LOCK(); \
|
---|
723 | grTexDownloadMipMapLevel(t, sa, tlod, llod, ar, f, eo, d); \
|
---|
724 | END_BOARD_LOCK(); \
|
---|
725 | } while (0)
|
---|
726 |
|
---|
727 | #define FX_grTexDownloadMipMapLevel_NoLock grTexDownloadMipMapLevel
|
---|
728 |
|
---|
729 | #define FX_grTexDownloadMipMapLevelPartial(t, sa, tlod, llod, ar, f, eo, d, s, e); \
|
---|
730 | do { \
|
---|
731 | BEGIN_BOARD_LOCK(); \
|
---|
732 | grTexDownloadMipMapLevelPartial(t, sa, tlod, llod, ar, f, eo, d, s, e); \
|
---|
733 | END_BOARD_LOCK(); \
|
---|
734 | } while (0)
|
---|
735 |
|
---|
736 | #define FX_grTexFilterMode(t, minf, magf) \
|
---|
737 | do { \
|
---|
738 | BEGIN_BOARD_LOCK(); \
|
---|
739 | grTexFilterMode(t, minf, magf); \
|
---|
740 | END_BOARD_LOCK(); \
|
---|
741 | } while (0)
|
---|
742 |
|
---|
743 | #define FX_grTexFilterMode_NoLock grTexFilterMode
|
---|
744 |
|
---|
745 | extern FxU32 FX_grTexMinAddress(GrChipID_t tmu);
|
---|
746 | extern FxU32 FX_grTexMaxAddress(GrChipID_t tmu);
|
---|
747 |
|
---|
748 | #define FX_grTexMipMapMode(t, m, lod) \
|
---|
749 | do { \
|
---|
750 | BEGIN_BOARD_LOCK(); \
|
---|
751 | grTexMipMapMode(t, m, lod); \
|
---|
752 | END_BOARD_LOCK(); \
|
---|
753 | } while (0)
|
---|
754 |
|
---|
755 | #define FX_grTexMipMapMode_NoLock grTexMipMapMode
|
---|
756 |
|
---|
757 | #define FX_grTexSource(t, sa, eo, i) \
|
---|
758 | do { \
|
---|
759 | BEGIN_BOARD_LOCK(); \
|
---|
760 | grTexSource(t, sa, eo, i); \
|
---|
761 | END_BOARD_LOCK(); \
|
---|
762 | } while (0)
|
---|
763 |
|
---|
764 | #define FX_grTexSource_NoLock grTexSource
|
---|
765 |
|
---|
766 | extern FxU32 FX_grTexTextureMemRequired(FxU32 evenOdd, GrTexInfo *info);
|
---|
767 | #define FX_grTexTextureMemRequired_NoLock grTexTextureMemRequired
|
---|
768 |
|
---|
769 | #define FX_grGlideGetState(s) \
|
---|
770 | do { \
|
---|
771 | BEGIN_BOARD_LOCK(); \
|
---|
772 | grGlideGetState(s); \
|
---|
773 | END_BOARD_LOCK(); \
|
---|
774 | } while (0)
|
---|
775 | #define FX_grGlideGetState_NoLock(s) grGlideGetState(s);
|
---|
776 |
|
---|
777 | #define FX_grDRIBufferSwap(i) \
|
---|
778 | do { \
|
---|
779 | BEGIN_BOARD_LOCK(); \
|
---|
780 | grDRIBufferSwap(i); \
|
---|
781 | END_BOARD_LOCK(); \
|
---|
782 | } while (0)
|
---|
783 |
|
---|
784 | #define FX_grSstSelect(b) \
|
---|
785 | do { \
|
---|
786 | BEGIN_BOARD_LOCK(); \
|
---|
787 | grSstSelect(b); \
|
---|
788 | END_BOARD_LOCK(); \
|
---|
789 | } while (0)
|
---|
790 |
|
---|
791 | #define FX_grSstSelect_NoLock grSstSelect
|
---|
792 |
|
---|
793 | #define FX_grGlideSetState(s) \
|
---|
794 | do { \
|
---|
795 | BEGIN_BOARD_LOCK(); \
|
---|
796 | grGlideSetState(s); \
|
---|
797 | END_BOARD_LOCK(); \
|
---|
798 | } while (0)
|
---|
799 | #define FX_grGlideSetState_NoLock(s) grGlideSetState(s);
|
---|
800 |
|
---|
801 | #define FX_grDepthBufferMode(m) \
|
---|
802 | do { \
|
---|
803 | BEGIN_BOARD_LOCK(); \
|
---|
804 | grDepthBufferMode(m); \
|
---|
805 | END_BOARD_LOCK(); \
|
---|
806 | } while (0)
|
---|
807 |
|
---|
808 | #define FX_grLfbWriteColorFormat(f) \
|
---|
809 | do { \
|
---|
810 | BEGIN_BOARD_LOCK(); \
|
---|
811 | grLfbWriteColorFormat(f); \
|
---|
812 | END_BOARD_LOCK(); \
|
---|
813 | } while (0)
|
---|
814 |
|
---|
815 | #define FX_grDrawVertexArray(m, c, p) \
|
---|
816 | do { \
|
---|
817 | BEGIN_CLIP_LOOP(); \
|
---|
818 | grDrawVertexArray(m, c, p); \
|
---|
819 | END_CLIP_LOOP(); \
|
---|
820 | } while (0)
|
---|
821 |
|
---|
822 | #define FX_grGlideShutdown() \
|
---|
823 | do { \
|
---|
824 | BEGIN_CLIP_LOOP(); \
|
---|
825 | grGlideShutdown(); \
|
---|
826 | END_CLIP_LOOP(); \
|
---|
827 | } while (0)
|
---|
828 |
|
---|
829 | #define FX_grGlideInit_NoLock grGlideInit
|
---|
830 | #define FX_grSstWinOpen_NoLock grSstWinOpen
|
---|
831 |
|
---|
832 | extern int FX_getFogTableSize(void);
|
---|
833 | extern int FX_getGrStateSize(void);
|
---|
834 |
|
---|
835 | #endif /* __FX_GLIDE_WARPER__ */
|
---|
836 |
|
---|