arrayobj.h revision af69d88d
17117f1b4Smrg/*
27117f1b4Smrg * Mesa 3-D graphics library
37117f1b4Smrg *
47117f1b4Smrg * Copyright (C) 1999-2004  Brian Paul   All Rights Reserved.
57117f1b4Smrg * (C) Copyright IBM Corporation 2006
64a49301eSmrg * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
77117f1b4Smrg *
87117f1b4Smrg * Permission is hereby granted, free of charge, to any person obtaining a
97117f1b4Smrg * copy of this software and associated documentation files (the "Software"),
107117f1b4Smrg * to deal in the Software without restriction, including without limitation
117117f1b4Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
127117f1b4Smrg * and/or sell copies of the Software, and to permit persons to whom the
137117f1b4Smrg * Software is furnished to do so, subject to the following conditions:
147117f1b4Smrg *
157117f1b4Smrg * The above copyright notice and this permission notice shall be included
167117f1b4Smrg * in all copies or substantial portions of the Software.
177117f1b4Smrg *
187117f1b4Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
197117f1b4Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
207117f1b4Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
21af69d88dSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
22af69d88dSmrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23af69d88dSmrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24af69d88dSmrg * OTHER DEALINGS IN THE SOFTWARE.
257117f1b4Smrg */
267117f1b4Smrg
277117f1b4Smrg#ifndef ARRAYOBJ_H
287117f1b4Smrg#define ARRAYOBJ_H
297117f1b4Smrg
303464ebd5Sriastradh#include "glheader.h"
31af69d88dSmrg#include "mtypes.h"
32af69d88dSmrg#include "glformats.h"
333464ebd5Sriastradh
343464ebd5Sriastradhstruct gl_context;
357117f1b4Smrg
367117f1b4Smrg/**
377117f1b4Smrg * \file arrayobj.h
387117f1b4Smrg * Functions for the GL_APPLE_vertex_array_object extension.
397117f1b4Smrg *
407117f1b4Smrg * \author Ian Romanick <idr@us.ibm.com>
417117f1b4Smrg * \author Brian Paul
427117f1b4Smrg */
437117f1b4Smrg
447117f1b4Smrg/*
457117f1b4Smrg * Internal functions
467117f1b4Smrg */
477117f1b4Smrg
48af69d88dSmrgextern struct gl_vertex_array_object *
49af69d88dSmrg_mesa_lookup_vao(struct gl_context *ctx, GLuint id);
50af69d88dSmrg
51af69d88dSmrgextern struct gl_vertex_array_object *
52af69d88dSmrg_mesa_new_vao(struct gl_context *ctx, GLuint name);
537117f1b4Smrg
544a49301eSmrgextern void
55af69d88dSmrg_mesa_delete_vao(struct gl_context *ctx, struct gl_vertex_array_object *obj);
567117f1b4Smrg
574a49301eSmrgextern void
58af69d88dSmrg_mesa_reference_vao_(struct gl_context *ctx,
59af69d88dSmrg                     struct gl_vertex_array_object **ptr,
60af69d88dSmrg                     struct gl_vertex_array_object *vao);
61af69d88dSmrg
62af69d88dSmrgstatic inline void
63af69d88dSmrg_mesa_reference_vao(struct gl_context *ctx,
64af69d88dSmrg                    struct gl_vertex_array_object **ptr,
65af69d88dSmrg                    struct gl_vertex_array_object *vao)
66af69d88dSmrg{
67af69d88dSmrg   if (*ptr != vao)
68af69d88dSmrg      _mesa_reference_vao_(ctx, ptr, vao);
69af69d88dSmrg}
70af69d88dSmrg
717117f1b4Smrg
724a49301eSmrgextern void
73af69d88dSmrg_mesa_initialize_vao(struct gl_context *ctx,
74af69d88dSmrg                     struct gl_vertex_array_object *obj, GLuint name);
757117f1b4Smrg
767117f1b4Smrg
774a49301eSmrgextern void
78af69d88dSmrg_mesa_update_vao_max_element(struct gl_context *ctx,
79af69d88dSmrg                             struct gl_vertex_array_object *vao);
80af69d88dSmrg
81af69d88dSmrgextern void
82af69d88dSmrg_mesa_update_vao_client_arrays(struct gl_context *ctx,
83af69d88dSmrg                               struct gl_vertex_array_object *vao);
84af69d88dSmrg
85af69d88dSmrg
86af69d88dSmrg/** Returns the bitmask of all enabled arrays in fixed function mode.
87af69d88dSmrg *
88af69d88dSmrg *  In fixed function mode only the traditional fixed function arrays
89af69d88dSmrg *  are available.
90af69d88dSmrg */
91af69d88dSmrgstatic inline GLbitfield64
92af69d88dSmrg_mesa_array_object_get_enabled_ff(const struct gl_vertex_array_object *vao)
93af69d88dSmrg{
94af69d88dSmrg   return vao->_Enabled & VERT_BIT_FF_ALL;
95af69d88dSmrg}
96af69d88dSmrg
97af69d88dSmrg/** Returns the bitmask of all enabled arrays in arb/glsl shader mode.
98af69d88dSmrg *
99af69d88dSmrg *  In arb/glsl shader mode all the fixed function and the arb/glsl generic
100af69d88dSmrg *  arrays are available. Only the first generic array takes
101af69d88dSmrg *  precedence over the legacy position array.
102af69d88dSmrg */
103af69d88dSmrgstatic inline GLbitfield64
104af69d88dSmrg_mesa_array_object_get_enabled_arb(const struct gl_vertex_array_object *vao)
105af69d88dSmrg{
106af69d88dSmrg   GLbitfield64 enabled = vao->_Enabled;
107af69d88dSmrg   return enabled & ~(VERT_BIT_POS & (enabled >> VERT_ATTRIB_GENERIC0));
108af69d88dSmrg}
1097117f1b4Smrg
1107117f1b4Smrg
1117117f1b4Smrg/*
1127117f1b4Smrg * API functions
1137117f1b4Smrg */
1147117f1b4Smrg
1154a49301eSmrg
1164a49301eSmrgvoid GLAPIENTRY _mesa_BindVertexArray( GLuint id );
1174a49301eSmrg
1187117f1b4Smrgvoid GLAPIENTRY _mesa_BindVertexArrayAPPLE( GLuint id );
1197117f1b4Smrg
120af69d88dSmrgvoid GLAPIENTRY _mesa_DeleteVertexArrays(GLsizei n, const GLuint *ids);
1217117f1b4Smrg
1224a49301eSmrgvoid GLAPIENTRY _mesa_GenVertexArrays(GLsizei n, GLuint *arrays);
1234a49301eSmrg
1247117f1b4Smrgvoid GLAPIENTRY _mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *buffer);
1257117f1b4Smrg
126af69d88dSmrgGLboolean GLAPIENTRY _mesa_IsVertexArray( GLuint id );
1277117f1b4Smrg
1287117f1b4Smrg#endif /* ARRAYOBJ_H */
129