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 */
49 FX_grGetInteger_NoLock(FxU32 pname
)
53 if (grGet(pname
, 4, &result
)) {
57 if (TDFX_DEBUG
& VERBOSE_DRIVER
) {
58 fprintf(stderr
, "FX_grGetInteger_NoLock: wrong parameter (%lx)\n", pname
);
64 FX_grSstControl(FxU32 code
)
66 /* The glide 3 sources call for grEnable/grDisable to be called in exchange
67 * for grSstControl. */
69 case GR_CONTROL_ACTIVATE
:
70 grEnable(GR_PASSTHRU
);
72 case GR_CONTROL_DEACTIVATE
:
73 grDisable(GR_PASSTHRU
);
76 /* Appearently GR_CONTROL_RESIZE can be ignored. */
87 grGet(GR_VIEWPORT
, sizeof(FxI32
) * 4, result
);
94 FX_grSstScreenHeight()
99 grGet(GR_VIEWPORT
, sizeof(FxI32
) * 4, result
);
106 FX_grSstPerfStats(GrSstPerfStats_t
* st
)
109 grGet(GR_STATS_PIXELS_IN
, 4, &n
);
111 grGet(GR_STATS_PIXELS_CHROMA_FAIL
, 4, &n
);
113 grGet(GR_STATS_PIXELS_DEPTHFUNC_FAIL
, 4, &n
);
115 grGet(GR_STATS_PIXELS_AFUNC_FAIL
, 4, &n
);
117 grGet(GR_STATS_PIXELS_OUT
, 4, &n
);
122 FX_setupGrVertexLayout(void)
125 grReset(GR_VERTEX_PARAMETER
);
127 grCoordinateSpace(GR_WINDOW_COORDS
);
128 grVertexLayout(GR_PARAM_XY
, GR_VERTEX_X_OFFSET
<< 2, GR_PARAM_ENABLE
);
130 grVertexLayout(GR_PARAM_PARGB
, GR_VERTEX_PARGB_OFFSET
<< 2, GR_PARAM_ENABLE
);
131 #else /* !FX_PACKEDCOLOR */
132 grVertexLayout(GR_PARAM_RGB
, GR_VERTEX_RGB_OFFSET
<< 2, GR_PARAM_ENABLE
);
133 grVertexLayout(GR_PARAM_A
, GR_VERTEX_A_OFFSET
<< 2, GR_PARAM_ENABLE
);
134 #endif /* !FX_PACKEDCOLOR */
135 grVertexLayout(GR_PARAM_Q
, GR_VERTEX_OOW_OFFSET
<< 2, GR_PARAM_ENABLE
);
136 grVertexLayout(GR_PARAM_Z
, GR_VERTEX_OOZ_OFFSET
<< 2, GR_PARAM_ENABLE
);
137 grVertexLayout(GR_PARAM_ST0
, GR_VERTEX_SOW_TMU0_OFFSET
<< 2,
139 grVertexLayout(GR_PARAM_Q0
, GR_VERTEX_OOW_TMU0_OFFSET
<< 2,
141 grVertexLayout(GR_PARAM_ST1
, GR_VERTEX_SOW_TMU1_OFFSET
<< 2,
143 grVertexLayout(GR_PARAM_Q1
, GR_VERTEX_OOW_TMU1_OFFSET
<< 2,
149 FX_grHints_NoLock(GrHint_t hintType
, FxU32 hintMask
)
152 case GR_HINT_STWHINT
:
154 if (hintMask
& GR_STWHINT_W_DIFF_TMU0
)
155 grVertexLayout(GR_PARAM_Q0
, GR_VERTEX_OOW_TMU0_OFFSET
<< 2,
158 grVertexLayout(GR_PARAM_Q0
, GR_VERTEX_OOW_TMU0_OFFSET
<< 2,
161 if (hintMask
& GR_STWHINT_ST_DIFF_TMU1
)
162 grVertexLayout(GR_PARAM_ST1
, GR_VERTEX_SOW_TMU1_OFFSET
<< 2,
165 grVertexLayout(GR_PARAM_ST1
, GR_VERTEX_SOW_TMU1_OFFSET
<< 2,
168 if (hintMask
& GR_STWHINT_W_DIFF_TMU1
)
169 grVertexLayout(GR_PARAM_Q1
, GR_VERTEX_OOW_TMU1_OFFSET
<< 2,
172 grVertexLayout(GR_PARAM_Q1
, GR_VERTEX_OOW_TMU1_OFFSET
<< 2,
180 * Glide3 doesn't have the grSstQueryHardware function anymore.
181 * Instead, we call grGet() and fill in the data structures ourselves.
184 FX_grSstQueryHardware(GrHwConfiguration
* config
)
191 grGet(GR_NUM_BOARDS
, 4, (void *) &(config
->num_sst
));
192 if (config
->num_sst
== 0)
195 for (i
= 0; i
< config
->num_sst
; i
++) {
197 const char *extension
;
201 extension
= grGetString(GR_HARDWARE
);
202 if (strstr(extension
, "Rush")) {
203 config
->SSTs
[i
].type
= GR_SSTTYPE_SST96
;
204 } else if (strstr(extension
, "Voodoo2")) {
205 config
->SSTs
[i
].type
= GR_SSTTYPE_Voodoo2
;
206 } else if (strstr(extension
, "Voodoo Banshee")) {
207 config
->SSTs
[i
].type
= GR_SSTTYPE_Banshee
;
208 } else if (strstr(extension
, "Voodoo3")) {
209 config
->SSTs
[i
].type
= GR_SSTTYPE_Voodoo3
;
210 } else if (strstr(extension
, "Voodoo4")) {
211 config
->SSTs
[i
].type
= GR_SSTTYPE_Voodoo4
;
212 } else if (strstr(extension
, "Voodoo5")) {
213 config
->SSTs
[i
].type
= GR_SSTTYPE_Voodoo5
;
215 config
->SSTs
[i
].type
= GR_SSTTYPE_VOODOO
;
218 grGet(GR_MEMORY_FB
, 4, &result
);
219 config
->SSTs
[i
].fbRam
= result
/ (1024 * 1024);
221 grGet(GR_NUM_TMU
, 4, &result
);
222 config
->SSTs
[i
].nTexelfx
= result
;
224 grGet(GR_REVISION_FB
, 4, &result
);
225 config
->SSTs
[i
].fbiRev
= result
;
227 for (j
= 0; j
< config
->SSTs
[i
].nTexelfx
; j
++) {
228 grGet(GR_MEMORY_TMU
, 4, &result
);
229 config
->SSTs
[i
].tmuConfig
[j
].tmuRam
= result
/ (1024 * 1024);
230 grGet(GR_REVISION_TMU
, 4, &result
);
231 config
->SSTs
[i
].tmuConfig
[j
].tmuRev
= result
;
234 extension
= grGetString(GR_EXTENSION
);
235 config
->SSTs
[i
].HavePalExt
= (strstr(extension
, " PALETTE6666 ") != NULL
);
236 config
->SSTs
[i
].HavePixExt
= (strstr(extension
, " PIXEXT ") != NULL
);
237 config
->SSTs
[i
].HaveTexFmt
= (strstr(extension
, " TEXFMT ") != NULL
);
238 config
->SSTs
[i
].HaveCmbExt
= (strstr(extension
, " COMBINE ") != NULL
);
239 config
->SSTs
[i
].HaveMirExt
= (strstr(extension
, " TEXMIRROR ") != NULL
);
240 config
->SSTs
[i
].HaveTexUma
= (strstr(extension
, " TEXUMA ") != NULL
);
242 /* number of Voodoo chips */
243 grGet(GR_NUM_FB
, 4, (void *) &numFB
);
244 config
->SSTs
[i
].numChips
= numFB
;
248 tdfx_hook_glide(&config
->Glide
, getenv("MESA_FX_POINTCAST") != NULL
);
259 * Need this to provide at least one external definition.
262 extern int gl_fx_dummy_function_glidew(void);
264 gl_fx_dummy_function_glidew(void)