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 Array type draw functions, the main workhorse of any OpenGL API
27  * \author Keith Whitwell
28  */
29 
30 
31 #ifndef DRAW_H
32 #define DRAW_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    GLubyte mode;    /**< GL_POINTS, GL_LINES, GL_QUAD_STRIP, etc */
46 
47    /**
48     * tnl: If true, line stipple emulation will reset the pattern walker.
49     * vbo: If false and the primitive is a line loop, the first vertex is
50     *      the beginning of the line loop and it won't be drawn.
51     *      Instead, it will be moved to the end.
52     */
53    bool begin;
54 
55    /**
56     * tnl: If true and the primitive is a line loop, it will be closed.
57     * vbo: Same as tnl.
58     */
59    bool end;
60 
61    GLuint start;
62    GLuint count;
63    GLint basevertex;
64    GLuint draw_id;
65 };
66 
67 /* Would like to call this a "vbo_index_buffer", but this would be
68  * confusing as the indices are not neccessarily yet in a non-null
69  * buffer object.
70  */
71 struct _mesa_index_buffer
72 {
73    GLuint count;
74    uint8_t index_size_shift; /* logbase2(index_size) */
75    struct gl_buffer_object *obj;
76    const void *ptr;
77 };
78 
79 
80 void
81 _mesa_initialize_exec_dispatch(const struct gl_context *ctx,
82                                struct _glapi_table *exec);
83 
84 void GLAPIENTRY
85 _mesa_EvalMesh1(GLenum mode, GLint i1, GLint i2);
86 
87 void GLAPIENTRY
88 _mesa_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
89 
90 void GLAPIENTRY
91 _mesa_DrawElementsInstancedARB(GLenum mode, GLsizei count, GLenum type,
92                                const GLvoid * indices, GLsizei numInstances);
93 
94 void GLAPIENTRY
95 _mesa_DrawArraysInstancedBaseInstance(GLenum mode, GLint first,
96                                       GLsizei count, GLsizei numInstances,
97                                       GLuint baseInstance);
98 
99 void GLAPIENTRY
100 _mesa_DrawElementsInstancedBaseVertex(GLenum mode, GLsizei count,
101                                       GLenum type, const GLvoid * indices,
102                                       GLsizei numInstances,
103                                       GLint basevertex);
104 
105 void GLAPIENTRY
106 _mesa_DrawElementsInstancedBaseInstance(GLenum mode, GLsizei count,
107                                         GLenum type,
108                                         const GLvoid *indices,
109                                         GLsizei numInstances,
110                                         GLuint baseInstance);
111 
112 void GLAPIENTRY
113 _mesa_DrawTransformFeedbackStream(GLenum mode, GLuint name, GLuint stream);
114 
115 void GLAPIENTRY
116 _mesa_DrawTransformFeedbackInstanced(GLenum mode, GLuint name,
117                                      GLsizei primcount);
118 
119 void GLAPIENTRY
120 _mesa_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name,
121                                            GLuint stream,
122                                            GLsizei primcount);
123 
124 void GLAPIENTRY
125 _mesa_DrawArraysIndirect(GLenum mode, const GLvoid *indirect);
126 
127 void GLAPIENTRY
128 _mesa_DrawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect);
129 
130 void GLAPIENTRY
131 _mesa_MultiDrawArraysIndirect(GLenum mode, const GLvoid *indirect,
132                               GLsizei primcount, GLsizei stride);
133 
134 void GLAPIENTRY
135 _mesa_MultiDrawElementsIndirect(GLenum mode, GLenum type,
136                                 const GLvoid *indirect,
137                                 GLsizei primcount, GLsizei stride);
138 
139 void GLAPIENTRY
140 _mesa_MultiDrawArraysIndirectCountARB(GLenum mode, GLintptr indirect,
141                                       GLintptr drawcount_offset,
142                                       GLsizei maxdrawcount, GLsizei stride);
143 
144 void GLAPIENTRY
145 _mesa_MultiDrawElementsIndirectCountARB(GLenum mode, GLenum type,
146                                         GLintptr indirect,
147                                         GLintptr drawcount_offset,
148                                         GLsizei maxdrawcount, GLsizei stride);
149 
150 void GLAPIENTRY
151 _mesa_DrawArrays(GLenum mode, GLint first, GLsizei count);
152 
153 
154 void GLAPIENTRY
155 _mesa_DrawArraysInstancedARB(GLenum mode, GLint first, GLsizei count,
156                              GLsizei primcount);
157 
158 void GLAPIENTRY
159 _mesa_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode,
160                                                   GLsizei count,
161                                                   GLenum type,
162                                                   const GLvoid *indices,
163                                                   GLsizei numInstances,
164                                                   GLint basevertex,
165                                                   GLuint baseInstance);
166 
167 void GLAPIENTRY
168 _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type,
169                    const GLvoid *indices);
170 
171 
172 void GLAPIENTRY
173 _mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count,
174                         GLenum type, const GLvoid *indices);
175 
176 
177 void GLAPIENTRY
178 _mesa_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
179                              const GLvoid *indices, GLint basevertex);
180 
181 
182 void GLAPIENTRY
183 _mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end,
184                                   GLsizei count, GLenum type,
185                                   const GLvoid *indices,
186                                   GLint basevertex);
187 
188 
189 void GLAPIENTRY
190 _mesa_DrawTransformFeedback(GLenum mode, GLuint name);
191 
192 
193 
194 void GLAPIENTRY
195 _mesa_MultiDrawArrays(GLenum mode, const GLint *first,
196                       const GLsizei *count, GLsizei primcount);
197 
198 
199 void GLAPIENTRY
200 _mesa_MultiDrawElements(GLenum mode, const GLsizei *count, GLenum type,
201                         const GLvoid *const *indices, GLsizei primcount);
202 
203 
204 void GLAPIENTRY
205 _mesa_MultiDrawElementsBaseVertex(GLenum mode,
206                                   const GLsizei *count, GLenum type,
207                                   const GLvoid * const * indices, GLsizei primcount,
208                                   const GLint *basevertex);
209 
210 
211 void GLAPIENTRY
212 _mesa_MultiModeDrawArraysIBM(const GLenum * mode, const GLint * first,
213                              const GLsizei * count,
214                              GLsizei primcount, GLint modestride);
215 
216 
217 void GLAPIENTRY
218 _mesa_MultiModeDrawElementsIBM(const GLenum * mode, const GLsizei * count,
219                                GLenum type, const GLvoid * const * indices,
220                                GLsizei primcount, GLint modestride);
221 
222 
223 #ifdef __cplusplus
224 } // extern "C"
225 #endif
226 
227 #endif
228