]> icculus.org git repositories - taylor/freespace2.git/blob - src/glide/glide.cpp
Initial revision
[taylor/freespace2.git] / src / glide / glide.cpp
1 /*
2  * $Logfile: /Freespace2/code/glide/Glide.cpp $
3  * $Revision$
4  * $Date$
5  * $Author$
6  *
7  * Code for dynamically loading glide libraries
8  *
9  * $Log$
10  * Revision 1.1  2002/05/03 03:28:09  root
11  * Initial revision
12  *
13  * 
14  * 3     11/11/98 5:37p Dave
15  * Checkin for multiplayer testing.
16  * 
17  * 2     10/07/98 10:52a Dave
18  * Initial checkin.
19  * 
20  * 1     10/07/98 10:48a Dave
21  * 
22  * 4     3/18/98 1:57p John
23  * Made non-perspective correct textures do 2d clipping before rendering.
24  * 
25  * 3     2/21/98 11:58a John
26  * Put in some stuff to externalize strings
27  * 
28  * 2     2/19/98 6:13p John
29  * Made Glide do texturing & zbuffering.
30  * 
31  * 1     1/05/98 10:38a John
32  *
33  * $NoKeywords: $
34  */
35
36 #define __MSC__
37 #include <windows.h>
38 #include <windowsx.h>
39
40 #include "glide.h"
41 #include "pstypes.h"
42
43 static HMODULE Glide_lib_handle;
44
45 void vglide_close()
46 {
47         if ( Glide_lib_handle ) {
48                 FreeLibrary(Glide_lib_handle);
49                 Glide_lib_handle = NULL;
50         }       
51 }
52
53 // Returns 1 if Glide found, else 0 if not
54 int vglide_init()
55 {
56         HMODULE lib_handle;
57         Glide_lib_handle = LoadLibrary(NOX("glide2x.dll"));
58         if (Glide_lib_handle == NULL) {
59                 //No lib so no glide
60                 return 0;
61         }
62
63         lib_handle = Glide_lib_handle;
64
65         //XSTR:OFF
66
67         grDrawLine = (void (__stdcall*)(const GrVertex *, const GrVertex *))GetProcAddress(lib_handle, "_grDrawLine@8");
68         grDrawPlanarPolygon = (void (__stdcall *)(int,const int [],const GrVertex []))GetProcAddress(lib_handle, "_grDrawPlanarPolygon@12");
69         grDrawPlanarPolygonVertexList = (void (__stdcall *)(int,const GrVertex []))GetProcAddress(lib_handle, "_grDrawPlanarPolygonVertexList@8");
70         grDrawPoint = (void (__stdcall *)(const GrVertex *))GetProcAddress(lib_handle, "_grDrawPoint@4");
71         grDrawPolygon = (void (__stdcall *)(int,const int [],const GrVertex []))GetProcAddress(lib_handle, "_grDrawPolygon@12");
72         grDrawPolygonVertexList = (void (__stdcall *)(int,const GrVertex []))GetProcAddress(lib_handle, "_grDrawPolygonVertexList@8");
73         grDrawTriangle = (void (__stdcall *)(const GrVertex *,const GrVertex *,const GrVertex *))GetProcAddress(lib_handle, "_grDrawTriangle@12");
74         guDrawTriangleWithClip = (void (__stdcall *)(const GrVertex *,const GrVertex *,const GrVertex *))GetProcAddress(lib_handle, "_guDrawTriangleWithClip@12");
75         grBufferClear = (void (__stdcall *)(unsigned long,unsigned char,unsigned short))GetProcAddress(lib_handle, "_grBufferClear@12");
76         grBufferNumPending = GetProcAddress(lib_handle, "_grBufferNumPending@0");
77         grBufferSwap = (void (__stdcall *)(int))GetProcAddress(lib_handle, "_grBufferSwap@4");
78         grRenderBuffer = (void (__stdcall *)(long))GetProcAddress(lib_handle, "_grRenderBuffer@4");
79
80         grErrorSetCallback = (void (__stdcall *)(void (__cdecl *)(const char *,int)))GetProcAddress(lib_handle, "_grErrorSetCallback@4");
81         grSstIdle = (void (__stdcall *)(void))GetProcAddress(lib_handle, "_grSstIdle@0");
82         grSstVideoLine = (unsigned long (__stdcall *)(void))GetProcAddress(lib_handle, "_grSstVideoLine@0");
83         grSstVRetraceOn = (int (__stdcall *)(void))GetProcAddress(lib_handle, "_grSstVRetraceOn@0");
84         grSstIsBusy = (int (__stdcall *)(void))GetProcAddress(lib_handle, "_grSstIsBusy@0");
85         grSstWinOpen = (int (__stdcall *)(unsigned long,long,long,long,long,int,int))GetProcAddress(lib_handle, "_grSstWinOpen@28");
86         grSstWinClose = (void (__stdcall *)(void))GetProcAddress(lib_handle, "_grSstWinClose@0");
87         grSstControl = (int (__stdcall *)(unsigned long))GetProcAddress(lib_handle, "_grSstControl@4");
88         grSstQueryHardware = (int (__stdcall *)(GrHwConfiguration *))GetProcAddress(lib_handle, "_grSstQueryHardware@4");
89         grSstQueryBoards = (int (__stdcall *)(GrHwConfiguration *))GetProcAddress(lib_handle, "_grSstQueryBoards@4");
90
91         grSstOrigin = (void (__stdcall *)(long))GetProcAddress(lib_handle, "_grSstOrigin@4");
92         grSstSelect = (void (__stdcall *)(int))GetProcAddress(lib_handle, "_grSstSelect@4");
93         grSstScreenHeight = (unsigned long (__stdcall *)(void))GetProcAddress(lib_handle, "_grSstScreenHeight@0");
94         grSstScreenWidth = (unsigned long (__stdcall *)(void))GetProcAddress(lib_handle, "_grSstScreenWidth@0");
95         grSstStatus = (unsigned long (__stdcall *)(void))GetProcAddress(lib_handle, "_grSstStatus@0");
96         grSstPerfStats = (void (__stdcall *)(struct GrSstPerfStats_s *))GetProcAddress(lib_handle, "_grSstPerfStats@4");
97         grSstResetPerfStats = (void (__stdcall *)(void))GetProcAddress(lib_handle, "_grSstResetPerfStats@0");
98         grResetTriStats = (void (__stdcall *)(void))GetProcAddress(lib_handle, "_grResetTriStats@0");
99         grTriStats = (void (__stdcall *)(unsigned long *,unsigned long *))GetProcAddress(lib_handle, "_grTriStats@8");
100         grAlphaBlendFunction = (void (__stdcall *)(long,long,long,long))GetProcAddress(lib_handle, "_grAlphaBlendFunction@16");
101
102         grAlphaCombine = (void (__stdcall *)(long,long,long,long,int))GetProcAddress(lib_handle, "_grAlphaCombine@20");
103         grAlphaControlsITRGBLighting = (void (__stdcall *)(int))GetProcAddress(lib_handle, "_grAlphaControlsITRGBLighting@4");
104         grAlphaTestFunction = (void (__stdcall *)(long))GetProcAddress(lib_handle, "_grAlphaTestFunction@4");
105         grAlphaTestReferenceValue = (void (__stdcall *)(unsigned char))GetProcAddress(lib_handle, "_grAlphaTestReferenceValue@4");
106         grChromakeyMode = (void (__stdcall *)(long))GetProcAddress(lib_handle, "_grChromakeyMode@4");
107         grChromakeyValue = (void (__stdcall *)(unsigned long))GetProcAddress(lib_handle, "_grChromakeyValue@4");
108         grClipWindow = (void (__stdcall *)(unsigned long,unsigned long,unsigned long,unsigned long))GetProcAddress(lib_handle, "_grClipWindow@16");
109
110         grColorCombine = (void (__stdcall *)(long,long,long,long,int))GetProcAddress(lib_handle, "_grColorCombine@20");
111         grColorMask = (void (__stdcall *)(int,int))GetProcAddress(lib_handle, "_grColorMask@8");
112         grCullMode = (void (__stdcall *)(long))GetProcAddress(lib_handle, "_grCullMode@4");
113         grConstantColorValue = (void (__stdcall *)(unsigned long))GetProcAddress(lib_handle, "_grConstantColorValue@4");
114         grConstantColorValue4 = (void (__stdcall *)(float,float,float,float))GetProcAddress(lib_handle, "_grConstantColorValue4@16");
115         grDepthBiasLevel = (void (__stdcall *)(short))GetProcAddress(lib_handle, "_grDepthBiasLevel@4");
116         grDepthBufferFunction = (void (__stdcall *)(long))GetProcAddress(lib_handle, "_grDepthBufferFunction@4");
117         grDepthBufferMode = (void (__stdcall *)(long))GetProcAddress(lib_handle, "_grDepthBufferMode@4");
118         grDepthMask = (void (__stdcall *)(int))GetProcAddress(lib_handle, "_grDepthMask@4");
119         grDisableAllEffects = (void (__stdcall *)(void))GetProcAddress(lib_handle, "_grDisableAllEffects@0");
120         grDitherMode = (void (__stdcall *)(long))GetProcAddress(lib_handle, "_grDitherMode@4");
121
122         grFogColorValue = (void (__stdcall *)(unsigned long))GetProcAddress(lib_handle, "_grFogColorValue@4");
123         grFogMode = (void (__stdcall *)(long))GetProcAddress(lib_handle, "_grFogMode@4");
124         grFogTable = (void (__stdcall *)(const unsigned char []))GetProcAddress(lib_handle, "_grFogTable@4");
125         grGammaCorrectionValue = (void (__stdcall *)(float))GetProcAddress(lib_handle, "_grGammaCorrectionValue@4");
126         grSplash = (void (__stdcall *)(float,float,float,float,unsigned long))GetProcAddress(lib_handle, "_grSplash@20");
127
128         grTexCalcMemRequired = (unsigned long (__stdcall *)(long,long,long,long))GetProcAddress(lib_handle, "_grTexCalcMemRequired@16");
129         grTexTextureMemRequired = (unsigned long (__stdcall *)(unsigned long,GrTexInfo *))GetProcAddress(lib_handle, "_grTexTextureMemRequired@8");
130         grTexMinAddress = (unsigned long (__stdcall *)(long))GetProcAddress(lib_handle, "_grTexMinAddress@4");
131         grTexMaxAddress = (unsigned long (__stdcall *)(long))GetProcAddress(lib_handle, "_grTexMaxAddress@4");
132         grTexNCCTable = (void (__stdcall *)(long,unsigned long))GetProcAddress(lib_handle, "_grTexNCCTable@8");
133         grTexSource = (void (__stdcall *)(long,unsigned long,unsigned long,GrTexInfo *))GetProcAddress(lib_handle, "_grTexSource@16");
134         grTexClampMode = (void (__stdcall *)(long,long,long))GetProcAddress(lib_handle, "_grTexClampMode@12");
135         grTexCombine = (void (__stdcall *)(long,long,long,long,long,int,int))GetProcAddress(lib_handle, "_grTexCombine@28");
136         grTexCombineFunction = (void (__stdcall *)(long,long))GetProcAddress(lib_handle, "_grTexCombineFunction@8");
137         grTexDetailControl = (void (__stdcall *)(long,int,unsigned char,float))GetProcAddress(lib_handle, "_grTexDetailControl@16");
138         grTexFilterMode = (void (__stdcall *)(long,long,long))GetProcAddress(lib_handle, "_grTexFilterMode@12");
139         grTexLodBiasValue = (void (__stdcall *)(long,float))GetProcAddress(lib_handle, "_grTexLodBiasValue@8");
140         grTexDownloadMipMap = (void (__stdcall *)(long,unsigned long,unsigned long,GrTexInfo *))GetProcAddress(lib_handle, "_grTexDownloadMipMap@16");
141         grTexDownloadMipMapLevel = (void (__stdcall *)(long,unsigned long,long,long,long,long,unsigned long,void *))GetProcAddress(lib_handle, "_grTexDownloadMipMapLevel@32");
142         grTexDownloadMipMapLevelPartial = (void (__stdcall *)(long,unsigned long,long,long,long,long,unsigned long,void *,int,int))GetProcAddress(lib_handle, "_grTexDownloadMipMapLevelPartial@40");
143         ConvertAndDownloadRle = (void (__stdcall *)(long,unsigned long,long,long,long,long,unsigned long,unsigned char *,long,unsigned long,unsigned long,unsigned long,unsigned long,unsigned long,unsigned long,unsigned short *))GetProcAddress(lib_handle, "_ConvertAndDownloadRle@64");
144
145         grCheckForRoom = (void (__stdcall *)(long))GetProcAddress(lib_handle, "_grCheckForRoom@4");
146         grTexDownloadTable = (void (__stdcall *)(long,unsigned long,void *))GetProcAddress(lib_handle, "_grTexDownloadTable@12");
147         grTexDownloadTablePartial = (void (__stdcall *)(long,unsigned long,void *,int,int))GetProcAddress(lib_handle, "_grTexDownloadTablePartial@20");
148         grTexMipMapMode = (void (__stdcall *)(long,long,int))GetProcAddress(lib_handle, "_grTexMipMapMode@12");
149         grTexMultibase = (void (__stdcall *)(long,int))GetProcAddress(lib_handle, "_grTexMultibase@8");
150         grTexMultibaseAddress = (void (__stdcall *)(long,unsigned long,unsigned long,unsigned long,GrTexInfo *))GetProcAddress(lib_handle, "_grTexMultibaseAddress@20");
151
152         guTexAllocateMemory = (unsigned long (__stdcall *)(long,unsigned char,int,int,long,long,long,long,long,long,long,long,long,float,int))GetProcAddress(lib_handle, "_guTexAllocateMemory@60");
153         guTexChangeAttributes = (int (__stdcall *)(unsigned long,int,int,long,long,long,long,long,long,long,long,long))GetProcAddress(lib_handle, "_guTexChangeAttributes@48");
154         guTexCombineFunction = (void (__stdcall *)(long,long))GetProcAddress(lib_handle, "_guTexCombineFunction@8");
155         guTexGetCurrentMipMap = (unsigned long (__stdcall *)(long))GetProcAddress(lib_handle, "_guTexGetCurrentMipMap@4");
156         guTexGetMipMapInfo = (GrMipMapInfo *(__stdcall *)(unsigned long))GetProcAddress(lib_handle, "_guTexGetMipMapInfo@4");
157         guTexMemQueryAvail = (unsigned long (__stdcall *)(long))GetProcAddress(lib_handle, "_guTexMemQueryAvail@4");
158         guTexMemReset = (void (__stdcall *)(void))GetProcAddress(lib_handle, "_guTexMemReset@0");
159         guTexDownloadMipMap = (void (__stdcall *)(unsigned long,const void *,const GuNccTable *))GetProcAddress(lib_handle, "_guTexDownloadMipMap@12");
160         guTexDownloadMipMapLevel = (void (__stdcall *)(unsigned long,long,const void ** ))GetProcAddress(lib_handle, "_guTexDownloadMipMapLevel@12");
161         guTexSource = (void (__stdcall *)(unsigned long))GetProcAddress(lib_handle, "_guTexSource@4");
162         guColorCombineFunction = (void (__stdcall *)(long))GetProcAddress(lib_handle, "_guColorCombineFunction@4");
163
164         grLfbLock = (int (__stdcall *)(unsigned long,long,long,long,int,GrLfbInfo_t *))GetProcAddress(lib_handle, "_grLfbLock@24");
165         grLfbUnlock = (int (__stdcall *)(unsigned long,long))GetProcAddress(lib_handle, "_grLfbUnlock@8");
166         grLfbConstantAlpha = (void (__stdcall *)(unsigned char))GetProcAddress(lib_handle, "_grLfbConstantAlpha@4");
167         grLfbConstantDepth = (void (__stdcall *)(unsigned short))GetProcAddress(lib_handle, "_grLfbConstantDepth@4");
168         grLfbWriteColorSwizzle = (void (__stdcall *)(int,int))GetProcAddress(lib_handle, "_grLfbWriteColorSwizzle@8");
169         grLfbWriteColorFormat = (void (__stdcall *)(long))GetProcAddress(lib_handle, "_grLfbWriteColorFormat@4");
170         grLfbWriteRegion = (int (__stdcall *)(long,unsigned long,unsigned long,unsigned long,unsigned long,unsigned long,long,void *))GetProcAddress(lib_handle, "_grLfbWriteRegion@32");
171         grLfbReadRegion = (int (__stdcall *)(long,unsigned long,unsigned long,unsigned long,unsigned long,unsigned long,void *))GetProcAddress(lib_handle, "_grLfbReadRegion@28");
172
173         grAADrawLine = (void (__stdcall *)(const GrVertex *,const GrVertex *))GetProcAddress(lib_handle, "_grAADrawLine@8");
174         grAADrawPoint = (void (__stdcall *)(const GrVertex *))GetProcAddress(lib_handle, "_grAADrawPoint@4");
175         grAADrawPolygon = (void (__stdcall *)(const int,const int [],const GrVertex []))GetProcAddress(lib_handle, "_grAADrawPolygon@12");
176         grAADrawPolygonVertexList = (void (__stdcall *)(const int,const GrVertex []))GetProcAddress(lib_handle, "_grAADrawPolygonVertexList@8");
177         grAADrawTriangle = (void (__stdcall *)(const GrVertex *,const GrVertex *,const GrVertex *,int,int,int))GetProcAddress(lib_handle, "_grAADrawTriangle@24");
178
179         grGlideInit = (void (__stdcall *)(void))GetProcAddress(lib_handle, "_grGlideInit@0");
180         grGlideShutdown = (void (__stdcall *)(void))GetProcAddress(lib_handle, "_grGlideShutdown@0");
181         grGlideGetVersion = (void (__stdcall *)(char []))GetProcAddress(lib_handle, "_grGlideGetVersion@4");
182         grGlideGetState = (void (__stdcall *)(struct _GrState_s *))GetProcAddress(lib_handle, "_grGlideGetState@4");
183         grGlideSetState = (void (__stdcall *)(const struct _GrState_s *))GetProcAddress(lib_handle, "_grGlideSetState@4");
184         grGlideShamelessPlug = (void (__stdcall *)(const int))GetProcAddress(lib_handle, "_grGlideShamelessPlug@4");
185         grHints = (void (__stdcall *)(unsigned long,unsigned long))GetProcAddress(lib_handle, "_grHints@8");
186
187         guFogTableIndexToW = (float (__stdcall *)(int))GetProcAddress(lib_handle, "_guFogTableIndexToW@4");
188         guFogGenerateExp = (void (__stdcall *)( GrFog_t fogtable[GR_FOG_TABLE_SIZE], float))GetProcAddress(lib_handle, "_guFogGenerateExp@8");
189         guFogGenerateExp2 = (void (__stdcall *)(GrFog_t fogtable[GR_FOG_TABLE_SIZE], float))GetProcAddress(lib_handle, "_guFogGenerateExp2@8");
190         guFogGenerateLinear = (void (__stdcall *)(GrFog_t fogtable[GR_FOG_TABLE_SIZE], float , float))GetProcAddress(lib_handle, "_guFogGenerateLinear@12");
191
192         //XSTR:ON
193
194         return 1;
195 }
196
197
198 void (__stdcall *grDrawLine)(const GrVertex *v1, const GrVertex *v2) = NULL;
199 void (__stdcall *grDrawPlanarPolygon)(int nverts, const int ilist[], const GrVertex vlist[]) = NULL;
200 void (__stdcall *grDrawPlanarPolygonVertexList)(int nverts, const GrVertex vlist[]) = NULL;
201 void (__stdcall *grDrawPoint)(const GrVertex *pt) = NULL;
202 void (__stdcall *grDrawPolygon)(int nverts, const int ilist[], const GrVertex vlist[]) = NULL;
203 void (__stdcall *grDrawPolygonVertexList)(int nverts, const GrVertex vlist[]) = NULL;
204 void (__stdcall *grDrawTriangle)(const GrVertex *a, const GrVertex *b, const GrVertex *c) = NULL;
205 void (__stdcall *guDrawTriangleWithClip)(const GrVertex *a, const GrVertex *b, const GrVertex *c) = NULL;
206 void (__stdcall *grBufferClear)(GrColor_t color, GrAlpha_t alpha, FxU16 depth) = NULL;
207 int (__stdcall *grBufferNumPending)(void) = NULL;
208 void (__stdcall *grBufferSwap)(int swap_interval) = NULL;
209 void (__stdcall *grRenderBuffer)(GrBuffer_t buffer) = NULL;
210
211 typedef void (*GrErrorCallbackFnc_t)(const char *string, FxBool fatal);
212
213 void (__stdcall *grErrorSetCallback)(GrErrorCallbackFnc_t fnc) = NULL;
214 void (__stdcall *grSstIdle)(void) = NULL;
215 FxU32 (__stdcall *grSstVideoLine)(void) = NULL;
216 FxBool (__stdcall *grSstVRetraceOn)(void) = NULL;
217 FxBool (__stdcall *grSstIsBusy)(void) = NULL;
218 FxBool (__stdcall *grSstWinOpen)(
219           FxU32                hWnd,
220           GrScreenResolution_t screen_resolution,
221           GrScreenRefresh_t    refresh_rate,
222           GrColorFormat_t      color_format,
223           GrOriginLocation_t   origin_location,
224           int                  nColBuffers,
225           int                  nAuxBuffers) = NULL;
226 void (__stdcall *grSstWinClose)(void) = NULL;
227 FxBool (__stdcall *grSstControl)(FxU32 code) = NULL;
228 FxBool (__stdcall *grSstQueryHardware)(GrHwConfiguration *hwconfig) = NULL;
229 FxBool (__stdcall *grSstQueryBoards)(GrHwConfiguration *hwconfig) = NULL;
230 void (__stdcall *grSstOrigin)(GrOriginLocation_t origin) = NULL;
231 void (__stdcall *grSstSelect)(int which_sst) = NULL;
232 FxU32 (__stdcall *grSstScreenHeight)(void) = NULL;
233 FxU32 (__stdcall *grSstScreenWidth)(void) = NULL;
234 FxU32 (__stdcall *grSstStatus)(void) = NULL;
235 void (__stdcall *grSstPerfStats)(GrSstPerfStats_t *pStats) = NULL;
236 void (__stdcall *grSstResetPerfStats)(void) = NULL;
237 void (__stdcall *grResetTriStats)() = NULL;
238 void (__stdcall *grTriStats)(FxU32 *trisProcessed, FxU32 *trisDrawn) = NULL;
239 void (__stdcall *grAlphaBlendFunction)(GrAlphaBlendFnc_t rgb_sf, GrAlphaBlendFnc_t rgb_df, GrAlphaBlendFnc_t alpha_sf, GrAlphaBlendFnc_t alpha_df) = NULL;
240 void (__stdcall *grAlphaCombine)(GrCombineFunction_t function, GrCombineFactor_t factor, GrCombineLocal_t local, GrCombineOther_t other, FxBool invert) = NULL;
241 void (__stdcall *grAlphaControlsITRGBLighting)(FxBool enable) = NULL;
242 void (__stdcall *grAlphaTestFunction)(GrCmpFnc_t function) = NULL;
243 void (__stdcall *grAlphaTestReferenceValue)(GrAlpha_t value) = NULL;
244 void (__stdcall *grChromakeyMode)(GrChromakeyMode_t mode) = NULL;
245 void (__stdcall *grChromakeyValue)(GrColor_t value) = NULL;
246 void (__stdcall *grClipWindow)(FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy) = NULL;
247 void (__stdcall *grColorCombine)(
248                GrCombineFunction_t function, GrCombineFactor_t factor,
249                GrCombineLocal_t local, GrCombineOther_t other,
250                FxBool invert) = NULL;
251 void (__stdcall *grColorMask)(FxBool rgb, FxBool a) = NULL;
252 void (__stdcall *grCullMode)(GrCullMode_t mode) = NULL;
253 void (__stdcall *grConstantColorValue)(GrColor_t value) = NULL;
254 void (__stdcall *grConstantColorValue4)(float a, float r, float g, float b) = NULL;
255 void (__stdcall *grDepthBiasLevel)(FxI16 level) = NULL;
256 void (__stdcall *grDepthBufferFunction)(GrCmpFnc_t function) = NULL;
257 void (__stdcall *grDepthBufferMode)(GrDepthBufferMode_t mode) = NULL;
258 void (__stdcall *grDepthMask)(FxBool mask) = NULL;
259 void (__stdcall *grDisableAllEffects)(void) = NULL;
260 void (__stdcall *grDitherMode)( GrDitherMode_t mode) = NULL;
261 void (__stdcall *grFogColorValue)( GrColor_t fogcolor) = NULL;
262 void (__stdcall *grFogMode)(GrFogMode_t mode) = NULL;
263 void (__stdcall *grFogTable)(const GrFog_t ft[GR_FOG_TABLE_SIZE]) = NULL;
264 void (__stdcall *grGammaCorrectionValue)(float value) = NULL;
265 void (__stdcall *grSplash)(float x, float y, float width, float height, FxU32 frame) = NULL;
266 FxU32 (__stdcall *grTexCalcMemRequired)(
267                      GrLOD_t lodmin, GrLOD_t lodmax,
268                      GrAspectRatio_t aspect, GrTextureFormat_t fmt) = NULL;
269 FxU32 (__stdcall *grTexTextureMemRequired)(FxU32 evenOdd, GrTexInfo *info) = NULL;
270 FxU32 (__stdcall *grTexMinAddress)(GrChipID_t tmu) = NULL;
271 FxU32 (__stdcall *grTexMaxAddress)(GrChipID_t tmu) = NULL;
272 void (__stdcall *grTexNCCTable)(GrChipID_t tmu, GrNCCTable_t table) = NULL;
273 void (__stdcall *grTexSource)(GrChipID_t tmu, FxU32 startAddress, FxU32 evenOdd, GrTexInfo  *info) = NULL;
274 void (__stdcall *grTexClampMode)(GrChipID_t tmu, GrTextureClampMode_t s_clampmode, GrTextureClampMode_t t_clampmode) = NULL;
275 void (__stdcall *grTexCombine)(
276              GrChipID_t tmu,
277              GrCombineFunction_t rgb_function,
278              GrCombineFactor_t rgb_factor, 
279              GrCombineFunction_t alpha_function,
280              GrCombineFactor_t alpha_factor,
281              FxBool rgb_invert,
282              FxBool alpha_invert
283              ) = NULL;
284 void (__stdcall *grTexCombineFunction)(
285                      GrChipID_t tmu,
286                      GrTextureCombineFnc_t fnc
287                      ) = NULL;
288 void (__stdcall *grTexDetailControl)(
289                    GrChipID_t tmu,
290                    int lod_bias,
291                    FxU8 detail_scale,
292                    float detail_max
293                    ) = NULL;
294 void (__stdcall *grTexFilterMode)(
295                 GrChipID_t tmu,
296                 GrTextureFilterMode_t minfilter_mode,
297                 GrTextureFilterMode_t magfilter_mode
298                 ) = NULL;
299 void (__stdcall *grTexLodBiasValue)(GrChipID_t tmu, float bias) = NULL;
300 void (__stdcall *grTexDownloadMipMap)(GrChipID_t tmu,
301                      FxU32      startAddress,
302                      FxU32      evenOdd,
303                      GrTexInfo  *info) = NULL;
304
305 void (__stdcall *grTexDownloadMipMapLevel)(GrChipID_t        tmu,
306                           FxU32             startAddress,
307                           GrLOD_t           thisLod,
308                           GrLOD_t           largeLod,
309                           GrAspectRatio_t   aspectRatio,
310                           GrTextureFormat_t format,
311                           FxU32             evenOdd,
312                           void              *data) = NULL;
313
314 void (__stdcall *grTexDownloadMipMapLevelPartial)(GrChipID_t        tmu,
315                                  FxU32             startAddress,
316                                  GrLOD_t           thisLod,
317                                  GrLOD_t           largeLod,
318                                  GrAspectRatio_t   aspectRatio,
319                                  GrTextureFormat_t format,
320                                  FxU32             evenOdd,
321                                  void              *data,
322                                  int               start,
323                                  int               end) = NULL;
324
325
326 void (__stdcall *ConvertAndDownloadRle)(GrChipID_t        tmu,
327                         FxU32             startAddress,
328                         GrLOD_t           thisLod,
329                         GrLOD_t           largeLod,
330                         GrAspectRatio_t   aspectRatio,
331                         GrTextureFormat_t format,
332                         FxU32             evenOdd,
333                         FxU8              *bm_data,
334                         long              bm_h,
335                         FxU32             u0,
336                         FxU32             v0,
337                         FxU32             width,
338                         FxU32             height,
339                         FxU32             dest_width,
340                         FxU32             dest_height,
341                         FxU16             *tlut) = NULL;
342
343 void (__stdcall *grCheckForRoom)(FxI32 n);
344
345 void (__stdcall *grTexDownloadTable)(GrChipID_t   tmu,
346                     GrTexTable_t type, 
347                     void         *data) = NULL;
348
349 void (__stdcall *grTexDownloadTablePartial)(GrChipID_t   tmu,
350                            GrTexTable_t type, 
351                            void         *data,
352                            int          start,
353                            int          end) = NULL;
354
355 void (__stdcall *grTexMipMapMode)(GrChipID_t     tmu, 
356                  GrMipMapMode_t mode,
357                  FxBool         lodBlend) = NULL;
358
359 void (__stdcall *grTexMultibase)(GrChipID_t tmu,
360                 FxBool     enable) = NULL;
361
362 void (__stdcall *grTexMultibaseAddress)(GrChipID_t       tmu,
363                        GrTexBaseRange_t range,
364                        FxU32            startAddress,
365                        FxU32            evenOdd,
366                        GrTexInfo        *info) = NULL;
367
368 GrMipMapId_t (__stdcall *guTexAllocateMemory)(
369                     GrChipID_t tmu,
370                     FxU8 odd_even_mask,
371                     int width, int height,
372                     GrTextureFormat_t fmt,
373                     GrMipMapMode_t mm_mode,
374                     GrLOD_t smallest_lod, GrLOD_t largest_lod,
375                     GrAspectRatio_t aspect,
376                     GrTextureClampMode_t s_clamp_mode,
377                     GrTextureClampMode_t t_clamp_mode,
378                     GrTextureFilterMode_t minfilter_mode,
379                     GrTextureFilterMode_t magfilter_mode,
380                     float lod_bias,
381                     FxBool trilinear
382                     ) = NULL;
383
384 FxBool (__stdcall *guTexChangeAttributes)(
385                       GrMipMapId_t mmid,
386                       int width, int height,
387                       GrTextureFormat_t fmt,
388                       GrMipMapMode_t mm_mode,
389                       GrLOD_t smallest_lod, GrLOD_t largest_lod,
390                       GrAspectRatio_t aspect,
391                       GrTextureClampMode_t s_clamp_mode,
392                       GrTextureClampMode_t t_clamp_mode,
393                       GrTextureFilterMode_t minFilterMode,
394                       GrTextureFilterMode_t magFilterMode
395                       ) = NULL;
396 void (__stdcall *guTexCombineFunction)(
397                      GrChipID_t tmu,
398                      GrTextureCombineFnc_t fnc
399                      ) = NULL;
400 GrMipMapId_t (__stdcall *guTexGetCurrentMipMap)(GrChipID_t tmu) = NULL;
401 GrMipMapInfo* (__stdcall *guTexGetMipMapInfo)(GrMipMapId_t mmid);
402 FxU32 (__stdcall *guTexMemQueryAvail)(GrChipID_t tmu) = NULL;
403 void (__stdcall *guTexMemReset)(void) = NULL;
404 void (__stdcall *guTexDownloadMipMap)(
405                     GrMipMapId_t mmid,
406                     const void *src,
407                     const GuNccTable *table
408                     ) = NULL;
409 void (__stdcall *guTexDownloadMipMapLevel)(
410                          GrMipMapId_t mmid,
411                          GrLOD_t lod,
412                          const void **src
413                          ) = NULL;
414 void (__stdcall *guTexSource)(GrMipMapId_t id) = NULL;
415 void (__stdcall *guColorCombineFunction)(GrColorCombineFnc_t fnc) = NULL;
416
417 FxBool (__stdcall *grLfbLock)( GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode,
418            GrOriginLocation_t origin, FxBool pixelPipeline, 
419            GrLfbInfo_t *info) = NULL;
420 FxBool (__stdcall *grLfbUnlock)(GrLock_t type, GrBuffer_t buffer) = NULL;
421 void (__stdcall *grLfbConstantAlpha)(GrAlpha_t alpha) = NULL;
422 void (__stdcall *grLfbConstantDepth)(FxU16 depth) = NULL;
423 void (__stdcall *grLfbWriteColorSwizzle)(FxBool swizzleBytes, FxBool swapWords) = NULL;
424 void (__stdcall *grLfbWriteColorFormat)(GrColorFormat_t colorFormat) = NULL;
425 FxBool (__stdcall *grLfbWriteRegion)(GrBuffer_t dst_buffer, 
426                   FxU32 dst_x, FxU32 dst_y, 
427                   GrLfbSrcFmt_t src_format, 
428                   FxU32 src_width, FxU32 src_height, 
429                   FxI32 src_stride, void *src_data) = NULL;
430
431 FxBool (__stdcall *grLfbReadRegion)(GrBuffer_t src_buffer,
432                  FxU32 src_x, FxU32 src_y,
433                  FxU32 src_width, FxU32 src_height,
434                  FxU32 dst_stride, void *dst_data) = NULL;
435
436 void (__stdcall *grAADrawLine)(const GrVertex *v1, const GrVertex *v2) = NULL;
437 void (__stdcall *grAADrawPoint)(const GrVertex *pt) = NULL;
438 void (__stdcall *grAADrawPolygon)(const int nverts, const int ilist[], const GrVertex vlist[]) = NULL;
439 void (__stdcall *grAADrawPolygonVertexList)(const int nverts, const GrVertex vlist[]) = NULL;
440 void (__stdcall *grAADrawTriangle)(
441                  const GrVertex *a, const GrVertex *b, const GrVertex *c,
442                  FxBool ab_antialias, FxBool bc_antialias, FxBool ca_antialias
443                  ) = NULL;
444 void (__stdcall *grGlideInit)(void) = NULL;
445 void (__stdcall *grGlideShutdown)(void) = NULL;
446 void (__stdcall *grGlideGetVersion)(char version[80]) = NULL;
447 void (__stdcall *grGlideGetState)(GrState *state) = NULL;
448 void (__stdcall *grGlideSetState)( const GrState *state) = NULL;
449 void (__stdcall *grGlideShamelessPlug)(const FxBool on) = NULL;
450 void (__stdcall *grHints)(GrHint_t hintType, FxU32 hintMask) = NULL;
451
452 float (__stdcall *guFogTableIndexToW)(int i) = NULL;
453 void (__stdcall *guFogGenerateExp)( GrFog_t fogtable[GR_FOG_TABLE_SIZE], float density ) = NULL;
454 void (__stdcall *guFogGenerateExp2)( GrFog_t fogtable[GR_FOG_TABLE_SIZE], float density ) = NULL;
455 void (__stdcall *guFogGenerateLinear)( GrFog_t fogtable[GR_FOG_TABLE_SIZE], float nearZ, float farZ ) = NULL;