vbo: move VBO-private types, prototypes, etc. into new vbo_private.h header
[mesa.git] / src / mesa / vbo / vbo_context.h
1 /*
2 * mesa 3-D graphics library
3 *
4 * Copyright (C) 1999-2006 Brian Paul 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 "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25 /**
26 * \file vbo_context.h
27 * \brief VBO builder module datatypes and definitions.
28 * \author Keith Whitwell
29 */
30
31
32 /**
33 * \mainpage The VBO builder module
34 *
35 * This module hooks into the GL dispatch table and catches all vertex
36 * building and drawing commands, such as glVertex3f, glBegin and
37 * glDrawArrays. The module stores all incoming vertex data as arrays
38 * in GL vertex buffer objects (VBOs), and translates all drawing
39 * commands into calls to a driver supplied DrawPrimitives() callback.
40 *
41 * The module captures both immediate mode and display list drawing,
42 * and manages the allocation, reference counting and deallocation of
43 * vertex buffer objects itself.
44 *
45 * The DrawPrimitives() callback can be either implemented by the
46 * driver itself or hooked to the tnl module's _tnl_draw_primitives()
47 * function for hardware without tnl capablilties or during fallbacks.
48 */
49
50
51 #ifndef _VBO_CONTEXT_H
52 #define _VBO_CONTEXT_H
53
54 #include "vbo.h"
55 #include "vbo_attrib.h"
56 #include "vbo_exec.h"
57 #include "vbo_save.h"
58
59 #include "main/api_arrayelt.h"
60 #include "main/macros.h"
61
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65
66 struct vbo_context {
67 struct gl_vertex_array currval[VBO_ATTRIB_MAX];
68
69 /** Map VERT_ATTRIB_x to VBO_ATTRIB_y */
70 GLubyte map_vp_none[VERT_ATTRIB_MAX];
71 GLubyte map_vp_arb[VERT_ATTRIB_MAX];
72
73 struct vbo_exec_context exec;
74 struct vbo_save_context save;
75
76 /* Callback into the driver. This must always succeed, the driver
77 * is responsible for initiating any fallback actions required:
78 */
79 vbo_draw_func draw_prims;
80
81 /* Optional callback for indirect draws. This allows multidraws to not be
82 * broken up, as well as for the actual count to be passed in as a separate
83 * indirect parameter.
84 */
85 vbo_indirect_draw_func draw_indirect_prims;
86 };
87
88
89 void
90 vbo_exec_invalidate_state(struct gl_context *ctx);
91
92
93 void
94 _vbo_install_exec_vtxfmt(struct gl_context *ctx);
95
96
97 #ifdef __cplusplus
98 } // extern "C"
99 #endif
100
101 #endif