Remove unused functions
[mesa.git] / src / mesa / drivers / dri / r600 / r600_context.h
1 /*
2 Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
3
4 The Weather Channel (TM) funded Tungsten Graphics to develop the
5 initial release of the Radeon 8500 driver under the XFree86 license.
6 This notice must be preserved.
7
8 Permission is hereby granted, free of charge, to any person obtaining
9 a copy of this software and associated documentation files (the
10 "Software"), to deal in the Software without restriction, including
11 without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense, and/or sell copies of the Software, and to
13 permit persons to whom the Software is furnished to do so, subject to
14 the following conditions:
15
16 The above copyright notice and this permission notice (including the
17 next paragraph) shall be included in all copies or substantial
18 portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
24 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
28 **************************************************************************/
29
30 /**
31 * \file
32 *
33 * \author Keith Whitwell <keith@tungstengraphics.com>
34 * \author Nicolai Haehnle <prefect_@gmx.net>
35 */
36
37 #ifndef __R600_CONTEXT_H__
38 #define __R600_CONTEXT_H__
39
40 #include "tnl/t_vertex.h"
41 #include "drm.h"
42 #include "radeon_drm.h"
43 #include "dri_util.h"
44 #include "texmem.h"
45 #include "radeon_common.h"
46
47 #include "main/macros.h"
48 #include "main/mtypes.h"
49 #include "main/colormac.h"
50
51 struct r600_context;
52 typedef struct r600_context r600ContextRec;
53 typedef struct r600_context *r600ContextPtr;
54
55 typedef struct r600_context context_t;
56
57 #include "main/mm.h"
58
59 /* From http://gcc. gnu.org/onlinedocs/gcc-3.2.3/gcc/Variadic-Macros.html .
60 I suppose we could inline this and use macro to fetch out __LINE__ and stuff in case we run into trouble
61 with other compilers ... GLUE!
62 */
63 #define WARN_ONCE(a, ...) { \
64 static int warn##__LINE__=1; \
65 if(warn##__LINE__){ \
66 fprintf(stderr, "*********************************WARN_ONCE*********************************\n"); \
67 fprintf(stderr, "File %s function %s line %d\n", \
68 __FILE__, __FUNCTION__, __LINE__); \
69 fprintf(stderr, a, ## __VA_ARGS__);\
70 fprintf(stderr, "***************************************************************************\n"); \
71 warn##__LINE__=0;\
72 } \
73 }
74
75 /************ DMA BUFFERS **************/
76
77 /* The blit width for texture uploads
78 */
79 #define R600_BLIT_WIDTH_BYTES 1024
80 #define R600_MAX_TEXTURE_UNITS 8
81
82 struct r600_texture_state {
83 int tc_count; /* number of incoming texture coordinates from VAP */
84 };
85
86 /* Perhaps more if we store programs in vmem? */
87 /* drm_r600_cmd_header_t->vpu->count is unsigned char */
88 #define VSF_MAX_FRAGMENT_LENGTH (255*4)
89
90 /* Can be tested with colormat currently. */
91 #define VSF_MAX_FRAGMENT_TEMPS (14)
92
93 #define STATE_R600_WINDOW_DIMENSION (STATE_INTERNAL_DRIVER+0)
94 #define STATE_R600_TEXRECT_FACTOR (STATE_INTERNAL_DRIVER+1)
95
96 extern int hw_tcl_on;
97
98 #define COLOR_IS_RGBA
99 #define TAG(x) r600##x
100 #include "tnl_dd/t_dd_vertex.h"
101 #undef TAG
102
103 #define PFS_MAX_ALU_INST 64
104 #define PFS_MAX_TEX_INST 64
105 #define PFS_MAX_TEX_INDIRECT 4
106 #define PFS_NUM_TEMP_REGS 32
107 #define PFS_NUM_CONST_REGS 16
108
109 #define R600_MAX_AOS_ARRAYS 16
110
111 #define REG_COORDS 0
112 #define REG_COLOR0 1
113 #define REG_TEX0 2
114
115 #define R600_FALLBACK_NONE 0
116 #define R600_FALLBACK_TCL 1
117 #define R600_FALLBACK_RAST 2
118
119 /* r600_swtcl.c
120 */
121 struct r600_swtcl_info {
122 /*
123 * Offset of the 4UB color data within a hardware (swtcl) vertex.
124 */
125 GLuint coloroffset;
126
127 /**
128 * Offset of the 3UB specular color data within a hardware (swtcl) vertex.
129 */
130 GLuint specoffset;
131
132 struct vertex_attribute{
133 GLuint attr;
134 GLubyte format;
135 GLubyte dst_loc;
136 GLuint swizzle;
137 GLubyte write_mask;
138 } vert_attrs[VERT_ATTRIB_MAX];
139
140 GLubyte vertex_attr_count;
141 };
142
143 enum
144 {
145 NO_SHIFT = 0,
146 LEFT_SHIFT = 1,
147 RIGHT_SHIFT = 2,
148 };
149
150 typedef struct offset_modifiers
151 {
152 GLuint shift;
153 GLuint shiftbits;
154 GLuint mask;
155 } offset_modifiers;
156
157 typedef struct chip_object
158 {
159 void *pvChipObj;
160
161 /* ------------ OUT ------------------- */
162 GLboolean (*DestroyChipObj)(GLcontext * ctx);
163
164 void (*InitFuncs)(struct dd_function_table *functions);
165
166 void (*InitState)(GLcontext * ctx);
167
168 GLuint (*GetTexObjSize)(void);
169
170 /* ------------ IN ------------------- */
171 GLboolean (*EmitShader)( GLcontext * ctx,
172 void ** shaderbo,
173 GLvoid * data,
174 int sizeinDWORD,
175 char * szShaderUsage);
176 GLboolean (*DeleteShader)(GLcontext * ctx,
177 void * shaderbo);
178 struct tnl_pipeline_stage **stages;
179 } chip_object;
180
181 /**
182 * \brief R600 context structure.
183 */
184 struct r600_context {
185 struct radeon_context radeon; /* parent class, must be first */
186
187 /* ------ */
188 chip_object chipobj;
189
190 /* Vertex buffers
191 */
192 GLvector4f dummy_attrib[_TNL_ATTRIB_MAX];
193 GLvector4f *temp_attrib[_TNL_ATTRIB_MAX];
194
195 GLboolean disable_lowimpact_fallback;
196
197 struct r600_swtcl_info swtcl;
198 GLboolean vap_flush_needed;
199 };
200
201 #define R600_CONTEXT(ctx) ((r600ContextPtr)(ctx->DriverCtx))
202 #define R700_CONTEXT(ctx) ((context_t *)(ctx->DriverCtx))
203 #define GL_CONTEXT(context) ((GLcontext *)(context->radeon.glCtx))
204
205 extern void r600DestroyContext(__DRIcontextPrivate * driContextPriv);
206 extern GLboolean r600CreateContext(const __GLcontextModes * glVisual,
207 __DRIcontextPrivate * driContextPriv,
208 void *sharedContextPrivate);
209
210 #define RADEON_D_CAPTURE 0
211 #define RADEON_D_PLAYBACK 1
212 #define RADEON_D_PLAYBACK_RAW 2
213 #define RADEON_D_T 3
214
215 #define r600PackFloat32 radeonPackFloat32
216 #define r600PackFloat24 radeonPackFloat24
217
218 #endif /* __R600_CONTEXT_H__ */