717c7916e3a0515e42ce54244f17bcc9062c92c3
[mesa.git] / src / mesa / main / arrayobj.h
1 /*
2 * Mesa 3-D graphics library
3 * Version: 7.6
4 *
5 * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
6 * (C) Copyright IBM Corporation 2006
7 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL OR IBM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * SOFTWARE.
26 */
27
28 #ifndef ARRAYOBJ_H
29 #define ARRAYOBJ_H
30
31 #include "glheader.h"
32 #include "mtypes.h"
33
34 struct gl_context;
35
36 /**
37 * \file arrayobj.h
38 * Functions for the GL_APPLE_vertex_array_object extension.
39 *
40 * \author Ian Romanick <idr@us.ibm.com>
41 * \author Brian Paul
42 */
43
44 /*
45 * Internal functions
46 */
47
48 extern struct gl_array_object *
49 _mesa_new_array_object( struct gl_context *ctx, GLuint name );
50
51 extern void
52 _mesa_delete_array_object( struct gl_context *ctx, struct gl_array_object *obj );
53
54 extern void
55 _mesa_reference_array_object(struct gl_context *ctx,
56 struct gl_array_object **ptr,
57 struct gl_array_object *arrayObj);
58
59 extern void
60 _mesa_initialize_array_object( struct gl_context *ctx,
61 struct gl_array_object *obj, GLuint name );
62
63
64 extern void
65 _mesa_update_array_object_max_element(struct gl_context *ctx,
66 struct gl_array_object *arrayObj);
67
68 /** Returns the bitmask of all enabled arrays in fixed function mode.
69 *
70 * In fixed function mode only the traditional fixed function arrays
71 * are available.
72 */
73 static inline GLbitfield64
74 _mesa_array_object_get_enabled_ff(const struct gl_array_object *arrayObj)
75 {
76 return arrayObj->_Enabled & VERT_BIT_FF_ALL;
77 }
78
79 /** Returns the bitmask of all enabled arrays in nv shader mode.
80 *
81 * In nv shader mode, the nv generic arrays take precedence over
82 * the legacy arrays.
83 */
84 static inline GLbitfield64
85 _mesa_array_object_get_enabled_nv(const struct gl_array_object *arrayObj)
86 {
87 GLbitfield64 enabled = arrayObj->_Enabled;
88 return enabled & ~(VERT_BIT_FF_NVALIAS & (enabled >> VERT_ATTRIB_GENERIC0));
89 }
90
91 /** Returns the bitmask of all enabled arrays in arb/glsl shader mode.
92 *
93 * In arb/glsl shader mode all the fixed function and the arb/glsl generic
94 * arrays are available. Only the first generic array takes
95 * precedence over the legacy position array.
96 */
97 static inline GLbitfield64
98 _mesa_array_object_get_enabled_arb(const struct gl_array_object *arrayObj)
99 {
100 GLbitfield64 enabled = arrayObj->_Enabled;
101 return enabled & ~(VERT_BIT_POS & (enabled >> VERT_ATTRIB_GENERIC0));
102 }
103
104
105 /*
106 * API functions
107 */
108
109
110 void GLAPIENTRY _mesa_BindVertexArray( GLuint id );
111
112 void GLAPIENTRY _mesa_BindVertexArrayAPPLE( GLuint id );
113
114 void GLAPIENTRY _mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids);
115
116 void GLAPIENTRY _mesa_GenVertexArrays(GLsizei n, GLuint *arrays);
117
118 void GLAPIENTRY _mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *buffer);
119
120 GLboolean GLAPIENTRY _mesa_IsVertexArrayAPPLE( GLuint id );
121
122 #endif /* ARRAYOBJ_H */