101e04c3fSmrg/*
201e04c3fSmrg * mesa 3-D graphics library
301e04c3fSmrg *
401e04c3fSmrg * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
501e04c3fSmrg *
601e04c3fSmrg * Permission is hereby granted, free of charge, to any person obtaining a
701e04c3fSmrg * copy of this software and associated documentation files (the "Software"),
801e04c3fSmrg * to deal in the Software without restriction, including without limitation
901e04c3fSmrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
1001e04c3fSmrg * and/or sell copies of the Software, and to permit persons to whom the
1101e04c3fSmrg * Software is furnished to do so, subject to the following conditions:
1201e04c3fSmrg *
1301e04c3fSmrg * The above copyright notice and this permission notice shall be included
1401e04c3fSmrg * in all copies or substantial portions of the Software.
1501e04c3fSmrg *
1601e04c3fSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1701e04c3fSmrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1801e04c3fSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1901e04c3fSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
2001e04c3fSmrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2101e04c3fSmrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2201e04c3fSmrg * OTHER DEALINGS IN THE SOFTWARE.
2301e04c3fSmrg */
2401e04c3fSmrg
2501e04c3fSmrg/**
2601e04c3fSmrg * \brief Array type draw functions, the main workhorse of any OpenGL API
2701e04c3fSmrg * \author Keith Whitwell
2801e04c3fSmrg */
2901e04c3fSmrg
3001e04c3fSmrg
3101e04c3fSmrg#ifndef DRAW_H
3201e04c3fSmrg#define DRAW_H
3301e04c3fSmrg
3401e04c3fSmrg#include <stdbool.h>
3501e04c3fSmrg#include "main/glheader.h"
3601e04c3fSmrg
3701e04c3fSmrg#ifdef __cplusplus
3801e04c3fSmrgextern "C" {
3901e04c3fSmrg#endif
4001e04c3fSmrg
4101e04c3fSmrgstruct gl_context;
427ec681f3Smrgstruct gl_vertex_array_object;
4301e04c3fSmrgstruct _mesa_prim
4401e04c3fSmrg{
457ec681f3Smrg   GLubyte mode;    /**< GL_POINTS, GL_LINES, GL_QUAD_STRIP, etc */
467ec681f3Smrg
477ec681f3Smrg   /**
487ec681f3Smrg    * tnl: If true, line stipple emulation will reset the pattern walker.
497ec681f3Smrg    * vbo: If false and the primitive is a line loop, the first vertex is
507ec681f3Smrg    *      the beginning of the line loop and it won't be drawn.
517ec681f3Smrg    *      Instead, it will be moved to the end.
527ec681f3Smrg    */
537ec681f3Smrg   bool begin;
547ec681f3Smrg
557ec681f3Smrg   /**
567ec681f3Smrg    * tnl: If true and the primitive is a line loop, it will be closed.
577ec681f3Smrg    * vbo: Same as tnl.
587ec681f3Smrg    */
597ec681f3Smrg   bool end;
6001e04c3fSmrg
6101e04c3fSmrg   GLuint start;
6201e04c3fSmrg   GLuint count;
6301e04c3fSmrg   GLint basevertex;
6401e04c3fSmrg   GLuint draw_id;
6501e04c3fSmrg};
6601e04c3fSmrg
6701e04c3fSmrg/* Would like to call this a "vbo_index_buffer", but this would be
6801e04c3fSmrg * confusing as the indices are not neccessarily yet in a non-null
6901e04c3fSmrg * buffer object.
7001e04c3fSmrg */
7101e04c3fSmrgstruct _mesa_index_buffer
7201e04c3fSmrg{
7301e04c3fSmrg   GLuint count;
747ec681f3Smrg   uint8_t index_size_shift; /* logbase2(index_size) */
7501e04c3fSmrg   struct gl_buffer_object *obj;
7601e04c3fSmrg   const void *ptr;
7701e04c3fSmrg};
7801e04c3fSmrg
7901e04c3fSmrg
8001e04c3fSmrgvoid
817ec681f3Smrg_mesa_set_varying_vp_inputs(struct gl_context *ctx, GLbitfield varying_inputs);
8201e04c3fSmrg
837ec681f3Smrg/**
847ec681f3Smrg * Set the _DrawVAO and the net enabled arrays.
857ec681f3Smrg */
867ec681f3Smrgvoid
877ec681f3Smrg_mesa_set_draw_vao(struct gl_context *ctx, struct gl_vertex_array_object *vao,
887ec681f3Smrg                   GLbitfield filter);
897ec681f3Smrg
907ec681f3Smrgvoid
917ec681f3Smrg_mesa_draw_gallium_fallback(struct gl_context *ctx,
927ec681f3Smrg                            struct pipe_draw_info *info,
937ec681f3Smrg                            unsigned drawid_offset,
947ec681f3Smrg                            const struct pipe_draw_start_count_bias *draws,
957ec681f3Smrg                            unsigned num_draws);
9601e04c3fSmrg
9701e04c3fSmrgvoid
987ec681f3Smrg_mesa_draw_gallium_multimode_fallback(struct gl_context *ctx,
997ec681f3Smrg                                     struct pipe_draw_info *info,
1007ec681f3Smrg                                     const struct pipe_draw_start_count_bias *draws,
1017ec681f3Smrg                                     const unsigned char *mode,
1027ec681f3Smrg                                     unsigned num_draws);
1037ec681f3Smrg
1047ec681f3Smrgvoid GLAPIENTRY
1057ec681f3Smrg_mesa_EvalMesh1(GLenum mode, GLint i1, GLint i2);
1067ec681f3Smrg
1077ec681f3Smrgvoid GLAPIENTRY
1087ec681f3Smrg_mesa_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
1097ec681f3Smrg
1107ec681f3Smrgvoid GLAPIENTRY
1117ec681f3Smrg_mesa_DrawElementsInstancedARB(GLenum mode, GLsizei count, GLenum type,
1127ec681f3Smrg                               const GLvoid * indices, GLsizei numInstances);
1137ec681f3Smrg
1147ec681f3Smrgvoid GLAPIENTRY
1157ec681f3Smrg_mesa_DrawArraysInstancedBaseInstance(GLenum mode, GLint first,
1167ec681f3Smrg                                      GLsizei count, GLsizei numInstances,
1177ec681f3Smrg                                      GLuint baseInstance);
1187ec681f3Smrg
1197ec681f3Smrgvoid GLAPIENTRY
1207ec681f3Smrg_mesa_DrawElementsInstancedBaseVertex(GLenum mode, GLsizei count,
1217ec681f3Smrg                                      GLenum type, const GLvoid * indices,
1227ec681f3Smrg                                      GLsizei numInstances,
1237ec681f3Smrg                                      GLint basevertex);
1247ec681f3Smrg
1257ec681f3Smrgvoid GLAPIENTRY
1267ec681f3Smrg_mesa_DrawElementsInstancedBaseInstance(GLenum mode, GLsizei count,
1277ec681f3Smrg                                        GLenum type,
1287ec681f3Smrg                                        const GLvoid *indices,
1297ec681f3Smrg                                        GLsizei numInstances,
1307ec681f3Smrg                                        GLuint baseInstance);
1317ec681f3Smrg
1327ec681f3Smrgvoid GLAPIENTRY
1337ec681f3Smrg_mesa_DrawTransformFeedbackStream(GLenum mode, GLuint name, GLuint stream);
1347ec681f3Smrg
1357ec681f3Smrgvoid GLAPIENTRY
1367ec681f3Smrg_mesa_DrawTransformFeedbackInstanced(GLenum mode, GLuint name,
1377ec681f3Smrg                                     GLsizei primcount);
1387ec681f3Smrg
1397ec681f3Smrgvoid GLAPIENTRY
1407ec681f3Smrg_mesa_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name,
1417ec681f3Smrg                                           GLuint stream,
1427ec681f3Smrg                                           GLsizei primcount);
1437ec681f3Smrg
1447ec681f3Smrgvoid GLAPIENTRY
1457ec681f3Smrg_mesa_DrawArraysIndirect(GLenum mode, const GLvoid *indirect);
1467ec681f3Smrg
1477ec681f3Smrgvoid GLAPIENTRY
1487ec681f3Smrg_mesa_DrawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect);
14901e04c3fSmrg
1507ec681f3Smrgvoid GLAPIENTRY
1517ec681f3Smrg_mesa_MultiDrawArraysIndirect(GLenum mode, const GLvoid *indirect,
1527ec681f3Smrg                              GLsizei primcount, GLsizei stride);
1537ec681f3Smrg
1547ec681f3Smrgvoid GLAPIENTRY
1557ec681f3Smrg_mesa_MultiDrawElementsIndirect(GLenum mode, GLenum type,
1567ec681f3Smrg                                const GLvoid *indirect,
1577ec681f3Smrg                                GLsizei primcount, GLsizei stride);
1587ec681f3Smrg
1597ec681f3Smrgvoid GLAPIENTRY
1607ec681f3Smrg_mesa_MultiDrawArraysIndirectCountARB(GLenum mode, GLintptr indirect,
1617ec681f3Smrg                                      GLintptr drawcount_offset,
1627ec681f3Smrg                                      GLsizei maxdrawcount, GLsizei stride);
1637ec681f3Smrg
1647ec681f3Smrgvoid GLAPIENTRY
1657ec681f3Smrg_mesa_MultiDrawElementsIndirectCountARB(GLenum mode, GLenum type,
1667ec681f3Smrg                                        GLintptr indirect,
1677ec681f3Smrg                                        GLintptr drawcount_offset,
1687ec681f3Smrg                                        GLsizei maxdrawcount, GLsizei stride);
16901e04c3fSmrg
17001e04c3fSmrgvoid GLAPIENTRY
17101e04c3fSmrg_mesa_DrawArrays(GLenum mode, GLint first, GLsizei count);
17201e04c3fSmrg
17301e04c3fSmrg
17401e04c3fSmrgvoid GLAPIENTRY
1757ec681f3Smrg_mesa_DrawArraysInstancedARB(GLenum mode, GLint first, GLsizei count,
1767ec681f3Smrg                             GLsizei primcount);
17701e04c3fSmrg
1787ec681f3Smrgvoid GLAPIENTRY
1797ec681f3Smrg_mesa_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode,
1807ec681f3Smrg                                                  GLsizei count,
1817ec681f3Smrg                                                  GLenum type,
1827ec681f3Smrg                                                  const GLvoid *indices,
1837ec681f3Smrg                                                  GLsizei numInstances,
1847ec681f3Smrg                                                  GLint basevertex,
1857ec681f3Smrg                                                  GLuint baseInstance);
18601e04c3fSmrg
18701e04c3fSmrgvoid GLAPIENTRY
18801e04c3fSmrg_mesa_DrawElements(GLenum mode, GLsizei count, GLenum type,
18901e04c3fSmrg                   const GLvoid *indices);
19001e04c3fSmrg
19101e04c3fSmrg
19201e04c3fSmrgvoid GLAPIENTRY
19301e04c3fSmrg_mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count,
19401e04c3fSmrg                        GLenum type, const GLvoid *indices);
19501e04c3fSmrg
19601e04c3fSmrg
19701e04c3fSmrgvoid GLAPIENTRY
19801e04c3fSmrg_mesa_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
19901e04c3fSmrg                             const GLvoid *indices, GLint basevertex);
20001e04c3fSmrg
20101e04c3fSmrg
20201e04c3fSmrgvoid GLAPIENTRY
20301e04c3fSmrg_mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end,
20401e04c3fSmrg                                  GLsizei count, GLenum type,
20501e04c3fSmrg                                  const GLvoid *indices,
20601e04c3fSmrg                                  GLint basevertex);
20701e04c3fSmrg
20801e04c3fSmrg
20901e04c3fSmrgvoid GLAPIENTRY
21001e04c3fSmrg_mesa_DrawTransformFeedback(GLenum mode, GLuint name);
21101e04c3fSmrg
21201e04c3fSmrg
21301e04c3fSmrg
21401e04c3fSmrgvoid GLAPIENTRY
21501e04c3fSmrg_mesa_MultiDrawArrays(GLenum mode, const GLint *first,
21601e04c3fSmrg                      const GLsizei *count, GLsizei primcount);
21701e04c3fSmrg
21801e04c3fSmrg
21901e04c3fSmrgvoid GLAPIENTRY
2207ec681f3Smrg_mesa_MultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type,
2217ec681f3Smrg                           const GLvoid *const *indices, GLsizei primcount);
22201e04c3fSmrg
22301e04c3fSmrg
22401e04c3fSmrgvoid GLAPIENTRY
22501e04c3fSmrg_mesa_MultiDrawElementsBaseVertex(GLenum mode,
22601e04c3fSmrg                                  const GLsizei *count, GLenum type,
227a8bb7a65Smaya                                  const GLvoid * const * indices, GLsizei primcount,
22801e04c3fSmrg                                  const GLint *basevertex);
22901e04c3fSmrg
23001e04c3fSmrg
23101e04c3fSmrgvoid GLAPIENTRY
23201e04c3fSmrg_mesa_MultiModeDrawArraysIBM(const GLenum * mode, const GLint * first,
23301e04c3fSmrg                             const GLsizei * count,
23401e04c3fSmrg                             GLsizei primcount, GLint modestride);
23501e04c3fSmrg
23601e04c3fSmrg
23701e04c3fSmrgvoid GLAPIENTRY
23801e04c3fSmrg_mesa_MultiModeDrawElementsIBM(const GLenum * mode, const GLsizei * count,
23901e04c3fSmrg                               GLenum type, const GLvoid * const * indices,
24001e04c3fSmrg                               GLsizei primcount, GLint modestride);
24101e04c3fSmrg
2427ec681f3Smrgvoid GLAPIENTRY
2437ec681f3Smrg_mesa_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
2447ec681f3Smrg
2457ec681f3Smrgvoid GLAPIENTRY
2467ec681f3Smrg_mesa_Rectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
2477ec681f3Smrg
2487ec681f3Smrgvoid GLAPIENTRY
2497ec681f3Smrg_mesa_Rectdv(const GLdouble *v1, const GLdouble *v2);
2507ec681f3Smrg
2517ec681f3Smrgvoid GLAPIENTRY
2527ec681f3Smrg_mesa_Rectfv(const GLfloat *v1, const GLfloat *v2);
2537ec681f3Smrg
2547ec681f3Smrgvoid GLAPIENTRY
2557ec681f3Smrg_mesa_Recti(GLint x1, GLint y1, GLint x2, GLint y2);
2567ec681f3Smrg
2577ec681f3Smrgvoid GLAPIENTRY
2587ec681f3Smrg_mesa_Rectiv(const GLint *v1, const GLint *v2);
2597ec681f3Smrg
2607ec681f3Smrgvoid GLAPIENTRY
2617ec681f3Smrg_mesa_Rects(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
2627ec681f3Smrg
2637ec681f3Smrgvoid GLAPIENTRY
2647ec681f3Smrg_mesa_Rectsv(const GLshort *v1, const GLshort *v2);
26501e04c3fSmrg
26601e04c3fSmrg#ifdef __cplusplus
26701e04c3fSmrg} // extern "C"
26801e04c3fSmrg#endif
26901e04c3fSmrg
27001e04c3fSmrg#endif
271