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
38extern "C" {
39#endif
40
41struct gl_context;
42struct gl_vertex_array_object;
43struct _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 */
71struct _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
80void
81_mesa_set_varying_vp_inputs(struct gl_context *ctx, GLbitfield varying_inputs);
82
83/**
84 * Set the _DrawVAO and the net enabled arrays.
85 */
86void
87_mesa_set_draw_vao(struct gl_context *ctx, struct gl_vertex_array_object *vao,
88                   GLbitfield filter);
89
90void
91_mesa_draw_gallium_fallback(struct gl_context *ctx,
92                            struct pipe_draw_info *info,
93                            unsigned drawid_offset,
94                            const struct pipe_draw_start_count_bias *draws,
95                            unsigned num_draws);
96
97void
98_mesa_draw_gallium_multimode_fallback(struct gl_context *ctx,
99                                     struct pipe_draw_info *info,
100                                     const struct pipe_draw_start_count_bias *draws,
101                                     const unsigned char *mode,
102                                     unsigned num_draws);
103
104void GLAPIENTRY
105_mesa_EvalMesh1(GLenum mode, GLint i1, GLint i2);
106
107void GLAPIENTRY
108_mesa_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
109
110void GLAPIENTRY
111_mesa_DrawElementsInstancedARB(GLenum mode, GLsizei count, GLenum type,
112                               const GLvoid * indices, GLsizei numInstances);
113
114void GLAPIENTRY
115_mesa_DrawArraysInstancedBaseInstance(GLenum mode, GLint first,
116                                      GLsizei count, GLsizei numInstances,
117                                      GLuint baseInstance);
118
119void GLAPIENTRY
120_mesa_DrawElementsInstancedBaseVertex(GLenum mode, GLsizei count,
121                                      GLenum type, const GLvoid * indices,
122                                      GLsizei numInstances,
123                                      GLint basevertex);
124
125void GLAPIENTRY
126_mesa_DrawElementsInstancedBaseInstance(GLenum mode, GLsizei count,
127                                        GLenum type,
128                                        const GLvoid *indices,
129                                        GLsizei numInstances,
130                                        GLuint baseInstance);
131
132void GLAPIENTRY
133_mesa_DrawTransformFeedbackStream(GLenum mode, GLuint name, GLuint stream);
134
135void GLAPIENTRY
136_mesa_DrawTransformFeedbackInstanced(GLenum mode, GLuint name,
137                                     GLsizei primcount);
138
139void GLAPIENTRY
140_mesa_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name,
141                                           GLuint stream,
142                                           GLsizei primcount);
143
144void GLAPIENTRY
145_mesa_DrawArraysIndirect(GLenum mode, const GLvoid *indirect);
146
147void GLAPIENTRY
148_mesa_DrawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect);
149
150void GLAPIENTRY
151_mesa_MultiDrawArraysIndirect(GLenum mode, const GLvoid *indirect,
152                              GLsizei primcount, GLsizei stride);
153
154void GLAPIENTRY
155_mesa_MultiDrawElementsIndirect(GLenum mode, GLenum type,
156                                const GLvoid *indirect,
157                                GLsizei primcount, GLsizei stride);
158
159void GLAPIENTRY
160_mesa_MultiDrawArraysIndirectCountARB(GLenum mode, GLintptr indirect,
161                                      GLintptr drawcount_offset,
162                                      GLsizei maxdrawcount, GLsizei stride);
163
164void GLAPIENTRY
165_mesa_MultiDrawElementsIndirectCountARB(GLenum mode, GLenum type,
166                                        GLintptr indirect,
167                                        GLintptr drawcount_offset,
168                                        GLsizei maxdrawcount, GLsizei stride);
169
170void GLAPIENTRY
171_mesa_DrawArrays(GLenum mode, GLint first, GLsizei count);
172
173
174void GLAPIENTRY
175_mesa_DrawArraysInstancedARB(GLenum mode, GLint first, GLsizei count,
176                             GLsizei primcount);
177
178void GLAPIENTRY
179_mesa_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode,
180                                                  GLsizei count,
181                                                  GLenum type,
182                                                  const GLvoid *indices,
183                                                  GLsizei numInstances,
184                                                  GLint basevertex,
185                                                  GLuint baseInstance);
186
187void GLAPIENTRY
188_mesa_DrawElements(GLenum mode, GLsizei count, GLenum type,
189                   const GLvoid *indices);
190
191
192void GLAPIENTRY
193_mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count,
194                        GLenum type, const GLvoid *indices);
195
196
197void GLAPIENTRY
198_mesa_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
199                             const GLvoid *indices, GLint basevertex);
200
201
202void GLAPIENTRY
203_mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end,
204                                  GLsizei count, GLenum type,
205                                  const GLvoid *indices,
206                                  GLint basevertex);
207
208
209void GLAPIENTRY
210_mesa_DrawTransformFeedback(GLenum mode, GLuint name);
211
212
213
214void GLAPIENTRY
215_mesa_MultiDrawArrays(GLenum mode, const GLint *first,
216                      const GLsizei *count, GLsizei primcount);
217
218
219void GLAPIENTRY
220_mesa_MultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type,
221                           const GLvoid *const *indices, GLsizei primcount);
222
223
224void GLAPIENTRY
225_mesa_MultiDrawElementsBaseVertex(GLenum mode,
226                                  const GLsizei *count, GLenum type,
227                                  const GLvoid * const * indices, GLsizei primcount,
228                                  const GLint *basevertex);
229
230
231void GLAPIENTRY
232_mesa_MultiModeDrawArraysIBM(const GLenum * mode, const GLint * first,
233                             const GLsizei * count,
234                             GLsizei primcount, GLint modestride);
235
236
237void GLAPIENTRY
238_mesa_MultiModeDrawElementsIBM(const GLenum * mode, const GLsizei * count,
239                               GLenum type, const GLvoid * const * indices,
240                               GLsizei primcount, GLint modestride);
241
242void GLAPIENTRY
243_mesa_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
244
245void GLAPIENTRY
246_mesa_Rectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
247
248void GLAPIENTRY
249_mesa_Rectdv(const GLdouble *v1, const GLdouble *v2);
250
251void GLAPIENTRY
252_mesa_Rectfv(const GLfloat *v1, const GLfloat *v2);
253
254void GLAPIENTRY
255_mesa_Recti(GLint x1, GLint y1, GLint x2, GLint y2);
256
257void GLAPIENTRY
258_mesa_Rectiv(const GLint *v1, const GLint *v2);
259
260void GLAPIENTRY
261_mesa_Rects(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
262
263void GLAPIENTRY
264_mesa_Rectsv(const GLshort *v1, const GLshort *v2);
265
266#ifdef __cplusplus
267} // extern "C"
268#endif
269
270#endif
271