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