1 /**************************************************************************
3 Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas.
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:
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
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.
26 **************************************************************************/
30 * Keith Whitwell <keith@tungstengraphics.com>
34 #ifndef __BRW_EXEC_H__
35 #define __BRW_EXEC_H__
38 #include "brw_attrib.h"
42 #define BRW_MAX_PRIM 64
44 /* Wierd implementation stuff:
46 #define BRW_VERT_BUFFER_SIZE (1024*16) /* dwords == 64k */
47 #define BRW_MAX_ATTR_CODEGEN 16
48 #define ERROR_ATTRIB 16
53 struct brw_exec_eval1_map
{
54 struct gl_1d_map
*map
;
58 struct brw_exec_eval2_map
{
59 struct gl_2d_map
*map
;
65 struct brw_exec_copied_vtx
{
66 GLfloat buffer
[BRW_ATTRIB_MAX
* 4 * BRW_MAX_COPIED_VERTS
];
71 typedef void (*brw_attrfv_func
)( const GLfloat
* );
74 struct brw_exec_context
77 GLvertexformat vtxfmt
;
80 struct gl_buffer_object
*bufferobj
;
85 struct brw_draw_prim prim
[BRW_MAX_PRIM
];
88 GLfloat
*vbptr
; /* cursor, points into buffer */
89 GLfloat vertex
[BRW_ATTRIB_MAX
*4]; /* current vertex */
91 GLfloat
*current
[BRW_ATTRIB_MAX
]; /* points into ctx->Current, ctx->Light.Material */
92 GLfloat CurrentFloatEdgeFlag
;
96 struct brw_exec_copied_vtx copied
;
98 brw_attrfv_func tabfv
[BRW_MAX_ATTR_CODEGEN
+1][4]; /* plus 1 for ERROR_ATTRIB */
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
];
108 GLboolean recalculate_maps
;
109 struct brw_exec_eval1_map map1
[BRW_ATTRIB_MAX
];
110 struct brw_exec_eval2_map map2
[BRW_ATTRIB_MAX
];
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
];
119 struct gl_buffer_object
*index_obj
;
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
);
134 /* Internal functions:
136 void brw_exec_array_init( struct brw_exec_context
*exec
);
137 void brw_exec_array_destroy( struct brw_exec_context
*exec
);
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
);
145 void brw_exec_eval_update( struct brw_exec_context
*exec
);
147 void brw_exec_do_EvalCoord2f( struct brw_exec_context
*exec
,
148 GLfloat u
, GLfloat v
);
150 void brw_exec_do_EvalCoord1f( struct brw_exec_context
*exec
,
155 void brw_exec_vtx_generic_init( struct brw_exec_context
*exec
);
157 void brw_exec_generic_attr_table_init( brw_attrfv_func (*tab
)[4] );