Minor r200 vertex program cleanups. Remove disabled leftovers from r300 vertex progra...
[mesa.git] / src / mesa / drivers / dri / i965 / brw_exec.h
1 /**************************************************************************
2
3 Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas.
4
5 All Rights Reserved.
6
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 on the rights to use, copy, modify, merge, publish, distribute, sub
11 license, and/or sell copies of the Software, and to permit persons to whom
12 the Software is furnished to do so, subject to the following conditions:
13
14 The above copyright notice and this permission notice (including the next
15 paragraph) shall be included in all copies or substantial portions of the
16 Software.
17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 USE OR OTHER DEALINGS IN THE SOFTWARE.
25
26 **************************************************************************/
27
28 /*
29 * Authors:
30 * Keith Whitwell <keith@tungstengraphics.com>
31 *
32 */
33
34 #ifndef __BRW_EXEC_H__
35 #define __BRW_EXEC_H__
36
37 #include "mtypes.h"
38 #include "brw_attrib.h"
39 #include "brw_draw.h"
40
41
42 #define BRW_MAX_PRIM 64
43
44 /* Wierd implementation stuff:
45 */
46 #define BRW_VERT_BUFFER_SIZE (1024*16) /* dwords == 64k */
47 #define BRW_MAX_ATTR_CODEGEN 16
48 #define ERROR_ATTRIB 16
49
50
51
52
53 struct brw_exec_eval1_map {
54 struct gl_1d_map *map;
55 GLuint sz;
56 };
57
58 struct brw_exec_eval2_map {
59 struct gl_2d_map *map;
60 GLuint sz;
61 };
62
63
64
65 struct brw_exec_copied_vtx {
66 GLfloat buffer[BRW_ATTRIB_MAX * 4 * BRW_MAX_COPIED_VERTS];
67 GLuint nr;
68 };
69
70
71 typedef void (*brw_attrfv_func)( const GLfloat * );
72
73
74 struct brw_exec_context
75 {
76 GLcontext *ctx;
77 GLvertexformat vtxfmt;
78
79 struct {
80 struct gl_buffer_object *bufferobj;
81 GLubyte *buffer_map;
82
83 GLuint vertex_size;
84
85 struct brw_draw_prim prim[BRW_MAX_PRIM];
86 GLuint prim_count;
87
88 GLfloat *vbptr; /* cursor, points into buffer */
89 GLfloat vertex[BRW_ATTRIB_MAX*4]; /* current vertex */
90
91 GLfloat *current[BRW_ATTRIB_MAX]; /* points into ctx->Current, ctx->Light.Material */
92 GLfloat CurrentFloatEdgeFlag;
93
94 GLuint vert_count;
95 GLuint max_vert;
96 struct brw_exec_copied_vtx copied;
97
98 brw_attrfv_func tabfv[BRW_MAX_ATTR_CODEGEN+1][4]; /* plus 1 for ERROR_ATTRIB */
99
100 GLubyte attrsz[BRW_ATTRIB_MAX];
101 GLfloat *attrptr[BRW_ATTRIB_MAX];
102 struct gl_client_array arrays[BRW_ATTRIB_MAX];
103 const struct gl_client_array *inputs[BRW_ATTRIB_MAX];
104 } vtx;
105
106
107 struct {
108 GLboolean recalculate_maps;
109 struct brw_exec_eval1_map map1[BRW_ATTRIB_MAX];
110 struct brw_exec_eval2_map map2[BRW_ATTRIB_MAX];
111 } eval;
112
113 struct {
114 GLboolean recalculate_inputs;
115 const struct gl_client_array *inputs[BRW_ATTRIB_MAX];
116 const struct gl_client_array *attrib_arrays[BRW_ATTRIB_MAX];
117 const struct gl_client_array *legacy_arrays[BRW_ATTRIB_MAX];
118
119 struct gl_buffer_object *index_obj;
120 } array;
121 };
122
123
124
125 /* External API:
126 */
127 void brw_exec_init( GLcontext *ctx );
128 void brw_exec_destroy( GLcontext *ctx );
129 void brw_exec_invalidate_state( GLcontext *ctx, GLuint new_state );
130 void brw_exec_FlushVertices( GLcontext *ctx, GLuint flags );
131 void brw_exec_wakeup( GLcontext *ctx );
132
133
134 /* Internal functions:
135 */
136 void brw_exec_array_init( struct brw_exec_context *exec );
137 void brw_exec_array_destroy( struct brw_exec_context *exec );
138
139
140 void brw_exec_vtx_init( struct brw_exec_context *exec );
141 void brw_exec_vtx_destroy( struct brw_exec_context *exec );
142 void brw_exec_vtx_flush( struct brw_exec_context *exec );
143 void brw_exec_vtx_wrap( struct brw_exec_context *exec );
144
145 void brw_exec_eval_update( struct brw_exec_context *exec );
146
147 void brw_exec_do_EvalCoord2f( struct brw_exec_context *exec,
148 GLfloat u, GLfloat v );
149
150 void brw_exec_do_EvalCoord1f( struct brw_exec_context *exec,
151 GLfloat u);
152
153
154
155 void brw_exec_vtx_generic_init( struct brw_exec_context *exec );
156
157 void brw_exec_generic_attr_table_init( brw_attrfv_func (*tab)[4] );
158
159
160 #endif