2 ** Copyright (c) 1995, 3Dfx Interactive, Inc.
3 ** All Rights Reserved.
5 ** This is UNPUBLISHED PROPRIETARY SOURCE CODE of 3Dfx Interactive, Inc.;
6 ** the contents of this file may not be disclosed to third parties, copied or
7 ** duplicated in any form, in whole or in part, without the prior written
8 ** permission of 3Dfx Interactive, Inc.
10 ** RESTRICTED RIGHTS LEGEND:
11 ** Use, duplication or disclosure by the Government is subject to restrictions
12 ** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
13 ** and Computer Software clause at DFARS 252.227-7013, and/or in similar or
14 ** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
15 ** rights reserved under the Copyright Laws of the United States.
21 ** The following #defines are relevant when using Glide:
23 ** One of the following "platform constants" must be defined during
26 ** __DOS__ Defined for 32-bit DOS applications
27 ** __WIN32__ Defined for 32-bit Windows applications
28 ** __sparc__ Defined for Sun Solaris/SunOS
29 ** __linux__ Defined for Linux applications
30 ** __IRIX__ Defined for SGI Irix applications
45 ** -----------------------------------------------------------------------
47 ** -----------------------------------------------------------------------
49 typedef FxU32 GrColor_t;
50 typedef FxU8 GrAlpha_t;
51 typedef FxU32 GrMipMapId_t;
55 ** -----------------------------------------------------------------------
56 ** CONSTANTS AND TYPES
57 ** -----------------------------------------------------------------------
60 #define MAX_MIPMAPS_PER_SST 1024
61 #define GR_FOG_TABLE_SIZE 64
62 #define GR_NULL_MIPMAP_HANDLE ((GrMipMapId_t) -1)
63 #define GR_ZDEPTHVALUE_NEAREST 0xFFFF
64 #define GR_ZDEPTHVALUE_FARTHEST 0x0000
65 #define GR_WDEPTHVALUE_NEAREST 0x0000
66 #define GR_WDEPTHVALUE_FARTHEST 0xFFFF
68 #define GR_MIPMAPLEVELMASK_EVEN FXBIT(0)
69 #define GR_MIPMAPLEVELMASK_ODD FXBIT(1)
70 #define GR_MIPMAPLEVELMASK_BOTH (GR_MIPMAPLEVELMASK_EVEN | GR_MIPMAPLEVELMASK_ODD )
72 #define GR_LODBIAS_BILINEAR 0.5
73 #define GR_LODBIAS_TRILINEAR 0.0
75 typedef FxI32 GrChipID_t;
81 typedef FxI32 GrCombineFunction_t;
82 #define GR_COMBINE_FUNCTION_ZERO 0x0
83 #define GR_COMBINE_FUNCTION_NONE GR_COMBINE_FUNCTION_ZERO
84 #define GR_COMBINE_FUNCTION_LOCAL 0x1
85 #define GR_COMBINE_FUNCTION_LOCAL_ALPHA 0x2
86 #define GR_COMBINE_FUNCTION_SCALE_OTHER 0x3
87 #define GR_COMBINE_FUNCTION_BLEND_OTHER GR_COMBINE_FUNCTION_SCALE_OTHER
88 #define GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL 0x4
89 #define GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA 0x5
90 #define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL 0x6
91 #define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL 0x7
92 #define GR_COMBINE_FUNCTION_BLEND GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL
93 #define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA 0x8
94 #define GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL 0x9
95 #define GR_COMBINE_FUNCTION_BLEND_LOCAL GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL
96 #define GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA 0x10
98 typedef FxI32 GrCombineFactor_t;
99 #define GR_COMBINE_FACTOR_ZERO 0x0
100 #define GR_COMBINE_FACTOR_NONE GR_COMBINE_FACTOR_ZERO
101 #define GR_COMBINE_FACTOR_LOCAL 0x1
102 #define GR_COMBINE_FACTOR_OTHER_ALPHA 0x2
103 #define GR_COMBINE_FACTOR_LOCAL_ALPHA 0x3
104 #define GR_COMBINE_FACTOR_TEXTURE_ALPHA 0x4
105 #define GR_COMBINE_FACTOR_DETAIL_FACTOR GR_COMBINE_FACTOR_TEXTURE_ALPHA
106 #define GR_COMBINE_FACTOR_LOD_FRACTION 0x5
107 #define GR_COMBINE_FACTOR_ONE 0x8
108 #define GR_COMBINE_FACTOR_ONE_MINUS_LOCAL 0x9
109 #define GR_COMBINE_FACTOR_ONE_MINUS_OTHER_ALPHA 0xa
110 #define GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA 0xb
111 #define GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA 0xc
112 #define GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA
113 #define GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION 0xd
116 typedef FxI32 GrCombineLocal_t;
117 #define GR_COMBINE_LOCAL_ITERATED 0x0
118 #define GR_COMBINE_LOCAL_CONSTANT 0x1
119 #define GR_COMBINE_LOCAL_NONE GR_COMBINE_LOCAL_CONSTANT
120 #define GR_COMBINE_LOCAL_DEPTH 0x2
122 typedef FxI32 GrCombineOther_t;
123 #define GR_COMBINE_OTHER_ITERATED 0x0
124 #define GR_COMBINE_OTHER_TEXTURE 0x1
125 #define GR_COMBINE_OTHER_CONSTANT 0x2
126 #define GR_COMBINE_OTHER_NONE GR_COMBINE_OTHER_CONSTANT
129 typedef FxI32 GrAlphaSource_t;
130 #define GR_ALPHASOURCE_CC_ALPHA 0x0
131 #define GR_ALPHASOURCE_ITERATED_ALPHA 0x1
132 #define GR_ALPHASOURCE_TEXTURE_ALPHA 0x2
133 #define GR_ALPHASOURCE_TEXTURE_ALPHA_TIMES_ITERATED_ALPHA 0x3
136 typedef FxI32 GrColorCombineFnc_t;
137 #define GR_COLORCOMBINE_ZERO 0x0
138 #define GR_COLORCOMBINE_CCRGB 0x1
139 #define GR_COLORCOMBINE_ITRGB 0x2
140 #define GR_COLORCOMBINE_ITRGB_DELTA0 0x3
141 #define GR_COLORCOMBINE_DECAL_TEXTURE 0x4
142 #define GR_COLORCOMBINE_TEXTURE_TIMES_CCRGB 0x5
143 #define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB 0x6
144 #define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB_DELTA0 0x7
145 #define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB_ADD_ALPHA 0x8
146 #define GR_COLORCOMBINE_TEXTURE_TIMES_ALPHA 0x9
147 #define GR_COLORCOMBINE_TEXTURE_TIMES_ALPHA_ADD_ITRGB 0xa
148 #define GR_COLORCOMBINE_TEXTURE_ADD_ITRGB 0xb
149 #define GR_COLORCOMBINE_TEXTURE_SUB_ITRGB 0xc
150 #define GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA 0xd
151 #define GR_COLORCOMBINE_DIFF_SPEC_A 0xe
152 #define GR_COLORCOMBINE_DIFF_SPEC_B 0xf
153 #define GR_COLORCOMBINE_ONE 0x10
155 typedef FxI32 GrAlphaBlendFnc_t;
156 #define GR_BLEND_ZERO 0x0
157 #define GR_BLEND_SRC_ALPHA 0x1
158 #define GR_BLEND_SRC_COLOR 0x2
159 #define GR_BLEND_DST_COLOR GR_BLEND_SRC_COLOR
160 #define GR_BLEND_DST_ALPHA 0x3
161 #define GR_BLEND_ONE 0x4
162 #define GR_BLEND_ONE_MINUS_SRC_ALPHA 0x5
163 #define GR_BLEND_ONE_MINUS_SRC_COLOR 0x6
164 #define GR_BLEND_ONE_MINUS_DST_COLOR GR_BLEND_ONE_MINUS_SRC_COLOR
165 #define GR_BLEND_ONE_MINUS_DST_ALPHA 0x7
166 #define GR_BLEND_RESERVED_8 0x8
167 #define GR_BLEND_RESERVED_9 0x9
168 #define GR_BLEND_RESERVED_A 0xa
169 #define GR_BLEND_RESERVED_B 0xb
170 #define GR_BLEND_RESERVED_C 0xc
171 #define GR_BLEND_RESERVED_D 0xd
172 #define GR_BLEND_RESERVED_E 0xe
173 #define GR_BLEND_ALPHA_SATURATE 0xf
174 #define GR_BLEND_PREFOG_COLOR GR_BLEND_ALPHA_SATURATE
176 typedef FxI32 GrAspectRatio_t;
177 #define GR_ASPECT_8x1 0x0 /* 8W x 1H */
178 #define GR_ASPECT_4x1 0x1 /* 4W x 1H */
179 #define GR_ASPECT_2x1 0x2 /* 2W x 1H */
180 #define GR_ASPECT_1x1 0x3 /* 1W x 1H */
181 #define GR_ASPECT_1x2 0x4 /* 1W x 2H */
182 #define GR_ASPECT_1x4 0x5 /* 1W x 4H */
183 #define GR_ASPECT_1x8 0x6 /* 1W x 8H */
185 typedef FxI32 GrBuffer_t;
186 #define GR_BUFFER_FRONTBUFFER 0x0
187 #define GR_BUFFER_BACKBUFFER 0x1
188 #define GR_BUFFER_AUXBUFFER 0x2
189 #define GR_BUFFER_DEPTHBUFFER 0x3
190 #define GR_BUFFER_ALPHABUFFER 0x4
191 #define GR_BUFFER_TRIPLEBUFFER 0x5
193 typedef FxI32 GrChromakeyMode_t;
194 #define GR_CHROMAKEY_DISABLE 0x0
195 #define GR_CHROMAKEY_ENABLE 0x1
197 typedef FxI32 GrCmpFnc_t;
198 #define GR_CMP_NEVER 0x0
199 #define GR_CMP_LESS 0x1
200 #define GR_CMP_EQUAL 0x2
201 #define GR_CMP_LEQUAL 0x3
202 #define GR_CMP_GREATER 0x4
203 #define GR_CMP_NOTEQUAL 0x5
204 #define GR_CMP_GEQUAL 0x6
205 #define GR_CMP_ALWAYS 0x7
207 typedef FxI32 GrColorFormat_t;
208 #define GR_COLORFORMAT_ARGB 0x0
209 #define GR_COLORFORMAT_ABGR 0x1
211 #define GR_COLORFORMAT_RGBA 0x2
212 #define GR_COLORFORMAT_BGRA 0x3
214 typedef FxI32 GrCullMode_t;
215 #define GR_CULL_DISABLE 0x0
216 #define GR_CULL_NEGATIVE 0x1
217 #define GR_CULL_POSITIVE 0x2
219 typedef FxI32 GrDepthBufferMode_t;
220 #define GR_DEPTHBUFFER_DISABLE 0x0
221 #define GR_DEPTHBUFFER_ZBUFFER 0x1
222 #define GR_DEPTHBUFFER_WBUFFER 0x2
223 #define GR_DEPTHBUFFER_ZBUFFER_COMPARE_TO_BIAS 0x3
224 #define GR_DEPTHBUFFER_WBUFFER_COMPARE_TO_BIAS 0x4
226 typedef FxI32 GrDitherMode_t;
227 #define GR_DITHER_DISABLE 0x0
228 #define GR_DITHER_2x2 0x1
229 #define GR_DITHER_4x4 0x2
231 typedef FxI32 GrFogMode_t;
232 #define GR_FOG_DISABLE 0x0
233 #define GR_FOG_WITH_ITERATED_ALPHA 0x1
234 #define GR_FOG_WITH_TABLE 0x2
235 #define GR_FOG_WITH_ITERATED_Z 0x3 /* Bug 735 */
236 #define GR_FOG_MULT2 0x100
237 #define GR_FOG_ADD2 0x200
239 typedef FxU32 GrLock_t;
240 #define GR_LFB_READ_ONLY 0x00
241 #define GR_LFB_WRITE_ONLY 0x01
242 #define GR_LFB_IDLE 0x00
243 #define GR_LFB_NOIDLE 0x10
245 typedef FxI32 GrLfbBypassMode_t;
246 #define GR_LFBBYPASS_DISABLE 0x0
247 #define GR_LFBBYPASS_ENABLE 0x1
249 typedef FxI32 GrLfbWriteMode_t;
250 #define GR_LFBWRITEMODE_565 0x0 /* RGB:RGB */
251 #define GR_LFBWRITEMODE_555 0x1 /* RGB:RGB */
252 #define GR_LFBWRITEMODE_1555 0x2 /* ARGB:ARGB */
253 #define GR_LFBWRITEMODE_RESERVED1 0x3
254 #define GR_LFBWRITEMODE_888 0x4 /* RGB */
255 #define GR_LFBWRITEMODE_8888 0x5 /* ARGB */
256 #define GR_LFBWRITEMODE_RESERVED2 0x6
257 #define GR_LFBWRITEMODE_RESERVED3 0x7
258 #define GR_LFBWRITEMODE_RESERVED4 0x8
259 #define GR_LFBWRITEMODE_RESERVED5 0x9
260 #define GR_LFBWRITEMODE_RESERVED6 0xa
261 #define GR_LFBWRITEMODE_RESERVED7 0xb
262 #define GR_LFBWRITEMODE_565_DEPTH 0xc /* RGB:DEPTH */
263 #define GR_LFBWRITEMODE_555_DEPTH 0xd /* RGB:DEPTH */
264 #define GR_LFBWRITEMODE_1555_DEPTH 0xe /* ARGB:DEPTH */
265 #define GR_LFBWRITEMODE_ZA16 0xf /* DEPTH:DEPTH */
266 #define GR_LFBWRITEMODE_ANY 0xFF
269 typedef FxI32 GrOriginLocation_t;
270 #define GR_ORIGIN_UPPER_LEFT 0x0
271 #define GR_ORIGIN_LOWER_LEFT 0x1
272 #define GR_ORIGIN_ANY 0xFF
278 GrLfbWriteMode_t writeMode;
279 GrOriginLocation_t origin;
282 typedef FxI32 GrLOD_t;
283 #define GR_LOD_256 0x0
284 #define GR_LOD_128 0x1
285 #define GR_LOD_64 0x2
286 #define GR_LOD_32 0x3
287 #define GR_LOD_16 0x4
293 typedef FxI32 GrMipMapMode_t;
294 #define GR_MIPMAP_DISABLE 0x0 /* no mip mapping */
295 #define GR_MIPMAP_NEAREST 0x1 /* use nearest mipmap */
296 #define GR_MIPMAP_NEAREST_DITHER 0x2 /* GR_MIPMAP_NEAREST + LOD dith */
299 typedef FxI32 GrSmoothingMode_t;
300 #define GR_SMOOTHING_DISABLE 0x0
301 #define GR_SMOOTHING_ENABLE 0x1
303 typedef FxI32 GrTextureClampMode_t;
304 #define GR_TEXTURECLAMP_WRAP 0x0
305 #define GR_TEXTURECLAMP_CLAMP 0x1
307 typedef FxI32 GrTextureCombineFnc_t;
308 #define GR_TEXTURECOMBINE_ZERO 0x0 /* texout = 0 */
309 #define GR_TEXTURECOMBINE_DECAL 0x1 /* texout = texthis */
310 #define GR_TEXTURECOMBINE_OTHER 0x2 /* this TMU in passthru mode */
311 #define GR_TEXTURECOMBINE_ADD 0x3 /* tout = tthis + t(this+1) */
312 #define GR_TEXTURECOMBINE_MULTIPLY 0x4 /* texout = tthis * t(this+1) */
313 #define GR_TEXTURECOMBINE_SUBTRACT 0x5 /* Sutract from upstream TMU */
314 #define GR_TEXTURECOMBINE_DETAIL 0x6 /* detail--detail on tthis */
315 #define GR_TEXTURECOMBINE_DETAIL_OTHER 0x7 /* detail--detail on tthis+1 */
316 #define GR_TEXTURECOMBINE_TRILINEAR_ODD 0x8 /* trilinear--odd levels tthis*/
317 #define GR_TEXTURECOMBINE_TRILINEAR_EVEN 0x9 /*trilinear--even levels tthis*/
318 #define GR_TEXTURECOMBINE_ONE 0xa /* texout = 0xFFFFFFFF */
320 typedef FxI32 GrTextureFilterMode_t;
321 #define GR_TEXTUREFILTER_POINT_SAMPLED 0x0
322 #define GR_TEXTUREFILTER_BILINEAR 0x1
324 typedef FxI32 GrTextureFormat_t;
325 #define GR_TEXFMT_8BIT 0x0
326 #define GR_TEXFMT_RGB_332 GR_TEXFMT_8BIT
327 #define GR_TEXFMT_YIQ_422 0x1
328 #define GR_TEXFMT_ALPHA_8 0x2 /* (0..0xFF) alpha */
329 #define GR_TEXFMT_INTENSITY_8 0x3 /* (0..0xFF) intensity */
330 #define GR_TEXFMT_ALPHA_INTENSITY_44 0x4
331 #define GR_TEXFMT_P_8 0x5 /* 8-bit palette */
332 #define GR_TEXFMT_RSVD0 0x6
333 #define GR_TEXFMT_RSVD1 0x7
334 #define GR_TEXFMT_16BIT 0x8
335 #define GR_TEXFMT_ARGB_8332 GR_TEXFMT_16BIT
336 #define GR_TEXFMT_AYIQ_8422 0x9
337 #define GR_TEXFMT_RGB_565 0xa
338 #define GR_TEXFMT_ARGB_1555 0xb
339 #define GR_TEXFMT_ARGB_4444 0xc
340 #define GR_TEXFMT_ALPHA_INTENSITY_88 0xd
341 #define GR_TEXFMT_AP_88 0xe /* 8-bit alpha 8-bit palette */
342 #define GR_TEXFMT_RSVD2 0xf
344 typedef FxU32 GrTexTable_t;
345 #define GR_TEXTABLE_NCC0 0x0
346 #define GR_TEXTABLE_NCC1 0x1
347 #define GR_TEXTABLE_PALETTE 0x2
349 typedef FxU32 GrNCCTable_t;
350 #define GR_NCCTABLE_NCC0 0x0
351 #define GR_NCCTABLE_NCC1 0x1
353 typedef FxU32 GrTexBaseRange_t;
354 #define GR_TEXBASE_256 0x0
355 #define GR_TEXBASE_128 0x1
356 #define GR_TEXBASE_64 0x2
357 #define GR_TEXBASE_32_TO_1 0x3
360 #define GLIDE3_EXTRA_STATE 68
362 #define GLIDE3_EXTRA_STATE 0
365 #define GLIDE_STATE_PAD_SIZE 312 + GLIDE3_EXTRA_STATE
368 typedef struct _GrState_s GrState;
370 typedef struct _GrState_s {
371 char pad[GLIDE_STATE_PAD_SIZE];
376 /* Types of data in strips */
380 /* Parameters for strips */
383 #define GR_TEXTURE0 2
384 #define GR_TEXTURE1 3
386 /* Componenets for strips */
388 #define GR_VERTEX_XYZ 3
389 #define GR_VERTEX_XYZW 4
391 #define GR_COLOR_RGB 3
392 #define GR_COLOR_RGBA 4
394 #define GR_TEX_NONE 0
398 /* Stuf for grDrawArray */
400 #define GR_LINE_STRIP 1
402 #define GR_TRIANGLE_STRIP 3
403 #define GR_TRIANGLE_FAN 4
404 #define GR_TRIANGLES 5
409 ** -----------------------------------------------------------------------
411 ** -----------------------------------------------------------------------
414 ** 3DF texture file structs
419 int small_lod, large_lod;
420 GrAspectRatio_t aspect_ratio;
421 GrTextureFormat_t format;
429 FxU32 packed_data[12];
438 GuTexPalette palette;
446 FxU32 mem_required; /* memory required for mip map in bytes. */
452 GrAspectRatio_t aspectRatio;
453 GrTextureFormat_t format;
459 int sst; /* SST where this texture map was stored */
460 FxBool valid; /* set when this table entry is allocated*/
462 GrAspectRatio_t aspect_ratio; /* aspect ratio of the mip map. */
463 void *data; /* actual texture data */
465 GrTextureFormat_t format; /* format of the texture table */
466 GrMipMapMode_t mipmap_mode; /* mip map mode for this texture */
467 GrTextureFilterMode_t magfilter_mode; /* filtering to be used when magnified */
468 GrTextureFilterMode_t minfilter_mode; /* filtering to be used with minified */
469 GrTextureClampMode_t s_clamp_mode; /* how this texture should be clamped in s */
470 GrTextureClampMode_t t_clamp_mode; /* how this texture should be clamped in t */
471 FxU32 tLOD; /* Register value for tLOD register */
472 FxU32 tTextureMode; /* Register value for tTextureMode register
473 not including non-texture specific bits */
474 FxU32 lod_bias; /* LOD bias of the mip map in preshifted 4.2*/
475 GrLOD_t lod_min, lod_max; /* largest and smallest levels of detail */
476 int tmu; /* tmu on which this texture resides */
477 FxU32 odd_even_mask; /* mask specifying levels on this tmu */
478 FxU32 tmu_base_address; /* base addr (in TMU mem) of this texture */
479 FxBool trilinear; /* should we blend by lod? */
481 GuNccTable ncc_table; /* NCC compression table (optional) */
484 typedef int GrSstType;
485 #define GR_SSTTYPE_VOODOO 0
486 #define GR_SSTTYPE_SST96 1
487 #define GR_SSTTYPE_AT3D 2
488 #define GR_SSTTYPE_Voodoo2 3
490 typedef struct GrTMUConfig_St {
491 int tmuRev; /* Rev of Texelfx chip */
492 int tmuRam; /* 1, 2, or 4 MB */
495 typedef struct GrVoodooConfig_St {
496 int fbRam; /* 1, 2, or 4 MB */
497 int fbiRev; /* Rev of Pixelfx chip */
498 int nTexelfx; /* How many texelFX chips are there? */
499 FxBool sliDetect; /* Is it a scan-line interleaved board? */
500 GrTMUConfig_t tmuConfig[GLIDE_NUM_TMU]; /* Configuration of the Texelfx chips */
503 typedef struct GrSst96Config_St {
504 int fbRam; /* How much? */
506 GrTMUConfig_t tmuConfig;
509 typedef GrVoodooConfig_t GrVoodoo2Config_t;
511 typedef struct GrAT3DConfig_St {
516 int num_sst; /* # of HW units in the system */
518 GrSstType type; /* Which hardware is it? */
520 GrVoodooConfig_t VoodooConfig;
521 GrSst96Config_t SST96Config;
522 GrAT3DConfig_t AT3DConfig;
523 GrVoodoo2Config_t Voodoo2Config;
525 } SSTs[MAX_NUM_SST]; /* configuration for each board */
528 typedef struct GrSstPerfStats_s {
529 FxU32 pixelsIn; /* # pixels processed (minus buffer clears) */
530 FxU32 chromaFail; /* # pixels not drawn due to chroma key */
531 FxU32 zFuncFail; /* # pixels not drawn due to Z comparison */
532 FxU32 aFuncFail; /* # pixels not drawn due to alpha comparison */
533 FxU32 pixelsOut; /* # pixels drawn (including buffer clears) */
538 float sow; /* s texture ordinate (s over w) */
539 float tow; /* t texture ordinate (t over w) */
540 float oow; /* 1/w (used mipmapping - really 0xfff/w) */
545 ** If these are changed the C & assembly language trisetup routines MUST
546 ** be changed, for they will no longer work.
550 float x, y, z; /* X, Y, and Z of scrn space -- Z is ignored */
551 float r, g, b; /* R, G, B, ([0..255.0]) */
552 float ooz; /* 65535/Z (used for Z-buffering) */
553 float a; /* Alpha [0..255.0] */
554 float oow; /* 1/W (used for W-buffering, texturing) */
555 GrTmuVertex tmuvtx[GLIDE_NUM_TMU];
558 /* For indexing GrVertex as a float *.
559 CHANGE THESE IF THE VERTEX STRUCTURE CHANGES!
561 #define GR_VERTEX_X_OFFSET 0
562 #define GR_VERTEX_Y_OFFSET 1
563 #define GR_VERTEX_Z_OFFSET 2
564 #define GR_VERTEX_R_OFFSET 3
565 #define GR_VERTEX_G_OFFSET 4
566 #define GR_VERTEX_B_OFFSET 5
567 #define GR_VERTEX_OOZ_OFFSET 6
568 #define GR_VERTEX_A_OFFSET 7
569 #define GR_VERTEX_OOW_OFFSET 8
570 #define GR_VERTEX_SOW_TMU0_OFFSET 9
571 #define GR_VERTEX_TOW_TMU0_OFFSET 10
572 #define GR_VERTEX_OOW_TMU0_OFFSET 11
573 #define GR_VERTEX_SOW_TMU1_OFFSET 12
574 #define GR_VERTEX_TOW_TMU1_OFFSET 13
575 #define GR_VERTEX_OOW_TMU1_OFFSET 14
576 #if (GLIDE_NUM_TMU > 2)
577 #define GR_VERTEX_SOW_TMU2_OFFSET 15
578 #define GR_VERTEX_TOW_TMU2_OFFSET 16
579 #define GR_VERTEX_OOW_TMU2_OFFSET 17
582 typedef FxU32 GrLfbSrcFmt_t;
583 #define GR_LFB_SRC_FMT_565 0x00
584 #define GR_LFB_SRC_FMT_555 0x01
585 #define GR_LFB_SRC_FMT_1555 0x02
586 #define GR_LFB_SRC_FMT_888 0x04
587 #define GR_LFB_SRC_FMT_8888 0x05
588 #define GR_LFB_SRC_FMT_565_DEPTH 0x0c
589 #define GR_LFB_SRC_FMT_555_DEPTH 0x0d
590 #define GR_LFB_SRC_FMT_1555_DEPTH 0x0e
591 #define GR_LFB_SRC_FMT_ZA16 0x0f
592 #define GR_LFB_SRC_FMT_RLE16 0x80
594 typedef FxI32 GrPassthruMode_t;
595 #define GR_PASSTHRU_SHOW_VGA 0x0
596 #define GR_PASSTHRU_SHOW_SST1 0x1
598 typedef FxU32 GrHint_t;
599 #define GR_HINTTYPE_MIN 0
600 #define GR_HINT_STWHINT 0
601 #define GR_HINT_FIFOCHECKHINT 1
602 #define GR_HINT_FPUPRECISION 2
603 #define GR_HINT_ALLOW_MIPMAP_DITHER 3
604 #define GR_HINTTYPE_MAX 3
606 typedef FxU32 GrSTWHint_t;
607 #define GR_STWHINT_W_DIFF_FBI FXBIT(0)
608 #define GR_STWHINT_W_DIFF_TMU0 FXBIT(1)
609 #define GR_STWHINT_ST_DIFF_TMU0 FXBIT(2)
610 #define GR_STWHINT_W_DIFF_TMU1 FXBIT(3)
611 #define GR_STWHINT_ST_DIFF_TMU1 FXBIT(4)
612 #define GR_STWHINT_W_DIFF_TMU2 FXBIT(5)
613 #define GR_STWHINT_ST_DIFF_TMU2 FXBIT(6)
615 typedef FxU32 GrControl_t;
616 #define GR_CONTROL_ACTIVATE 0x1
617 #define GR_CONTROL_DEACTIVATE 0x2
618 #define GR_CONTROL_RESIZE 0x3
619 #define GR_CONTROL_MOVE 0x4
621 #define GR_GENERATE_FIFOCHECK_HINT_MASK(swHWM, swLWM) \
622 (((swHWM & 0xffff) << 16) | (swLWM & 0xffff))
625 ** -----------------------------------------------------------------------
626 ** FUNCTION PROTOTYPES
627 ** -----------------------------------------------------------------------
629 #ifndef FX_GLIDE_NO_FUNC_PROTO
631 ** rendering functions
633 FX_ENTRY void FX_CALL
634 grDrawLine( const GrVertex *v1, const GrVertex *v2 );
636 FX_ENTRY void FX_CALL
637 grDrawPlanarPolygon( int nverts, const int ilist[], const GrVertex vlist[] );
639 FX_ENTRY void FX_CALL
640 grDrawPlanarPolygonVertexList( int nverts, const GrVertex vlist[] );
642 FX_ENTRY void FX_CALL
643 grDrawPoint( const GrVertex *pt );
645 FX_ENTRY void FX_CALL
646 grDrawPolygon( int nverts, const int ilist[], const GrVertex vlist[] );
648 FX_ENTRY void FX_CALL
649 grDrawPolygonVertexList( int nverts, const GrVertex vlist[] );
651 FX_ENTRY void FX_CALL
652 grDrawTriangle( const GrVertex *a, const GrVertex *b, const GrVertex *c );
657 FX_ENTRY void FX_CALL
658 grBufferClear( GrColor_t color, GrAlpha_t alpha, FxU16 depth );
661 grBufferNumPending( void );
663 FX_ENTRY void FX_CALL
664 grBufferSwap( int swap_interval );
666 FX_ENTRY void FX_CALL
667 grRenderBuffer( GrBuffer_t buffer );
672 typedef void (*GrErrorCallbackFnc_t)( const char *string, FxBool fatal );
674 FX_ENTRY void FX_CALL
675 grErrorSetCallback( GrErrorCallbackFnc_t fnc );
680 FX_ENTRY void FX_CALL
683 FX_ENTRY FxU32 FX_CALL
684 grSstVideoLine( void );
686 FX_ENTRY FxBool FX_CALL
687 grSstVRetraceOn( void );
689 FX_ENTRY FxBool FX_CALL
692 FX_ENTRY FxBool FX_CALL
695 GrScreenResolution_t screen_resolution,
696 GrScreenRefresh_t refresh_rate,
697 GrColorFormat_t color_format,
698 GrOriginLocation_t origin_location,
702 FX_ENTRY void FX_CALL
703 grSstWinClose( void );
705 FX_ENTRY FxBool FX_CALL
706 grSstControl( FxU32 code );
708 FX_ENTRY FxBool FX_CALL
709 grSstQueryHardware( GrHwConfiguration *hwconfig );
711 FX_ENTRY FxBool FX_CALL
712 grSstQueryBoards( GrHwConfiguration *hwconfig );
714 FX_ENTRY void FX_CALL
715 grSstOrigin(GrOriginLocation_t origin);
717 FX_ENTRY void FX_CALL
718 grSstSelect( int which_sst );
720 FX_ENTRY FxU32 FX_CALL
721 grSstScreenHeight( void );
723 FX_ENTRY FxU32 FX_CALL
724 grSstScreenWidth( void );
726 FX_ENTRY FxU32 FX_CALL
730 ** Drawing Statistics
732 FX_ENTRY void FX_CALL
733 grSstPerfStats(GrSstPerfStats_t *pStats);
735 FX_ENTRY void FX_CALL
736 grSstResetPerfStats(void);
738 FX_ENTRY void FX_CALL
741 FX_ENTRY void FX_CALL
742 grTriStats(FxU32 *trisProcessed, FxU32 *trisDrawn);
745 ** Glide configuration and special effect maintenance functions
747 FX_ENTRY void FX_CALL
748 grAlphaBlendFunction(
749 GrAlphaBlendFnc_t rgb_sf, GrAlphaBlendFnc_t rgb_df,
750 GrAlphaBlendFnc_t alpha_sf, GrAlphaBlendFnc_t alpha_df
753 FX_ENTRY void FX_CALL
755 GrCombineFunction_t function, GrCombineFactor_t factor,
756 GrCombineLocal_t local, GrCombineOther_t other,
760 FX_ENTRY void FX_CALL
761 grAlphaControlsITRGBLighting( FxBool enable );
763 FX_ENTRY void FX_CALL
764 grAlphaTestFunction( GrCmpFnc_t function );
766 FX_ENTRY void FX_CALL
767 grAlphaTestReferenceValue( GrAlpha_t value );
769 FX_ENTRY void FX_CALL
770 grChromakeyMode( GrChromakeyMode_t mode );
772 FX_ENTRY void FX_CALL
773 grChromakeyValue( GrColor_t value );
775 FX_ENTRY void FX_CALL
776 grClipWindow( FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy );
778 FX_ENTRY void FX_CALL
780 GrCombineFunction_t function, GrCombineFactor_t factor,
781 GrCombineLocal_t local, GrCombineOther_t other,
784 FX_ENTRY void FX_CALL
785 grColorMask( FxBool rgb, FxBool a );
787 FX_ENTRY void FX_CALL
788 grCullMode( GrCullMode_t mode );
790 FX_ENTRY void FX_CALL
791 grConstantColorValue( GrColor_t value );
793 FX_ENTRY void FX_CALL
794 grConstantColorValue4( float a, float r, float g, float b );
796 FX_ENTRY void FX_CALL
797 grDepthBiasLevel( FxI16 level );
799 FX_ENTRY void FX_CALL
800 grDepthBufferFunction( GrCmpFnc_t function );
802 FX_ENTRY void FX_CALL
803 grDepthBufferMode( GrDepthBufferMode_t mode );
805 FX_ENTRY void FX_CALL
806 grDepthMask( FxBool mask );
808 FX_ENTRY void FX_CALL
809 grDisableAllEffects( void );
811 FX_ENTRY void FX_CALL
812 grDitherMode( GrDitherMode_t mode );
814 FX_ENTRY void FX_CALL
815 grFogColorValue( GrColor_t fogcolor );
817 FX_ENTRY void FX_CALL
818 grFogMode( GrFogMode_t mode );
820 FX_ENTRY void FX_CALL
821 grFogTable( const GrFog_t ft[GR_FOG_TABLE_SIZE] );
823 FX_ENTRY void FX_CALL
824 grGammaCorrectionValue( float value );
826 FX_ENTRY void FX_CALL
827 grSplash(float x, float y, float width, float height, FxU32 frame);
830 ** texture mapping control functions
832 FX_ENTRY FxU32 FX_CALL
833 grTexCalcMemRequired(
834 GrLOD_t lodmin, GrLOD_t lodmax,
835 GrAspectRatio_t aspect, GrTextureFormat_t fmt);
837 FX_ENTRY FxU32 FX_CALL
838 grTexTextureMemRequired( FxU32 evenOdd,
841 FX_ENTRY FxU32 FX_CALL
842 grTexMinAddress( GrChipID_t tmu );
845 FX_ENTRY FxU32 FX_CALL
846 grTexMaxAddress( GrChipID_t tmu );
849 FX_ENTRY void FX_CALL
850 grTexNCCTable( GrChipID_t tmu, GrNCCTable_t table );
852 FX_ENTRY void FX_CALL
853 grTexSource( GrChipID_t tmu,
858 FX_ENTRY void FX_CALL
861 GrTextureClampMode_t s_clampmode,
862 GrTextureClampMode_t t_clampmode
865 FX_ENTRY void FX_CALL
868 GrCombineFunction_t rgb_function,
869 GrCombineFactor_t rgb_factor,
870 GrCombineFunction_t alpha_function,
871 GrCombineFactor_t alpha_factor,
876 FX_ENTRY void FX_CALL
877 grTexCombineFunction(
879 GrTextureCombineFnc_t fnc
882 FX_ENTRY void FX_CALL
890 FX_ENTRY void FX_CALL
893 GrTextureFilterMode_t minfilter_mode,
894 GrTextureFilterMode_t magfilter_mode
898 FX_ENTRY void FX_CALL
899 grTexLodBiasValue(GrChipID_t tmu, float bias );
901 FX_ENTRY void FX_CALL
902 grTexDownloadMipMap( GrChipID_t tmu,
907 FX_ENTRY void FX_CALL
908 grTexDownloadMipMapLevel( GrChipID_t tmu,
912 GrAspectRatio_t aspectRatio,
913 GrTextureFormat_t format,
917 FX_ENTRY void FX_CALL
918 grTexDownloadMipMapLevelPartial( GrChipID_t tmu,
922 GrAspectRatio_t aspectRatio,
923 GrTextureFormat_t format,
930 FX_ENTRY void FX_CALL
931 ConvertAndDownloadRle( GrChipID_t tmu,
935 GrAspectRatio_t aspectRatio,
936 GrTextureFormat_t format,
948 FX_ENTRY void FX_CALL
949 grCheckForRoom(FxI32 n);
951 FX_ENTRY void FX_CALL
952 grTexDownloadTable( GrChipID_t tmu,
956 FX_ENTRY void FX_CALL
957 grTexDownloadTablePartial( GrChipID_t tmu,
963 FX_ENTRY void FX_CALL
964 grTexMipMapMode( GrChipID_t tmu,
968 FX_ENTRY void FX_CALL
969 grTexMultibase( GrChipID_t tmu,
972 FX_ENTRY void FX_CALL
973 grTexMultibaseAddress( GrChipID_t tmu,
974 GrTexBaseRange_t range,
980 ** utility texture functions
982 FX_ENTRY GrMipMapId_t FX_CALL
986 int width, int height,
987 GrTextureFormat_t fmt,
988 GrMipMapMode_t mm_mode,
989 GrLOD_t smallest_lod, GrLOD_t largest_lod,
990 GrAspectRatio_t aspect,
991 GrTextureClampMode_t s_clamp_mode,
992 GrTextureClampMode_t t_clamp_mode,
993 GrTextureFilterMode_t minfilter_mode,
994 GrTextureFilterMode_t magfilter_mode,
999 FX_ENTRY FxBool FX_CALL
1000 guTexChangeAttributes(
1002 int width, int height,
1003 GrTextureFormat_t fmt,
1004 GrMipMapMode_t mm_mode,
1005 GrLOD_t smallest_lod, GrLOD_t largest_lod,
1006 GrAspectRatio_t aspect,
1007 GrTextureClampMode_t s_clamp_mode,
1008 GrTextureClampMode_t t_clamp_mode,
1009 GrTextureFilterMode_t minFilterMode,
1010 GrTextureFilterMode_t magFilterMode
1013 FX_ENTRY void FX_CALL
1014 guTexCombineFunction(
1016 GrTextureCombineFnc_t fnc
1019 FX_ENTRY GrMipMapId_t FX_CALL
1020 guTexGetCurrentMipMap( GrChipID_t tmu );
1022 FX_ENTRY GrMipMapInfo * FX_CALL
1023 guTexGetMipMapInfo( GrMipMapId_t mmid );
1025 FX_ENTRY FxU32 FX_CALL
1026 guTexMemQueryAvail( GrChipID_t tmu );
1028 FX_ENTRY void FX_CALL
1029 guTexMemReset( void );
1031 FX_ENTRY void FX_CALL
1032 guTexDownloadMipMap(
1035 const GuNccTable *table
1038 FX_ENTRY void FX_CALL
1039 guTexDownloadMipMapLevel(
1044 FX_ENTRY void FX_CALL
1045 guTexSource( GrMipMapId_t id );
1048 ** linear frame buffer functions
1051 FX_ENTRY FxBool FX_CALL
1052 grLfbLock( GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode,
1053 GrOriginLocation_t origin, FxBool pixelPipeline,
1054 GrLfbInfo_t *info );
1056 FX_ENTRY FxBool FX_CALL
1057 grLfbUnlock( GrLock_t type, GrBuffer_t buffer );
1059 FX_ENTRY void FX_CALL
1060 grLfbConstantAlpha( GrAlpha_t alpha );
1062 FX_ENTRY void FX_CALL
1063 grLfbConstantDepth( FxU16 depth );
1065 FX_ENTRY void FX_CALL
1066 grLfbWriteColorSwizzle(FxBool swizzleBytes, FxBool swapWords);
1068 FX_ENTRY void FX_CALL
1069 grLfbWriteColorFormat(GrColorFormat_t colorFormat);
1072 FX_ENTRY FxBool FX_CALL
1073 grLfbWriteRegion( GrBuffer_t dst_buffer,
1074 FxU32 dst_x, FxU32 dst_y,
1075 GrLfbSrcFmt_t src_format,
1076 FxU32 src_width, FxU32 src_height,
1077 FxI32 src_stride, void *src_data );
1079 FX_ENTRY FxBool FX_CALL
1080 grLfbReadRegion( GrBuffer_t src_buffer,
1081 FxU32 src_x, FxU32 src_y,
1082 FxU32 src_width, FxU32 src_height,
1083 FxU32 dst_stride, void *dst_data );
1087 ** Antialiasing Functions
1089 FX_ENTRY void FX_CALL
1090 grAADrawLine(const GrVertex *v1, const GrVertex *v2);
1092 FX_ENTRY void FX_CALL
1093 grAADrawPoint(const GrVertex *pt );
1095 FX_ENTRY void FX_CALL
1096 grAADrawPolygon(const int nverts, const int ilist[], const GrVertex vlist[]);
1098 FX_ENTRY void FX_CALL
1099 grAADrawPolygonVertexList(const int nverts, const GrVertex vlist[]);
1101 FX_ENTRY void FX_CALL
1103 const GrVertex *a, const GrVertex *b, const GrVertex *c,
1104 FxBool ab_antialias, FxBool bc_antialias, FxBool ca_antialias
1108 ** glide management functions
1110 FX_ENTRY void FX_CALL
1111 grGlideInit( void );
1113 FX_ENTRY void FX_CALL
1114 grGlideShutdown( void );
1116 FX_ENTRY void FX_CALL
1117 grGlideGetVersion( char version[80] );
1119 FX_ENTRY void FX_CALL
1120 grGlideGetState( GrState *state );
1122 FX_ENTRY void FX_CALL
1123 grGlideSetState( const GrState *state );
1125 FX_ENTRY void FX_CALL
1126 grGlideShamelessPlug(const FxBool on);
1128 FX_ENTRY void FX_CALL
1129 grHints(GrHint_t hintType, FxU32 hintMask);
1132 FX_ENTRY void FX_CALL
1133 grParameterData(FxU32 param, FxU32 components, FxU32 type, FxI32 offset);
1135 FX_ENTRY void FX_CALL
1136 grDrawArray(FxU32 mode, FxU32 Count, void *pointers[]);
1139 #endif /* FX_GLIDE_NO_FUNC_PROTO */
1145 #include <glideutl.h>
1147 #endif /* __GLIDE_H__ */