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;
42
43struct _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 is_indirect:1;
50   GLuint pad:20;
51
52   GLuint start;
53   GLuint count;
54   GLint basevertex;
55   GLuint num_instances;
56   GLuint base_instance;
57   GLuint draw_id;
58
59   GLsizeiptr indirect_offset;
60};
61
62/* Would like to call this a "vbo_index_buffer", but this would be
63 * confusing as the indices are not neccessarily yet in a non-null
64 * buffer object.
65 */
66struct _mesa_index_buffer
67{
68   GLuint count;
69   unsigned index_size;
70   struct gl_buffer_object *obj;
71   const void *ptr;
72};
73
74
75void
76_mesa_initialize_exec_dispatch(const struct gl_context *ctx,
77                               struct _glapi_table *exec);
78
79
80void
81_mesa_draw_indirect(struct gl_context *ctx, GLuint mode,
82                    struct gl_buffer_object *indirect_data,
83                    GLsizeiptr indirect_offset, unsigned draw_count,
84                    unsigned stride,
85                    struct gl_buffer_object *indirect_draw_count_buffer,
86                    GLsizeiptr indirect_draw_count_offset,
87                    const struct _mesa_index_buffer *ib);
88
89
90void GLAPIENTRY
91_mesa_DrawArrays(GLenum mode, GLint first, GLsizei count);
92
93
94void GLAPIENTRY
95_mesa_DrawArraysInstanced(GLenum mode, GLint first, GLsizei count,
96                          GLsizei primcount);
97
98
99void GLAPIENTRY
100_mesa_DrawElements(GLenum mode, GLsizei count, GLenum type,
101                   const GLvoid *indices);
102
103
104void GLAPIENTRY
105_mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count,
106                        GLenum type, const GLvoid *indices);
107
108
109void GLAPIENTRY
110_mesa_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
111                             const GLvoid *indices, GLint basevertex);
112
113
114void GLAPIENTRY
115_mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end,
116                                  GLsizei count, GLenum type,
117                                  const GLvoid *indices,
118                                  GLint basevertex);
119
120
121void GLAPIENTRY
122_mesa_DrawTransformFeedback(GLenum mode, GLuint name);
123
124
125
126void GLAPIENTRY
127_mesa_MultiDrawArrays(GLenum mode, const GLint *first,
128                      const GLsizei *count, GLsizei primcount);
129
130
131void GLAPIENTRY
132_mesa_MultiDrawElements(GLenum mode, const GLsizei *count, GLenum type,
133                        const GLvoid *const *indices, GLsizei primcount);
134
135
136void GLAPIENTRY
137_mesa_MultiDrawElementsBaseVertex(GLenum mode,
138                                  const GLsizei *count, GLenum type,
139                                  const GLvoid * const * indices, GLsizei primcount,
140                                  const GLint *basevertex);
141
142
143void GLAPIENTRY
144_mesa_MultiModeDrawArraysIBM(const GLenum * mode, const GLint * first,
145                             const GLsizei * count,
146                             GLsizei primcount, GLint modestride);
147
148
149void GLAPIENTRY
150_mesa_MultiModeDrawElementsIBM(const GLenum * mode, const GLsizei * count,
151                               GLenum type, const GLvoid * const * indices,
152                               GLsizei primcount, GLint modestride);
153
154
155#ifdef __cplusplus
156} // extern "C"
157#endif
158
159#endif
160