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