fix up radeon span functions using latest r200 code from Brian,
[mesa.git] / src / mesa / drivers / dri / r200 / r200_vtxfmt.h
1 /* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.h,v 1.1 2002/10/30 12:51:53 alanh Exp $ */
2 /*
3 Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
4
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.
8
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:
16
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.
20
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.
28
29 **************************************************************************/
30
31 /*
32 * Authors:
33 * Keith Whitwell <keith@tungstengraphics.com>
34 */
35
36 #ifndef __R200_VTXFMT_H__
37 #define __R200_VTXFMT_H__
38
39 #include "r200_context.h"
40
41
42
43 extern void r200VtxfmtUpdate( GLcontext *ctx );
44 extern void r200VtxfmtInit( GLcontext *ctx, GLboolean useCodegen );
45 extern void r200VtxfmtInvalidate( GLcontext *ctx );
46 extern void r200VtxfmtDestroy( GLcontext *ctx );
47 extern void r200VtxfmtInitChoosers( GLvertexformat *vfmt );
48
49 extern void r200VtxfmtMakeCurrent( GLcontext *ctx );
50 extern void r200VtxfmtUnbindContext( GLcontext *ctx );
51
52 extern void r200_copy_to_current( GLcontext *ctx );
53 extern void VFMT_FALLBACK( const char *caller );
54
55 #define DFN( FUNC, CACHE) \
56 do { \
57 char *start = (char *)&FUNC; \
58 char *end = (char *)&FUNC##_end; \
59 insert_at_head( &CACHE, dfn ); \
60 dfn->key[0] = key[0]; \
61 dfn->key[1] = key[1]; \
62 dfn->code = _mesa_exec_malloc( end - start ); \
63 _mesa_memcpy(dfn->code, start, end - start); \
64 } \
65 while ( 0 )
66
67 #define FIXUP( CODE, OFFSET, CHECKVAL, NEWVAL ) \
68 do { \
69 int *icode = (int *)(CODE+OFFSET); \
70 assert (*icode == CHECKVAL); \
71 *icode = (int)NEWVAL; \
72 } while (0)
73
74
75 /* Useful for figuring out the offsets:
76 */
77 #define FIXUP2( CODE, OFFSET, CHECKVAL, NEWVAL ) \
78 do { \
79 while (*(int *)(CODE+OFFSET) != CHECKVAL) OFFSET++; \
80 /*fprintf(stderr, "%s/%d CVAL %x OFFSET %d VAL %x\n", __FUNCTION__,*/ \
81 /* __LINE__, CHECKVAL, OFFSET, (int)(NEWVAL));*/ \
82 *(int *)(CODE+OFFSET) = (int)(NEWVAL); \
83 OFFSET += 4; \
84 } while (0)
85
86 /*
87 */
88 void r200InitCodegen( struct dfn_generators *gen, GLboolean useCodegen );
89 void r200InitX86Codegen( struct dfn_generators *gen );
90 void r200InitSSECodegen( struct dfn_generators *gen );
91
92
93
94 /* Defined in r200_vtxfmt_x86.c
95 */
96 struct dynfn *r200_makeX86Vertex2f( GLcontext *, const int * );
97 struct dynfn *r200_makeX86Vertex2fv( GLcontext *, const int * );
98 struct dynfn *r200_makeX86Vertex3f( GLcontext *, const int * );
99 struct dynfn *r200_makeX86Vertex3fv( GLcontext *, const int * );
100 struct dynfn *r200_makeX86Color4ub( GLcontext *, const int * );
101 struct dynfn *r200_makeX86Color4ubv( GLcontext *, const int * );
102 struct dynfn *r200_makeX86Color3ub( GLcontext *, const int * );
103 struct dynfn *r200_makeX86Color3ubv( GLcontext *, const int * );
104 struct dynfn *r200_makeX86Color4f( GLcontext *, const int * );
105 struct dynfn *r200_makeX86Color4fv( GLcontext *, const int * );
106 struct dynfn *r200_makeX86Color3f( GLcontext *, const int * );
107 struct dynfn *r200_makeX86Color3fv( GLcontext *, const int * );
108 struct dynfn *r200_makeX86SecondaryColor3ubEXT( GLcontext *, const int * );
109 struct dynfn *r200_makeX86SecondaryColor3ubvEXT( GLcontext *, const int * );
110 struct dynfn *r200_makeX86SecondaryColor3fEXT( GLcontext *, const int * );
111 struct dynfn *r200_makeX86SecondaryColor3fvEXT( GLcontext *, const int * );
112 struct dynfn *r200_makeX86Normal3f( GLcontext *, const int * );
113 struct dynfn *r200_makeX86Normal3fv( GLcontext *, const int * );
114 struct dynfn *r200_makeX86TexCoord2f( GLcontext *, const int * );
115 struct dynfn *r200_makeX86TexCoord2fv( GLcontext *, const int * );
116 struct dynfn *r200_makeX86TexCoord1f( GLcontext *, const int * );
117 struct dynfn *r200_makeX86TexCoord1fv( GLcontext *, const int * );
118 struct dynfn *r200_makeX86MultiTexCoord2fARB( GLcontext *, const int * );
119 struct dynfn *r200_makeX86MultiTexCoord2fvARB( GLcontext *, const int * );
120 struct dynfn *r200_makeX86MultiTexCoord1fARB( GLcontext *, const int * );
121 struct dynfn *r200_makeX86MultiTexCoord1fvARB( GLcontext *, const int * );
122
123 #endif