2 * (C) Copyright IBM Corporation 2004, 2005
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sub license,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
20 * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
22 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 #ifndef _INDIRECT_VA_PRIVATE_
27 #define _INDIRECT_VA_PRIVATE_
30 * \file indirect_va_private.h
32 * \author Ian Romanick <idr@us.ibm.com>
37 #include "glxclient.h"
39 #include <GL/glxproto.h>
43 * State descriptor for a single array of vertex data.
48 * Pointer to the application supplied data.
53 * Enum representing the type of the application supplied data.
58 * Stride value supplied by the application. This value is not used
59 * internally. It is only kept so that it can be queried by the
60 * application using glGet*v.
65 * Calculated size, in bytes, of a single element in the array. This
66 * is calculated based on \c count and the size of the data type
67 * represented by \c data_type.
72 * Actual byte-stride from one element to the next. This value will
73 * be equal to either \c user_stride or \c element_stride.
78 * Number of data values in each element.
83 * "Normalized" data is on the range [0,1] (unsigned) or [-1,1] (signed).
84 * This is used for mapping integral types to floating point types.
89 * Pre-calculated GLX protocol command header.
94 * Size of the header data. For simple data, like glColorPointerfv,
95 * this is 4. For complex data that requires either a count (e.g.,
96 * glWeightfvARB), an index (e.g., glVertexAttrib1fvARB), or a
97 * selector enum (e.g., glMultiTexCoord2fv) this is 8.
102 * Set to \c GL_TRUE if this array is enabled. Otherwise, it is set
108 * For multi-arrayed data (e.g., texture coordinates, generic vertex
109 * program attributes, etc.), this specifies which array this is.
114 * Per-array-type key. For most arrays, this will be the GL enum for
115 * that array (e.g., GL_VERTEX_ARRAY for vertex data, GL_NORMAL_ARRAY
116 * for normal data, GL_TEXTURE_COORD_ARRAY for texture coordinate data,
122 * If this array can be used with the "classic" \c glDrawArrays protocol,
123 * this is set to \c GL_TRUE. Otherwise, it is set to \c GL_FALSE.
125 GLboolean old_DrawArrays_possible;
130 * Array state that is pushed / poped by \c glPushClientAttrib and
131 * \c glPopClientAttrib.
133 struct array_stack_state
136 * Pointer to the application supplied data.
141 * Enum representing the type of the application supplied data.
146 * Stride value supplied by the application. This value is not used
147 * internally. It is only kept so that it can be queried by the
148 * application using glGet*v.
153 * Number of data values in each element.
158 * Per-array-type key. For most arrays, this will be the GL enum for
159 * that array (e.g., GL_VERTEX_ARRAY for vertex data, GL_NORMAL_ARRAY
160 * for normal data, GL_TEXTURE_COORD_ARRAY for texture coordinate data,
166 * For multi-arrayed data (e.g., texture coordinates, generic vertex
167 * program attributes, etc.), this specifies which array this is.
172 * Set to \c GL_TRUE if this array is enabled. Otherwise, it is set
180 * Collection of all the vertex array state.
182 struct array_state_vector
185 * Number of arrays tracked by \c ::arrays.
190 * Array of vertex array state. This array contains all of the valid
191 * vertex arrays. If a vertex array isn't in this array, then it isn't
192 * valid. For example, if an implementation does not support
193 * EXT_fog_coord, there won't be a GL_FOG_COORD_ARRAY entry in this
196 struct array_state *arrays;
199 * Number of currently enabled client-side arrays. The value of this
200 * field is only valid if \c array_info_cache_valid is true.
202 size_t enabled_client_array_count;
205 * \name ARRAY_INFO cache.
207 * These fields track the state of the ARRAY_INFO cache. The
208 * \c array_info_cache_size is the size of the actual data stored in
209 * \c array_info_cache. \c array_info_cache_buffer_size is the size of
210 * the buffer. This will always be greater than or equal to
211 * \c array_info_cache_size.
214 * There are some bytes of extra data before \c array_info_cache that is
215 * used to hold the header for RenderLarge commands. This is
216 * \b not included in \c array_info_cache_size or
217 * \c array_info_cache_buffer_size. \c array_info_cache_base stores a
218 * pointer to the true start of the buffer (i.e., what malloc returned).
221 size_t array_info_cache_size;
222 size_t array_info_cache_buffer_size;
223 void *array_info_cache;
224 void *array_info_cache_base;
229 * Is the cache of ARRAY_INFO data valid? The cache can become invalid
230 * when one of several state changes occur. Among these chages are
231 * modifying the array settings for an enabled array and enabling /
232 * disabling an array.
234 GLboolean array_info_cache_valid;
237 * Is it possible to use the GL 1.1 / EXT_vertex_arrays protocol? Use
238 * of this protocol is disabled with really old servers (i.e., servers
239 * that don't support GL 1.1 or EXT_vertex_arrays) or when an environment
243 * GL 1.1 and EXT_vertex_arrays use identical protocol, but have different
244 * opcodes for \c glDrawArrays. For servers that advertise one or the
245 * other, there should be a way to select which opcode to use.
247 GLboolean old_DrawArrays_possible;
250 * Is it possible to use the new GL X.X / ARB_vertex_buffer_object
254 * This protocol has not yet been defined by the ARB, but is currently a
255 * work in progress. This field is a place-holder.
257 GLboolean new_DrawArrays_possible;
260 * Active texture unit set by \c glClientActiveTexture.
262 * \sa __glXGetActiveTextureUnit
264 unsigned active_texture_unit;
267 * Number of supported texture units. Even if ARB_multitexture /
268 * GL 1.3 are not supported, this will be at least 1. When multitexture
269 * is supported, this will be the value queried by calling
270 * \c glGetIntegerv with \c GL_MAX_TEXTURE_UNITS.
273 * Investigate if this should be the value of \c GL_MAX_TEXTURE_COORDS
274 * instead (if GL 2.0 / ARB_fragment_shader / ARB_fragment_program /
275 * NV_fragment_program are supported).
277 unsigned num_texture_units;
280 * Number of generic vertex program attribs. If GL_ARB_vertex_program
281 * is not supported, this will be zero. Otherwise it will be the value
282 * queries by calling \c glGetProgramiv with \c GL_VERTEX_PROGRAM_ARB
283 * and \c GL_MAX_PROGRAM_ATTRIBS_ARB.
285 unsigned num_vertex_program_attribs;
288 * \n Methods for implementing various GL functions.
290 * These method pointers are only valid \c array_info_cache_valid is set.
291 * When each function starts, it much check \c array_info_cache_valid.
292 * If it is not set, it must call \c fill_array_info_cache and call
295 * \sa fill_array_info_cache
298 * Write code to plug these functions directly into the dispatch table.
301 void (*DrawArrays) (GLenum, GLint, GLsizei);
302 void (*DrawElements) (GLenum mode, GLsizei count, GLenum type,
303 const GLvoid * indices);
306 struct array_stack_state *stack;
307 unsigned active_texture_unit_stack[__GL_CLIENT_ATTRIB_STACK_DEPTH];
308 unsigned stack_index;
311 #endif /* _INDIRECT_VA_PRIVATE_ */