2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
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:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
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.
34 /* fxsetup.c - 3Dfx VooDoo rendering mode setup functions */
40 /* If you comment out this define, a variable takes its place, letting
41 * you turn debugging on/off from the debugger.
47 #if defined(__linux__)
57 #include "GL/fxmesa.h"
60 #include "math/m_vector.h"
63 /* Define some shorter names for these things.
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
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
78 #define FXCOLOR4( c ) (* (int *)c)
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])) )
87 #define TDFXPACKCOLOR1555( r, g, b, a ) \
88 ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \
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))
97 /* fastpath flags first
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 SETUP_FOGC 0x100
108 #define MAX_SETUP 0x200
113 #define FX_TMU0 GR_TMU0
114 #define FX_TMU1 GR_TMU1
115 #define FX_TMU_SPLIT 98
116 #define FX_TMU_BOTH 99
117 #define FX_TMU_NONE 100
119 /* Used for fxMesa->lastUnitsMode */
121 #define FX_UM_NONE 0x00000000
123 #define FX_UM_E0_REPLACE 0x00000001
124 #define FX_UM_E0_MODULATE 0x00000002
125 #define FX_UM_E0_DECAL 0x00000004
126 #define FX_UM_E0_BLEND 0x00000008
127 #define FX_UM_E0_ADD 0x00000010
129 #define FX_UM_E1_REPLACE 0x00000020
130 #define FX_UM_E1_MODULATE 0x00000040
131 #define FX_UM_E1_DECAL 0x00000080
132 #define FX_UM_E1_BLEND 0x00000100
133 #define FX_UM_E1_ADD 0x00000200
135 #define FX_UM_E_ENVMODE 0x000003ff
137 #define FX_UM_E0_ALPHA 0x00001000
138 #define FX_UM_E0_LUMINANCE 0x00002000
139 #define FX_UM_E0_LUMINANCE_ALPHA 0x00004000
140 #define FX_UM_E0_INTENSITY 0x00008000
141 #define FX_UM_E0_RGB 0x00010000
142 #define FX_UM_E0_RGBA 0x00020000
144 #define FX_UM_E1_ALPHA 0x00040000
145 #define FX_UM_E1_LUMINANCE 0x00080000
146 #define FX_UM_E1_LUMINANCE_ALPHA 0x00100000
147 #define FX_UM_E1_INTENSITY 0x00200000
148 #define FX_UM_E1_RGB 0x00400000
149 #define FX_UM_E1_RGBA 0x00800000
151 #define FX_UM_E_IFMT 0x00fff000
153 #define FX_UM_COLOR_ITERATED 0x01000000
154 #define FX_UM_COLOR_CONSTANT 0x02000000
155 #define FX_UM_ALPHA_ITERATED 0x04000000
156 #define FX_UM_ALPHA_CONSTANT 0x08000000
159 /* for Voodoo3/Banshee's grColorCombine() and grAlphaCombine() */
160 struct tdfx_combine
{
161 GrCombineFunction_t Function
; /* Combine function */
162 GrCombineFactor_t Factor
; /* Combine scale factor */
163 GrCombineLocal_t Local
; /* Local combine source */
164 GrCombineOther_t Other
; /* Other combine source */
165 FxBool Invert
; /* Combine result inversion flag */
168 /* for Voodoo3's grTexCombine() */
169 struct tdfx_texcombine
{
170 GrCombineFunction_t FunctionRGB
;
171 GrCombineFactor_t FactorRGB
;
172 GrCombineFunction_t FunctionAlpha
;
173 GrCombineFactor_t FactorAlpha
;
179 /* for Voodoo5's grColorCombineExt() */
180 struct tdfx_combine_color_ext
{
181 GrCCUColor_t SourceA
;
182 GrCombineMode_t ModeA
;
183 GrCCUColor_t SourceB
;
184 GrCombineMode_t ModeB
;
185 GrCCUColor_t SourceC
;
187 GrCCUColor_t SourceD
;
193 /* for Voodoo5's grAlphaCombineExt() */
194 struct tdfx_combine_alpha_ext
{
195 GrACUColor_t SourceA
;
196 GrCombineMode_t ModeA
;
197 GrACUColor_t SourceB
;
198 GrCombineMode_t ModeB
;
199 GrACUColor_t SourceC
;
201 GrACUColor_t SourceD
;
207 /* for Voodoo5's grTexColorCombineExt() */
208 struct tdfx_color_texenv
{
209 GrTCCUColor_t SourceA
;
210 GrCombineMode_t ModeA
;
211 GrTCCUColor_t SourceB
;
212 GrCombineMode_t ModeB
;
213 GrTCCUColor_t SourceC
;
215 GrTCCUColor_t SourceD
;
221 /* for Voodoo5's grTexAlphaCombineExt() */
222 struct tdfx_alpha_texenv
{
223 GrTACUColor_t SourceA
;
224 GrCombineMode_t ModeA
;
225 GrTACUColor_t SourceB
;
226 GrCombineMode_t ModeB
;
227 GrTACUColor_t SourceC
;
229 GrTCCUColor_t SourceD
;
235 /* Voodoo5's texture combine environment */
236 struct tdfx_texcombine_ext
{
237 struct tdfx_alpha_texenv Alpha
;
238 struct tdfx_color_texenv Color
;
244 Memory range from startAddr to endAddr-1
246 typedef struct MemRange_t
248 struct MemRange_t
*next
;
249 FxU32 startAddr
, endAddr
;
255 GLsizei width
, height
; /* image size */
256 GLint wScale
, hScale
; /* image scale factor */
257 GrTextureFormat_t glideFormat
; /* Glide image format */
262 * TDFX-specific texture object data. This hangs off of the
263 * struct gl_texture_object DriverData pointer.
265 typedef struct tfxTexInfo_t
267 struct tfxTexInfo_t
*next
;
268 struct gl_texture_object
*tObj
;
274 MemRange
*tm
[FX_NUM_TMU
];
276 GLint minLevel
, maxLevel
;
277 GLint baseLevelInternalFormat
;
281 GrTextureFilterMode_t minFilt
;
282 GrTextureFilterMode_t maxFilt
;
285 GrTextureClampMode_t sClamp
;
286 GrTextureClampMode_t tClamp
;
288 GrMipMapMode_t mmMode
;
290 GLfloat sScale
, tScale
;
292 GrTexTable_t paltype
;
293 GuTexPalette palette
;
295 GLboolean fixedPalette
;
317 GLboolean alphaTestEnabled
;
318 GrCmpFnc_t alphaTestFunc
;
319 GLfloat alphaTestRefValue
;
323 GLboolean blendEnabled
;
324 GrAlphaBlendFnc_t blendSrcFuncRGB
;
325 GrAlphaBlendFnc_t blendDstFuncRGB
;
326 GrAlphaBlendFnc_t blendSrcFuncAlpha
;
327 GrAlphaBlendFnc_t blendDstFuncAlpha
;
328 GrAlphaBlendOp_t blendEqRGB
;
329 GrAlphaBlendOp_t blendEqAlpha
;
333 GLboolean depthTestEnabled
;
335 GrCmpFnc_t depthTestFunc
;
340 GLboolean stencilEnabled
;
341 GrCmpFnc_t stencilFunction
; /* Stencil function */
342 GrStencil_t stencilRefValue
; /* Stencil reference value */
343 GrStencil_t stencilValueMask
; /* Value mask */
344 GrStencil_t stencilWriteMask
; /* Write mask */
345 GrCmpFnc_t stencilFailFunc
; /* Stencil fail function */
346 GrCmpFnc_t stencilZFailFunc
; /* Stencil pass, depth fail function */
347 GrCmpFnc_t stencilZPassFunc
; /* Stencil pass, depth pass function */
348 GrStencil_t stencilClear
; /* Buffer clear value */
355 /* Flags for fxMesa->new_state
357 #define FX_NEW_TEXTURING 0x1
358 #define FX_NEW_BLEND 0x2
359 #define FX_NEW_ALPHA 0x4
360 #define FX_NEW_DEPTH 0x8
361 #define FX_NEW_FOG 0x10
362 #define FX_NEW_SCISSOR 0x20
363 #define FX_NEW_COLOR_MASK 0x40
364 #define FX_NEW_CULL 0x80
365 #define FX_NEW_STENCIL 0x100
368 #define FX_CONTEXT(ctx) ((fxMesaContext)((ctx)->DriverCtx))
370 #define FX_TEXTURE_DATA(texUnit) fxTMGetTexInfo((texUnit)->_Current)
372 #define fxTMGetTexInfo(o) ((tfxTexInfo*)((o)->DriverData))
374 #define FX_MIPMAP_DATA(img) ((tfxMipMapLevel *) (img)->DriverData)
376 #define BEGIN_BOARD_LOCK()
377 #define END_BOARD_LOCK()
378 #define BEGIN_CLIP_LOOP()
379 #define END_CLIP_LOOP()
384 /* Covers the state referenced by IsInHardware:
386 #define _FX_NEW_IS_IN_HARDWARE (_NEW_TEXTURE| \
393 /* Covers the state referenced by fxDDChooseRenderState
395 #define _FX_NEW_RENDERSTATE (_FX_NEW_IS_IN_HARDWARE | \
396 _DD_NEW_FLATSHADE | \
397 _DD_NEW_TRI_LIGHT_TWOSIDE| \
398 _DD_NEW_TRI_OFFSET | \
399 _DD_NEW_TRI_UNFILLED | \
400 _DD_NEW_TRI_SMOOTH | \
401 _DD_NEW_TRI_STIPPLE | \
402 _DD_NEW_LINE_SMOOTH | \
403 _DD_NEW_LINE_STIPPLE | \
404 _DD_NEW_LINE_WIDTH | \
405 _DD_NEW_POINT_SMOOTH | \
406 _DD_NEW_POINT_SIZE | \
410 /* Covers the state referenced by fxDDChooseSetupFunction.
412 #define _FX_NEW_SETUP_FUNCTION (_NEW_LIGHT| \
418 /* lookup table for scaling y bit colors up to 8 bits */
419 extern GLuint FX_rgb_scale_4
[16];
420 extern GLuint FX_rgb_scale_5
[32];
421 extern GLuint FX_rgb_scale_6
[64];
423 typedef void (*fx_tri_func
) (fxMesaContext
, GrVertex
*, GrVertex
*, GrVertex
*);
424 typedef void (*fx_line_func
) (fxMesaContext
, GrVertex
*, GrVertex
*);
425 typedef void (*fx_point_func
) (fxMesaContext
, GrVertex
*);
427 struct tfxMesaContext
429 GrTexTable_t glbPalType
;
430 GuTexPalette glbPalette
;
432 GLcontext
*glCtx
; /* the core Mesa context */
433 GLvisual
*glVis
; /* describes the color buffer */
434 GLframebuffer
*glBuffer
; /* the ancillary buffers */
436 GLint board
; /* the board used for this context */
437 GLint width
, height
; /* size of color buffer */
439 GrBuffer_t currentFB
;
446 GrCullMode_t cullMode
;
448 tfxUnitsState unitsState
;
449 tfxUnitsState restoreUnitsState
; /* saved during multipass */
450 GLboolean multipass
; /* true when drawing intermediate pass */
455 /* Texture Memory Manager Data
457 GLuint texBindNumber
;
459 GLuint lastUnitsMode
;
460 GLuint freeTexMem
[FX_NUM_TMU
];
462 MemRange
*tmFree
[FX_NUM_TMU
];
466 GLfloat fogStart
, fogEnd
;
471 /* Vertex building and storage:
473 GLuint tmu_source
[FX_NUM_TMU
];
475 GLuint stw_hint_state
; /* for grHints */
477 GLboolean snapVertices
; /* needed for older Voodoo hardware */
483 GLenum render_primitive
;
484 GLenum raster_primitive
;
486 /* Current rasterization functions
488 fx_point_func draw_point
;
489 fx_line_func draw_line
;
490 fx_tri_func draw_tri
;
493 /* Keep texture scales somewhere handy:
513 GLboolean haveTwoTMUs
; /* True if we really have 2 tmu's */
514 GLboolean haveHwAlpha
;
515 GLboolean haveHwStencil
;
516 GLboolean haveZBuffer
;
517 GLboolean haveDoubleBuffer
;
518 GLboolean haveGlobalPaletteTexture
;
520 GLint maxPendingSwapBuffers
;
522 GrContext_t glideContext
;
534 /* Glide (per card) capabilities. These get mirrored
535 * from `glbHWConfig' when creating a new context...
538 FxBool HavePalExt
; /* PALETTE6666 */
539 FxBool HavePixExt
; /* PIXEXT */
540 FxBool HaveTexFmt
; /* TEXFMT */
541 FxBool HaveCmbExt
; /* COMBINE */
542 FxBool HaveMirExt
; /* TEXMIRROR */
543 FxBool HaveTexUma
; /* TEXUMA */
544 FxBool HaveTexus2
; /* Texus 2 - FXT1 */
545 struct tdfx_glide Glide
;
546 char rendererString
[64];
550 extern void fxSetupFXUnits(GLcontext
*);
551 extern void fxSetupDDPointers(GLcontext
*);
555 extern void fxAllocVB(GLcontext
* ctx
);
556 extern void fxFreeVB(GLcontext
* ctx
);
557 extern void fxPrintSetupFlags(char *msg
, GLuint flags
);
558 extern void fxCheckTexSizes( GLcontext
*ctx
);
559 extern void fxBuildVertices( GLcontext
*ctx
, GLuint start
, GLuint end
,
561 extern void fxChooseVertexState( GLcontext
*ctx
);
570 extern void fxDDInitTriFuncs(GLcontext
*);
571 extern void fxDDChooseRenderState(GLcontext
* ctx
);
574 extern void fxUpdateDDSpanPointers(GLcontext
*);
575 extern void fxSetupDDSpanPointers(GLcontext
*);
577 extern void fxPrintTextureData(tfxTexInfo
* ti
);
579 extern const struct gl_texture_format
*
580 fxDDChooseTextureFormat( GLcontext
*ctx
, GLint internalFormat
,
581 GLenum srcFormat
, GLenum srcType
);
582 extern void fxDDTexImage2D(GLcontext
* ctx
, GLenum target
, GLint level
,
583 GLint internalFormat
, GLint width
, GLint height
,
584 GLint border
, GLenum format
, GLenum type
,
585 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 fxDDTexSubImage2D(GLcontext
* ctx
, GLenum target
, GLint level
,
590 GLint xoffset
, GLint yoffset
,
591 GLsizei width
, GLsizei height
,
592 GLenum format
, GLenum type
,
593 const GLvoid
* pixels
,
594 const struct gl_pixelstore_attrib
*packing
,
595 struct gl_texture_object
*texObj
,
596 struct gl_texture_image
*texImage
);
597 extern void fxDDCompressedTexImage2D(GLcontext
*ctx
, GLenum target
,
598 GLint level
, GLint internalFormat
,
599 GLsizei width
, GLsizei height
, GLint border
,
600 GLsizei imageSize
, const GLvoid
*data
,
601 struct gl_texture_object
*texObj
,
602 struct gl_texture_image
*texImage
);
603 extern void fxDDCompressedTexSubImage2D(GLcontext
*ctx
, GLenum target
,
604 GLint level
, GLint xoffset
,
605 GLint yoffset
, GLsizei width
,
606 GLint height
, GLenum format
,
607 GLsizei imageSize
, const GLvoid
*data
,
608 struct gl_texture_object
*texObj
,
609 struct gl_texture_image
*texImage
);
610 extern void fxDDTexImage1D(GLcontext
* ctx
, GLenum target
, GLint level
,
611 GLint internalFormat
, GLint width
,
612 GLint border
, GLenum format
, GLenum type
,
613 const GLvoid
* pixels
,
614 const struct gl_pixelstore_attrib
*packing
,
615 struct gl_texture_object
*texObj
,
616 struct gl_texture_image
*texImage
);
617 extern void fxDDTexSubImage1D(GLcontext
* ctx
, GLenum target
, GLint level
,
618 GLint xoffset
, GLint width
,
619 GLenum format
, GLenum type
,
620 const GLvoid
* pixels
,
621 const struct gl_pixelstore_attrib
*packing
,
622 struct gl_texture_object
*texObj
,
623 struct gl_texture_image
*texImage
);
624 extern GLboolean
fxDDTestProxyTexImage (GLcontext
*ctx
, GLenum target
,
625 GLint level
, GLint internalFormat
,
626 GLenum format
, GLenum type
,
627 GLint width
, GLint height
,
628 GLint depth
, GLint border
);
629 extern void fxDDTexEnv(GLcontext
*, GLenum
, GLenum
, const GLfloat
*);
630 extern void fxDDTexParam(GLcontext
*, GLenum
, struct gl_texture_object
*,
631 GLenum
, const GLfloat
*);
632 extern void fxDDTexBind(GLcontext
*, GLenum
, struct gl_texture_object
*);
633 extern struct gl_texture_object
*fxDDNewTextureObject( GLcontext
*ctx
, GLuint name
, GLenum target
);
634 extern void fxDDTexDel(GLcontext
*, struct gl_texture_object
*);
635 extern GLboolean
fxDDIsTextureResident(GLcontext
*, struct gl_texture_object
*);
636 extern void fxDDTexPalette(GLcontext
*, struct gl_texture_object
*);
637 extern void fxDDTexUseGlbPalette(GLcontext
*, GLboolean
);
639 extern void fxDDEnable(GLcontext
*, GLenum
, GLboolean
);
640 extern void fxDDAlphaFunc(GLcontext
*, GLenum
, GLfloat
);
641 extern void fxDDBlendFuncSeparate(GLcontext
*, GLenum
, GLenum
, GLenum
, GLenum
);
642 extern void fxDDBlendEquationSeparate(GLcontext
*, GLenum
, GLenum
);
643 extern void fxDDDepthMask(GLcontext
*, GLboolean
);
644 extern void fxDDDepthFunc(GLcontext
*, GLenum
);
645 extern void fxDDStencilFunc (GLcontext
*ctx
, GLenum func
, GLint ref
, GLuint mask
);
646 extern void fxDDStencilMask (GLcontext
*ctx
, GLuint mask
);
647 extern void fxDDStencilOp (GLcontext
*ctx
, GLenum sfail
, GLenum zfail
, GLenum zpass
);
649 extern void fxDDInitExtensions(GLcontext
* ctx
);
651 extern void fxTMInit(fxMesaContext ctx
);
652 extern void fxTMClose(fxMesaContext ctx
);
653 extern void fxTMRestoreTextures_NoLock(fxMesaContext ctx
);
654 extern void fxTMMoveInTM(fxMesaContext
, struct gl_texture_object
*, GLint
);
655 extern void fxTMMoveOutTM(fxMesaContext
, struct gl_texture_object
*);
656 #define fxTMMoveOutTM_NoLock fxTMMoveOutTM
657 extern void fxTMFreeTexture(fxMesaContext
, struct gl_texture_object
*);
658 extern void fxTMReloadMipMapLevel(fxMesaContext
, struct gl_texture_object
*,
660 extern void fxTMReloadSubMipMapLevel(fxMesaContext
,
661 struct gl_texture_object
*, GLint
, GLint
,
663 extern int fxTMCheckStartAddr (fxMesaContext fxMesa
, GLint tmu
, tfxTexInfo
*ti
);
665 extern void fxTexGetFormat(GLcontext
*, GLenum
, GrTextureFormat_t
*, GLint
*); /* [koolsmoky] */
667 extern int fxTexGetInfo(int, int, GrLOD_t
*, GrAspectRatio_t
*,
668 float *, float *, int *, int *);
670 extern void fxDDScissor(GLcontext
* ctx
,
671 GLint x
, GLint y
, GLsizei w
, GLsizei h
);
672 extern void fxDDFogfv(GLcontext
* ctx
, GLenum pname
, const GLfloat
* params
);
673 extern void fxDDColorMask(GLcontext
* ctx
,
674 GLboolean r
, GLboolean g
, GLboolean b
, GLboolean a
);
676 extern void fxDDWriteDepthSpan(GLcontext
* ctx
, GLuint n
, GLint x
, GLint y
,
677 const GLdepth depth
[], const GLubyte mask
[]);
679 extern void fxDDReadDepthSpan(GLcontext
* ctx
, GLuint n
, GLint x
, GLint y
,
682 extern void fxDDWriteDepthPixels(GLcontext
* ctx
, GLuint n
,
683 const GLint x
[], const GLint y
[],
684 const GLdepth depth
[], const GLubyte mask
[]);
686 extern void fxDDReadDepthPixels(GLcontext
* ctx
, GLuint n
,
687 const GLint x
[], const GLint y
[],
690 extern void fxDDShadeModel(GLcontext
* ctx
, GLenum mode
);
692 extern void fxDDCullFace(GLcontext
* ctx
, GLenum mode
);
693 extern void fxDDFrontFace(GLcontext
* ctx
, GLenum mode
);
695 extern void fxPrintRenderState(const char *msg
, GLuint state
);
696 extern void fxPrintHintState(const char *msg
, GLuint state
);
698 extern int fxDDInitFxMesaContext(fxMesaContext fxMesa
);
699 extern void fxDDDestroyFxMesaContext(fxMesaContext fxMesa
);
702 extern void fxSetScissorValues(GLcontext
* ctx
);
703 extern void fxTMMoveInTM_NoLock(fxMesaContext fxMesa
,
704 struct gl_texture_object
*tObj
, GLint where
);
706 extern void fxCheckIsInHardware(GLcontext
*ctx
);
709 * semi-private functions
711 void fxSetupCull (GLcontext
* ctx
);
712 void fxSetupScissor (GLcontext
* ctx
);
713 void fxSetupColorMask (GLcontext
* ctx
);
714 void fxSetupBlend (GLcontext
*ctx
);
715 void fxSetupDepthTest (GLcontext
*ctx
);
716 void fxSetupTexture (GLcontext
*ctx
);
717 void fxSetupStencil (GLcontext
*ctx
);
718 void fxSetupStencilFace (GLcontext
*ctx
, GLint face
);
720 /* Flags for software fallback cases */
721 #define FX_FALLBACK_TEXTURE_MAP 0x0001
722 #define FX_FALLBACK_DRAW_BUFFER 0x0002
723 #define FX_FALLBACK_SPECULAR 0x0004
724 #define FX_FALLBACK_STENCIL 0x0008
725 #define FX_FALLBACK_RENDER_MODE 0x0010
726 #define FX_FALLBACK_LOGICOP 0x0020
727 #define FX_FALLBACK_TEXTURE_ENV 0x0040
728 #define FX_FALLBACK_TEXTURE_BORDER 0x0080
729 #define FX_FALLBACK_COLORMASK 0x0100
730 #define FX_FALLBACK_BLEND 0x0200
731 #define FX_FALLBACK_TEXTURE_MULTI 0x0400
733 extern GLuint
fx_check_IsInHardware(GLcontext
*ctx
);
736 *** CNORM: clamp float to [0,1] and map to float in [0,255]
738 #if defined(USE_IEEE) && !defined(DEBUG)
739 #define IEEE_0996 0x3f7f0000 /* 0.996 or so */
740 #define CNORM(N, F) \
746 else if (__tmp.i >= IEEE_0996) \
753 #define CNORM(n, f) \
754 n = (CLAMP((f), 0.0F, 1.0F) * 255.0F)
757 /* run-time debugging */
762 extern int TDFX_DEBUG
;
768 #define FX_RESCALE_BIG_TEXURES_HACK 1
769 #define FX_COMPRESS_S3TC_AS_FXT1_HACK 1