cfe43bb687cbfd1bca73637282b20fa354f5a334
[mesa.git] / src / mesa / drivers / glide / fxdrv.h
1 /*
2 * Mesa 3-D graphics library
3 * Version: 4.0
4 *
5 * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25 /* Authors:
26 * David Bucciarelli
27 * Brian Paul
28 * Daryll Strauss
29 * Keith Whitwell
30 * Daniel Borca
31 * Hiroshi Morii
32 */
33
34 /* fxsetup.c - 3Dfx VooDoo rendering mode setup functions */
35
36
37 #ifndef FXDRV_H
38 #define FXDRV_H
39
40 /* If you comment out this define, a variable takes its place, letting
41 * you turn debugging on/off from the debugger.
42 */
43
44 #include "glheader.h"
45
46
47 #if defined(__linux__)
48 #include <signal.h>
49 #endif
50
51 #include "context.h"
52 #include "imports.h"
53 #include "macros.h"
54 #include "matrix.h"
55 #include "mtypes.h"
56
57 #include "GL/fxmesa.h"
58 #include "fxglidew.h"
59
60 #include "math/m_vector.h"
61
62
63 /* Define some shorter names for these things.
64 */
65 #define XCOORD GR_VERTEX_X_OFFSET
66 #define YCOORD GR_VERTEX_Y_OFFSET
67 #define ZCOORD GR_VERTEX_OOZ_OFFSET
68 #define OOWCOORD GR_VERTEX_OOW_OFFSET
69
70 #define S0COORD GR_VERTEX_SOW_TMU0_OFFSET
71 #define T0COORD GR_VERTEX_TOW_TMU0_OFFSET
72 #define S1COORD GR_VERTEX_SOW_TMU1_OFFSET
73 #define T1COORD GR_VERTEX_TOW_TMU1_OFFSET
74
75
76
77 #ifdef __i386__
78 #define FXCOLOR4( c ) (* (int *)c)
79 #else
80 #define FXCOLOR4( c ) ( \
81 ( ((unsigned int)(c[3]))<<24 ) | \
82 ( ((unsigned int)(c[2]))<<16 ) | \
83 ( ((unsigned int)(c[1]))<<8 ) | \
84 ( (unsigned int)(c[0])) )
85 #endif
86
87 #define TDFXPACKCOLOR1555( r, g, b, a ) \
88 ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \
89 ((a) ? 0x8000 : 0))
90 #define TDFXPACKCOLOR565( r, g, b ) \
91 ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
92 #define TDFXPACKCOLOR8888( r, g, b, a ) \
93 (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
94
95
96
97 /* fastpath flags first
98 */
99 #define SETUP_TMU0 0x1
100 #define SETUP_TMU1 0x2
101 #define SETUP_RGBA 0x4
102 #define SETUP_SNAP 0x8
103 #define SETUP_XYZW 0x10
104 #define SETUP_PTEX 0x20
105 #define SETUP_PSIZ 0x40
106 #define SETUP_SPEC 0x80
107 #define MAX_SETUP 0x100
108
109
110 #define FX_NUM_TMU 2
111
112 #define FX_TMU0 GR_TMU0
113 #define FX_TMU1 GR_TMU1
114 #define FX_TMU_SPLIT 98
115 #define FX_TMU_BOTH 99
116 #define FX_TMU_NONE 100
117
118 /* Used for fxMesa->lastUnitsMode */
119
120 #define FX_UM_NONE 0x00000000
121
122 #define FX_UM_E0_REPLACE 0x00000001
123 #define FX_UM_E0_MODULATE 0x00000002
124 #define FX_UM_E0_DECAL 0x00000004
125 #define FX_UM_E0_BLEND 0x00000008
126 #define FX_UM_E0_ADD 0x00000010
127
128 #define FX_UM_E1_REPLACE 0x00000020
129 #define FX_UM_E1_MODULATE 0x00000040
130 #define FX_UM_E1_DECAL 0x00000080
131 #define FX_UM_E1_BLEND 0x00000100
132 #define FX_UM_E1_ADD 0x00000200
133
134 #define FX_UM_E_ENVMODE 0x000003ff
135
136 #define FX_UM_E0_ALPHA 0x00001000
137 #define FX_UM_E0_LUMINANCE 0x00002000
138 #define FX_UM_E0_LUMINANCE_ALPHA 0x00004000
139 #define FX_UM_E0_INTENSITY 0x00008000
140 #define FX_UM_E0_RGB 0x00010000
141 #define FX_UM_E0_RGBA 0x00020000
142
143 #define FX_UM_E1_ALPHA 0x00040000
144 #define FX_UM_E1_LUMINANCE 0x00080000
145 #define FX_UM_E1_LUMINANCE_ALPHA 0x00100000
146 #define FX_UM_E1_INTENSITY 0x00200000
147 #define FX_UM_E1_RGB 0x00400000
148 #define FX_UM_E1_RGBA 0x00800000
149
150 #define FX_UM_E_IFMT 0x00fff000
151
152 #define FX_UM_COLOR_ITERATED 0x01000000
153 #define FX_UM_COLOR_CONSTANT 0x02000000
154 #define FX_UM_ALPHA_ITERATED 0x04000000
155 #define FX_UM_ALPHA_CONSTANT 0x08000000
156
157
158 /* for Voodoo3/Banshee's grColorCombine() and grAlphaCombine() */
159 struct tdfx_combine {
160 GrCombineFunction_t Function; /* Combine function */
161 GrCombineFactor_t Factor; /* Combine scale factor */
162 GrCombineLocal_t Local; /* Local combine source */
163 GrCombineOther_t Other; /* Other combine source */
164 FxBool Invert; /* Combine result inversion flag */
165 };
166
167 /* for Voodoo3's grTexCombine() */
168 struct tdfx_texcombine {
169 GrCombineFunction_t FunctionRGB;
170 GrCombineFactor_t FactorRGB;
171 GrCombineFunction_t FunctionAlpha;
172 GrCombineFactor_t FactorAlpha;
173 FxBool InvertRGB;
174 FxBool InvertAlpha;
175 };
176
177
178 /* for Voodoo5's grColorCombineExt() */
179 struct tdfx_combine_color_ext {
180 GrCCUColor_t SourceA;
181 GrCombineMode_t ModeA;
182 GrCCUColor_t SourceB;
183 GrCombineMode_t ModeB;
184 GrCCUColor_t SourceC;
185 FxBool InvertC;
186 GrCCUColor_t SourceD;
187 FxBool InvertD;
188 FxU32 Shift;
189 FxBool Invert;
190 };
191
192 /* for Voodoo5's grAlphaCombineExt() */
193 struct tdfx_combine_alpha_ext {
194 GrACUColor_t SourceA;
195 GrCombineMode_t ModeA;
196 GrACUColor_t SourceB;
197 GrCombineMode_t ModeB;
198 GrACUColor_t SourceC;
199 FxBool InvertC;
200 GrACUColor_t SourceD;
201 FxBool InvertD;
202 FxU32 Shift;
203 FxBool Invert;
204 };
205
206 /* for Voodoo5's grTexColorCombineExt() */
207 struct tdfx_color_texenv {
208 GrTCCUColor_t SourceA;
209 GrCombineMode_t ModeA;
210 GrTCCUColor_t SourceB;
211 GrCombineMode_t ModeB;
212 GrTCCUColor_t SourceC;
213 FxBool InvertC;
214 GrTCCUColor_t SourceD;
215 FxBool InvertD;
216 FxU32 Shift;
217 FxBool Invert;
218 };
219
220 /* for Voodoo5's grTexAlphaCombineExt() */
221 struct tdfx_alpha_texenv {
222 GrTACUColor_t SourceA;
223 GrCombineMode_t ModeA;
224 GrTACUColor_t SourceB;
225 GrCombineMode_t ModeB;
226 GrTACUColor_t SourceC;
227 FxBool InvertC;
228 GrTCCUColor_t SourceD;
229 FxBool InvertD;
230 FxU32 Shift;
231 FxBool Invert;
232 };
233
234 /* Voodoo5's texture combine environment */
235 struct tdfx_texcombine_ext {
236 struct tdfx_alpha_texenv Alpha;
237 struct tdfx_color_texenv Color;
238 GrColor_t EnvColor;
239 };
240
241
242 /*
243 Memory range from startAddr to endAddr-1
244 */
245 typedef struct MemRange_t
246 {
247 struct MemRange_t *next;
248 FxU32 startAddr, endAddr;
249 }
250 MemRange;
251
252 typedef struct
253 {
254 GLsizei width, height; /* image size */
255 GLint wScale, hScale; /* image scale factor */
256 GrTextureFormat_t glideFormat; /* Glide image format */
257 }
258 tfxMipMapLevel;
259
260 /*
261 * TDFX-specific texture object data. This hangs off of the
262 * struct gl_texture_object DriverData pointer.
263 */
264 typedef struct tfxTexInfo_t
265 {
266 struct tfxTexInfo_t *next;
267 struct gl_texture_object *tObj;
268
269 GLuint lastTimeUsed;
270 FxU32 whichTMU;
271 GLboolean isInTM;
272
273 MemRange *tm[FX_NUM_TMU];
274
275 GLint minLevel, maxLevel;
276 GLint baseLevelInternalFormat;
277
278 GrTexInfo info;
279
280 GrTextureFilterMode_t minFilt;
281 GrTextureFilterMode_t maxFilt;
282 FxBool LODblend;
283
284 GrTextureClampMode_t sClamp;
285 GrTextureClampMode_t tClamp;
286
287 GrMipMapMode_t mmMode;
288
289 GLfloat sScale, tScale;
290
291 GrTexTable_t paltype;
292 GuTexPalette palette;
293
294 GLboolean fixedPalette;
295 GLboolean validated;
296 }
297 tfxTexInfo;
298
299 typedef struct
300 {
301 GLuint swapBuffer;
302 GLuint reqTexUpload;
303 GLuint texUpload;
304 GLuint memTexUpload;
305 }
306 tfxStats;
307
308
309
310 typedef struct
311 {
312 /* Alpha test */
313
314 GLboolean alphaTestEnabled;
315 GrCmpFnc_t alphaTestFunc;
316 GLfloat alphaTestRefValue;
317
318 /* Blend function */
319
320 GLboolean blendEnabled;
321 GrAlphaBlendFnc_t blendSrcFuncRGB;
322 GrAlphaBlendFnc_t blendDstFuncRGB;
323 GrAlphaBlendFnc_t blendSrcFuncAlpha;
324 GrAlphaBlendFnc_t blendDstFuncAlpha;
325 GrAlphaBlendOp_t blendEq;
326
327 /* Depth test */
328
329 GLboolean depthTestEnabled;
330 GLboolean depthMask;
331 GrCmpFnc_t depthTestFunc;
332 FxI32 depthBias;
333
334 /* Stencil */
335
336 GLboolean stencilEnabled;
337 GrCmpFnc_t stencilFunction; /* Stencil function */
338 GrStencil_t stencilRefValue; /* Stencil reference value */
339 GrStencil_t stencilValueMask; /* Value mask */
340 GrStencil_t stencilWriteMask; /* Write mask */
341 GrCmpFnc_t stencilFailFunc; /* Stencil fail function */
342 GrCmpFnc_t stencilZFailFunc; /* Stencil pass, depth fail function */
343 GrCmpFnc_t stencilZPassFunc; /* Stencil pass, depth pass function */
344 GrStencil_t stencilClear; /* Buffer clear value */
345 }
346 tfxUnitsState;
347
348
349
350
351 /* Flags for fxMesa->new_state
352 */
353 #define FX_NEW_TEXTURING 0x1
354 #define FX_NEW_BLEND 0x2
355 #define FX_NEW_ALPHA 0x4
356 #define FX_NEW_DEPTH 0x8
357 #define FX_NEW_FOG 0x10
358 #define FX_NEW_SCISSOR 0x20
359 #define FX_NEW_COLOR_MASK 0x40
360 #define FX_NEW_CULL 0x80
361 #define FX_NEW_STENCIL 0x100
362
363
364 #define FX_CONTEXT(ctx) ((fxMesaContext)((ctx)->DriverCtx))
365
366 #define FX_TEXTURE_DATA(texUnit) fxTMGetTexInfo((texUnit)->_Current)
367
368 #define fxTMGetTexInfo(o) ((tfxTexInfo*)((o)->DriverData))
369
370 #define FX_MIPMAP_DATA(img) ((tfxMipMapLevel *) (img)->DriverData)
371
372 #define BEGIN_BOARD_LOCK()
373 #define END_BOARD_LOCK()
374 #define BEGIN_CLIP_LOOP()
375 #define END_CLIP_LOOP()
376
377
378
379
380 /* Covers the state referenced by IsInHardware:
381 */
382 #define _FX_NEW_IS_IN_HARDWARE (_NEW_TEXTURE| \
383 _NEW_HINT| \
384 _NEW_STENCIL| \
385 _NEW_BUFFERS| \
386 _NEW_COLOR| \
387 _NEW_LIGHT)
388
389 /* Covers the state referenced by fxDDChooseRenderState
390 */
391 #define _FX_NEW_RENDERSTATE (_FX_NEW_IS_IN_HARDWARE | \
392 _DD_NEW_FLATSHADE | \
393 _DD_NEW_TRI_LIGHT_TWOSIDE| \
394 _DD_NEW_TRI_OFFSET | \
395 _DD_NEW_TRI_UNFILLED | \
396 _DD_NEW_TRI_SMOOTH | \
397 _DD_NEW_TRI_STIPPLE | \
398 _DD_NEW_LINE_SMOOTH | \
399 _DD_NEW_LINE_STIPPLE | \
400 _DD_NEW_LINE_WIDTH | \
401 _DD_NEW_POINT_SMOOTH | \
402 _DD_NEW_POINT_SIZE | \
403 _NEW_LINE)
404
405
406 /* Covers the state referenced by fxDDChooseSetupFunction.
407 */
408 #define _FX_NEW_SETUP_FUNCTION (_NEW_LIGHT| \
409 _NEW_FOG| \
410 _NEW_TEXTURE| \
411 _NEW_COLOR) \
412
413
414 /* lookup table for scaling y bit colors up to 8 bits */
415 extern GLuint FX_rgb_scale_4[16];
416 extern GLuint FX_rgb_scale_5[32];
417 extern GLuint FX_rgb_scale_6[64];
418
419 typedef void (*fx_tri_func) (fxMesaContext, GrVertex *, GrVertex *, GrVertex *);
420 typedef void (*fx_line_func) (fxMesaContext, GrVertex *, GrVertex *);
421 typedef void (*fx_point_func) (fxMesaContext, GrVertex *);
422
423 struct tfxMesaContext
424 {
425 GrTexTable_t glbPalType;
426 GuTexPalette glbPalette;
427
428 GLcontext *glCtx; /* the core Mesa context */
429 GLvisual *glVis; /* describes the color buffer */
430 GLframebuffer *glBuffer; /* the ancillary buffers */
431
432 GLint board; /* the board used for this context */
433 GLint width, height; /* size of color buffer */
434
435 GrBuffer_t currentFB;
436
437 GLboolean bgrOrder;
438 GrColor_t color;
439 GrColor_t clearC;
440 GrAlpha_t clearA;
441 GLuint constColor;
442 GrCullMode_t cullMode;
443
444 tfxUnitsState unitsState;
445 tfxUnitsState restoreUnitsState; /* saved during multipass */
446
447
448 GLuint new_state;
449 GLuint new_gl_state;
450
451 /* Texture Memory Manager Data
452 */
453 GLuint texBindNumber;
454 GLint tmuSrc;
455 GLuint lastUnitsMode;
456 GLuint freeTexMem[FX_NUM_TMU];
457 MemRange *tmPool;
458 MemRange *tmFree[FX_NUM_TMU];
459
460 GLenum fogTableMode;
461 GLfloat fogDensity;
462 GLfloat fogStart, fogEnd;
463 GrFog_t *fogTable;
464 GLint textureAlign;
465 GLint textureMaxLod;
466
467 /* Vertex building and storage:
468 */
469 GLuint tmu_source[FX_NUM_TMU];
470 GLuint SetupIndex;
471 GLuint stw_hint_state; /* for grHints */
472 GrVertex *verts;
473 GLboolean snapVertices; /* needed for older Voodoo hardware */
474
475 /* Rasterization:
476 */
477 GLuint render_index;
478 GLuint fallback;
479 GLenum render_primitive;
480 GLenum raster_primitive;
481
482 /* Current rasterization functions
483 */
484 fx_point_func draw_point;
485 fx_line_func draw_line;
486 fx_tri_func draw_tri;
487
488
489 /* Keep texture scales somewhere handy:
490 */
491 GLfloat s0scale;
492 GLfloat s1scale;
493 GLfloat t0scale;
494 GLfloat t1scale;
495
496 GLfloat inv_s0scale;
497 GLfloat inv_s1scale;
498 GLfloat inv_t0scale;
499 GLfloat inv_t1scale;
500
501 /* Glide stuff
502 */
503 tfxStats stats;
504 void *state;
505
506 /* Options */
507
508 GLboolean verbose;
509 GLboolean haveTwoTMUs; /* True if we really have 2 tmu's */
510 GLboolean haveHwAlpha;
511 GLboolean haveHwStencil;
512 GLboolean haveZBuffer;
513 GLboolean haveDoubleBuffer;
514 GLboolean haveGlobalPaletteTexture;
515 GLint swapInterval;
516 GLint maxPendingSwapBuffers;
517
518 GrContext_t glideContext;
519
520 int screen_width;
521 int screen_height;
522 int clipMinX;
523 int clipMaxX;
524 int clipMinY;
525 int clipMaxY;
526
527 int colDepth;
528 GLboolean fsaa;
529
530 /* Glide (per card) capabilities. These get mirrored
531 * from `glbHWConfig' when creating a new context...
532 */
533 GrSstType type;
534 FxBool HavePalExt; /* PALETTE6666 */
535 FxBool HavePixExt; /* PIXEXT */
536 FxBool HaveTexFmt; /* TEXFMT */
537 FxBool HaveCmbExt; /* COMBINE */
538 FxBool HaveMirExt; /* TEXMIRROR */
539 FxBool HaveTexUma; /* TEXUMA */
540 FxBool HaveTexus2; /* Texus 2 - FXT1 */
541 struct tdfx_glide Glide;
542 char rendererString[64];
543 };
544
545
546 extern void fxSetupFXUnits(GLcontext *);
547 extern void fxSetupDDPointers(GLcontext *);
548
549 /* fxvb.c:
550 */
551 extern void fxAllocVB(GLcontext * ctx);
552 extern void fxFreeVB(GLcontext * ctx);
553 extern void fxPrintSetupFlags(char *msg, GLuint flags );
554 extern void fxCheckTexSizes( GLcontext *ctx );
555 extern void fxBuildVertices( GLcontext *ctx, GLuint start, GLuint count,
556 GLuint newinputs );
557 extern void fxChooseVertexState( GLcontext *ctx );
558
559
560
561
562
563
564 /* fxtrifuncs:
565 */
566 extern void fxDDInitTriFuncs(GLcontext *);
567 extern void fxDDChooseRenderState(GLcontext * ctx);
568
569
570 extern void fxUpdateDDSpanPointers(GLcontext *);
571 extern void fxSetupDDSpanPointers(GLcontext *);
572
573 extern void fxPrintTextureData(tfxTexInfo * ti);
574
575 extern const struct gl_texture_format *
576 fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
577 GLenum srcFormat, GLenum srcType );
578 extern void fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
579 GLint internalFormat, GLint width, GLint height,
580 GLint border, GLenum format, GLenum type,
581 const GLvoid * pixels,
582 const struct gl_pixelstore_attrib *packing,
583 struct gl_texture_object *texObj,
584 struct gl_texture_image *texImage);
585 extern void fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
586 GLint xoffset, GLint yoffset,
587 GLsizei width, GLsizei height,
588 GLenum format, GLenum type,
589 const GLvoid * pixels,
590 const struct gl_pixelstore_attrib *packing,
591 struct gl_texture_object *texObj,
592 struct gl_texture_image *texImage);
593 extern void fxDDCompressedTexImage2D(GLcontext *ctx, GLenum target,
594 GLint level, GLint internalFormat,
595 GLsizei width, GLsizei height, GLint border,
596 GLsizei imageSize, const GLvoid *data,
597 struct gl_texture_object *texObj,
598 struct gl_texture_image *texImage);
599 extern void fxDDCompressedTexSubImage2D(GLcontext *ctx, GLenum target,
600 GLint level, GLint xoffset,
601 GLint yoffset, GLsizei width,
602 GLint height, GLenum format,
603 GLsizei imageSize, const GLvoid *data,
604 struct gl_texture_object *texObj,
605 struct gl_texture_image *texImage);
606 extern void fxDDTexImage1D(GLcontext * ctx, GLenum target, GLint level,
607 GLint internalFormat, GLint width,
608 GLint border, GLenum format, GLenum type,
609 const GLvoid * pixels,
610 const struct gl_pixelstore_attrib *packing,
611 struct gl_texture_object *texObj,
612 struct gl_texture_image *texImage);
613 extern void fxDDTexSubImage1D(GLcontext * ctx, GLenum target, GLint level,
614 GLint xoffset, GLint width,
615 GLenum format, GLenum type,
616 const GLvoid * pixels,
617 const struct gl_pixelstore_attrib *packing,
618 struct gl_texture_object *texObj,
619 struct gl_texture_image *texImage);
620 extern GLboolean fxDDTestProxyTexImage (GLcontext *ctx, GLenum target,
621 GLint level, GLint internalFormat,
622 GLenum format, GLenum type,
623 GLint width, GLint height,
624 GLint depth, GLint border);
625 extern void fxDDTexEnv(GLcontext *, GLenum, GLenum, const GLfloat *);
626 extern void fxDDTexParam(GLcontext *, GLenum, struct gl_texture_object *,
627 GLenum, const GLfloat *);
628 extern void fxDDTexBind(GLcontext *, GLenum, struct gl_texture_object *);
629 extern struct gl_texture_object *fxDDNewTextureObject( GLcontext *ctx, GLuint name, GLenum target );
630 extern void fxDDTexDel(GLcontext *, struct gl_texture_object *);
631 extern GLboolean fxDDIsTextureResident(GLcontext *, struct gl_texture_object *);
632 extern void fxDDTexPalette(GLcontext *, struct gl_texture_object *);
633 extern void fxDDTexUseGlbPalette(GLcontext *, GLboolean);
634
635 extern void fxDDEnable(GLcontext *, GLenum, GLboolean);
636 extern void fxDDAlphaFunc(GLcontext *, GLenum, GLfloat);
637 extern void fxDDBlendFuncSeparate(GLcontext *, GLenum, GLenum, GLenum, GLenum);
638 extern void fxDDBlendEquationSeparate(GLcontext *, GLenum, GLenum);
639 extern void fxDDDepthMask(GLcontext *, GLboolean);
640 extern void fxDDDepthFunc(GLcontext *, GLenum);
641 extern void fxDDStencilFunc (GLcontext *ctx, GLenum func, GLint ref, GLuint mask);
642 extern void fxDDStencilMask (GLcontext *ctx, GLuint mask);
643 extern void fxDDStencilOp (GLcontext *ctx, GLenum sfail, GLenum zfail, GLenum zpass);
644
645 extern void fxDDInitExtensions(GLcontext * ctx);
646
647 extern void fxTMInit(fxMesaContext ctx);
648 extern void fxTMClose(fxMesaContext ctx);
649 extern void fxTMRestoreTextures_NoLock(fxMesaContext ctx);
650 extern void fxTMMoveInTM(fxMesaContext, struct gl_texture_object *, GLint);
651 extern void fxTMMoveOutTM(fxMesaContext, struct gl_texture_object *);
652 #define fxTMMoveOutTM_NoLock fxTMMoveOutTM
653 extern void fxTMFreeTexture(fxMesaContext, struct gl_texture_object *);
654 extern void fxTMReloadMipMapLevel(fxMesaContext, struct gl_texture_object *,
655 GLint);
656 extern void fxTMReloadSubMipMapLevel(fxMesaContext,
657 struct gl_texture_object *, GLint, GLint,
658 GLint);
659 extern int fxTMCheckStartAddr (fxMesaContext fxMesa, GLint tmu, tfxTexInfo *ti);
660
661 extern void fxTexGetFormat(GLcontext *, GLenum, GrTextureFormat_t *, GLint *); /* [koolsmoky] */
662
663 extern int fxTexGetInfo(int, int, GrLOD_t *, GrAspectRatio_t *,
664 float *, float *, int *, int *);
665
666 extern void fxDDScissor(GLcontext * ctx,
667 GLint x, GLint y, GLsizei w, GLsizei h);
668 extern void fxDDFogfv(GLcontext * ctx, GLenum pname, const GLfloat * params);
669 extern void fxDDColorMask(GLcontext * ctx,
670 GLboolean r, GLboolean g, GLboolean b, GLboolean a);
671
672 extern void fxDDWriteDepthSpan(GLcontext * ctx, GLuint n, GLint x, GLint y,
673 const GLdepth depth[], const GLubyte mask[]);
674
675 extern void fxDDReadDepthSpan(GLcontext * ctx, GLuint n, GLint x, GLint y,
676 GLdepth depth[]);
677
678 extern void fxDDWriteDepthPixels(GLcontext * ctx, GLuint n,
679 const GLint x[], const GLint y[],
680 const GLdepth depth[], const GLubyte mask[]);
681
682 extern void fxDDReadDepthPixels(GLcontext * ctx, GLuint n,
683 const GLint x[], const GLint y[],
684 GLdepth depth[]);
685
686 extern void fxDDShadeModel(GLcontext * ctx, GLenum mode);
687
688 extern void fxDDCullFace(GLcontext * ctx, GLenum mode);
689 extern void fxDDFrontFace(GLcontext * ctx, GLenum mode);
690
691 extern void fxPrintRenderState(const char *msg, GLuint state);
692 extern void fxPrintHintState(const char *msg, GLuint state);
693
694 extern int fxDDInitFxMesaContext(fxMesaContext fxMesa);
695 extern void fxDDDestroyFxMesaContext(fxMesaContext fxMesa);
696
697
698 extern void fxSetScissorValues(GLcontext * ctx);
699 extern void fxTMMoveInTM_NoLock(fxMesaContext fxMesa,
700 struct gl_texture_object *tObj, GLint where);
701
702 extern void fxCheckIsInHardware(GLcontext *ctx);
703
704 /* fxsetup:
705 * semi-private functions
706 */
707 void fxSetupCull (GLcontext * ctx);
708 void fxSetupScissor (GLcontext * ctx);
709 void fxSetupColorMask (GLcontext * ctx);
710 void fxSetupBlend (GLcontext *ctx);
711 void fxSetupDepthTest (GLcontext *ctx);
712 void fxSetupTexture (GLcontext *ctx);
713
714 /* Flags for software fallback cases */
715 #define FX_FALLBACK_TEXTURE_MAP 0x0001
716 #define FX_FALLBACK_DRAW_BUFFER 0x0002
717 #define FX_FALLBACK_SPECULAR 0x0004
718 #define FX_FALLBACK_STENCIL 0x0008
719 #define FX_FALLBACK_RENDER_MODE 0x0010
720 #define FX_FALLBACK_LOGICOP 0x0020
721 #define FX_FALLBACK_TEXTURE_ENV 0x0040
722 #define FX_FALLBACK_TEXTURE_BORDER 0x0080
723 #define FX_FALLBACK_COLORMASK 0x0100
724 #define FX_FALLBACK_BLEND 0x0200
725 #define FX_FALLBACK_TEXTURE_MULTI 0x0400
726
727 extern GLuint fx_check_IsInHardware(GLcontext *ctx);
728
729 /* run-time debugging */
730 #if FX_DEBUG
731 extern int TDFX_DEBUG;
732 #else
733 #define TDFX_DEBUG 0
734 #endif
735
736 /* dirty hacks */
737 #define FX_RESCALE_BIG_TEXURES_HACK 1
738 #define FX_COMPRESS_S3TC_AS_FXT1_HACK 1
739
740 #endif