4e3f15999c068abf156e40cf1ae0b3323f3480ff
[mesa.git] / src / mesa / vbo / vbo.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 * \brief Public interface to the VBO module
27 * \author Keith Whitwell
28 */
29
30
31 #ifndef _VBO_H
32 #define _VBO_H
33
34 #include <stdbool.h>
35 #include "main/glheader.h"
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
41 struct gl_context;
42
43 struct _mesa_prim
44 {
45 GLuint mode:8; /**< GL_POINTS, GL_LINES, GL_QUAD_STRIP, etc */
46 GLuint indexed:1;
47 GLuint begin:1;
48 GLuint end:1;
49 GLuint weak:1;
50 GLuint no_current_update:1;
51 GLuint is_indirect:1;
52 GLuint pad:18;
53
54 GLuint start;
55 GLuint count;
56 GLint basevertex;
57 GLuint num_instances;
58 GLuint base_instance;
59 GLuint draw_id;
60
61 GLsizeiptr indirect_offset;
62 };
63
64 /* Would like to call this a "vbo_index_buffer", but this would be
65 * confusing as the indices are not neccessarily yet in a non-null
66 * buffer object.
67 */
68 struct _mesa_index_buffer
69 {
70 GLuint count;
71 unsigned index_size;
72 struct gl_buffer_object *obj;
73 const void *ptr;
74 };
75
76
77
78 GLboolean
79 _vbo_CreateContext(struct gl_context *ctx);
80
81 void
82 _vbo_DestroyContext(struct gl_context *ctx);
83
84 void
85 vbo_exec_invalidate_state(struct gl_context *ctx);
86
87 void
88 _vbo_install_exec_vtxfmt(struct gl_context *ctx);
89
90 void
91 vbo_initialize_exec_dispatch(const struct gl_context *ctx,
92 struct _glapi_table *exec);
93
94 void
95 vbo_initialize_save_dispatch(const struct gl_context *ctx,
96 struct _glapi_table *exec);
97
98 void
99 vbo_exec_FlushVertices(struct gl_context *ctx, GLuint flags);
100
101 void
102 vbo_save_SaveFlushVertices(struct gl_context *ctx);
103
104 void
105 vbo_save_NotifyBegin(struct gl_context *ctx, GLenum mode);
106
107 void
108 vbo_save_NewList(struct gl_context *ctx, GLuint list, GLenum mode);
109
110 void
111 vbo_save_EndList(struct gl_context *ctx);
112
113 void
114 vbo_save_BeginCallList(struct gl_context *ctx, struct gl_display_list *list);
115
116 void
117 vbo_save_EndCallList(struct gl_context *ctx);
118
119
120 void
121 _vbo_draw_indirect(struct gl_context *ctx, GLuint mode,
122 struct gl_buffer_object *indirect_data,
123 GLsizeiptr indirect_offset, unsigned draw_count,
124 unsigned stride,
125 struct gl_buffer_object *indirect_draw_count_buffer,
126 GLsizeiptr indirect_draw_count_offset,
127 const struct _mesa_index_buffer *ib);
128
129
130 void
131 vbo_delete_minmax_cache(struct gl_buffer_object *bufferObj);
132
133 void
134 vbo_get_minmax_indices(struct gl_context *ctx, const struct _mesa_prim *prim,
135 const struct _mesa_index_buffer *ib,
136 GLuint *min_index, GLuint *max_index, GLuint nr_prims);
137
138 void
139 vbo_use_buffer_objects(struct gl_context *ctx);
140
141 void
142 vbo_always_unmap_buffers(struct gl_context *ctx);
143
144 void
145 vbo_sw_primitive_restart(struct gl_context *ctx,
146 const struct _mesa_prim *prim,
147 GLuint nr_prims,
148 const struct _mesa_index_buffer *ib,
149 struct gl_buffer_object *indirect);
150
151
152 const struct gl_array_attributes*
153 _vbo_current_attrib(const struct gl_context *ctx, gl_vert_attrib attr);
154
155
156 const struct gl_vertex_buffer_binding*
157 _vbo_current_binding(const struct gl_context *ctx);
158
159
160 void GLAPIENTRY
161 _es_Color4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
162
163 void GLAPIENTRY
164 _es_Normal3f(GLfloat x, GLfloat y, GLfloat z);
165
166 void GLAPIENTRY
167 _es_MultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
168
169 void GLAPIENTRY
170 _es_Materialfv(GLenum face, GLenum pname, const GLfloat *params);
171
172 void GLAPIENTRY
173 _es_Materialf(GLenum face, GLenum pname, GLfloat param);
174
175 void GLAPIENTRY
176 _es_VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
177
178 void GLAPIENTRY
179 _es_VertexAttrib1f(GLuint indx, GLfloat x);
180
181 void GLAPIENTRY
182 _es_VertexAttrib1fv(GLuint indx, const GLfloat* values);
183
184 void GLAPIENTRY
185 _es_VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
186
187 void GLAPIENTRY
188 _es_VertexAttrib2fv(GLuint indx, const GLfloat* values);
189
190 void GLAPIENTRY
191 _es_VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
192
193 void GLAPIENTRY
194 _es_VertexAttrib3fv(GLuint indx, const GLfloat* values);
195
196 void GLAPIENTRY
197 _es_VertexAttrib4fv(GLuint indx, const GLfloat* values);
198
199 #ifdef __cplusplus
200 } // extern "C"
201 #endif
202
203 #endif