1 /* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_context.h,v 1.2 2002/12/16 16:18:54 dawes Exp $ */
3 Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
5 The Weather Channel (TM) funded Tungsten Graphics to develop the
6 initial release of the Radeon 8500 driver under the XFree86 license.
7 This notice must be preserved.
9 Permission is hereby granted, free of charge, to any person obtaining
10 a copy of this software and associated documentation files (the
11 "Software"), to deal in the Software without restriction, including
12 without limitation the rights to use, copy, modify, merge, publish,
13 distribute, sublicense, and/or sell copies of the Software, and to
14 permit persons to whom the Software is furnished to do so, subject to
15 the following conditions:
17 The above copyright notice and this permission notice (including the
18 next paragraph) shall be included in all copies or substantial
19 portions of the Software.
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
25 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 **************************************************************************/
33 * Keith Whitwell <keith@tungstengraphics.com>
36 #ifndef __R200_CONTEXT_H__
37 #define __R200_CONTEXT_H__
39 #ifdef GLX_DIRECT_RENDERING
43 #include "radeon_common.h"
51 #define ENABLE_HW_3D_TEXTURE 0 /* XXX this is temporary! */
54 typedef struct r200_context r200ContextRec
;
55 typedef struct r200_context
*r200ContextPtr
;
57 #include "r200_lock.h"
58 #include "r200_screen.h"
61 /* Flags for software fallback cases */
62 /* See correponding strings in r200_swtcl.c */
63 #define R200_FALLBACK_TEXTURE 0x1
64 #define R200_FALLBACK_DRAW_BUFFER 0x2
65 #define R200_FALLBACK_STENCIL 0x4
66 #define R200_FALLBACK_RENDER_MODE 0x8
67 #define R200_FALLBACK_BLEND_EQ 0x10
68 #define R200_FALLBACK_BLEND_FUNC 0x20
69 #define R200_FALLBACK_DISABLE 0x40
70 #define R200_FALLBACK_BORDER_MODE 0x80
72 /* The blit width for texture uploads
74 #define BLIT_WIDTH_BYTES 1024
76 /* Use the templated vertex format:
79 #define TAG(x) r200##x
80 #include "tnl_dd/t_dd_vertex.h"
83 typedef void (*r200_tri_func
)( r200ContextPtr
,
88 typedef void (*r200_line_func
)( r200ContextPtr
,
92 typedef void (*r200_point_func
)( r200ContextPtr
,
96 struct r200_colorbuffer_state
{
98 GLint drawOffset
, drawPitch
;
103 struct r200_depthbuffer_state
{
107 struct r200_pixel_state
{
108 GLint readOffset
, readPitch
;
111 struct r200_scissor_state
{
112 XF86DRIClipRectRec rect
;
115 GLuint numClipRects
; /* Cliprects active */
116 GLuint numAllocedClipRects
; /* Cliprects available */
117 XF86DRIClipRectPtr pClipRects
;
120 struct r200_stencilbuffer_state
{
122 GLuint clear
; /* rb3d_stencilrefmask value */
125 struct r200_stipple_state
{
135 typedef struct r200_tex_obj r200TexObj
, *r200TexObjPtr
;
137 /* Texture object in locally shared texture space.
139 struct r200_tex_obj
{
140 driTextureObject base
;
142 GLuint bufAddr
; /* Offset to start of locally
143 shared texture block */
145 GLuint dirty_state
; /* Flags (1 per texunit) for
146 whether or not this texobj
147 has dirty hardware state
148 (pp_*) that needs to be
152 drmRadeonTexImage image
[6][RADEON_MAX_TEXTURE_LEVELS
];
153 /* Six, for the cube faces */
155 GLuint pp_txfilter
; /* hardware register values */
157 GLuint pp_txformat_x
;
158 GLuint pp_txoffset
; /* Image location in texmem.
159 All cube faces follow. */
160 GLuint pp_txsize
; /* npot only */
161 GLuint pp_txpitch
; /* npot only */
162 GLuint pp_border_color
;
163 GLuint pp_cubic_faces
; /* cube face 1,2,3,4 log2 sizes */
165 GLboolean border_fallback
;
169 struct r200_texture_env_state
{
170 r200TexObjPtr texobj
;
175 #define R200_MAX_TEXTURE_UNITS 3
177 struct r200_texture_state
{
178 struct r200_texture_env_state unit
[R200_MAX_TEXTURE_UNITS
];
182 struct r200_state_atom
{
183 struct r200_state_atom
*next
, *prev
;
184 const char *name
; /* for debug */
185 int cmd_size
; /* size in bytes */
187 int *cmd
; /* one or more cmd's */
188 int *lastcmd
; /* one or more cmd's */
190 GLboolean (*check
)( GLcontext
*, int ); /* is this state active? */
195 /* Trying to keep these relatively short as the variables are becoming
196 * extravagently long. Drop the driver name prefix off the front of
197 * everything - I think we know which driver we're in by now, and keep the
198 * prefix to 3 letters unless absolutely impossible.
202 #define CTX_PP_MISC 1
203 #define CTX_PP_FOG_COLOR 2
204 #define CTX_RE_SOLID_COLOR 3
205 #define CTX_RB3D_BLENDCNTL 4
206 #define CTX_RB3D_DEPTHOFFSET 5
207 #define CTX_RB3D_DEPTHPITCH 6
208 #define CTX_RB3D_ZSTENCILCNTL 7
210 #define CTX_PP_CNTL 9
211 #define CTX_RB3D_CNTL 10
212 #define CTX_RB3D_COLOROFFSET 11
213 #define CTX_CMD_2 12 /* why */
214 #define CTX_RB3D_COLORPITCH 13 /* why */
215 #define CTX_STATE_SIZE 14
218 #define SET_SE_CNTL 1
219 #define SET_RE_CNTL 2 /* replace se_coord_fmt */
220 #define SET_STATE_SIZE 3
223 #define VTE_SE_VTE_CNTL 1
224 #define VTE_STATE_SIZE 2
227 #define LIN_RE_LINE_PATTERN 1
228 #define LIN_RE_LINE_STATE 2
230 #define LIN_SE_LINE_WIDTH 4
231 #define LIN_STATE_SIZE 5
234 #define MSK_RB3D_STENCILREFMASK 1
235 #define MSK_RB3D_ROPCNTL 2
236 #define MSK_RB3D_PLANEMASK 3
237 #define MSK_STATE_SIZE 4
240 #define VPT_SE_VPORT_XSCALE 1
241 #define VPT_SE_VPORT_XOFFSET 2
242 #define VPT_SE_VPORT_YSCALE 3
243 #define VPT_SE_VPORT_YOFFSET 4
244 #define VPT_SE_VPORT_ZSCALE 5
245 #define VPT_SE_VPORT_ZOFFSET 6
246 #define VPT_STATE_SIZE 7
249 #define ZBS_SE_ZBIAS_FACTOR 1
250 #define ZBS_SE_ZBIAS_CONSTANT 2
251 #define ZBS_STATE_SIZE 3
254 #define MSC_RE_MISC 1
255 #define MSC_STATE_SIZE 2
259 #define TAM_STATE_SIZE 2
262 #define TEX_PP_TXFILTER 1 /*2c00*/
263 #define TEX_PP_TXFORMAT 2 /*2c04*/
264 #define TEX_PP_TXFORMAT_X 3 /*2c08*/
265 #define TEX_PP_TXSIZE 4 /*2c0c*/
266 #define TEX_PP_TXPITCH 5 /*2c10*/
267 #define TEX_PP_BORDER_COLOR 6 /*2c14*/
269 #define TEX_PP_TXOFFSET 8 /*2d00 */
270 #define TEX_STATE_SIZE 9
272 #define CUBE_CMD_0 0 /* 1 register follows */
273 #define CUBE_PP_CUBIC_FACES 1 /* 0x2c18 */
274 #define CUBE_CMD_1 2 /* 5 registers follow */
275 #define CUBE_PP_CUBIC_OFFSET_F1 3 /* 0x2d04 */
276 #define CUBE_PP_CUBIC_OFFSET_F2 4 /* 0x2d08 */
277 #define CUBE_PP_CUBIC_OFFSET_F3 5 /* 0x2d0c */
278 #define CUBE_PP_CUBIC_OFFSET_F4 6 /* 0x2d10 */
279 #define CUBE_PP_CUBIC_OFFSET_F5 7 /* 0x2d14 */
280 #define CUBE_STATE_SIZE 8
283 #define PIX_PP_TXCBLEND 1
284 #define PIX_PP_TXCBLEND2 2
285 #define PIX_PP_TXABLEND 3
286 #define PIX_PP_TXABLEND2 4
287 #define PIX_STATE_SIZE 5
290 #define TF_TFACTOR_0 1
291 #define TF_TFACTOR_1 2
292 #define TF_TFACTOR_2 3
293 #define TF_TFACTOR_3 4
294 #define TF_TFACTOR_4 5
295 #define TF_TFACTOR_5 6
296 #define TF_STATE_SIZE 7
299 #define TCL_LIGHT_MODEL_CTL_0 1
300 #define TCL_LIGHT_MODEL_CTL_1 2
301 #define TCL_PER_LIGHT_CTL_0 3
302 #define TCL_PER_LIGHT_CTL_1 4
303 #define TCL_PER_LIGHT_CTL_2 5
304 #define TCL_PER_LIGHT_CTL_3 6
306 #define TCL_UCP_VERT_BLEND_CTL 8
307 #define TCL_STATE_SIZE 9
310 #define MSL_MATRIX_SELECT_0 1
311 #define MSL_MATRIX_SELECT_1 2
312 #define MSL_MATRIX_SELECT_2 3
313 #define MSL_MATRIX_SELECT_3 4
314 #define MSL_MATRIX_SELECT_4 5
315 #define MSL_STATE_SIZE 6
318 #define TCG_TEX_PROC_CTL_2 1
319 #define TCG_TEX_PROC_CTL_3 2
320 #define TCG_TEX_PROC_CTL_0 3
321 #define TCG_TEX_PROC_CTL_1 4
322 #define TCG_TEX_CYL_WRAP_CTL 5
323 #define TCG_STATE_SIZE 6
326 #define MTL_EMMISSIVE_RED 1
327 #define MTL_EMMISSIVE_GREEN 2
328 #define MTL_EMMISSIVE_BLUE 3
329 #define MTL_EMMISSIVE_ALPHA 4
330 #define MTL_AMBIENT_RED 5
331 #define MTL_AMBIENT_GREEN 6
332 #define MTL_AMBIENT_BLUE 7
333 #define MTL_AMBIENT_ALPHA 8
334 #define MTL_DIFFUSE_RED 9
335 #define MTL_DIFFUSE_GREEN 10
336 #define MTL_DIFFUSE_BLUE 11
337 #define MTL_DIFFUSE_ALPHA 12
338 #define MTL_SPECULAR_RED 13
339 #define MTL_SPECULAR_GREEN 14
340 #define MTL_SPECULAR_BLUE 15
341 #define MTL_SPECULAR_ALPHA 16
343 #define MTL_SHININESS 18
344 #define MTL_STATE_SIZE 19
347 #define VAP_SE_VAP_CNTL 1
348 #define VAP_STATE_SIZE 2
350 /* Replaces a lot of packet info from radeon
353 #define VTX_VTXFMT_0 1
354 #define VTX_VTXFMT_1 2
355 #define VTX_TCL_OUTPUT_VTXFMT_0 3
356 #define VTX_TCL_OUTPUT_VTXFMT_1 4
358 #define VTX_TCL_OUTPUT_COMPSEL 6
360 #define VTX_STATE_CNTL 8
361 #define VTX_STATE_SIZE 9
364 #define VTX_COLOR(v,n) (((v)>>(R200_VTX_COLOR_0_SHIFT+(n)*2))&\
369 #define MAT_STATE_SIZE 17
372 #define GRD_VERT_GUARD_CLIP_ADJ 1
373 #define GRD_VERT_GUARD_DISCARD_ADJ 2
374 #define GRD_HORZ_GUARD_CLIP_ADJ 3
375 #define GRD_HORZ_GUARD_DISCARD_ADJ 4
376 #define GRD_STATE_SIZE 5
378 /* position changes frequently when lighting in modelpos - separate
379 * out to new state item?
382 #define LIT_AMBIENT_RED 1
383 #define LIT_AMBIENT_GREEN 2
384 #define LIT_AMBIENT_BLUE 3
385 #define LIT_AMBIENT_ALPHA 4
386 #define LIT_DIFFUSE_RED 5
387 #define LIT_DIFFUSE_GREEN 6
388 #define LIT_DIFFUSE_BLUE 7
389 #define LIT_DIFFUSE_ALPHA 8
390 #define LIT_SPECULAR_RED 9
391 #define LIT_SPECULAR_GREEN 10
392 #define LIT_SPECULAR_BLUE 11
393 #define LIT_SPECULAR_ALPHA 12
394 #define LIT_POSITION_X 13
395 #define LIT_POSITION_Y 14
396 #define LIT_POSITION_Z 15
397 #define LIT_POSITION_W 16
398 #define LIT_DIRECTION_X 17
399 #define LIT_DIRECTION_Y 18
400 #define LIT_DIRECTION_Z 19
401 #define LIT_DIRECTION_W 20
402 #define LIT_ATTEN_CONST 21
403 #define LIT_ATTEN_LINEAR 22
404 #define LIT_ATTEN_QUADRATIC 23
405 #define LIT_ATTEN_XXX 24
407 #define LIT_SPOT_DCD 26
408 #define LIT_SPOT_DCM 27
409 #define LIT_SPOT_EXPONENT 28
410 #define LIT_SPOT_CUTOFF 29
411 #define LIT_SPECULAR_THRESH 30
412 #define LIT_RANGE_CUTOFF 31 /* ? */
413 #define LIT_RANGE_ATTEN 32 /* ? */
414 #define LIT_STATE_SIZE 33
423 #define FOG_STATE_SIZE 5
432 #define UCP_STATE_SIZE 5
434 /* GLT - Global ambient
441 #define GLT_STATE_SIZE 5
449 #define EYE_RESCALE_FACTOR 4
450 #define EYE_STATE_SIZE 5
452 /* CST - constant state
455 #define CST_PP_CNTL_X 1
457 #define CST_RB3D_DEPTHXY_OFFSET 3
459 #define CST_RE_AUX_SCISSOR_CNTL 5
461 #define CST_RE_SCISSOR_TL_0 7
462 #define CST_RE_SCISSOR_BR_0 8
464 #define CST_SE_VAP_CNTL_STATUS 10
466 #define CST_RE_POINTSIZE 12
468 #define CST_SE_TCL_INPUT_VTX_0 14
469 #define CST_SE_TCL_INPUT_VTX_1 15
470 #define CST_SE_TCL_INPUT_VTX_2 16
471 #define CST_SE_TCL_INPUT_VTX_3 17
472 #define CST_STATE_SIZE 18
477 struct r200_hw_state
{
478 /* All state should be on one of these lists:
480 struct r200_state_atom dirty
; /* dirty list head placeholder */
481 struct r200_state_atom clean
; /* clean list head placeholder */
483 /* Hardware state, stored as cmdbuf commands:
484 * -- Need to doublebuffer for
485 * - reviving state after loss of context
486 * - eliding noop statechange loops? (except line stipple count)
488 struct r200_state_atom ctx
;
489 struct r200_state_atom set
;
490 struct r200_state_atom vte
;
491 struct r200_state_atom lin
;
492 struct r200_state_atom msk
;
493 struct r200_state_atom vpt
;
494 struct r200_state_atom vap
;
495 struct r200_state_atom vtx
;
496 struct r200_state_atom tcl
;
497 struct r200_state_atom msl
;
498 struct r200_state_atom tcg
;
499 struct r200_state_atom msc
;
500 struct r200_state_atom cst
;
501 struct r200_state_atom tam
;
502 struct r200_state_atom tf
;
503 struct r200_state_atom tex
[2];
504 struct r200_state_atom cube
[2];
505 struct r200_state_atom zbs
;
506 struct r200_state_atom mtl
[2];
507 struct r200_state_atom mat
[5];
508 struct r200_state_atom lit
[8]; /* includes vec, scl commands */
509 struct r200_state_atom ucp
[6];
510 struct r200_state_atom pix
[6]; /* pixshader stages */
511 struct r200_state_atom eye
; /* eye pos */
512 struct r200_state_atom grd
; /* guard band clipping */
513 struct r200_state_atom fog
;
514 struct r200_state_atom glt
;
518 /* Derived state for internal purposes:
520 struct r200_colorbuffer_state color
;
521 struct r200_depthbuffer_state depth
;
522 struct r200_pixel_state pixel
;
523 struct r200_scissor_state scissor
;
524 struct r200_stencilbuffer_state stencil
;
525 struct r200_stipple_state stipple
;
526 struct r200_texture_state texture
;
529 /* Need refcounting on dma buffers:
531 struct r200_dma_buffer
{
532 int refcount
; /* the number of retained regions in buf */
536 #define GET_START(rvb) (rmesa->r200Screen->gart_buffer_offset + \
537 (rvb)->address - rmesa->dma.buf0_address + \
540 /* A retained region, eg vertices for indexed vertices.
542 struct r200_dma_region
{
543 struct r200_dma_buffer
*buf
;
544 char *address
; /* == buf->address */
545 int start
, end
, ptr
; /* offsets from start of buf */
553 /* Active dma region. Allocations for vertices and retained
554 * regions come from here. Also used for emitting random vertices,
555 * these may be flushed by calling flush_current();
557 struct r200_dma_region current
;
559 void (*flush
)( r200ContextPtr
);
561 char *buf0_address
; /* start of buf[0], for index calcs */
562 GLuint nr_released_bufs
; /* flush after so many buffers released */
565 struct r200_dri_mirror
{
566 __DRIcontextPrivate
*context
; /* DRI context */
567 __DRIscreenPrivate
*screen
; /* DRI screen */
568 __DRIdrawablePrivate
*drawable
; /* DRI drawable bound to this ctx */
570 drmContext hwContext
;
577 #define R200_CMD_BUF_SZ (8*1024)
582 char cmd_buf
[R200_CMD_BUF_SZ
];
590 struct r200_tcl_info
{
591 GLuint vertex_format
;
595 struct r200_dma_region
*aos_components
[8];
596 GLuint nr_aos_components
;
600 struct r200_dma_region indexed_verts
;
601 struct r200_dma_region obj
;
602 struct r200_dma_region rgba
;
603 struct r200_dma_region spec
;
604 struct r200_dma_region fog
;
605 struct r200_dma_region tex
[R200_MAX_TEXTURE_UNITS
];
606 struct r200_dma_region norm
;
612 struct r200_swtcl_info
{
614 GLuint SetupNewInputs
;
617 GLuint vertex_stride_shift
;
618 GLuint vertex_format
;
621 /* Fallback rasterization functions
623 r200_point_func draw_point
;
624 r200_line_func draw_line
;
625 r200_tri_func draw_tri
;
628 GLenum render_primitive
;
631 struct r200_dma_region indexed_verts
;
636 GLuint vertex_offset
;
642 #define R200_MAX_PRIMS 64
645 /* Want to keep a cache of these around. Each is parameterized by
646 * only a single value which has only a small range. Only expect a
647 * few, so just rescan the list each time?
650 struct dynfn
*next
, *prev
;
656 struct dynfn Vertex2f
;
657 struct dynfn Vertex2fv
;
658 struct dynfn Vertex3f
;
659 struct dynfn Vertex3fv
;
660 struct dynfn Color4ub
;
661 struct dynfn Color4ubv
;
662 struct dynfn Color3ub
;
663 struct dynfn Color3ubv
;
664 struct dynfn Color4f
;
665 struct dynfn Color4fv
;
666 struct dynfn Color3f
;
667 struct dynfn Color3fv
;
668 struct dynfn SecondaryColor3ubEXT
;
669 struct dynfn SecondaryColor3ubvEXT
;
670 struct dynfn SecondaryColor3fEXT
;
671 struct dynfn SecondaryColor3fvEXT
;
672 struct dynfn Normal3f
;
673 struct dynfn Normal3fv
;
674 struct dynfn TexCoord2f
;
675 struct dynfn TexCoord2fv
;
676 struct dynfn TexCoord1f
;
677 struct dynfn TexCoord1fv
;
678 struct dynfn MultiTexCoord2fARB
;
679 struct dynfn MultiTexCoord2fvARB
;
680 struct dynfn MultiTexCoord1fARB
;
681 struct dynfn MultiTexCoord1fvARB
;
684 struct dfn_generators
{
685 struct dynfn
*(*Vertex2f
)( GLcontext
*, const int * );
686 struct dynfn
*(*Vertex2fv
)( GLcontext
*, const int * );
687 struct dynfn
*(*Vertex3f
)( GLcontext
*, const int * );
688 struct dynfn
*(*Vertex3fv
)( GLcontext
*, const int * );
689 struct dynfn
*(*Color4ub
)( GLcontext
*, const int * );
690 struct dynfn
*(*Color4ubv
)( GLcontext
*, const int * );
691 struct dynfn
*(*Color3ub
)( GLcontext
*, const int * );
692 struct dynfn
*(*Color3ubv
)( GLcontext
*, const int * );
693 struct dynfn
*(*Color4f
)( GLcontext
*, const int * );
694 struct dynfn
*(*Color4fv
)( GLcontext
*, const int * );
695 struct dynfn
*(*Color3f
)( GLcontext
*, const int * );
696 struct dynfn
*(*Color3fv
)( GLcontext
*, const int * );
697 struct dynfn
*(*SecondaryColor3ubEXT
)( GLcontext
*, const int * );
698 struct dynfn
*(*SecondaryColor3ubvEXT
)( GLcontext
*, const int * );
699 struct dynfn
*(*SecondaryColor3fEXT
)( GLcontext
*, const int * );
700 struct dynfn
*(*SecondaryColor3fvEXT
)( GLcontext
*, const int * );
701 struct dynfn
*(*Normal3f
)( GLcontext
*, const int * );
702 struct dynfn
*(*Normal3fv
)( GLcontext
*, const int * );
703 struct dynfn
*(*TexCoord2f
)( GLcontext
*, const int * );
704 struct dynfn
*(*TexCoord2fv
)( GLcontext
*, const int * );
705 struct dynfn
*(*TexCoord1f
)( GLcontext
*, const int * );
706 struct dynfn
*(*TexCoord1fv
)( GLcontext
*, const int * );
707 struct dynfn
*(*MultiTexCoord2fARB
)( GLcontext
*, const int * );
708 struct dynfn
*(*MultiTexCoord2fvARB
)( GLcontext
*, const int * );
709 struct dynfn
*(*MultiTexCoord1fARB
)( GLcontext
*, const int * );
710 struct dynfn
*(*MultiTexCoord1fvARB
)( GLcontext
*, const int * );
722 GLint counter
, initial_counter
;
724 void (*notify
)( void );
727 /* A maximum total of 15 elements per vertex: 3 floats for position, 3
728 * floats for normal, 4 floats for color, 4 bytes for secondary color,
729 * 2 floats for each texture unit (4 floats total).
731 * As soon as the 3rd TMU is supported or cube maps (or 3D textures) are
732 * supported, this value will grow.
734 * The position data is never actually stored here, so 3 elements could be
735 * trimmed out of the buffer.
737 union { float f
; int i
; r200_color_t color
; } vertex
[15];
740 GLfloat
*floatcolorptr
;
741 r200_color_t
*colorptr
;
742 GLfloat
*floatspecptr
;
743 r200_color_t
*specptr
;
744 GLfloat
*texcoordptr
[2];
747 GLenum
*prim
; /* &ctx->Driver.CurrentExecPrimitive */
749 GLboolean enabled
; /* *_NO_VTXFMT / *_NO_TCL env vars */
754 GLuint vtxfmt_0
, vtxfmt_1
;
756 GLuint installed_vertex_format
;
757 GLuint installed_color_3f_sz
;
759 struct r200_prim primlist
[R200_MAX_PRIMS
];
762 struct dfn_lists dfn_cache
;
763 struct dfn_generators codegen
;
764 GLvertexformat vtxfmt
;
770 struct r200_context
{
771 GLcontext
*glCtx
; /* Mesa context */
773 /* Driver and hardware state management
775 struct r200_hw_state hw
;
776 struct r200_state state
;
778 /* Texture object bookkeeping
781 driTexHeap
* texture_heaps
[ R200_NR_TEX_HEAPS
];
782 driTextureObject swapped
;
784 float initialMaxAnisotropy
;
786 /* Rasterization and vertex state:
794 struct r200_ioctl ioctl
;
796 struct r200_store store
;
809 /* Clientdata textures;
811 GLuint prefer_gart_client_texturing
;
813 /* Drawable, cliprect and scissor information
815 GLuint numClipRects
; /* Cliprects for the draw buffer */
816 XF86DRIClipRectPtr pClipRects
;
817 unsigned int lastStamp
;
818 GLboolean lost_context
;
819 r200ScreenPtr r200Screen
; /* Screen private DRI data */
820 RADEONSAREAPrivPtr sarea
; /* Private SAREA data */
824 GLmatrix TexGenMatrix
[R200_MAX_TEXTURE_UNITS
];
825 GLboolean recheck_texgen
[R200_MAX_TEXTURE_UNITS
];
826 GLboolean TexGenNeedNormals
[R200_MAX_TEXTURE_UNITS
];
827 GLuint TexMatEnabled
;
828 GLuint TexMatCompSel
;
829 GLuint TexGenEnabled
;
831 GLuint TexGenCompSel
;
840 int64_t swap_missed_ust
;
843 GLuint swap_missed_count
;
845 PFNGLXGETUSTPROC get_ust
;
849 struct r200_tcl_info tcl
;
853 struct r200_swtcl_info swtcl
;
857 struct r200_vbinfo vb
;
859 /* Mirrors of some DRI state
861 struct r200_dri_mirror dri
;
863 /* Configuration cache
865 driOptionCache optionCache
;
868 #define R200_CONTEXT(ctx) ((r200ContextPtr)(ctx->DriverCtx))
871 static __inline GLuint
r200PackColor( GLuint cpp
,
872 GLubyte r
, GLubyte g
,
873 GLubyte b
, GLubyte a
)
877 return PACK_COLOR_565( r
, g
, b
);
879 return PACK_COLOR_8888( a
, r
, g
, b
);
885 #define R200_OLD_PACKETS 0
888 extern void r200DestroyContext( __DRIcontextPrivate
*driContextPriv
);
889 extern GLboolean
r200CreateContext( const __GLcontextModes
*glVisual
,
890 __DRIcontextPrivate
*driContextPriv
,
891 void *sharedContextPrivate
);
892 extern void r200SwapBuffers( __DRIdrawablePrivate
*dPriv
);
893 extern GLboolean
r200MakeCurrent( __DRIcontextPrivate
*driContextPriv
,
894 __DRIdrawablePrivate
*driDrawPriv
,
895 __DRIdrawablePrivate
*driReadPriv
);
896 extern GLboolean
r200UnbindContext( __DRIcontextPrivate
*driContextPriv
);
898 /* ================================================================
904 extern int R200_DEBUG
;
909 #define DEBUG_TEXTURE 0x001
910 #define DEBUG_STATE 0x002
911 #define DEBUG_IOCTL 0x004
912 #define DEBUG_PRIMS 0x008
913 #define DEBUG_VERTS 0x010
914 #define DEBUG_FALLBACKS 0x020
915 #define DEBUG_VFMT 0x040
916 #define DEBUG_CODEGEN 0x080
917 #define DEBUG_VERBOSE 0x100
918 #define DEBUG_DRI 0x200
919 #define DEBUG_DMA 0x400
920 #define DEBUG_SANITY 0x800
921 #define DEBUG_SYNC 0x1000
922 #define DEBUG_PIXEL 0x2000
923 #define DEBUG_MEMORY 0x4000
926 #endif /* __R200_CONTEXT_H__ */