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