Merge branch 'mesa_7_5_branch' into mesa_7_6_branch
[mesa.git] / src / gallium / drivers / llvmpipe / lp_prim_setup.h
1 /**************************************************************************
2 *
3 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28
29 #ifndef LP_PRIM_SETUP_H
30 #define LP_PRIM_SETUP_H
31
32
33 /**
34 * vbuf is a special stage to gather the stream of triangles, lines, points
35 * together and reconstruct vertex buffers for hardware upload.
36 *
37 * First attempt, work in progress.
38 *
39 * TODO:
40 * - separate out vertex buffer building and primitive emit, ie >1 draw per vb.
41 * - tell vbuf stage how to build hw vertices directly
42 * - pass vbuf stage a buffer pointer for direct emit to agp/vram.
43 *
44 *
45 *
46 * Vertices are just an array of floats, with all the attributes
47 * packed. We currently assume a layout like:
48 *
49 * attr[0][0..3] - window position
50 * attr[1..n][0..3] - remaining attributes.
51 *
52 * Attributes are assumed to be 4 floats wide but are packed so that
53 * all the enabled attributes run contiguously.
54 */
55
56
57 struct draw_stage;
58 struct llvmpipe_context;
59
60
61 typedef void (*vbuf_draw_func)( struct pipe_context *pipe,
62 unsigned prim,
63 const ushort *elements,
64 unsigned nr_elements,
65 const void *vertex_buffer,
66 unsigned nr_vertices );
67
68
69 extern struct draw_stage *
70 lp_draw_render_stage( struct llvmpipe_context *llvmpipe );
71
72 extern struct setup_context *
73 lp_draw_setup_context( struct draw_stage * );
74
75 extern void
76 lp_draw_flush( struct draw_stage * );
77
78
79 extern struct draw_stage *
80 lp_draw_vbuf_stage( struct draw_context *draw_context,
81 struct pipe_context *pipe,
82 vbuf_draw_func draw );
83
84
85 #endif /* LP_PRIM_SETUP_H */