Added missing launcher
[mupen64plus-pandora.git] / gles2glide64 / src / Glitch64 / inc / glide.h
1 /*
2 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
3 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
4 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
8 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
10 ** 
11 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
12 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
13 ** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
14 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
15 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
16 ** THE UNITED STATES.  
17 ** 
18 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
19 */
20
21 /*
22 ** GLIDE.H
23 **
24 ** The following #defines are relevant when using Glide:
25 **
26 ** One of the following "platform constants" must be defined during
27 ** compilation:
28 **
29 **            __DOS__           Defined for 32-bit DOS applications
30 **            __WIN32__         Defined for 32-bit Windows applications
31 **            __sparc__         Defined for Sun Solaris/SunOS
32 **            __linux__         Defined for Linux applications
33 **            __FreeBSD__       Defined for FreeBSD applications
34 **            __NetBSD__        Defined for NetBSD applications
35 **            __OpenBSD__       Defined for OpenBSD applications
36 **            __IRIX__          Defined for SGI Irix applications
37 **
38 */
39 #ifndef __GLIDE_H__
40 #define __GLIDE_H__
41
42 #include <3dfx.h>
43 #include <glidesys.h>
44 #include <sst1vid.h>
45
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49
50 /*
51 ** -----------------------------------------------------------------------
52 ** TYPE DEFINITIONS
53 ** -----------------------------------------------------------------------
54 */
55 typedef FxU32 GrColor_t;
56 typedef FxU8  GrAlpha_t;
57 typedef FxU32 GrMipMapId_t;
58 typedef FxU32 GrStipplePattern_t;
59 typedef FxU8  GrFog_t;
60 typedef FxU32 GrContext_t;
61 typedef int (FX_CALL *GrProc)();
62
63 #ifndef WIN32
64 typedef int HWND;
65 #endif
66
67 /*
68 ** -----------------------------------------------------------------------
69 ** CONSTANTS AND TYPES
70 ** -----------------------------------------------------------------------
71 */
72 #define GR_NULL_MIPMAP_HANDLE  ((GrMipMapId_t) -1)
73
74 #define GR_MIPMAPLEVELMASK_EVEN  FXBIT(0)
75 #define GR_MIPMAPLEVELMASK_ODD  FXBIT(1)
76 #define GR_MIPMAPLEVELMASK_BOTH (GR_MIPMAPLEVELMASK_EVEN | GR_MIPMAPLEVELMASK_ODD )
77
78 #define GR_LODBIAS_BILINEAR     0.5
79 #define GR_LODBIAS_TRILINEAR    0.0
80
81 typedef FxI32 GrChipID_t;
82 #define GR_TMU0         0x0
83 #define GR_TMU1         0x1
84 #define GR_TMU2         0x2
85
86 #define GR_FBI          0x0
87
88 typedef FxI32 GrCombineFunction_t;
89 #define GR_COMBINE_FUNCTION_ZERO        0x0
90 #define GR_COMBINE_FUNCTION_NONE        GR_COMBINE_FUNCTION_ZERO
91 #define GR_COMBINE_FUNCTION_LOCAL       0x1
92 #define GR_COMBINE_FUNCTION_LOCAL_ALPHA 0x2
93 #define GR_COMBINE_FUNCTION_SCALE_OTHER 0x3
94 #define GR_COMBINE_FUNCTION_BLEND_OTHER GR_COMBINE_FUNCTION_SCALE_OTHER
95 #define GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL 0x4
96 #define GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA 0x5 
97 #define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL 0x6
98 #define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL 0x7
99 #define GR_COMBINE_FUNCTION_BLEND GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL
100 #define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA 0x8
101 #define GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL 0x9
102 #define GR_COMBINE_FUNCTION_BLEND_LOCAL GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL
103 #define GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA 0x10
104
105 typedef FxI32 GrCombineFactor_t;
106 #define GR_COMBINE_FACTOR_ZERO          0x0
107 #define GR_COMBINE_FACTOR_NONE          GR_COMBINE_FACTOR_ZERO
108 #define GR_COMBINE_FACTOR_LOCAL         0x1
109 #define GR_COMBINE_FACTOR_OTHER_ALPHA   0x2
110 #define GR_COMBINE_FACTOR_LOCAL_ALPHA   0x3
111 #define GR_COMBINE_FACTOR_TEXTURE_ALPHA 0x4
112 #define GR_COMBINE_FACTOR_TEXTURE_RGB   0x5
113 #define GR_COMBINE_FACTOR_DETAIL_FACTOR GR_COMBINE_FACTOR_TEXTURE_ALPHA
114 #define GR_COMBINE_FACTOR_LOD_FRACTION  0x5
115 #define GR_COMBINE_FACTOR_ONE           0x8
116 #define GR_COMBINE_FACTOR_ONE_MINUS_LOCAL 0x9
117 #define GR_COMBINE_FACTOR_ONE_MINUS_OTHER_ALPHA 0xa
118 #define GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA 0xb
119 #define GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA 0xc
120 #define GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA
121 #define GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION 0xd
122
123
124 typedef FxI32 GrCombineLocal_t;
125 #define GR_COMBINE_LOCAL_ITERATED 0x0
126 #define GR_COMBINE_LOCAL_CONSTANT 0x1
127 #define GR_COMBINE_LOCAL_NONE GR_COMBINE_LOCAL_CONSTANT
128 #define GR_COMBINE_LOCAL_DEPTH  0x2
129
130 typedef FxI32 GrCombineOther_t;
131 #define GR_COMBINE_OTHER_ITERATED 0x0
132 #define GR_COMBINE_OTHER_TEXTURE 0x1
133 #define GR_COMBINE_OTHER_CONSTANT 0x2
134 #define GR_COMBINE_OTHER_NONE GR_COMBINE_OTHER_CONSTANT
135
136
137 typedef FxI32 GrAlphaSource_t;
138 #define GR_ALPHASOURCE_CC_ALPHA 0x0
139 #define GR_ALPHASOURCE_ITERATED_ALPHA 0x1
140 #define GR_ALPHASOURCE_TEXTURE_ALPHA 0x2
141 #define GR_ALPHASOURCE_TEXTURE_ALPHA_TIMES_ITERATED_ALPHA 0x3
142
143
144 typedef FxI32 GrColorCombineFnc_t;
145 #define GR_COLORCOMBINE_ZERO 0x0
146 #define GR_COLORCOMBINE_CCRGB 0x1
147 #define GR_COLORCOMBINE_ITRGB 0x2
148 #define GR_COLORCOMBINE_ITRGB_DELTA0 0x3
149 #define GR_COLORCOMBINE_DECAL_TEXTURE 0x4
150 #define GR_COLORCOMBINE_TEXTURE_TIMES_CCRGB 0x5
151 #define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB 0x6
152 #define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB_DELTA0 0x7
153 #define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB_ADD_ALPHA 0x8
154 #define GR_COLORCOMBINE_TEXTURE_TIMES_ALPHA 0x9
155 #define GR_COLORCOMBINE_TEXTURE_TIMES_ALPHA_ADD_ITRGB 0xa
156 #define GR_COLORCOMBINE_TEXTURE_ADD_ITRGB 0xb
157 #define GR_COLORCOMBINE_TEXTURE_SUB_ITRGB 0xc
158 #define GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA 0xd
159 #define GR_COLORCOMBINE_DIFF_SPEC_A 0xe
160 #define GR_COLORCOMBINE_DIFF_SPEC_B 0xf
161 #define GR_COLORCOMBINE_ONE 0x10
162
163 typedef FxI32 GrAlphaBlendFnc_t;
164 #define GR_BLEND_ZERO 0x0
165 #define GR_BLEND_SRC_ALPHA 0x1
166 #define GR_BLEND_SRC_COLOR 0x2
167 #define GR_BLEND_DST_COLOR GR_BLEND_SRC_COLOR
168 #define GR_BLEND_DST_ALPHA 0x3 
169 #define GR_BLEND_ONE 0x4
170 #define GR_BLEND_ONE_MINUS_SRC_ALPHA 0x5
171 #define GR_BLEND_ONE_MINUS_SRC_COLOR 0x6
172 #define GR_BLEND_ONE_MINUS_DST_COLOR GR_BLEND_ONE_MINUS_SRC_COLOR 
173 #define GR_BLEND_ONE_MINUS_DST_ALPHA 0x7
174 #define GR_BLEND_RESERVED_8 0x8
175 #define GR_BLEND_RESERVED_9 0x9
176 #define GR_BLEND_RESERVED_A 0xa
177 #define GR_BLEND_RESERVED_B 0xb
178 #define GR_BLEND_RESERVED_C 0xc
179 #define GR_BLEND_RESERVED_D 0xd
180 #define GR_BLEND_RESERVED_E 0xe
181 #define GR_BLEND_ALPHA_SATURATE 0xf
182 #define GR_BLEND_PREFOG_COLOR GR_BLEND_ALPHA_SATURATE
183
184 typedef FxI32 GrAspectRatio_t;
185 #define GR_ASPECT_LOG2_8x1        3       /* 8W x 1H */
186 #define GR_ASPECT_LOG2_4x1        2       /* 4W x 1H */
187 #define GR_ASPECT_LOG2_2x1        1       /* 2W x 1H */
188 #define GR_ASPECT_LOG2_1x1        0       /* 1W x 1H */
189 #define GR_ASPECT_LOG2_1x2       -1       /* 1W x 2H */
190 #define GR_ASPECT_LOG2_1x4       -2       /* 1W x 4H */
191 #define GR_ASPECT_LOG2_1x8       -3       /* 1W x 8H */
192
193 typedef FxI32 GrBuffer_t;
194 #define GR_BUFFER_FRONTBUFFER   0x0
195 #define GR_BUFFER_BACKBUFFER    0x1
196 #define GR_BUFFER_AUXBUFFER     0x2
197 #define GR_BUFFER_DEPTHBUFFER   0x3
198 #define GR_BUFFER_ALPHABUFFER   0x4
199 #define GR_BUFFER_TRIPLEBUFFER  0x5
200
201 typedef FxI32 GrChromakeyMode_t;
202 #define GR_CHROMAKEY_DISABLE    0x0
203 #define GR_CHROMAKEY_ENABLE     0x1
204
205 typedef FxI32 GrChromaRangeMode_t;
206 #define GR_CHROMARANGE_RGB_ALL_EXT  0x0
207
208 #define GR_CHROMARANGE_DISABLE_EXT  0x00
209 #define GR_CHROMARANGE_ENABLE_EXT   0x01
210
211 typedef FxI32 GrTexChromakeyMode_t;
212 #define GR_TEXCHROMA_DISABLE_EXT               0x0
213 #define GR_TEXCHROMA_ENABLE_EXT                0x1
214
215 #define GR_TEXCHROMARANGE_RGB_ALL_EXT  0x0
216
217 typedef FxI32 GrCmpFnc_t;
218 #define GR_CMP_NEVER    0x0
219 #define GR_CMP_LESS     0x1
220 #define GR_CMP_EQUAL    0x2
221 #define GR_CMP_LEQUAL   0x3
222 #define GR_CMP_GREATER  0x4
223 #define GR_CMP_NOTEQUAL 0x5
224 #define GR_CMP_GEQUAL   0x6
225 #define GR_CMP_ALWAYS   0x7
226
227 typedef FxI32 GrColorFormat_t;
228 #define GR_COLORFORMAT_ARGB     0x0
229 #define GR_COLORFORMAT_ABGR     0x1
230
231 #define GR_COLORFORMAT_RGBA     0x2
232 #define GR_COLORFORMAT_BGRA     0x3
233
234 typedef FxI32 GrCullMode_t;
235 #define GR_CULL_DISABLE         0x0
236 #define GR_CULL_NEGATIVE        0x1
237 #define GR_CULL_POSITIVE        0x2
238
239 typedef FxI32 GrDepthBufferMode_t;
240 #define GR_DEPTHBUFFER_DISABLE                  0x0
241 #define GR_DEPTHBUFFER_ZBUFFER                  0x1
242 #define GR_DEPTHBUFFER_WBUFFER                  0x2
243 #define GR_DEPTHBUFFER_ZBUFFER_COMPARE_TO_BIAS  0x3
244 #define GR_DEPTHBUFFER_WBUFFER_COMPARE_TO_BIAS  0x4
245
246 typedef FxI32 GrDitherMode_t;
247 #define GR_DITHER_DISABLE       0x0
248 #define GR_DITHER_2x2           0x1
249 #define GR_DITHER_4x4           0x2
250
251 typedef FxI32 GrStippleMode_t;
252 #define GR_STIPPLE_DISABLE      0x0
253 #define GR_STIPPLE_PATTERN      0x1
254 #define GR_STIPPLE_ROTATE       0x2
255
256 typedef FxI32 GrFogMode_t;
257 #define GR_FOG_DISABLE                     0x0
258 #define GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT  0x1
259 #define GR_FOG_WITH_TABLE_ON_Q             0x2
260 #define GR_FOG_WITH_TABLE_ON_W             GR_FOG_WITH_TABLE_ON_Q
261 #define GR_FOG_WITH_ITERATED_Z             0x3
262 #define GR_FOG_WITH_ITERATED_ALPHA_EXT     0x4
263 #define GR_FOG_MULT2                       0x100
264 #define GR_FOG_ADD2                        0x200
265
266 typedef FxU32 GrLock_t;
267 #define GR_LFB_READ_ONLY  0x00
268 #define GR_LFB_WRITE_ONLY 0x01
269 #define GR_LFB_IDLE       0x00
270 #define GR_LFB_NOIDLE     0x10
271
272 #define GR_LFB_WRITE_ONLY_EXPLICIT_EXT  0x02 /* explicitly not allow reading from the lfb pointer */
273
274 typedef FxI32 GrLfbBypassMode_t;
275 #define GR_LFBBYPASS_DISABLE    0x0
276 #define GR_LFBBYPASS_ENABLE     0x1
277
278 typedef FxI32 GrLfbWriteMode_t;
279 #define GR_LFBWRITEMODE_565        0x0 /* RGB:RGB */
280 #define GR_LFBWRITEMODE_555        0x1 /* RGB:RGB */
281 #define GR_LFBWRITEMODE_1555       0x2 /* ARGB:ARGB */
282 #define GR_LFBWRITEMODE_RESERVED1  0x3
283 #define GR_LFBWRITEMODE_888        0x4 /* RGB */
284 #define GR_LFBWRITEMODE_8888       0x5 /* ARGB */
285 #define GR_LFBWRITEMODE_RESERVED2  0x6
286 #define GR_LFBWRITEMODE_RESERVED3  0x7
287 #define GR_LFBWRITEMODE_RESERVED4  0x8
288 #define GR_LFBWRITEMODE_RESERVED5  0x9
289 #define GR_LFBWRITEMODE_RESERVED6  0xa
290 #define GR_LFBWRITEMODE_RESERVED7  0xb
291 #define GR_LFBWRITEMODE_565_DEPTH  0xc /* RGB:DEPTH */
292 #define GR_LFBWRITEMODE_555_DEPTH  0xd /* RGB:DEPTH */
293 #define GR_LFBWRITEMODE_1555_DEPTH 0xe /* ARGB:DEPTH */
294 #define GR_LFBWRITEMODE_ZA16       0xf /* DEPTH:DEPTH */
295 #define GR_LFBWRITEMODE_ANY        0xFF
296
297
298 typedef FxI32 GrOriginLocation_t;
299 #define GR_ORIGIN_UPPER_LEFT    0x0
300 #define GR_ORIGIN_LOWER_LEFT    0x1
301 #define GR_ORIGIN_ANY           0xFF
302
303 typedef struct {
304     int                size;
305     void               *lfbPtr;
306     FxU32              strideInBytes;        
307     GrLfbWriteMode_t   writeMode;
308     GrOriginLocation_t origin;
309 } GrLfbInfo_t;
310
311 typedef FxI32 GrLOD_t;
312 #define GR_LOD_LOG2_256         0x8
313 #define GR_LOD_LOG2_128         0x7
314 #define GR_LOD_LOG2_64          0x6
315 #define GR_LOD_LOG2_32          0x5
316 #define GR_LOD_LOG2_16          0x4
317 #define GR_LOD_LOG2_8           0x3
318 #define GR_LOD_LOG2_4           0x2
319 #define GR_LOD_LOG2_2           0x1
320 #define GR_LOD_LOG2_1           0x0
321
322 typedef FxI32 GrMipMapMode_t;
323 #define GR_MIPMAP_DISABLE               0x0 /* no mip mapping  */
324 #define GR_MIPMAP_NEAREST               0x1 /* use nearest mipmap */
325 #define GR_MIPMAP_NEAREST_DITHER        0x2 /* GR_MIPMAP_NEAREST + LOD dith */
326
327 typedef FxI32 GrSmoothingMode_t;
328 #define GR_SMOOTHING_DISABLE    0x0
329 #define GR_SMOOTHING_ENABLE     0x1
330
331 typedef FxI32 GrTextureClampMode_t;
332 #define GR_TEXTURECLAMP_WRAP        0x0
333 #define GR_TEXTURECLAMP_CLAMP       0x1
334 #define GR_TEXTURECLAMP_MIRROR_EXT  0x2
335
336 typedef FxI32 GrTextureCombineFnc_t;
337 #define GR_TEXTURECOMBINE_ZERO          0x0 /* texout = 0 */
338 #define GR_TEXTURECOMBINE_DECAL         0x1 /* texout = texthis */
339 #define GR_TEXTURECOMBINE_OTHER         0x2 /* this TMU in passthru mode */
340 #define GR_TEXTURECOMBINE_ADD           0x3 /* tout = tthis + t(this+1) */
341 #define GR_TEXTURECOMBINE_MULTIPLY      0x4 /* texout = tthis * t(this+1) */
342 #define GR_TEXTURECOMBINE_SUBTRACT      0x5 /* Sutract from upstream TMU */
343 #define GR_TEXTURECOMBINE_DETAIL        0x6 /* detail--detail on tthis */
344 #define GR_TEXTURECOMBINE_DETAIL_OTHER  0x7 /* detail--detail on tthis+1 */
345 #define GR_TEXTURECOMBINE_TRILINEAR_ODD 0x8 /* trilinear--odd levels tthis*/
346 #define GR_TEXTURECOMBINE_TRILINEAR_EVEN 0x9 /*trilinear--even levels tthis*/
347 #define GR_TEXTURECOMBINE_ONE           0xa /* texout = 0xFFFFFFFF */
348
349 typedef FxI32 GrTextureFilterMode_t;
350 #define GR_TEXTUREFILTER_POINT_SAMPLED  0x0
351 #define GR_TEXTUREFILTER_BILINEAR       0x1
352
353 typedef FxI32 GrTextureFormat_t;
354 /* KoolSmoky - */
355 #define GR_TEXFMT_8BIT                  0x0
356 #define GR_TEXFMT_RGB_332               GR_TEXFMT_8BIT
357 #define GR_TEXFMT_YIQ_422               0x1
358 #define GR_TEXFMT_ALPHA_8               0x2 /* (0..0xFF) alpha     */
359 #define GR_TEXFMT_INTENSITY_8           0x3 /* (0..0xFF) intensity */
360 #define GR_TEXFMT_ALPHA_INTENSITY_44    0x4
361 #define GR_TEXFMT_P_8                   0x5 /* 8-bit palette */
362 #define GR_TEXFMT_RSVD0                 0x6 /* GR_TEXFMT_P_8_RGBA */
363 #define GR_TEXFMT_P_8_6666              GR_TEXFMT_RSVD0
364 #define GR_TEXFMT_P_8_6666_EXT          GR_TEXFMT_RSVD0
365 #define GR_TEXFMT_RSVD1                 0x7
366 #define GR_TEXFMT_16BIT                 0x8
367 #define GR_TEXFMT_ARGB_8332             GR_TEXFMT_16BIT
368 #define GR_TEXFMT_AYIQ_8422             0x9
369 #define GR_TEXFMT_RGB_565               0xa
370 #define GR_TEXFMT_ARGB_1555             0xb
371 #define GR_TEXFMT_ARGB_4444             0xc
372 #define GR_TEXFMT_ALPHA_INTENSITY_88    0xd
373 #define GR_TEXFMT_AP_88                 0xe /* 8-bit alpha 8-bit palette */
374 #define GR_TEXFMT_RSVD2                 0xf
375 #define GR_TEXFMT_RSVD4                 GR_TEXFMT_RSVD2
376
377 typedef FxU32 GrTexTable_t;
378 #define GR_TEXTABLE_NCC0                 0x0
379 #define GR_TEXTABLE_NCC1                 0x1
380 #define GR_TEXTABLE_PALETTE              0x2
381 #define GR_TEXTABLE_PALETTE_6666_EXT     0x3
382
383 typedef FxU32 GrNCCTable_t;
384 #define GR_NCCTABLE_NCC0    0x0
385 #define GR_NCCTABLE_NCC1    0x1
386
387 typedef FxU32 GrTexBaseRange_t;
388 #define GR_TEXBASE_256      0x3
389 #define GR_TEXBASE_128      0x2
390 #define GR_TEXBASE_64       0x1
391 #define GR_TEXBASE_32_TO_1  0x0
392
393
394 typedef FxU32 GrEnableMode_t;
395 #define GR_MODE_DISABLE     0x0
396 #define GR_MODE_ENABLE      0x1
397
398 #define GR_AA_ORDERED            0x01
399 #define GR_ALLOW_MIPMAP_DITHER   0x02
400 #define GR_PASSTHRU              0x03
401 #define GR_SHAMELESS_PLUG        0x04
402 #define GR_VIDEO_SMOOTHING       0x05
403
404 typedef FxU32 GrCoordinateSpaceMode_t;
405 #define GR_WINDOW_COORDS    0x00
406 #define GR_CLIP_COORDS      0x01
407
408 /* Types of data in strips */
409 #define GR_FLOAT        0
410 #define GR_U8           1
411
412 /* Parameters for strips */
413 #define GR_PARAM_XY       0x01
414 #define GR_PARAM_Z        0x02
415 #define GR_PARAM_W        0x03
416 #define GR_PARAM_Q        0x04
417 #define GR_PARAM_FOG_EXT  0x05
418
419 #define GR_PARAM_A        0x10
420
421 #define GR_PARAM_RGB      0x20
422
423 #define GR_PARAM_PARGB    0x30
424
425 #define GR_PARAM_ST0      0x40
426 #define GR_PARAM_ST1      GR_PARAM_ST0+1
427 #define GR_PARAM_ST2      GR_PARAM_ST0+2
428
429 #define GR_PARAM_Q0       0x50
430 #define GR_PARAM_Q1       GR_PARAM_Q0+1
431 #define GR_PARAM_Q2       GR_PARAM_Q0+2
432
433 #define GR_PARAM_DISABLE  0x00
434 #define GR_PARAM_ENABLE   0x01
435
436 /*
437 ** grDrawVertexArray/grDrawVertexArrayContiguous primitive type
438 */
439 #define GR_POINTS                        0
440 #define GR_LINE_STRIP                    1
441 #define GR_LINES                         2
442 #define GR_POLYGON                       3
443 #define GR_TRIANGLE_STRIP                4
444 #define GR_TRIANGLE_FAN                  5
445 #define GR_TRIANGLES                     6
446 #define GR_TRIANGLE_STRIP_CONTINUE       7
447 #define GR_TRIANGLE_FAN_CONTINUE         8
448
449 /* 
450 ** grGet/grReset types
451 */
452 #define GR_BITS_DEPTH                   0x01
453 #define GR_BITS_RGBA                    0x02
454 #define GR_FIFO_FULLNESS                0x03
455 #define GR_FOG_TABLE_ENTRIES            0x04
456 #define GR_GAMMA_TABLE_ENTRIES          0x05
457 #define GR_GLIDE_STATE_SIZE             0x06
458 #define GR_GLIDE_VERTEXLAYOUT_SIZE      0x07
459 #define GR_IS_BUSY                      0x08
460 #define GR_LFB_PIXEL_PIPE               0x09
461 #define GR_MAX_TEXTURE_SIZE             0x0a
462 #define GR_MAX_TEXTURE_ASPECT_RATIO     0x0b
463 #define GR_MEMORY_FB                    0x0c
464 #define GR_MEMORY_TMU                   0x0d
465 #define GR_MEMORY_UMA                   0x0e
466 #define GR_NUM_BOARDS                   0x0f
467 #define GR_NON_POWER_OF_TWO_TEXTURES    0x10
468 #define GR_NUM_FB                       0x11
469 #define GR_NUM_SWAP_HISTORY_BUFFER      0x12
470 #define GR_NUM_TMU                      0x13
471 #define GR_PENDING_BUFFERSWAPS          0x14
472 #define GR_REVISION_FB                  0x15
473 #define GR_REVISION_TMU                 0x16
474 #define GR_STATS_LINES                  0x17  /* grGet/grReset */
475 #define GR_STATS_PIXELS_AFUNC_FAIL      0x18
476 #define GR_STATS_PIXELS_CHROMA_FAIL     0x19
477 #define GR_STATS_PIXELS_DEPTHFUNC_FAIL  0x1a
478 #define GR_STATS_PIXELS_IN              0x1b
479 #define GR_STATS_PIXELS_OUT             0x1c
480 #define GR_STATS_PIXELS                 0x1d  /* grReset */
481 #define GR_STATS_POINTS                 0x1e  /* grGet/grReset */
482 #define GR_STATS_TRIANGLES_IN           0x1f
483 #define GR_STATS_TRIANGLES_OUT          0x20
484 #define GR_STATS_TRIANGLES              0x21  /* grReset */
485 #define GR_SWAP_HISTORY                 0x22
486 #define GR_SUPPORTS_PASSTHRU            0x23
487 #define GR_TEXTURE_ALIGN                0x24
488 #define GR_VIDEO_POSITION               0x25
489 #define GR_VIEWPORT                     0x26
490 #define GR_WDEPTH_MIN_MAX               0x27
491 #define GR_ZDEPTH_MIN_MAX               0x28
492 #define GR_VERTEX_PARAMETER             0x29
493 #define GR_BITS_GAMMA                   0x2a
494 #define GR_GET_RESERVED_1               0x1000
495
496 /*
497 ** grGetString types
498 */
499 #define GR_EXTENSION                    0xa0
500 #define GR_HARDWARE                     0xa1
501 #define GR_RENDERER                     0xa2
502 #define GR_VENDOR                       0xa3
503 #define GR_VERSION                      0xa4
504
505 /*
506 ** -----------------------------------------------------------------------
507 ** STRUCTURES
508 ** -----------------------------------------------------------------------
509 */
510
511 typedef struct {
512     GrLOD_t           smallLodLog2;
513     GrLOD_t           largeLodLog2;
514     GrAspectRatio_t   aspectRatioLog2;
515     GrTextureFormat_t format;
516     void              *data;
517 } GrTexInfo;
518
519 typedef struct GrSstPerfStats_s {
520   FxU32  pixelsIn;              /* # pixels processed (minus buffer clears) */
521   FxU32  chromaFail;            /* # pixels not drawn due to chroma key */ 
522   FxU32  zFuncFail;             /* # pixels not drawn due to Z comparison */
523   FxU32  aFuncFail;             /* # pixels not drawn due to alpha comparison */
524   FxU32  pixelsOut;             /* # pixels drawn (including buffer clears) */
525 } GrSstPerfStats_t;
526
527 typedef struct {
528   GrScreenResolution_t resolution;
529   GrScreenRefresh_t    refresh;
530   int                  numColorBuffers;
531   int                  numAuxBuffers;
532 } GrResolution;
533
534 typedef GrResolution GlideResolution;
535
536 #define GR_QUERY_ANY  ((FxU32)(~0))
537
538 typedef FxU32 GrLfbSrcFmt_t;
539 #define GR_LFB_SRC_FMT_565          0x00
540 #define GR_LFB_SRC_FMT_555          0x01
541 #define GR_LFB_SRC_FMT_1555         0x02
542 #define GR_LFB_SRC_FMT_888          0x04
543 #define GR_LFB_SRC_FMT_8888         0x05
544 #define GR_LFB_SRC_FMT_565_DEPTH    0x0c
545 #define GR_LFB_SRC_FMT_555_DEPTH    0x0d
546 #define GR_LFB_SRC_FMT_1555_DEPTH   0x0e
547 #define GR_LFB_SRC_FMT_ZA16         0x0f
548 #define GR_LFB_SRC_FMT_RLE16        0x80
549
550 #ifdef H3D
551 #define GR_HINT_H3DENABLE               4
552 #undef  GR_HINTTYPE_MAX
553 #define GR_HINTTYPE_MAX 4
554 #endif
555
556 /*
557 ** -----------------------------------------------------------------------
558 ** FUNCTION PROTOTYPES
559 ** -----------------------------------------------------------------------
560 */
561 #ifndef FX_GLIDE_NO_FUNC_PROTO
562 /*
563 ** rendering functions
564 */
565 FX_ENTRY void FX_CALL
566 grDrawPoint( const void *pt );
567
568 FX_ENTRY void FX_CALL
569 grDrawLine( const void *v1, const void *v2 );
570
571 FX_ENTRY void FX_CALL
572 grDrawTriangle( const void *a, const void *b, const void *c );
573
574 FX_ENTRY void FX_CALL
575 grVertexLayout(FxU32 param, FxI32 offset, FxU32 mode);
576
577 FX_ENTRY void FX_CALL 
578 grDrawVertexArray(FxU32 mode, FxU32 Count, void *pointers);
579
580 FX_ENTRY void FX_CALL 
581 grDrawVertexArrayContiguous(FxU32 mode, FxU32 Count, void *pointers, FxU32 stride);
582
583 /*
584 **  Antialiasing Functions
585 */
586
587 FX_ENTRY void FX_CALL
588 grAADrawTriangle(
589                  const void *a, const void *b, const void *c,
590                  FxBool ab_antialias, FxBool bc_antialias, FxBool ca_antialias
591                  );
592
593 /*
594 ** buffer management
595 */
596 FX_ENTRY void FX_CALL
597 grBufferClear( GrColor_t color, GrAlpha_t alpha, FxU32 depth );
598
599 FX_ENTRY void FX_CALL
600 grBufferSwap( FxU32 swap_interval );
601
602 FX_ENTRY void FX_CALL
603 grRenderBuffer( GrBuffer_t buffer );
604
605 /*
606 ** error management
607 */
608 typedef void (*GrErrorCallbackFnc_t)( const char *string, FxBool fatal );
609
610 FX_ENTRY void FX_CALL 
611 grErrorSetCallback( GrErrorCallbackFnc_t fnc );
612
613 /*
614 ** SST routines
615 */
616 FX_ENTRY void FX_CALL 
617 grFinish(void);
618
619 FX_ENTRY void FX_CALL 
620 grFlush(void);
621
622 FX_ENTRY GrContext_t FX_CALL 
623 grSstWinOpen(
624           HWND                 hWnd,
625           GrScreenResolution_t screen_resolution,
626           GrScreenRefresh_t    refresh_rate,
627           GrColorFormat_t      color_format,
628           GrOriginLocation_t   origin_location,
629           int                  nColBuffers,
630           int                  nAuxBuffers);
631
632 FX_ENTRY FxBool FX_CALL
633 grSstWinClose( GrContext_t context );
634
635 FX_ENTRY void FX_CALL
636 grSetNumPendingBuffers(FxI32 NumPendingBuffers);
637
638 FX_ENTRY FxBool FX_CALL
639 grSelectContext( GrContext_t context );
640
641 FX_ENTRY void FX_CALL
642 grSstOrigin(GrOriginLocation_t  origin);
643
644 FX_ENTRY void FX_CALL 
645 grSstSelect( int which_sst );
646
647 /*
648 ** Glide configuration and special effect maintenance functions
649 */
650 FX_ENTRY void FX_CALL
651 grAlphaBlendFunction(
652                      GrAlphaBlendFnc_t rgb_sf,   GrAlphaBlendFnc_t rgb_df,
653                      GrAlphaBlendFnc_t alpha_sf, GrAlphaBlendFnc_t alpha_df
654                      );
655
656 FX_ENTRY void FX_CALL
657 grAlphaCombine(
658                GrCombineFunction_t function, GrCombineFactor_t factor,
659                GrCombineLocal_t local, GrCombineOther_t other,
660                FxBool invert
661                );
662
663 FX_ENTRY void FX_CALL
664 grAlphaControlsITRGBLighting( FxBool enable );
665
666 FX_ENTRY void FX_CALL
667 grAlphaTestFunction( GrCmpFnc_t function );
668
669 FX_ENTRY void FX_CALL
670 grAlphaTestReferenceValue( GrAlpha_t value );
671
672 FX_ENTRY void FX_CALL 
673 grChromakeyMode( GrChromakeyMode_t mode );
674
675 FX_ENTRY void FX_CALL 
676 grChromakeyValue( GrColor_t value );
677
678 FX_ENTRY void FX_CALL 
679 grClipWindow( FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy );
680
681 FX_ENTRY void FX_CALL 
682 grColorCombine(
683                GrCombineFunction_t function, GrCombineFactor_t factor,
684                GrCombineLocal_t local, GrCombineOther_t other,
685                FxBool invert );
686
687 FX_ENTRY void FX_CALL
688 grColorMask( FxBool rgb, FxBool a );
689
690 FX_ENTRY void FX_CALL 
691 grCullMode( GrCullMode_t mode );
692
693 FX_ENTRY void FX_CALL 
694 grConstantColorValue( GrColor_t value );
695
696 FX_ENTRY void FX_CALL 
697 grDepthBiasLevel( FxI32 level );
698
699 FX_ENTRY void FX_CALL 
700 grDepthBufferFunction( GrCmpFnc_t function );
701
702 FX_ENTRY void FX_CALL 
703 grDepthBufferMode( GrDepthBufferMode_t mode );
704
705 FX_ENTRY void FX_CALL 
706 grDepthMask( FxBool mask );
707
708 FX_ENTRY void FX_CALL 
709 grDisableAllEffects( void );
710
711 FX_ENTRY void FX_CALL 
712 grDitherMode( GrDitherMode_t mode );
713
714 FX_ENTRY void FX_CALL 
715 grFogColorValue( GrColor_t fogcolor );
716
717 FX_ENTRY void FX_CALL 
718 grFogMode( GrFogMode_t mode );
719
720 FX_ENTRY void FX_CALL 
721 grFogTable( const GrFog_t ft[] );
722
723 FX_ENTRY void FX_CALL 
724 grLoadGammaTable( FxU32 nentries, FxU32 *red, FxU32 *green, FxU32 *blue);
725
726 FX_ENTRY void FX_CALL
727 grSplash(float x, float y, float width, float height, FxU32 frame);
728
729 FX_ENTRY FxU32 FX_CALL 
730 grGet( FxU32 pname, FxU32 plength, FxI32 *params );
731
732 FX_ENTRY const char * FX_CALL 
733 grGetString( FxU32 pname );
734
735 FX_ENTRY FxI32 FX_CALL 
736 grQueryResolutions( const GrResolution *resTemplate, GrResolution *output );
737
738 FX_ENTRY FxBool FX_CALL 
739 grReset( FxU32 what );
740
741 FX_ENTRY GrProc FX_CALL
742 grGetProcAddress( char *procName );
743
744 FX_ENTRY void FX_CALL 
745 grEnable( GrEnableMode_t mode );
746
747 FX_ENTRY void FX_CALL 
748 grDisable( GrEnableMode_t mode );
749
750 FX_ENTRY void FX_CALL 
751 grCoordinateSpace( GrCoordinateSpaceMode_t mode );
752
753 FX_ENTRY void FX_CALL 
754 grDepthRange( FxFloat n, FxFloat f );
755
756 FX_ENTRY void FX_CALL 
757 grStippleMode( GrStippleMode_t mode );
758
759 FX_ENTRY void FX_CALL 
760 grStipplePattern( GrStipplePattern_t mode );
761
762 FX_ENTRY void FX_CALL 
763 grViewport( FxI32 x, FxI32 y, FxI32 width, FxI32 height );
764
765 /*
766 ** texture mapping control functions
767 */
768 FX_ENTRY FxU32 FX_CALL 
769 grTexCalcMemRequired(
770                      GrLOD_t lodmin, GrLOD_t lodmax,
771                      GrAspectRatio_t aspect, GrTextureFormat_t fmt);
772
773 FX_ENTRY FxU32 FX_CALL 
774 grTexTextureMemRequired( FxU32     evenOdd,
775                                  GrTexInfo *info   );
776
777 FX_ENTRY FxU32 FX_CALL 
778 grTexMinAddress( GrChipID_t tmu );
779
780 FX_ENTRY FxU32 FX_CALL 
781 grTexMaxAddress( GrChipID_t tmu );
782
783 FX_ENTRY void FX_CALL 
784 grTexNCCTable( GrNCCTable_t table );
785
786 FX_ENTRY void FX_CALL 
787 grTexSource( GrChipID_t tmu,
788              FxU32      startAddress,
789              FxU32      evenOdd,
790              GrTexInfo  *info );
791
792 FX_ENTRY void FX_CALL 
793 grTexClampMode(
794                GrChipID_t tmu,
795                GrTextureClampMode_t s_clampmode,
796                GrTextureClampMode_t t_clampmode
797                );
798
799 FX_ENTRY void FX_CALL 
800 grTexCombine(
801              GrChipID_t tmu,
802              GrCombineFunction_t rgb_function,
803              GrCombineFactor_t rgb_factor, 
804              GrCombineFunction_t alpha_function,
805              GrCombineFactor_t alpha_factor,
806              FxBool rgb_invert,
807              FxBool alpha_invert
808              );
809
810 FX_ENTRY void FX_CALL 
811 grTexDetailControl(
812                    GrChipID_t tmu,
813                    int lod_bias,
814                    FxU8 detail_scale,
815                    float detail_max
816                    );
817
818 FX_ENTRY void FX_CALL 
819 grTexFilterMode(
820                 GrChipID_t tmu,
821                 GrTextureFilterMode_t minfilter_mode,
822                 GrTextureFilterMode_t magfilter_mode
823                 );
824
825
826 FX_ENTRY void FX_CALL 
827 grTexLodBiasValue(GrChipID_t tmu, float bias );
828
829 FX_ENTRY void FX_CALL 
830 grTexDownloadMipMap( GrChipID_t tmu,
831                      FxU32      startAddress,
832                      FxU32      evenOdd,
833                      GrTexInfo  *info );
834
835 FX_ENTRY void FX_CALL 
836 grTexDownloadMipMapLevel( GrChipID_t        tmu,
837                           FxU32             startAddress,
838                           GrLOD_t           thisLod,
839                           GrLOD_t           largeLod,
840                           GrAspectRatio_t   aspectRatio,
841                           GrTextureFormat_t format,
842                           FxU32             evenOdd,
843                           void              *data );
844
845 FX_ENTRY FxBool FX_CALL 
846 grTexDownloadMipMapLevelPartial( GrChipID_t        tmu,
847                                  FxU32             startAddress,
848                                  GrLOD_t           thisLod,
849                                  GrLOD_t           largeLod,
850                                  GrAspectRatio_t   aspectRatio,
851                                  GrTextureFormat_t format,
852                                  FxU32             evenOdd,
853                                  void              *data,
854                                  int               start,
855                                  int               end );
856
857 FX_ENTRY void FX_CALL
858 grTexDownloadTable( GrTexTable_t type, 
859                     void         *data );
860
861 FX_ENTRY void FX_CALL
862 grTexDownloadTablePartial( GrTexTable_t type, 
863                            void         *data,
864                            int          start,
865                            int          end );
866
867 FX_ENTRY void FX_CALL 
868 grTexMipMapMode( GrChipID_t     tmu, 
869                  GrMipMapMode_t mode,
870                  FxBool         lodBlend );
871
872 FX_ENTRY void FX_CALL 
873 grTexMultibase( GrChipID_t tmu,
874                 FxBool     enable );
875
876 FX_ENTRY void FX_CALL
877 grTexMultibaseAddress( GrChipID_t       tmu,
878                        GrTexBaseRange_t range,
879                        FxU32            startAddress,
880                        FxU32            evenOdd,
881                        GrTexInfo        *info );
882
883 /*
884 ** linear frame buffer functions
885 */
886
887 FX_ENTRY FxBool FX_CALL
888 grLfbLock( GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode,
889            GrOriginLocation_t origin, FxBool pixelPipeline, 
890            GrLfbInfo_t *info );
891
892 FX_ENTRY FxBool FX_CALL
893 grLfbUnlock( GrLock_t type, GrBuffer_t buffer );
894
895 FX_ENTRY void FX_CALL 
896 grLfbConstantAlpha( GrAlpha_t alpha );
897
898 FX_ENTRY void FX_CALL 
899 grLfbConstantDepth( FxU32 depth );
900
901 FX_ENTRY void FX_CALL 
902 grLfbWriteColorSwizzle(FxBool swizzleBytes, FxBool swapWords);
903
904 FX_ENTRY void FX_CALL
905 grLfbWriteColorFormat(GrColorFormat_t colorFormat);
906
907 FX_ENTRY FxBool FX_CALL
908 grLfbWriteRegion( GrBuffer_t dst_buffer, 
909                   FxU32 dst_x, FxU32 dst_y, 
910                   GrLfbSrcFmt_t src_format, 
911                   FxU32 src_width, FxU32 src_height, 
912                   FxBool pixelPipeline,
913                   FxI32 src_stride, void *src_data );
914
915 FX_ENTRY FxBool FX_CALL
916 grLfbReadRegion( GrBuffer_t src_buffer,
917                  FxU32 src_x, FxU32 src_y,
918                  FxU32 src_width, FxU32 src_height,
919                  FxU32 dst_stride, void *dst_data );
920
921 /*
922 ** glide management functions
923 */
924 FX_ENTRY void FX_CALL
925 grGlideInit( void );
926
927 FX_ENTRY void FX_CALL
928 grGlideShutdown( void );
929
930 FX_ENTRY void FX_CALL
931 grGlideGetState( void *state );
932
933 FX_ENTRY void FX_CALL
934 grGlideSetState( const void *state );
935
936 FX_ENTRY void FX_CALL
937 grGlideGetVertexLayout( void *layout );
938
939 FX_ENTRY void FX_CALL
940 grGlideSetVertexLayout( const void *layout );
941
942 #endif /* FX_GLIDE_NO_FUNC_PROTO */
943
944 #ifdef __cplusplus
945 }
946 #endif
947
948 #include <glideutl.h>
949
950 #endif /* __GLIDE_H__ */