got rid of __FUNCTION__ :(
[mesa.git] / src / mesa / drivers / glide / fxglidew.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
35 #ifndef __FX_GLIDE_WARPER__
36 #define __FX_GLIDE_WARPER__
37
38
39 #include "fxg.h"
40
41
42
43 #define MAX_NUM_SST 4
44
45 enum {
46 GR_SSTTYPE_VOODOO = 0,
47 GR_SSTTYPE_SST96 = 1,
48 GR_SSTTYPE_AT3D = 2,
49 GR_SSTTYPE_Voodoo2 = 3,
50 GR_SSTTYPE_Banshee = 4,
51 GR_SSTTYPE_Voodoo3 = 5,
52 GR_SSTTYPE_Voodoo4 = 6,
53 GR_SSTTYPE_Voodoo5 = 7
54 };
55
56 #define GrState void
57
58 typedef int GrSstType;
59
60 typedef struct GrTMUConfig_St {
61 int tmuRev; /* Rev of Texelfx chip */
62 int tmuRam; /* 1, 2, or 4 MB */
63 } GrTMUConfig_t;
64
65 typedef struct {
66 int num_sst; /* # of HW units in the system */
67 struct SstCard_St {
68 GrSstType type; /* Which hardware is it? */
69 int fbRam; /* 1, 2, or 4 MB */
70 int fbiRev; /* Rev of Pixelfx chip */
71 int nTexelfx; /* How many texelFX chips are there? */
72 int numChips; /* Number of Voodoo chips */
73 GrTMUConfig_t tmuConfig[GLIDE_NUM_TMU]; /* Configuration of the Texelfx chips */
74 /* Glide3 extensions */
75 FxBool HavePalExt; /* PALETTE6666 */
76 FxBool HavePixExt; /* PIXEXT */
77 FxBool HaveTexFmt; /* TEXFMT */
78 FxBool HaveCmbExt; /* COMBINE */
79 FxBool HaveMirExt; /* TEXMIRROR */
80 FxBool HaveTexUma; /* TEXUMA */
81 }
82 SSTs[MAX_NUM_SST]; /* configuration for each board */
83 struct tdfx_glide Glide;
84 } GrHwConfiguration;
85
86
87
88 typedef FxU32 GrHint_t;
89 #define GR_HINTTYPE_MIN 0
90 #define GR_HINT_STWHINT 0
91
92 typedef FxU32 GrSTWHint_t;
93 #define GR_STWHINT_W_DIFF_FBI FXBIT(0)
94 #define GR_STWHINT_W_DIFF_TMU0 FXBIT(1)
95 #define GR_STWHINT_ST_DIFF_TMU0 FXBIT(2)
96 #define GR_STWHINT_W_DIFF_TMU1 FXBIT(3)
97 #define GR_STWHINT_ST_DIFF_TMU1 FXBIT(4)
98 #define GR_STWHINT_W_DIFF_TMU2 FXBIT(5)
99 #define GR_STWHINT_ST_DIFF_TMU2 FXBIT(6)
100
101 #define GR_CONTROL_ACTIVATE 1
102 #define GR_CONTROL_DEACTIVATE 0
103
104
105
106 /*
107 ** move the vertex layout defintion to application
108 */
109 typedef struct {
110 float sow; /* s texture ordinate (s over w) */
111 float tow; /* t texture ordinate (t over w) */
112 float oow; /* 1/w (used mipmapping - really 0xfff/w) */
113 } GrTmuVertex;
114
115 typedef struct {
116 float x, y; /* X and Y in screen space */
117 float ooz; /* 65535/Z (used for Z-buffering) */
118 float oow; /* 1/W (used for W-buffering, texturing) */
119 unsigned char pargb[4]; /* B, G, R, A [0..255] */
120 GrTmuVertex tmuvtx[GLIDE_NUM_TMU];
121 float fog; /* fog coordinate */
122 float psize; /* point size */
123 long pad[16 - 13]; /* ensure 64b structure */
124 } GrVertex;
125
126 #define GR_VERTEX_X_OFFSET 0
127 #define GR_VERTEX_Y_OFFSET 1
128 #define GR_VERTEX_OOZ_OFFSET 2
129 #define GR_VERTEX_OOW_OFFSET 3
130 #define GR_VERTEX_PARGB_OFFSET 4
131 #define GR_VERTEX_SOW_TMU0_OFFSET 5
132 #define GR_VERTEX_TOW_TMU0_OFFSET 6
133 #define GR_VERTEX_OOW_TMU0_OFFSET 7
134 #define GR_VERTEX_SOW_TMU1_OFFSET 8
135 #define GR_VERTEX_TOW_TMU1_OFFSET 9
136 #define GR_VERTEX_OOW_TMU1_OFFSET 10
137 #define GR_VERTEX_FOG_OFFSET 11
138
139
140
141 /*
142 * For Lod/LodLog2 conversion.
143 */
144 #define FX_largeLodLog2(info) (info).largeLodLog2
145 #define FX_aspectRatioLog2(info) (info).aspectRatioLog2
146 #define FX_smallLodLog2(info) (info).smallLodLog2
147 #define FX_lodToValue(val) ((int)(GR_LOD_LOG2_256-val))
148 #define FX_largeLodValue(info) ((int)(GR_LOD_LOG2_256-(info).largeLodLog2))
149 #define FX_smallLodValue(info) ((int)(GR_LOD_LOG2_256-(info).smallLodLog2))
150 #define FX_valueToLod(val) ((GrLOD_t)(GR_LOD_LOG2_256-val))
151
152
153
154 /*
155 * Write region: ToDo possible exploit the PixelPipe parameter.
156 */
157 #define FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
158 do { \
159 BEGIN_BOARD_LOCK(); \
160 grLfbWriteRegion(dst_buffer,\
161 dst_x, \
162 dst_y, \
163 src_format,\
164 src_width, \
165 src_height,\
166 FXFALSE, \
167 src_stride,\
168 src_data); \
169 END_BOARD_LOCK(); \
170 } while(0)
171
172
173
174 /*
175 * ScreenWidth/Height stuff.
176 */
177 extern int FX_grSstScreenWidth(void);
178 extern int FX_grSstScreenHeight(void);
179
180
181
182 /*
183 * Query
184 */
185 extern void FX_grSstPerfStats(GrSstPerfStats_t *st);
186 extern int FX_grSstQueryHardware(GrHwConfiguration *config);
187 #define FX_grGetInteger FX_grGetInteger_NoLock
188 extern FxI32 FX_grGetInteger_NoLock(FxU32 pname);
189
190
191
192 /*
193 * GrHints
194 */
195 #define FX_grHints FX_grHints_NoLock
196 extern void FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask);
197
198
199
200 /*
201 * Needed for Glide3 only, to set up Glide2 compatible vertex layout.
202 */
203 extern void FX_setupGrVertexLayout(void);
204
205
206
207 /*
208 * grSstControl stuff
209 */
210 extern FxBool FX_grSstControl(FxU32 code);
211
212 #define FX_grBufferClear(c, a, d) \
213 do { \
214 BEGIN_CLIP_LOOP(); \
215 grBufferClear(c, a, d); \
216 END_CLIP_LOOP(); \
217 } while (0)
218
219
220
221 #endif /* __FX_GLIDE_WARPER__ */