1ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick/*
2ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick * Mesa 3-D graphics library
3de1cfc5e8a8e9d0b0b397671575ae448a554a002Brian Paul * Version:  7.6
4ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick *
5ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick * Copyright (C) 1999-2004  Brian Paul   All Rights Reserved.
6ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick * (C) Copyright IBM Corporation 2006
7de1cfc5e8a8e9d0b0b397671575ae448a554a002Brian Paul * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
8ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick *
9ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick * Permission is hereby granted, free of charge, to any person obtaining a
10ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick * copy of this software and associated documentation files (the "Software"),
11ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick * to deal in the Software without restriction, including without limitation
12ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick * and/or sell copies of the Software, and to permit persons to whom the
14ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick * Software is furnished to do so, subject to the following conditions:
15ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick *
16ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick * The above copyright notice and this permission notice shall be included
17ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick * in all copies or substantial portions of the Software.
18ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick *
19ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
22ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick * BRIAN PAUL OR IBM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick * SOFTWARE.
26ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick */
27ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick
28ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick#ifndef ARRAYOBJ_H
29ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick#define ARRAYOBJ_H
30ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick
313a223c3098ed6ae7d2c0dfcea6d1eee62bea3cc8Vinson Lee#include "glheader.h"
322a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich#include "mtypes.h"
33a1287f549a3e6527b8cf3bf5b5f563ba63c6f48cBrian Paul#include "glformats.h"
343a223c3098ed6ae7d2c0dfcea6d1eee62bea3cc8Vinson Lee
353a223c3098ed6ae7d2c0dfcea6d1eee62bea3cc8Vinson Leestruct gl_context;
36ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick
37ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick/**
38ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick * \file arrayobj.h
39ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick * Functions for the GL_APPLE_vertex_array_object extension.
40ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick *
41ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick * \author Ian Romanick <idr@us.ibm.com>
42ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick * \author Brian Paul
43ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick */
44ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick
45ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick/*
46ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick * Internal functions
47ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick */
48ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick
491030bf0ded2a88a5e27f7a4d393c11cfde3d3c5aBrian Paulextern struct gl_array_object *
50f9995b30756140724f41daf963fa06167912be7fKristian Høgsberg_mesa_new_array_object( struct gl_context *ctx, GLuint name );
51ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick
521030bf0ded2a88a5e27f7a4d393c11cfde3d3c5aBrian Paulextern void
53f9995b30756140724f41daf963fa06167912be7fKristian Høgsberg_mesa_delete_array_object( struct gl_context *ctx, struct gl_array_object *obj );
54ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick
551030bf0ded2a88a5e27f7a4d393c11cfde3d3c5aBrian Paulextern void
568459f4a63aec97847b0e3957ffb82beff94035faBrian Paul_mesa_reference_array_object_(struct gl_context *ctx,
578459f4a63aec97847b0e3957ffb82beff94035faBrian Paul                              struct gl_array_object **ptr,
588459f4a63aec97847b0e3957ffb82beff94035faBrian Paul                              struct gl_array_object *arrayObj);
598459f4a63aec97847b0e3957ffb82beff94035faBrian Paul
608459f4a63aec97847b0e3957ffb82beff94035faBrian Paulstatic inline void
61f9995b30756140724f41daf963fa06167912be7fKristian Høgsberg_mesa_reference_array_object(struct gl_context *ctx,
621030bf0ded2a88a5e27f7a4d393c11cfde3d3c5aBrian Paul                             struct gl_array_object **ptr,
638459f4a63aec97847b0e3957ffb82beff94035faBrian Paul                             struct gl_array_object *arrayObj)
648459f4a63aec97847b0e3957ffb82beff94035faBrian Paul{
658459f4a63aec97847b0e3957ffb82beff94035faBrian Paul   if (*ptr != arrayObj)
668459f4a63aec97847b0e3957ffb82beff94035faBrian Paul      _mesa_reference_array_object_(ctx, ptr, arrayObj);
678459f4a63aec97847b0e3957ffb82beff94035faBrian Paul}
688459f4a63aec97847b0e3957ffb82beff94035faBrian Paul
69ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick
701030bf0ded2a88a5e27f7a4d393c11cfde3d3c5aBrian Paulextern void
71f9995b30756140724f41daf963fa06167912be7fKristian Høgsberg_mesa_initialize_array_object( struct gl_context *ctx,
721030bf0ded2a88a5e27f7a4d393c11cfde3d3c5aBrian Paul                               struct gl_array_object *obj, GLuint name );
73ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick
74ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick
75de1cfc5e8a8e9d0b0b397671575ae448a554a002Brian Paulextern void
76f9995b30756140724f41daf963fa06167912be7fKristian Høgsberg_mesa_update_array_object_max_element(struct gl_context *ctx,
77de1cfc5e8a8e9d0b0b397671575ae448a554a002Brian Paul                                      struct gl_array_object *arrayObj);
78de1cfc5e8a8e9d0b0b397671575ae448a554a002Brian Paul
792a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich/** Returns the bitmask of all enabled arrays in fixed function mode.
802a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich *
812a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich *  In fixed function mode only the traditional fixed function arrays
822a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich *  are available.
832a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich */
842a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlichstatic inline GLbitfield64
852a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich_mesa_array_object_get_enabled_ff(const struct gl_array_object *arrayObj)
862a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich{
872a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich   return arrayObj->_Enabled & VERT_BIT_FF_ALL;
882a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich}
892a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich
902a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich/** Returns the bitmask of all enabled arrays in nv shader mode.
912a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich *
922a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich *  In nv shader mode, the nv generic arrays take precedence over
932a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich *  the legacy arrays.
942a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich */
952a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlichstatic inline GLbitfield64
962a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich_mesa_array_object_get_enabled_nv(const struct gl_array_object *arrayObj)
972a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich{
982a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich   GLbitfield64 enabled = arrayObj->_Enabled;
992a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich   return enabled & ~(VERT_BIT_FF_NVALIAS & (enabled >> VERT_ATTRIB_GENERIC0));
1002a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich}
1012a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich
1022a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich/** Returns the bitmask of all enabled arrays in arb/glsl shader mode.
1032a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich *
1042a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich *  In arb/glsl shader mode all the fixed function and the arb/glsl generic
1052a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich *  arrays are available. Only the first generic array takes
1062a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich *  precedence over the legacy position array.
1072a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich */
1082a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlichstatic inline GLbitfield64
1092a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich_mesa_array_object_get_enabled_arb(const struct gl_array_object *arrayObj)
1102a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich{
1112a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich   GLbitfield64 enabled = arrayObj->_Enabled;
1122a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich   return enabled & ~(VERT_BIT_POS & (enabled >> VERT_ATTRIB_GENERIC0));
1132a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich}
1142a207c4bf95312b68093280b97229cc4316f5724Mathias Froehlich
115ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick
116ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick/*
117ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick * API functions
118ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick */
119ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick
120b8000c874ecb33b1554407c5e568afbb471dda3aBrian Paul
121b8000c874ecb33b1554407c5e568afbb471dda3aBrian Paulvoid GLAPIENTRY _mesa_BindVertexArray( GLuint id );
122b8000c874ecb33b1554407c5e568afbb471dda3aBrian Paul
123ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanickvoid GLAPIENTRY _mesa_BindVertexArrayAPPLE( GLuint id );
124ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick
125ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanickvoid GLAPIENTRY _mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids);
126ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick
1279342e6f5a94d3b884dcb98b4741295f1aa23e282Brian Paulvoid GLAPIENTRY _mesa_GenVertexArrays(GLsizei n, GLuint *arrays);
1289342e6f5a94d3b884dcb98b4741295f1aa23e282Brian Paul
129ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanickvoid GLAPIENTRY _mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *buffer);
130ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick
131ee34e6ef716bb630440299ac1efbc2055ef09ffdIan RomanickGLboolean GLAPIENTRY _mesa_IsVertexArrayAPPLE( GLuint id );
132ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick
133ee34e6ef716bb630440299ac1efbc2055ef09ffdIan Romanick#endif /* ARRAYOBJ_H */
134