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__)
51 #include "main/context.h"
52 #include "main/imports.h"
53 #include "main/macros.h"
54 #include "main/matrix.h"
55 #include "main/mtypes.h"
57 #include "GL/fxmesa.h"
60 #include "math/m_vector.h"
63 #define COPY_FLOAT(dst, src) (dst) = (src)
65 /* Define some shorter names for these things.
67 #define XCOORD GR_VERTEX_X_OFFSET
68 #define YCOORD GR_VERTEX_Y_OFFSET
69 #define ZCOORD GR_VERTEX_OOZ_OFFSET
70 #define OOWCOORD GR_VERTEX_OOW_OFFSET
72 #define S0COORD GR_VERTEX_SOW_TMU0_OFFSET
73 #define T0COORD GR_VERTEX_TOW_TMU0_OFFSET
74 #define S1COORD GR_VERTEX_SOW_TMU1_OFFSET
75 #define T1COORD GR_VERTEX_TOW_TMU1_OFFSET
80 #define FXCOLOR4( c ) (* (int *)c)
82 #define FXCOLOR4( c ) ( \
83 ( ((unsigned int)(c[3]))<<24 ) | \
84 ( ((unsigned int)(c[2]))<<16 ) | \
85 ( ((unsigned int)(c[1]))<<8 ) | \
86 ( (unsigned int)(c[0])) )
89 #define TDFXPACKCOLOR1555( r, g, b, a ) \
90 ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \
92 #define TDFXPACKCOLOR565( r, g, b ) \
93 ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
94 #define TDFXPACKCOLOR8888( r, g, b, a ) \
95 (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
99 /* fastpath flags first
101 #define SETUP_TMU0 0x1
102 #define SETUP_TMU1 0x2
103 #define SETUP_RGBA 0x4
104 #define SETUP_SNAP 0x8
105 #define SETUP_XYZW 0x10
106 #define SETUP_PTEX 0x20
107 #define SETUP_PSIZ 0x40
108 #define SETUP_SPEC 0x80
109 #define SETUP_FOGC 0x100
110 #define MAX_SETUP 0x200
115 #define FX_TMU0 GR_TMU0
116 #define FX_TMU1 GR_TMU1
117 #define FX_TMU_SPLIT 98
118 #define FX_TMU_BOTH 99
119 #define FX_TMU_NONE 100
121 /* Used for fxMesa->lastUnitsMode */
123 #define FX_UM_NONE 0x00000000
125 #define FX_UM_E0_REPLACE 0x00000001
126 #define FX_UM_E0_MODULATE 0x00000002
127 #define FX_UM_E0_DECAL 0x00000004
128 #define FX_UM_E0_BLEND 0x00000008
129 #define FX_UM_E0_ADD 0x00000010
131 #define FX_UM_E1_REPLACE 0x00000020
132 #define FX_UM_E1_MODULATE 0x00000040
133 #define FX_UM_E1_DECAL 0x00000080
134 #define FX_UM_E1_BLEND 0x00000100
135 #define FX_UM_E1_ADD 0x00000200
137 #define FX_UM_E_ENVMODE 0x000003ff
139 #define FX_UM_E0_ALPHA 0x00001000
140 #define FX_UM_E0_LUMINANCE 0x00002000
141 #define FX_UM_E0_LUMINANCE_ALPHA 0x00004000
142 #define FX_UM_E0_INTENSITY 0x00008000
143 #define FX_UM_E0_RGB 0x00010000
144 #define FX_UM_E0_RGBA 0x00020000
146 #define FX_UM_E1_ALPHA 0x00040000
147 #define FX_UM_E1_LUMINANCE 0x00080000
148 #define FX_UM_E1_LUMINANCE_ALPHA 0x00100000
149 #define FX_UM_E1_INTENSITY 0x00200000
150 #define FX_UM_E1_RGB 0x00400000
151 #define FX_UM_E1_RGBA 0x00800000
153 #define FX_UM_E_IFMT 0x00fff000
155 #define FX_UM_COLOR_ITERATED 0x01000000
156 #define FX_UM_COLOR_CONSTANT 0x02000000
157 #define FX_UM_ALPHA_ITERATED 0x04000000
158 #define FX_UM_ALPHA_CONSTANT 0x08000000
161 /* for Voodoo3/Banshee's grColorCombine() and grAlphaCombine() */
162 struct tdfx_combine
{
163 GrCombineFunction_t Function
; /* Combine function */
164 GrCombineFactor_t Factor
; /* Combine scale factor */
165 GrCombineLocal_t Local
; /* Local combine source */
166 GrCombineOther_t Other
; /* Other combine source */
167 FxBool Invert
; /* Combine result inversion flag */
170 /* for Voodoo3's grTexCombine() */
171 struct tdfx_texcombine
{
172 GrCombineFunction_t FunctionRGB
;
173 GrCombineFactor_t FactorRGB
;
174 GrCombineFunction_t FunctionAlpha
;
175 GrCombineFactor_t FactorAlpha
;
181 /* for Voodoo5's grColorCombineExt() */
182 struct tdfx_combine_color_ext
{
183 GrCCUColor_t SourceA
;
184 GrCombineMode_t ModeA
;
185 GrCCUColor_t SourceB
;
186 GrCombineMode_t ModeB
;
187 GrCCUColor_t SourceC
;
189 GrCCUColor_t SourceD
;
195 /* for Voodoo5's grAlphaCombineExt() */
196 struct tdfx_combine_alpha_ext
{
197 GrACUColor_t SourceA
;
198 GrCombineMode_t ModeA
;
199 GrACUColor_t SourceB
;
200 GrCombineMode_t ModeB
;
201 GrACUColor_t SourceC
;
203 GrACUColor_t SourceD
;
209 /* for Voodoo5's grTexColorCombineExt() */
210 struct tdfx_color_texenv
{
211 GrTCCUColor_t SourceA
;
212 GrCombineMode_t ModeA
;
213 GrTCCUColor_t SourceB
;
214 GrCombineMode_t ModeB
;
215 GrTCCUColor_t SourceC
;
217 GrTCCUColor_t SourceD
;
223 /* for Voodoo5's grTexAlphaCombineExt() */
224 struct tdfx_alpha_texenv
{
225 GrTACUColor_t SourceA
;
226 GrCombineMode_t ModeA
;
227 GrTACUColor_t SourceB
;
228 GrCombineMode_t ModeB
;
229 GrTACUColor_t SourceC
;
231 GrTCCUColor_t SourceD
;
237 /* Voodoo5's texture combine environment */
238 struct tdfx_texcombine_ext
{
239 struct tdfx_alpha_texenv Alpha
;
240 struct tdfx_color_texenv Color
;
246 Memory range from startAddr to endAddr-1
248 typedef struct MemRange_t
250 struct MemRange_t
*next
;
251 FxU32 startAddr
, endAddr
;
257 GLsizei width
, height
; /* image size */
258 GLint wScale
, hScale
; /* image scale factor */
259 GrTextureFormat_t glideFormat
; /* Glide image format */
264 * TDFX-specific texture object data. This hangs off of the
265 * struct gl_texture_object DriverData pointer.
267 typedef struct tfxTexInfo_t
269 struct tfxTexInfo_t
*next
;
270 struct gl_texture_object
*tObj
;
276 MemRange
*tm
[FX_NUM_TMU
];
278 GLint minLevel
, maxLevel
;
279 GLint baseLevelInternalFormat
;
283 GrTextureFilterMode_t minFilt
;
284 GrTextureFilterMode_t maxFilt
;
287 GrTextureClampMode_t sClamp
;
288 GrTextureClampMode_t tClamp
;
290 GrMipMapMode_t mmMode
;
292 GLfloat sScale
, tScale
;
294 GrTexTable_t paltype
;
295 GuTexPalette palette
;
297 GLboolean fixedPalette
;
319 GLboolean alphaTestEnabled
;
320 GrCmpFnc_t alphaTestFunc
;
321 GLfloat alphaTestRefValue
;
325 GLboolean blendEnabled
;
326 GrAlphaBlendFnc_t blendSrcFuncRGB
;
327 GrAlphaBlendFnc_t blendDstFuncRGB
;
328 GrAlphaBlendFnc_t blendSrcFuncAlpha
;
329 GrAlphaBlendFnc_t blendDstFuncAlpha
;
330 GrAlphaBlendOp_t blendEqRGB
;
331 GrAlphaBlendOp_t blendEqAlpha
;
335 GLboolean depthTestEnabled
;
337 GrCmpFnc_t depthTestFunc
;
342 GLboolean stencilEnabled
;
343 GrCmpFnc_t stencilFunction
; /* Stencil function */
344 GrStencil_t stencilRefValue
; /* Stencil reference value */
345 GrStencil_t stencilValueMask
; /* Value mask */
346 GrStencil_t stencilWriteMask
; /* Write mask */
347 GrCmpFnc_t stencilFailFunc
; /* Stencil fail function */
348 GrCmpFnc_t stencilZFailFunc
; /* Stencil pass, depth fail function */
349 GrCmpFnc_t stencilZPassFunc
; /* Stencil pass, depth pass function */
350 GrStencil_t stencilClear
; /* Buffer clear value */
357 /* Flags for fxMesa->new_state
359 #define FX_NEW_TEXTURING 0x1
360 #define FX_NEW_BLEND 0x2
361 #define FX_NEW_ALPHA 0x4
362 #define FX_NEW_DEPTH 0x8
363 #define FX_NEW_FOG 0x10
364 #define FX_NEW_SCISSOR 0x20
365 #define FX_NEW_COLOR_MASK 0x40
366 #define FX_NEW_CULL 0x80
367 #define FX_NEW_STENCIL 0x100
370 #define FX_CONTEXT(ctx) ((fxMesaContext)((ctx)->DriverCtx))
372 #define FX_TEXTURE_DATA(texUnit) fxTMGetTexInfo((texUnit)->_Current)
374 #define fxTMGetTexInfo(o) ((tfxTexInfo*)((o)->DriverData))
376 #define FX_MIPMAP_DATA(img) ((tfxMipMapLevel *) (img)->DriverData)
378 #define BEGIN_BOARD_LOCK()
379 #define END_BOARD_LOCK()
380 #define BEGIN_CLIP_LOOP()
381 #define END_CLIP_LOOP()
386 /* Covers the state referenced by IsInHardware:
388 #define _FX_NEW_IS_IN_HARDWARE (_NEW_TEXTURE| \
395 /* Covers the state referenced by fxDDChooseRenderState
397 #define _FX_NEW_RENDERSTATE (_FX_NEW_IS_IN_HARDWARE | \
398 _DD_NEW_FLATSHADE | \
399 _DD_NEW_TRI_LIGHT_TWOSIDE| \
400 _DD_NEW_TRI_OFFSET | \
401 _DD_NEW_TRI_UNFILLED | \
402 _DD_NEW_TRI_SMOOTH | \
403 _DD_NEW_TRI_STIPPLE | \
404 _DD_NEW_LINE_SMOOTH | \
405 _DD_NEW_LINE_STIPPLE | \
406 _DD_NEW_LINE_WIDTH | \
407 _DD_NEW_POINT_SMOOTH | \
408 _DD_NEW_POINT_SIZE | \
412 /* Covers the state referenced by fxDDChooseSetupFunction.
414 #define _FX_NEW_SETUP_FUNCTION (_NEW_LIGHT| \
420 /* lookup table for scaling y bit colors up to 8 bits */
421 extern GLuint FX_rgb_scale_4
[16];
422 extern GLuint FX_rgb_scale_5
[32];
423 extern GLuint FX_rgb_scale_6
[64];
425 typedef void (*fx_tri_func
) (fxMesaContext
, GrVertex
*, GrVertex
*, GrVertex
*);
426 typedef void (*fx_line_func
) (fxMesaContext
, GrVertex
*, GrVertex
*);
427 typedef void (*fx_point_func
) (fxMesaContext
, GrVertex
*);
429 struct tfxMesaContext
431 GrTexTable_t glbPalType
;
432 GuTexPalette glbPalette
;
434 GLcontext
*glCtx
; /* the core Mesa context */
435 GLvisual
*glVis
; /* describes the color buffer */
436 GLframebuffer
*glBuffer
; /* the ancillary buffers */
438 GLint board
; /* the board used for this context */
439 GLint width
, height
; /* size of color buffer */
441 GrBuffer_t currentFB
;
448 GrCullMode_t cullMode
;
450 tfxUnitsState unitsState
;
451 tfxUnitsState restoreUnitsState
; /* saved during multipass */
452 GLboolean multipass
; /* true when drawing intermediate pass */
457 /* Texture Memory Manager Data
459 GLuint texBindNumber
;
461 GLuint lastUnitsMode
;
462 GLuint freeTexMem
[FX_NUM_TMU
];
464 MemRange
*tmFree
[FX_NUM_TMU
];
468 GLfloat fogStart
, fogEnd
;
473 /* Vertex building and storage:
475 GLuint tmu_source
[FX_NUM_TMU
];
477 GLuint stw_hint_state
; /* for grHints */
479 GLboolean snapVertices
; /* needed for older Voodoo hardware */
485 GLenum render_primitive
;
486 GLenum raster_primitive
;
488 /* Current rasterization functions
490 fx_point_func draw_point
;
491 fx_line_func draw_line
;
492 fx_tri_func draw_tri
;
495 /* Keep texture scales somewhere handy:
515 GLboolean haveTwoTMUs
; /* True if we really have 2 tmu's */
516 GLboolean haveHwAlpha
;
517 GLboolean haveHwStencil
;
518 GLboolean haveZBuffer
;
519 GLboolean haveDoubleBuffer
;
520 GLboolean haveGlobalPaletteTexture
;
522 GLint maxPendingSwapBuffers
;
524 GrContext_t glideContext
;
536 /* Glide (per card) capabilities. These get mirrored
537 * from `glbHWConfig' when creating a new context...
540 FxBool HavePalExt
; /* PALETTE6666 */
541 FxBool HavePixExt
; /* PIXEXT */
542 FxBool HaveTexFmt
; /* TEXFMT */
543 FxBool HaveCmbExt
; /* COMBINE */
544 FxBool HaveMirExt
; /* TEXMIRROR */
545 FxBool HaveTexUma
; /* TEXUMA */
546 FxBool HaveTexus2
; /* Texus 2 - FXT1 */
547 struct tdfx_glide Glide
;
548 char rendererString
[64];
552 extern void fxSetupFXUnits(GLcontext
*);
553 extern void fxSetupDDPointers(GLcontext
*);
557 extern void fxAllocVB(GLcontext
* ctx
);
558 extern void fxFreeVB(GLcontext
* ctx
);
559 extern void fxPrintSetupFlags(char *msg
, GLuint flags
);
560 extern void fxCheckTexSizes( GLcontext
*ctx
);
561 extern void fxBuildVertices( GLcontext
*ctx
, GLuint start
, GLuint end
,
563 extern void fxChooseVertexState( GLcontext
*ctx
);
572 extern void fxDDInitTriFuncs(GLcontext
*);
573 extern void fxDDChooseRenderState(GLcontext
* ctx
);
576 extern void fxUpdateDDSpanPointers(GLcontext
*);
577 extern void fxSetupDDSpanPointers(GLcontext
*);
579 extern void fxPrintTextureData(tfxTexInfo
* ti
);
581 extern const struct gl_texture_format
*
582 fxDDChooseTextureFormat( GLcontext
*ctx
, GLint internalFormat
,
583 GLenum srcFormat
, GLenum srcType
);
584 extern void fxDDTexImage2D(GLcontext
* ctx
, GLenum target
, GLint level
,
585 GLint internalFormat
, GLint width
, GLint height
,
586 GLint border
, GLenum format
, GLenum type
,
587 const GLvoid
* pixels
,
588 const struct gl_pixelstore_attrib
*packing
,
589 struct gl_texture_object
*texObj
,
590 struct gl_texture_image
*texImage
);
591 extern void fxDDTexSubImage2D(GLcontext
* ctx
, GLenum target
, GLint level
,
592 GLint xoffset
, GLint yoffset
,
593 GLsizei width
, GLsizei height
,
594 GLenum format
, GLenum type
,
595 const GLvoid
* pixels
,
596 const struct gl_pixelstore_attrib
*packing
,
597 struct gl_texture_object
*texObj
,
598 struct gl_texture_image
*texImage
);
599 extern void fxDDCompressedTexImage2D(GLcontext
*ctx
, GLenum target
,
600 GLint level
, GLint internalFormat
,
601 GLsizei width
, GLsizei height
, GLint border
,
602 GLsizei imageSize
, const GLvoid
*data
,
603 struct gl_texture_object
*texObj
,
604 struct gl_texture_image
*texImage
);
605 extern void fxDDCompressedTexSubImage2D(GLcontext
*ctx
, GLenum target
,
606 GLint level
, GLint xoffset
,
607 GLint yoffset
, GLsizei width
,
608 GLint height
, GLenum format
,
609 GLsizei imageSize
, const GLvoid
*data
,
610 struct gl_texture_object
*texObj
,
611 struct gl_texture_image
*texImage
);
612 extern void fxDDTexImage1D(GLcontext
* ctx
, GLenum target
, GLint level
,
613 GLint internalFormat
, GLint width
,
614 GLint border
, GLenum format
, GLenum type
,
615 const GLvoid
* pixels
,
616 const struct gl_pixelstore_attrib
*packing
,
617 struct gl_texture_object
*texObj
,
618 struct gl_texture_image
*texImage
);
619 extern void fxDDTexSubImage1D(GLcontext
* ctx
, GLenum target
, GLint level
,
620 GLint xoffset
, GLint width
,
621 GLenum format
, GLenum type
,
622 const GLvoid
* pixels
,
623 const struct gl_pixelstore_attrib
*packing
,
624 struct gl_texture_object
*texObj
,
625 struct gl_texture_image
*texImage
);
626 extern GLboolean
fxDDTestProxyTexImage (GLcontext
*ctx
, GLenum target
,
627 GLint level
, GLint internalFormat
,
628 GLenum format
, GLenum type
,
629 GLint width
, GLint height
,
630 GLint depth
, GLint border
);
631 extern void fxDDTexEnv(GLcontext
*, GLenum
, GLenum
, const GLfloat
*);
632 extern void fxDDTexParam(GLcontext
*, GLenum
, struct gl_texture_object
*,
633 GLenum
, const GLfloat
*);
634 extern void fxDDTexBind(GLcontext
*, GLenum
, struct gl_texture_object
*);
635 extern struct gl_texture_object
*fxDDNewTextureObject( GLcontext
*ctx
, GLuint name
, GLenum target
);
636 extern void fxDDTexDel(GLcontext
*, struct gl_texture_object
*);
637 extern GLboolean
fxDDIsTextureResident(GLcontext
*, struct gl_texture_object
*);
638 extern void fxDDTexPalette(GLcontext
*, struct gl_texture_object
*);
639 extern void fxDDTexUseGlbPalette(GLcontext
*, GLboolean
);
641 extern void fxDDEnable(GLcontext
*, GLenum
, GLboolean
);
642 extern void fxDDAlphaFunc(GLcontext
*, GLenum
, GLfloat
);
643 extern void fxDDBlendFuncSeparate(GLcontext
*, GLenum
, GLenum
, GLenum
, GLenum
);
644 extern void fxDDBlendEquationSeparate(GLcontext
*, GLenum
, GLenum
);
645 extern void fxDDDepthMask(GLcontext
*, GLboolean
);
646 extern void fxDDDepthFunc(GLcontext
*, GLenum
);
647 extern void fxDDStencilFuncSeparate (GLcontext
*ctx
, GLenum face
, GLenum func
, GLint ref
, GLuint mask
);
648 extern void fxDDStencilMaskSeparate (GLcontext
*ctx
, GLenum face
, GLuint mask
);
649 extern void fxDDStencilOpSeparate (GLcontext
*ctx
, GLenum face
, GLenum sfail
, GLenum zfail
, GLenum zpass
);
651 extern void fxDDInitExtensions(GLcontext
* ctx
);
653 extern void fxTMInit(fxMesaContext ctx
);
654 extern void fxTMClose(fxMesaContext ctx
);
655 extern void fxTMRestoreTextures_NoLock(fxMesaContext ctx
);
656 extern void fxTMMoveInTM(fxMesaContext
, struct gl_texture_object
*, GLint
);
657 extern void fxTMMoveOutTM(fxMesaContext
, struct gl_texture_object
*);
658 #define fxTMMoveOutTM_NoLock fxTMMoveOutTM
659 extern void fxTMFreeTexture(fxMesaContext
, struct gl_texture_object
*);
660 extern void fxTMReloadMipMapLevel(fxMesaContext
, struct gl_texture_object
*,
662 extern void fxTMReloadSubMipMapLevel(fxMesaContext
,
663 struct gl_texture_object
*, GLint
, GLint
,
665 extern int fxTMCheckStartAddr (fxMesaContext fxMesa
, GLint tmu
, tfxTexInfo
*ti
);
667 extern void fxTexGetFormat(GLcontext
*, GLenum
, GrTextureFormat_t
*, GLint
*); /* [koolsmoky] */
669 extern int fxTexGetInfo(int, int, GrLOD_t
*, GrAspectRatio_t
*,
670 float *, float *, int *, int *);
672 extern void fxDDScissor(GLcontext
* ctx
,
673 GLint x
, GLint y
, GLsizei w
, GLsizei h
);
674 extern void fxDDFogfv(GLcontext
* ctx
, GLenum pname
, const GLfloat
* params
);
675 extern void fxDDColorMask(GLcontext
* ctx
,
676 GLboolean r
, GLboolean g
, GLboolean b
, GLboolean a
);
678 extern void fxDDWriteDepthSpan(GLcontext
* ctx
, GLuint n
, GLint x
, GLint y
,
679 const GLuint depth
[], const GLubyte mask
[]);
681 extern void fxDDReadDepthSpan(GLcontext
* ctx
, GLuint n
, GLint x
, GLint y
,
684 extern void fxDDWriteDepthPixels(GLcontext
* ctx
, GLuint n
,
685 const GLint x
[], const GLint y
[],
686 const GLuint depth
[], const GLubyte mask
[]);
688 extern void fxDDReadDepthPixels(GLcontext
* ctx
, GLuint n
,
689 const GLint x
[], const GLint y
[],
692 extern void fxDDShadeModel(GLcontext
* ctx
, GLenum mode
);
694 extern void fxDDCullFace(GLcontext
* ctx
, GLenum mode
);
695 extern void fxDDFrontFace(GLcontext
* ctx
, GLenum mode
);
697 extern void fxPrintRenderState(const char *msg
, GLuint state
);
698 extern void fxPrintHintState(const char *msg
, GLuint state
);
700 extern int fxDDInitFxMesaContext(fxMesaContext fxMesa
);
701 extern void fxDDDestroyFxMesaContext(fxMesaContext fxMesa
);
704 extern void fxSetScissorValues(GLcontext
* ctx
);
705 extern void fxTMMoveInTM_NoLock(fxMesaContext fxMesa
,
706 struct gl_texture_object
*tObj
, GLint where
);
708 extern void fxCheckIsInHardware(GLcontext
*ctx
);
711 * semi-private functions
713 void fxSetupCull (GLcontext
* ctx
);
714 void fxSetupScissor (GLcontext
* ctx
);
715 void fxSetupColorMask (GLcontext
* ctx
);
716 void fxSetupBlend (GLcontext
*ctx
);
717 void fxSetupDepthTest (GLcontext
*ctx
);
718 void fxSetupTexture (GLcontext
*ctx
);
719 void fxSetupStencil (GLcontext
*ctx
);
720 void fxSetupStencilFace (GLcontext
*ctx
, GLint face
);
722 /* Flags for software fallback cases */
723 #define FX_FALLBACK_TEXTURE_MAP 0x0001
724 #define FX_FALLBACK_DRAW_BUFFER 0x0002
725 #define FX_FALLBACK_SPECULAR 0x0004
726 #define FX_FALLBACK_STENCIL 0x0008
727 #define FX_FALLBACK_RENDER_MODE 0x0010
728 #define FX_FALLBACK_LOGICOP 0x0020
729 #define FX_FALLBACK_TEXTURE_ENV 0x0040
730 #define FX_FALLBACK_TEXTURE_BORDER 0x0080
731 #define FX_FALLBACK_COLORMASK 0x0100
732 #define FX_FALLBACK_BLEND 0x0200
733 #define FX_FALLBACK_TEXTURE_MULTI 0x0400
735 extern GLuint
fx_check_IsInHardware(GLcontext
*ctx
);
738 *** CNORM: clamp float to [0,1] and map to float in [0,255]
740 #if defined(USE_IEEE) && !defined(DEBUG)
741 #define IEEE_0996 0x3f7f0000 /* 0.996 or so */
742 #define CNORM(N, F) \
748 else if (__tmp.i >= IEEE_0996) \
755 #define CNORM(n, f) \
756 n = (CLAMP((f), 0.0F, 1.0F) * 255.0F)
759 /* run-time debugging */
764 extern int TDFX_DEBUG
;
770 #define FX_RESCALE_BIG_TEXURES_HACK 1
771 #define FX_COMPRESS_S3TC_AS_FXT1_HACK 1