31a8fa3b02eece2421ce74da40af4dd487c470bc
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__
46 GR_SSTTYPE_VOODOO
= 0,
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
58 typedef int GrSstType
;
60 typedef struct GrTMUConfig_St
{
61 int tmuRev
; /* Rev of Texelfx chip */
62 int tmuRam
; /* 1, 2, or 4 MB */
66 int num_sst
; /* # of HW units in the system */
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 FxBool HaveTexus2
; /* Texus 2 - FXT1 */
83 SSTs
[MAX_NUM_SST
]; /* configuration for each board */
84 struct tdfx_glide Glide
;
89 typedef FxU32 GrHint_t
;
90 #define GR_HINTTYPE_MIN 0
91 #define GR_HINT_STWHINT 0
93 typedef FxU32 GrSTWHint_t
;
94 #define GR_STWHINT_W_DIFF_FBI FXBIT(0)
95 #define GR_STWHINT_W_DIFF_TMU0 FXBIT(1)
96 #define GR_STWHINT_ST_DIFF_TMU0 FXBIT(2)
97 #define GR_STWHINT_W_DIFF_TMU1 FXBIT(3)
98 #define GR_STWHINT_ST_DIFF_TMU1 FXBIT(4)
99 #define GR_STWHINT_W_DIFF_TMU2 FXBIT(5)
100 #define GR_STWHINT_ST_DIFF_TMU2 FXBIT(6)
102 #define GR_CONTROL_ACTIVATE 1
103 #define GR_CONTROL_DEACTIVATE 0
108 ** move the vertex layout defintion to application
111 float sow
; /* s texture ordinate (s over w) */
112 float tow
; /* t texture ordinate (t over w) */
113 float oow
; /* 1/w (used mipmapping - really 0xfff/w) */
117 float x
, y
; /* X and Y in screen space */
118 float ooz
; /* 65535/Z (used for Z-buffering) */
119 float oow
; /* 1/W (used for W-buffering, texturing) */
120 unsigned char pargb
[4]; /* B, G, R, A [0..255] */
121 GrTmuVertex tmuvtx
[GLIDE_NUM_TMU
];
122 long pad
[16 - 11]; /* future use; also ensure 64b structure */
125 #define GR_VERTEX_X_OFFSET 0
126 #define GR_VERTEX_Y_OFFSET 1
127 #define GR_VERTEX_OOZ_OFFSET 2
128 #define GR_VERTEX_OOW_OFFSET 3
129 #define GR_VERTEX_PARGB_OFFSET 4
130 #define GR_VERTEX_SOW_TMU0_OFFSET 5
131 #define GR_VERTEX_TOW_TMU0_OFFSET 6
132 #define GR_VERTEX_OOW_TMU0_OFFSET 7
133 #define GR_VERTEX_SOW_TMU1_OFFSET 8
134 #define GR_VERTEX_TOW_TMU1_OFFSET 9
135 #define GR_VERTEX_OOW_TMU1_OFFSET 10
140 * For Lod/LodLog2 conversion.
142 #define FX_largeLodLog2(info) (info).largeLodLog2
143 #define FX_aspectRatioLog2(info) (info).aspectRatioLog2
144 #define FX_smallLodLog2(info) (info).smallLodLog2
145 #define FX_lodToValue(val) ((int)(GR_LOD_LOG2_256-val))
146 #define FX_largeLodValue(info) ((int)(GR_LOD_LOG2_256-(info).largeLodLog2))
147 #define FX_smallLodValue(info) ((int)(GR_LOD_LOG2_256-(info).smallLodLog2))
148 #define FX_valueToLod(val) ((GrLOD_t)(GR_LOD_LOG2_256-val))
153 * Write region: ToDo possible exploit the PixelPipe parameter.
155 #define FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
157 BEGIN_BOARD_LOCK(); \
158 grLfbWriteRegion(dst_buffer,\
173 * ScreenWidth/Height stuff.
175 extern int FX_grSstScreenWidth(void);
176 extern int FX_grSstScreenHeight(void);
183 extern void FX_grSstPerfStats(GrSstPerfStats_t
*st
);
184 extern int FX_grSstQueryHardware(GrHwConfiguration
*config
);
185 #define FX_grGetInteger FX_grGetInteger_NoLock
186 extern FxI32
FX_grGetInteger_NoLock(FxU32 pname
);
193 #define FX_grHints FX_grHints_NoLock
194 extern void FX_grHints_NoLock(GrHint_t hintType
, FxU32 hintMask
);
199 * Needed for Glide3 only, to set up Glide2 compatible vertex layout.
201 extern void FX_setupGrVertexLayout(void);
208 extern FxBool
FX_grSstControl(FxU32 code
);
210 #define FX_grBufferClear(c, a, d) \
213 grBufferClear(c, a, d); \
219 #endif /* __FX_GLIDE_WARPER__ */