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.
35 #ifndef __FX_GLIDE_WARPER__
36 #define __FX_GLIDE_WARPER__
41 #ifndef FX_PACKEDCOLOR
42 #define FX_PACKEDCOLOR 1
48 GR_SSTTYPE_VOODOO
= 0,
51 GR_SSTTYPE_Voodoo2
= 3,
52 GR_SSTTYPE_Banshee
= 4,
53 GR_SSTTYPE_Voodoo3
= 5,
54 GR_SSTTYPE_Voodoo4
= 6,
55 GR_SSTTYPE_Voodoo5
= 7
60 typedef int GrSstType
;
62 typedef struct GrTMUConfig_St
{
63 int tmuRev
; /* Rev of Texelfx chip */
64 int tmuRam
; /* 1, 2, or 4 MB */
68 int num_sst
; /* # of HW units in the system */
70 GrSstType type
; /* Which hardware is it? */
71 int fbRam
; /* 1, 2, or 4 MB */
72 int fbiRev
; /* Rev of Pixelfx chip */
73 int nTexelfx
; /* How many texelFX chips are there? */
74 int numChips
; /* Number of Voodoo chips */
75 GrTMUConfig_t tmuConfig
[GLIDE_NUM_TMU
]; /* Configuration of the Texelfx chips */
76 /* Glide3 extensions */
77 FxBool HavePalExt
; /* PALETTE6666 */
78 FxBool HavePixExt
; /* PIXEXT */
79 FxBool HaveTexFmt
; /* TEXFMT */
80 FxBool HaveCmbExt
; /* COMBINE */
81 FxBool HaveMirExt
; /* TEXMIRROR */
82 FxBool HaveTexUma
; /* TEXUMA */
84 SSTs
[MAX_NUM_SST
]; /* configuration for each board */
85 struct tdfx_glide Glide
;
90 typedef FxU32 GrHint_t
;
91 #define GR_HINTTYPE_MIN 0
92 #define GR_HINT_STWHINT 0
94 typedef FxU32 GrSTWHint_t
;
95 #define GR_STWHINT_W_DIFF_FBI FXBIT(0)
96 #define GR_STWHINT_W_DIFF_TMU0 FXBIT(1)
97 #define GR_STWHINT_ST_DIFF_TMU0 FXBIT(2)
98 #define GR_STWHINT_W_DIFF_TMU1 FXBIT(3)
99 #define GR_STWHINT_ST_DIFF_TMU1 FXBIT(4)
100 #define GR_STWHINT_W_DIFF_TMU2 FXBIT(5)
101 #define GR_STWHINT_ST_DIFF_TMU2 FXBIT(6)
103 #define GR_CONTROL_ACTIVATE 1
104 #define GR_CONTROL_DEACTIVATE 0
109 ** move the vertex layout defintion to application
112 float sow
; /* s texture ordinate (s over w) */
113 float tow
; /* t texture ordinate (t over w) */
114 float oow
; /* 1/w (used mipmapping - really 0xfff/w) */
119 float x
, y
; /* X and Y in screen space */
120 float ooz
; /* 65535/Z (used for Z-buffering) */
121 float oow
; /* 1/W (used for W-buffering, texturing) */
122 unsigned char pargb
[4]; /* B, G, R, A [0..255] */
123 GrTmuVertex tmuvtx
[GLIDE_NUM_TMU
];
124 float fog
; /* fog coordinate */
125 unsigned char pspec
[4]; /* B, G, R, A [0..255] */
126 float psize
; /* point size */
127 long pad
[16 - 14]; /* ensure 64b structure */
130 #define GR_VERTEX_X_OFFSET 0
131 #define GR_VERTEX_Y_OFFSET 1
132 #define GR_VERTEX_OOZ_OFFSET 2
133 #define GR_VERTEX_OOW_OFFSET 3
134 #define GR_VERTEX_PARGB_OFFSET 4
135 #define GR_VERTEX_SOW_TMU0_OFFSET 5
136 #define GR_VERTEX_TOW_TMU0_OFFSET 6
137 #define GR_VERTEX_OOW_TMU0_OFFSET 7
138 #define GR_VERTEX_SOW_TMU1_OFFSET 8
139 #define GR_VERTEX_TOW_TMU1_OFFSET 9
140 #define GR_VERTEX_OOW_TMU1_OFFSET 10
141 #define GR_VERTEX_FOG_OFFSET 11
142 #define GR_VERTEX_PSPEC_OFFSET 12
143 #else /* !FX_PACKEDCOLOR */
145 float x
, y
; /* X and Y in screen space */
146 float ooz
; /* 65535/Z (used for Z-buffering) */
147 float oow
; /* 1/W (used for W-buffering, texturing) */
148 float r
, g
, b
, a
; /* R, G, B, A [0..255] */
149 GrTmuVertex tmuvtx
[GLIDE_NUM_TMU
];
150 float fog
; /* fog coordinate */
151 float r1
, g1
, b1
; /* R, G, B [0..255] */
152 float psize
; /* point size */
153 long pad
[20 - 19]; /* ensure multiple of 16 */
156 #define GR_VERTEX_X_OFFSET 0
157 #define GR_VERTEX_Y_OFFSET 1
158 #define GR_VERTEX_OOZ_OFFSET 2
159 #define GR_VERTEX_OOW_OFFSET 3
160 #define GR_VERTEX_RGB_OFFSET 4
161 #define GR_VERTEX_A_OFFSET 7
162 #define GR_VERTEX_SOW_TMU0_OFFSET 8
163 #define GR_VERTEX_TOW_TMU0_OFFSET 9
164 #define GR_VERTEX_OOW_TMU0_OFFSET 10
165 #define GR_VERTEX_SOW_TMU1_OFFSET 11
166 #define GR_VERTEX_TOW_TMU1_OFFSET 12
167 #define GR_VERTEX_OOW_TMU1_OFFSET 13
168 #define GR_VERTEX_FOG_OFFSET 14
169 #define GR_VERTEX_SPEC_OFFSET 15
170 #endif /* !FX_PACKEDCOLOR */
175 * For Lod/LodLog2 conversion.
177 #define FX_largeLodLog2(info) (info).largeLodLog2
178 #define FX_aspectRatioLog2(info) (info).aspectRatioLog2
179 #define FX_smallLodLog2(info) (info).smallLodLog2
180 #define FX_lodToValue(val) ((int)(GR_LOD_LOG2_256-val))
181 #define FX_largeLodValue(info) ((int)(GR_LOD_LOG2_256-(info).largeLodLog2))
182 #define FX_smallLodValue(info) ((int)(GR_LOD_LOG2_256-(info).smallLodLog2))
183 #define FX_valueToLod(val) ((GrLOD_t)(GR_LOD_LOG2_256-val))
190 extern int FX_grSstScreenWidth(void);
191 extern int FX_grSstScreenHeight(void);
192 extern void FX_grSstPerfStats(GrSstPerfStats_t
*st
);
193 extern int FX_grSstQueryHardware(GrHwConfiguration
*config
);
194 #define FX_grGetInteger FX_grGetInteger_NoLock
195 extern FxI32
FX_grGetInteger_NoLock(FxU32 pname
);
202 #define FX_grHints FX_grHints_NoLock
203 extern void FX_grHints_NoLock(GrHint_t hintType
, FxU32 hintMask
);
208 * Needed for Glide3 only, to set up Glide2 compatible vertex layout.
210 extern void FX_setupGrVertexLayout(void);
217 extern FxBool
FX_grSstControl(FxU32 code
);
219 #define FX_grBufferClear(c, a, d) \
222 grBufferClear(c, a, d); \
228 #endif /* __FX_GLIDE_WARPER__ */