1 | /* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Mesa 3-D graphics library
|
---|
5 | * Version: 3.3
|
---|
6 | *
|
---|
7 | * Copyright (C) 1999 Brian Paul All Rights Reserved.
|
---|
8 | *
|
---|
9 | * Permission is hereby granted, free of charge, to any person obtaining a
|
---|
10 | * copy of this software and associated documentation files (the "Software"),
|
---|
11 | * to deal in the Software without restriction, including without limitation
|
---|
12 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
---|
13 | * and/or sell copies of the Software, and to permit persons to whom the
|
---|
14 | * Software is furnished to do so, subject to the following conditions:
|
---|
15 | *
|
---|
16 | * The above copyright notice and this permission notice shall be included
|
---|
17 | * in all copies or substantial portions of the Software.
|
---|
18 | *
|
---|
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
---|
20 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
---|
22 | * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
---|
23 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
---|
24 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
---|
25 | *
|
---|
26 | *
|
---|
27 | * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
|
---|
28 | * terms stated above.
|
---|
29 | *
|
---|
30 | * Thank you for your contribution, David!
|
---|
31 | *
|
---|
32 | * Please make note of the above copyright/license statement. If you
|
---|
33 | * contributed code or bug fixes to this code under the previous (GNU
|
---|
34 | * Library) license and object to the new license, your code will be
|
---|
35 | * removed at your request. Please see the Mesa docs/COPYRIGHT file
|
---|
36 | * for more information.
|
---|
37 | *
|
---|
38 | * Additional Mesa/3Dfx driver developers:
|
---|
39 | * Daryll Strauss <daryll@precisioninsight.com>
|
---|
40 | * Keith Whitwell <keith@precisioninsight.com>
|
---|
41 | *
|
---|
42 | * See fxapi.h for more revision/author details.
|
---|
43 | */
|
---|
44 |
|
---|
45 |
|
---|
46 | #ifndef FXDRV_H
|
---|
47 | #define FXDRV_H
|
---|
48 |
|
---|
49 | /* If you comment out this define, a variable takes its place, letting
|
---|
50 | * you turn debugging on/off from the debugger.
|
---|
51 | */
|
---|
52 |
|
---|
53 | #ifndef XFree86Server
|
---|
54 | #include <math.h>
|
---|
55 | #include <stdio.h>
|
---|
56 | #include <stdlib.h>
|
---|
57 | #include <limits.h>
|
---|
58 | #include <assert.h>
|
---|
59 | #else
|
---|
60 | #include "GL/xf86glx.h"
|
---|
61 | #endif
|
---|
62 |
|
---|
63 |
|
---|
64 | #if defined(__linux__)
|
---|
65 | #include <signal.h>
|
---|
66 | #endif
|
---|
67 |
|
---|
68 | #include "types.h"
|
---|
69 | #include "context.h"
|
---|
70 | #include "macros.h"
|
---|
71 | #include "matrix.h"
|
---|
72 | #include "texture.h"
|
---|
73 | #include "vb.h"
|
---|
74 | #include "xform.h"
|
---|
75 | #include "clip.h"
|
---|
76 | #include "vbrender.h"
|
---|
77 | #include "mem.h"
|
---|
78 |
|
---|
79 | #ifdef XF86DRI
|
---|
80 | typedef struct tfxMesaContext *fxMesaContext;
|
---|
81 | #else
|
---|
82 | #include "GL/fxmesa.h"
|
---|
83 | #endif
|
---|
84 | #include "fxglidew.h"
|
---|
85 | /* use gl/gl.h GLAPI/GLAPIENTRY/GLCALLBACK in place of WINGDIAPI/APIENTRY/CALLBACK, */
|
---|
86 | /* these are defined in mesa gl/gl.h - tjump@spgs.com */
|
---|
87 |
|
---|
88 |
|
---|
89 |
|
---|
90 | extern void fx_sanity_triangle( GrVertex *, GrVertex *, GrVertex * );
|
---|
91 | #if defined(MESA_DEBUG) && 0
|
---|
92 | #define grDrawTriangle fx_sanity_triangle
|
---|
93 | #endif
|
---|
94 |
|
---|
95 |
|
---|
96 | /* Define some shorter names for these things.
|
---|
97 | */
|
---|
98 | #define XCOORD GR_VERTEX_X_OFFSET
|
---|
99 | #define YCOORD GR_VERTEX_Y_OFFSET
|
---|
100 | #define ZCOORD GR_VERTEX_OOZ_OFFSET
|
---|
101 | #define OOWCOORD GR_VERTEX_OOW_OFFSET
|
---|
102 |
|
---|
103 | #define RCOORD GR_VERTEX_R_OFFSET
|
---|
104 | #define GCOORD GR_VERTEX_G_OFFSET
|
---|
105 | #define BCOORD GR_VERTEX_B_OFFSET
|
---|
106 | #define ACOORD GR_VERTEX_A_OFFSET
|
---|
107 |
|
---|
108 | #define S0COORD GR_VERTEX_SOW_TMU0_OFFSET
|
---|
109 | #define T0COORD GR_VERTEX_TOW_TMU0_OFFSET
|
---|
110 | #define S1COORD GR_VERTEX_SOW_TMU1_OFFSET
|
---|
111 | #define T1COORD GR_VERTEX_TOW_TMU1_OFFSET
|
---|
112 |
|
---|
113 |
|
---|
114 | #if FX_USE_PARGB
|
---|
115 |
|
---|
116 | #define CLIP_XCOORD 0 /* normal place */
|
---|
117 | #define CLIP_YCOROD 1 /* normal place */
|
---|
118 | #define CLIP_ZCOORD 2 /* normal place */
|
---|
119 | #define CLIP_WCOORD 3 /* normal place */
|
---|
120 | #define CLIP_GCOORD 4 /* GR_VERTEX_PARGB_OFFSET */
|
---|
121 | #define CLIP_BCOORD 5 /* GR_VERTEX_SOW_TMU0_OFFSET */
|
---|
122 | #define CLIP_RCOORD 6 /* GR_VERTEX_TOW_TMU0_OFFSET */
|
---|
123 | #define CLIP_ACOORD 7 /* GR_VERTEX_OOW_TMU0_OFFSET */
|
---|
124 |
|
---|
125 | #else
|
---|
126 |
|
---|
127 | #define CLIP_XCOORD 0 /* normal place */
|
---|
128 | #define CLIP_YCOROD 1 /* normal place */
|
---|
129 | #define CLIP_ZCOORD 2 /* GR_VERTEX_Z_OFFSET */
|
---|
130 | #define CLIP_WCOORD 3 /* GR_VERTEX_R_OFFSET */
|
---|
131 | #define CLIP_GCOORD 4 /* normal place */
|
---|
132 | #define CLIP_BCOORD 5 /* normal place */
|
---|
133 | #define CLIP_RCOORD 6 /* GR_VERTEX_OOZ_OFFSET */
|
---|
134 | #define CLIP_ACOORD 7 /* normal place */
|
---|
135 |
|
---|
136 |
|
---|
137 | #endif
|
---|
138 |
|
---|
139 | /* Should have size == 16 * sizeof(float).
|
---|
140 | */
|
---|
141 | typedef struct {
|
---|
142 | GLfloat f[15]; /* Same layout as GrVertex */
|
---|
143 | GLubyte mask; /* Unsued */
|
---|
144 | GLubyte usermask; /* Unused */
|
---|
145 | } fxVertex;
|
---|
146 |
|
---|
147 |
|
---|
148 |
|
---|
149 |
|
---|
150 | #if defined(FXMESA_USE_ARGB)
|
---|
151 | #define FXCOLOR4( c ) ( \
|
---|
152 | ( ((unsigned int)(c[3]))<<24 ) | \
|
---|
153 | ( ((unsigned int)(c[0]))<<16 ) | \
|
---|
154 | ( ((unsigned int)(c[1]))<<8 ) | \
|
---|
155 | ( (unsigned int)(c[2])) )
|
---|
156 |
|
---|
157 | #else
|
---|
158 | #ifdef __i386__
|
---|
159 | #define FXCOLOR4( c ) (* (int *)c)
|
---|
160 | #else
|
---|
161 | #define FXCOLOR4( c ) ( \
|
---|
162 | ( ((unsigned int)(c[3]))<<24 ) | \
|
---|
163 | ( ((unsigned int)(c[2]))<<16 ) | \
|
---|
164 | ( ((unsigned int)(c[1]))<<8 ) | \
|
---|
165 | ( (unsigned int)(c[0])) )
|
---|
166 | #endif
|
---|
167 | #endif
|
---|
168 |
|
---|
169 | #define FX_VB_COLOR(fxm, color) \
|
---|
170 | do { \
|
---|
171 | if (sizeof(GLint) == 4*sizeof(GLubyte)) { \
|
---|
172 | if (fxm->constColor != *(GLuint*)color) { \
|
---|
173 | fxm->constColor = *(GLuint*)color; \
|
---|
174 | FX_grConstantColorValue(FXCOLOR4(color)); \
|
---|
175 | } \
|
---|
176 | } else { \
|
---|
177 | FX_grConstantColorValue(FXCOLOR4(color)); \
|
---|
178 | } \
|
---|
179 | } while (0)
|
---|
180 |
|
---|
181 | #define GOURAUD(x) { \
|
---|
182 | GLubyte *col = VB->ColorPtr->data[(x)]; \
|
---|
183 | gWin[(x)].v.r=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]); \
|
---|
184 | gWin[(x)].v.g=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[1]); \
|
---|
185 | gWin[(x)].v.b=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[2]); \
|
---|
186 | gWin[(x)].v.a=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]); \
|
---|
187 | }
|
---|
188 |
|
---|
189 | #if FX_USE_PARGB
|
---|
190 | #define GOURAUD2(v, c) { \
|
---|
191 | GLubyte *col = c; \
|
---|
192 | v->argb=MESACOLOR2PARGB(col); \
|
---|
193 | }
|
---|
194 | #else
|
---|
195 | #define GOURAUD2(v, c) { \
|
---|
196 | GLubyte *col = c; \
|
---|
197 | v->r=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]); \
|
---|
198 | v->g=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[1]); \
|
---|
199 | v->b=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[2]); \
|
---|
200 | v->a=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]); \
|
---|
201 | }
|
---|
202 | #endif
|
---|
203 |
|
---|
204 |
|
---|
205 | /* Mergable items first
|
---|
206 | */
|
---|
207 | #define SETUP_RGBA 0x1
|
---|
208 | #define SETUP_TMU0 0x2
|
---|
209 | #define SETUP_TMU1 0x4
|
---|
210 | #define SETUP_XY 0x8
|
---|
211 | #define SETUP_Z 0x10
|
---|
212 | #define SETUP_W 0x20
|
---|
213 |
|
---|
214 | #define MAX_MERGABLE 0x8
|
---|
215 |
|
---|
216 |
|
---|
217 | #define FX_NUM_TMU 2
|
---|
218 |
|
---|
219 | #define FX_TMU0 GR_TMU0
|
---|
220 | #define FX_TMU1 GR_TMU1
|
---|
221 | #define FX_TMU_SPLIT 98
|
---|
222 | #define FX_TMU_BOTH 99
|
---|
223 | #define FX_TMU_NONE 100
|
---|
224 |
|
---|
225 | /* Used for fxMesa->lastUnitsMode */
|
---|
226 |
|
---|
227 | #define FX_UM_NONE 0x00000000
|
---|
228 |
|
---|
229 | #define FX_UM_E0_REPLACE 0x00000001
|
---|
230 | #define FX_UM_E0_MODULATE 0x00000002
|
---|
231 | #define FX_UM_E0_DECAL 0x00000004
|
---|
232 | #define FX_UM_E0_BLEND 0x00000008
|
---|
233 | #define FX_UM_E0_ADD 0x00000010
|
---|
234 |
|
---|
235 | #define FX_UM_E1_REPLACE 0x00000020
|
---|
236 | #define FX_UM_E1_MODULATE 0x00000040
|
---|
237 | #define FX_UM_E1_DECAL 0x00000080
|
---|
238 | #define FX_UM_E1_BLEND 0x00000100
|
---|
239 | #define FX_UM_E1_ADD 0x00000200
|
---|
240 |
|
---|
241 | #define FX_UM_E_ENVMODE 0x000003ff
|
---|
242 |
|
---|
243 | #define FX_UM_E0_ALPHA 0x00001000
|
---|
244 | #define FX_UM_E0_LUMINANCE 0x00002000
|
---|
245 | #define FX_UM_E0_LUMINANCE_ALPHA 0x00004000
|
---|
246 | #define FX_UM_E0_INTENSITY 0x00008000
|
---|
247 | #define FX_UM_E0_RGB 0x00010000
|
---|
248 | #define FX_UM_E0_RGBA 0x00020000
|
---|
249 |
|
---|
250 | #define FX_UM_E1_ALPHA 0x00040000
|
---|
251 | #define FX_UM_E1_LUMINANCE 0x00080000
|
---|
252 | #define FX_UM_E1_LUMINANCE_ALPHA 0x00100000
|
---|
253 | #define FX_UM_E1_INTENSITY 0x00200000
|
---|
254 | #define FX_UM_E1_RGB 0x00400000
|
---|
255 | #define FX_UM_E1_RGBA 0x00800000
|
---|
256 |
|
---|
257 | #define FX_UM_E_IFMT 0x00fff000
|
---|
258 |
|
---|
259 | #define FX_UM_COLOR_ITERATED 0x01000000
|
---|
260 | #define FX_UM_COLOR_CONSTANT 0x02000000
|
---|
261 | #define FX_UM_ALPHA_ITERATED 0x04000000
|
---|
262 | #define FX_UM_ALPHA_CONSTANT 0x08000000
|
---|
263 |
|
---|
264 | typedef void (*tfxRenderVBFunc)(GLcontext *);
|
---|
265 |
|
---|
266 | /*
|
---|
267 | Memory range from startAddr to endAddr-1
|
---|
268 | */
|
---|
269 | typedef struct MemRange_t {
|
---|
270 | struct MemRange_t *next;
|
---|
271 | FxU32 startAddr, endAddr;
|
---|
272 | } MemRange;
|
---|
273 |
|
---|
274 | typedef struct {
|
---|
275 | GLsizei width, height; /* image size */
|
---|
276 | GrTextureFormat_t glideFormat; /* Glide image format */
|
---|
277 | unsigned short *data; /* Glide-formated texture image */
|
---|
278 | GLboolean translated; /* True if data points to a reformated image */
|
---|
279 | GLboolean used; /* True if we've given the image to Glide */
|
---|
280 | } tfxMipMapLevel;
|
---|
281 |
|
---|
282 | typedef struct tfxTexInfo_t {
|
---|
283 | struct tfxTexInfo_t *next;
|
---|
284 | struct gl_texture_object *tObj;
|
---|
285 |
|
---|
286 | GLuint lastTimeUsed;
|
---|
287 | FxU32 whichTMU;
|
---|
288 | GLboolean isInTM;
|
---|
289 |
|
---|
290 | tfxMipMapLevel mipmapLevel[MAX_TEXTURE_LEVELS];
|
---|
291 |
|
---|
292 | MemRange *tm[FX_NUM_TMU];
|
---|
293 |
|
---|
294 | GLint minLevel, maxLevel;
|
---|
295 | GLint baseLevelInternalFormat;
|
---|
296 |
|
---|
297 | GrTexInfo info;
|
---|
298 |
|
---|
299 | GrTextureFilterMode_t minFilt;
|
---|
300 | GrTextureFilterMode_t maxFilt;
|
---|
301 | FxBool LODblend;
|
---|
302 |
|
---|
303 | GrTextureClampMode_t sClamp;
|
---|
304 | GrTextureClampMode_t tClamp;
|
---|
305 |
|
---|
306 | GrMipMapMode_t mmMode;
|
---|
307 |
|
---|
308 | GLfloat sScale, tScale;
|
---|
309 | GLint int_sScale, int_tScale; /* x86 floating point trick for
|
---|
310 | * multiplication by powers of 2.
|
---|
311 | * Used in fxfasttmp.h
|
---|
312 | */
|
---|
313 |
|
---|
314 | GuTexPalette palette;
|
---|
315 |
|
---|
316 | GLboolean fixedPalette;
|
---|
317 | GLboolean validated;
|
---|
318 | } tfxTexInfo;
|
---|
319 |
|
---|
320 | typedef struct {
|
---|
321 | GLuint swapBuffer;
|
---|
322 | GLuint reqTexUpload;
|
---|
323 | GLuint texUpload;
|
---|
324 | GLuint memTexUpload;
|
---|
325 | } tfxStats;
|
---|
326 |
|
---|
327 |
|
---|
328 | typedef void (*tfxTriViewClipFunc)( struct vertex_buffer *VB,
|
---|
329 | GLuint v[],
|
---|
330 | GLubyte mask );
|
---|
331 |
|
---|
332 | typedef void (*tfxTriClipFunc)( struct vertex_buffer *VB,
|
---|
333 | GLuint v[],
|
---|
334 | GLuint mask );
|
---|
335 |
|
---|
336 |
|
---|
337 | typedef void (*tfxLineClipFunc)( struct vertex_buffer *VB,
|
---|
338 | GLuint v1, GLuint v2,
|
---|
339 | GLubyte mask );
|
---|
340 |
|
---|
341 |
|
---|
342 | extern tfxTriViewClipFunc fxTriViewClipTab[0x8];
|
---|
343 | extern tfxTriClipFunc fxTriClipStrideTab[0x8];
|
---|
344 | extern tfxLineClipFunc fxLineClipTab[0x8];
|
---|
345 |
|
---|
346 | typedef struct {
|
---|
347 | /* Alpha test */
|
---|
348 |
|
---|
349 | GLboolean alphaTestEnabled;
|
---|
350 | GrCmpFnc_t alphaTestFunc;
|
---|
351 | GrAlpha_t alphaTestRefValue;
|
---|
352 |
|
---|
353 | /* Blend function */
|
---|
354 |
|
---|
355 | GLboolean blendEnabled;
|
---|
356 | GrAlphaBlendFnc_t blendSrcFuncRGB;
|
---|
357 | GrAlphaBlendFnc_t blendDstFuncRGB;
|
---|
358 | GrAlphaBlendFnc_t blendSrcFuncAlpha;
|
---|
359 | GrAlphaBlendFnc_t blendDstFuncAlpha;
|
---|
360 |
|
---|
361 | /* Depth test */
|
---|
362 |
|
---|
363 | GLboolean depthTestEnabled;
|
---|
364 | GLboolean depthMask;
|
---|
365 | GrCmpFnc_t depthTestFunc;
|
---|
366 | } tfxUnitsState;
|
---|
367 |
|
---|
368 |
|
---|
369 | /* Flags for render_index.
|
---|
370 | */
|
---|
371 | #define FX_OFFSET 0x1
|
---|
372 | #define FX_TWOSIDE 0x2
|
---|
373 | #define FX_FRONT_BACK 0x4
|
---|
374 | #define FX_FLAT 0x8
|
---|
375 | #define FX_ANTIALIAS 0x10
|
---|
376 | #define FX_FALLBACK 0x20
|
---|
377 |
|
---|
378 |
|
---|
379 | /* Flags for fxMesa->new_state
|
---|
380 | */
|
---|
381 | #define FX_NEW_TEXTURING 0x1
|
---|
382 | #define FX_NEW_BLEND 0x2
|
---|
383 | #define FX_NEW_ALPHA 0x4
|
---|
384 | #define FX_NEW_DEPTH 0x8
|
---|
385 | #define FX_NEW_FOG 0x10
|
---|
386 | #define FX_NEW_SCISSOR 0x20
|
---|
387 | #define FX_NEW_COLOR_MASK 0x40
|
---|
388 | #define FX_NEW_CULL 0x80
|
---|
389 |
|
---|
390 | /* FX struct stored in VB->driver_data.
|
---|
391 | */
|
---|
392 | struct tfxMesaVertexBuffer {
|
---|
393 | GLvector1ui clipped_elements;
|
---|
394 |
|
---|
395 | fxVertex *verts;
|
---|
396 | fxVertex *last_vert;
|
---|
397 | void *vert_store;
|
---|
398 | #if defined(FX_GLIDE3)
|
---|
399 | GrVertex **triangle_b; /* Triangle buffer */
|
---|
400 | GrVertex **strips_b; /* Strips buffer */
|
---|
401 | #endif
|
---|
402 |
|
---|
403 | GLuint size;
|
---|
404 | };
|
---|
405 |
|
---|
406 | #define FX_DRIVER_DATA(vb) ((struct tfxMesaVertexBuffer *)((vb)->driver_data))
|
---|
407 | #define FX_CONTEXT(ctx) ((fxMesaContext)((ctx)->DriverCtx))
|
---|
408 | #define FX_TEXTURE_DATA(t) fxTMGetTexInfo((t)->Current)
|
---|
409 |
|
---|
410 | #if defined(XFree86Server) || defined(GLX_DIRECT_RENDERING)
|
---|
411 | #include "tdfx_init.h"
|
---|
412 | #else
|
---|
413 | #define DRI_FX_CONTEXT
|
---|
414 | #define BEGIN_BOARD_LOCK()
|
---|
415 | #define END_BOARD_LOCK()
|
---|
416 | #define BEGIN_CLIP_LOOP()
|
---|
417 | #define END_CLIP_LOOP()
|
---|
418 | #endif
|
---|
419 |
|
---|
420 |
|
---|
421 | /* These lookup table are used to extract RGB values in [0,255] from
|
---|
422 | * 16-bit pixel values.
|
---|
423 | */
|
---|
424 | extern GLubyte FX_PixelToR[0x10000];
|
---|
425 | extern GLubyte FX_PixelToG[0x10000];
|
---|
426 | extern GLubyte FX_PixelToB[0x10000];
|
---|
427 |
|
---|
428 |
|
---|
429 | struct tfxMesaContext {
|
---|
430 | GuTexPalette glbPalette;
|
---|
431 |
|
---|
432 | GLcontext *glCtx; /* the core Mesa context */
|
---|
433 | GLvisual *glVis; /* describes the color buffer */
|
---|
434 | GLframebuffer *glBuffer; /* the ancillary buffers */
|
---|
435 |
|
---|
436 | GLint board; /* the board used for this context */
|
---|
437 | GLint width, height; /* size of color buffer */
|
---|
438 |
|
---|
439 | GrBuffer_t currentFB;
|
---|
440 |
|
---|
441 | GLboolean bgrOrder;
|
---|
442 | GrColor_t color;
|
---|
443 | GrColor_t clearC;
|
---|
444 | GrAlpha_t clearA;
|
---|
445 | GLuint constColor;
|
---|
446 | GrCullMode_t cullMode;
|
---|
447 |
|
---|
448 | tfxUnitsState unitsState;
|
---|
449 | tfxUnitsState restoreUnitsState; /* saved during multipass */
|
---|
450 |
|
---|
451 | GLuint tmu_source[FX_NUM_TMU];
|
---|
452 | GLuint tex_dest[MAX_TEXTURE_UNITS];
|
---|
453 | GLuint setupindex;
|
---|
454 | GLuint partial_setup_index;
|
---|
455 | GLuint setupdone;
|
---|
456 | GLuint mergeindex;
|
---|
457 | GLuint mergeinputs;
|
---|
458 | GLuint render_index;
|
---|
459 | GLuint last_tri_caps;
|
---|
460 | GLuint stw_hint_state; /* for grHints */
|
---|
461 | GLuint is_in_hardware;
|
---|
462 | GLuint new_state;
|
---|
463 | GLuint using_fast_path, passes, multipass;
|
---|
464 |
|
---|
465 | tfxLineClipFunc clip_line;
|
---|
466 | tfxTriClipFunc clip_tri_stride;
|
---|
467 | tfxTriViewClipFunc view_clip_tri;
|
---|
468 |
|
---|
469 |
|
---|
470 | /* Texture Memory Manager Data */
|
---|
471 |
|
---|
472 | GLuint texBindNumber;
|
---|
473 | GLint tmuSrc;
|
---|
474 | GLuint lastUnitsMode;
|
---|
475 | GLuint freeTexMem[FX_NUM_TMU];
|
---|
476 | MemRange *tmPool;
|
---|
477 | MemRange *tmFree[FX_NUM_TMU];
|
---|
478 |
|
---|
479 | GLenum fogTableMode;
|
---|
480 | GLfloat fogDensity;
|
---|
481 | GLfloat fogStart, fogEnd;
|
---|
482 | GrFog_t *fogTable;
|
---|
483 | GLint textureAlign;
|
---|
484 |
|
---|
485 | /* Acc. functions */
|
---|
486 |
|
---|
487 | points_func PointsFunc;
|
---|
488 | line_func LineFunc;
|
---|
489 | triangle_func TriangleFunc;
|
---|
490 | quad_func QuadFunc;
|
---|
491 |
|
---|
492 | render_func **RenderVBTables;
|
---|
493 |
|
---|
494 | render_func *RenderVBClippedTab;
|
---|
495 | render_func *RenderVBCulledTab;
|
---|
496 | render_func *RenderVBRawTab;
|
---|
497 |
|
---|
498 |
|
---|
499 | tfxStats stats;
|
---|
500 |
|
---|
501 | void *state;
|
---|
502 |
|
---|
503 | /* Options */
|
---|
504 |
|
---|
505 | GLboolean verbose;
|
---|
506 | GLboolean haveTwoTMUs; /* True if we really have 2 tmu's */
|
---|
507 | GLboolean emulateTwoTMUs; /* True if we present 2 tmu's to mesa. */
|
---|
508 | GLboolean haveAlphaBuffer;
|
---|
509 | GLboolean haveZBuffer;
|
---|
510 | GLboolean haveDoubleBuffer;
|
---|
511 | GLboolean haveGlobalPaletteTexture;
|
---|
512 | GLint swapInterval;
|
---|
513 | GLint maxPendingSwapBuffers;
|
---|
514 |
|
---|
515 | FX_GrContext_t glideContext;
|
---|
516 |
|
---|
517 | int x_offset;
|
---|
518 | int y_offset;
|
---|
519 | int y_delta;
|
---|
520 | int screen_width;
|
---|
521 | int screen_height;
|
---|
522 | int initDone;
|
---|
523 | int clipMinX;
|
---|
524 | int clipMaxX;
|
---|
525 | int clipMinY;
|
---|
526 | int clipMaxY;
|
---|
527 | int needClip;
|
---|
528 |
|
---|
529 | DRI_FX_CONTEXT
|
---|
530 | };
|
---|
531 |
|
---|
532 | typedef void (*tfxSetupFunc)(struct vertex_buffer *, GLuint, GLuint);
|
---|
533 |
|
---|
534 | extern GrHwConfiguration glbHWConfig;
|
---|
535 | extern int glbCurrentBoard;
|
---|
536 |
|
---|
537 | extern void fxPrintSetupFlags( const char *msg, GLuint flags );
|
---|
538 | extern void fxSetupFXUnits(GLcontext *);
|
---|
539 | extern void fxSetupDDPointers(GLcontext *);
|
---|
540 | extern void fxDDSetNearFar(GLcontext *, GLfloat, GLfloat);
|
---|
541 |
|
---|
542 | extern void fxDDSetupInit(void);
|
---|
543 | extern void fxDDCvaInit(void);
|
---|
544 | extern void fxDDTrifuncInit(void);
|
---|
545 | extern void fxDDFastPathInit(void);
|
---|
546 |
|
---|
547 | extern void fxDDChooseRenderState( GLcontext *ctx );
|
---|
548 |
|
---|
549 | extern void fxRenderClippedLine( struct vertex_buffer *VB,
|
---|
550 | GLuint v1, GLuint v2 );
|
---|
551 |
|
---|
552 | extern void fxRenderClippedTriangle( struct vertex_buffer *VB,
|
---|
553 | GLuint n, GLuint vlist[] );
|
---|
554 |
|
---|
555 |
|
---|
556 | extern tfxSetupFunc fxDDChooseSetupFunction(GLcontext *);
|
---|
557 |
|
---|
558 | extern points_func fxDDChoosePointsFunction(GLcontext *);
|
---|
559 | extern line_func fxDDChooseLineFunction(GLcontext *);
|
---|
560 | extern triangle_func fxDDChooseTriangleFunction(GLcontext *);
|
---|
561 | extern quad_func fxDDChooseQuadFunction(GLcontext *);
|
---|
562 | extern render_func **fxDDChooseRenderVBTables(GLcontext *);
|
---|
563 |
|
---|
564 | extern void fxDDRenderInit(GLcontext *);
|
---|
565 | extern void fxDDClipInit(void);
|
---|
566 |
|
---|
567 | extern void fxUpdateDDSpanPointers(GLcontext *);
|
---|
568 | extern void fxSetupDDSpanPointers(GLcontext *);
|
---|
569 |
|
---|
570 | extern void fxPrintTextureData(tfxTexInfo *ti);
|
---|
571 | extern void fxDDTexImg(GLcontext *, GLenum, struct gl_texture_object *,
|
---|
572 | GLint, GLint, const struct gl_texture_image *);
|
---|
573 | extern void fxDDTexSubImg(GLcontext *, GLenum, struct gl_texture_object *,
|
---|
574 | GLint, GLint, GLint, GLint, GLint, GLint,
|
---|
575 | const struct gl_texture_image *);
|
---|
576 | extern GLboolean fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level,
|
---|
577 | GLenum format, GLenum type, const GLvoid *pixels,
|
---|
578 | const struct gl_pixelstore_attrib *packing,
|
---|
579 | struct gl_texture_object *texObj,
|
---|
580 | struct gl_texture_image *texImage,
|
---|
581 | GLboolean *retainInternalCopy);
|
---|
582 | extern GLboolean fxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
|
---|
583 | GLint xoffset, GLint yoffset,
|
---|
584 | GLsizei width, GLsizei height,
|
---|
585 | GLenum format, GLenum type, const GLvoid *pixels,
|
---|
586 | const struct gl_pixelstore_attrib *packing,
|
---|
587 | struct gl_texture_object *texObj,
|
---|
588 | struct gl_texture_image *texImage);
|
---|
589 | extern void fxDDTexEnv(GLcontext *, GLenum, GLenum, const GLfloat *);
|
---|
590 | extern void fxDDTexParam(GLcontext *, GLenum, struct gl_texture_object *,
|
---|
591 | GLenum, const GLfloat *);
|
---|
592 | extern void fxDDTexBind(GLcontext *, GLenum, struct gl_texture_object *);
|
---|
593 | extern void fxDDTexDel(GLcontext *, struct gl_texture_object *);
|
---|
594 | extern void fxDDTexPalette(GLcontext *, struct gl_texture_object *);
|
---|
595 | extern void fxDDTexUseGlbPalette(GLcontext *, GLboolean);
|
---|
596 |
|
---|
597 | extern void fxDDEnable(GLcontext *, GLenum, GLboolean);
|
---|
598 | extern void fxDDAlphaFunc(GLcontext *, GLenum, GLclampf);
|
---|
599 | extern void fxDDBlendFunc(GLcontext *, GLenum, GLenum);
|
---|
600 | extern void fxDDDepthMask(GLcontext *, GLboolean);
|
---|
601 | extern void fxDDDepthFunc(GLcontext *, GLenum);
|
---|
602 |
|
---|
603 | extern void fxDDRegisterVB( struct vertex_buffer *VB );
|
---|
604 | extern void fxDDUnregisterVB( struct vertex_buffer *VB );
|
---|
605 | extern void fxDDResizeVB( struct vertex_buffer *VB, GLuint size );
|
---|
606 |
|
---|
607 | extern void fxDDCheckMergeAndRender( GLcontext *ctx,
|
---|
608 | struct gl_pipeline_stage *d );
|
---|
609 |
|
---|
610 | extern void fxDDMergeAndRender( struct vertex_buffer *VB );
|
---|
611 |
|
---|
612 | extern void fxDDCheckPartialRasterSetup( GLcontext *ctx,
|
---|
613 | struct gl_pipeline_stage *d );
|
---|
614 |
|
---|
615 | extern void fxDDPartialRasterSetup( struct vertex_buffer *VB );
|
---|
616 |
|
---|
617 | extern void fxDDDoRasterSetup( struct vertex_buffer *VB );
|
---|
618 |
|
---|
619 | extern GLuint fxDDRegisterPipelineStages( struct gl_pipeline_stage *out,
|
---|
620 | const struct gl_pipeline_stage *in,
|
---|
621 | GLuint nr );
|
---|
622 |
|
---|
623 | extern GLboolean fxDDBuildPrecalcPipeline( GLcontext *ctx );
|
---|
624 |
|
---|
625 | extern void fxDDOptimizePrecalcPipeline( GLcontext *ctx,
|
---|
626 | struct gl_pipeline *pipe );
|
---|
627 |
|
---|
628 | extern void fxDDRenderElementsDirect( struct vertex_buffer *VB );
|
---|
629 | extern void fxDDRenderVBIndirectDirect( struct vertex_buffer *VB );
|
---|
630 |
|
---|
631 | extern void fxDDInitExtensions( GLcontext *ctx );
|
---|
632 |
|
---|
633 | #define fxTMGetTexInfo(o) ((tfxTexInfo*)((o)->DriverData))
|
---|
634 | extern void fxTMInit(fxMesaContext ctx);
|
---|
635 | extern void fxTMClose(fxMesaContext ctx);
|
---|
636 | extern void fxTMRestoreTextures_NoLock(fxMesaContext ctx);
|
---|
637 | extern void fxTMMoveInTM(fxMesaContext, struct gl_texture_object *, GLint);
|
---|
638 | extern void fxTMMoveOutTM(fxMesaContext, struct gl_texture_object *);
|
---|
639 | #define fxTMMoveOutTM_NoLock fxTMMoveOutTM
|
---|
640 | extern void fxTMFreeTexture(fxMesaContext, struct gl_texture_object *);
|
---|
641 | extern void fxTMReloadMipMapLevel(fxMesaContext, struct gl_texture_object *, GLint);
|
---|
642 | extern void fxTMReloadSubMipMapLevel(fxMesaContext, struct gl_texture_object *,
|
---|
643 | GLint, GLint, GLint);
|
---|
644 |
|
---|
645 | extern void fxTexGetFormat(GLenum, GrTextureFormat_t *, GLint *);
|
---|
646 | extern int fxTexGetInfo(int, int, GrLOD_t *, GrAspectRatio_t *,
|
---|
647 | float *, float *, int *, int *, int *, int *);
|
---|
648 |
|
---|
649 | extern void fxDDScissor( GLcontext *ctx,
|
---|
650 | GLint x, GLint y, GLsizei w, GLsizei h );
|
---|
651 | extern void fxDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *params );
|
---|
652 | extern GLboolean fxDDColorMask(GLcontext *ctx,
|
---|
653 | GLboolean r, GLboolean g,
|
---|
654 | GLboolean b, GLboolean a );
|
---|
655 |
|
---|
656 | extern void fxDDWriteDepthSpan(GLcontext *ctx, GLuint n, GLint x, GLint y,
|
---|
657 | const GLdepth depth[], const GLubyte mask[]);
|
---|
658 |
|
---|
659 | extern void fxDDReadDepthSpan(GLcontext *ctx, GLuint n, GLint x, GLint y,
|
---|
660 | GLdepth depth[]);
|
---|
661 |
|
---|
662 | extern void fxDDWriteDepthPixels(GLcontext *ctx, GLuint n,
|
---|
663 | const GLint x[], const GLint y[],
|
---|
664 | const GLdepth depth[], const GLubyte mask[]);
|
---|
665 |
|
---|
666 | extern void fxDDReadDepthPixels(GLcontext *ctx, GLuint n,
|
---|
667 | const GLint x[], const GLint y[],
|
---|
668 | GLdepth depth[]);
|
---|
669 |
|
---|
670 | extern void fxDDFastPath( struct vertex_buffer *VB );
|
---|
671 |
|
---|
672 | extern void fxDDShadeModel(GLcontext *ctx, GLenum mode);
|
---|
673 |
|
---|
674 | extern void fxDDCullFace(GLcontext *ctx, GLenum mode);
|
---|
675 | extern void fxDDFrontFace(GLcontext *ctx, GLenum mode);
|
---|
676 |
|
---|
677 | extern void fxPrintRenderState( const char *msg, GLuint state );
|
---|
678 | extern void fxPrintHintState( const char *msg, GLuint state );
|
---|
679 |
|
---|
680 | extern void fxDDDoRenderVB( struct vertex_buffer *VB );
|
---|
681 |
|
---|
682 | extern int fxDDInitFxMesaContext( fxMesaContext fxMesa );
|
---|
683 |
|
---|
684 |
|
---|
685 | extern void fxSetScissorValues(GLcontext *ctx);
|
---|
686 | extern void fxTMMoveInTM_NoLock(fxMesaContext fxMesa,
|
---|
687 | struct gl_texture_object *tObj,
|
---|
688 | GLint where);
|
---|
689 | extern void fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder);
|
---|
690 |
|
---|
691 | #endif
|
---|