|
|
@@ -43,86 +43,87 @@ |
|
|
|
/** |
|
|
|
* State descriptor for a single array of vertex data. |
|
|
|
*/ |
|
|
|
struct array_state { |
|
|
|
struct array_state |
|
|
|
{ |
|
|
|
/** |
|
|
|
* Pointer to the application supplied data. |
|
|
|
*/ |
|
|
|
const void * data; |
|
|
|
|
|
|
|
const void *data; |
|
|
|
|
|
|
|
/** |
|
|
|
* Enum representing the type of the application supplied data. |
|
|
|
*/ |
|
|
|
GLenum data_type; |
|
|
|
GLenum data_type; |
|
|
|
|
|
|
|
/** |
|
|
|
* Stride value supplied by the application. This value is not used |
|
|
|
* internally. It is only kept so that it can be queried by the |
|
|
|
* application using glGet*v. |
|
|
|
*/ |
|
|
|
GLsizei user_stride; |
|
|
|
GLsizei user_stride; |
|
|
|
|
|
|
|
/** |
|
|
|
* Calculated size, in bytes, of a single element in the array. This |
|
|
|
* is calculated based on \c count and the size of the data type |
|
|
|
* represented by \c data_type. |
|
|
|
*/ |
|
|
|
GLsizei element_size; |
|
|
|
GLsizei element_size; |
|
|
|
|
|
|
|
/** |
|
|
|
* Actual byte-stride from one element to the next. This value will |
|
|
|
* be equal to either \c user_stride or \c element_stride. |
|
|
|
*/ |
|
|
|
GLsizei true_stride; |
|
|
|
GLsizei true_stride; |
|
|
|
|
|
|
|
/** |
|
|
|
* Number of data values in each element. |
|
|
|
*/ |
|
|
|
GLint count; |
|
|
|
GLint count; |
|
|
|
|
|
|
|
/** |
|
|
|
* "Normalized" data is on the range [0,1] (unsigned) or [-1,1] (signed). |
|
|
|
* This is used for mapping integral types to floating point types. |
|
|
|
*/ |
|
|
|
GLboolean normalized; |
|
|
|
GLboolean normalized; |
|
|
|
|
|
|
|
/** |
|
|
|
* Pre-calculated GLX protocol command header. |
|
|
|
*/ |
|
|
|
uint32_t header[2]; |
|
|
|
|
|
|
|
uint32_t header[2]; |
|
|
|
|
|
|
|
/** |
|
|
|
* Size of the header data. For simple data, like glColorPointerfv, |
|
|
|
* this is 4. For complex data that requires either a count (e.g., |
|
|
|
* glWeightfvARB), an index (e.g., glVertexAttrib1fvARB), or a |
|
|
|
* selector enum (e.g., glMultiTexCoord2fv) this is 8. |
|
|
|
*/ |
|
|
|
unsigned header_size; |
|
|
|
|
|
|
|
unsigned header_size; |
|
|
|
|
|
|
|
/** |
|
|
|
* Set to \c GL_TRUE if this array is enabled. Otherwise, it is set |
|
|
|
* to \c GL_FALSE. |
|
|
|
*/ |
|
|
|
GLboolean enabled; |
|
|
|
GLboolean enabled; |
|
|
|
|
|
|
|
/** |
|
|
|
* For multi-arrayed data (e.g., texture coordinates, generic vertex |
|
|
|
* program attributes, etc.), this specifies which array this is. |
|
|
|
*/ |
|
|
|
unsigned index; |
|
|
|
|
|
|
|
unsigned index; |
|
|
|
|
|
|
|
/** |
|
|
|
* Per-array-type key. For most arrays, this will be the GL enum for |
|
|
|
* that array (e.g., GL_VERTEX_ARRAY for vertex data, GL_NORMAL_ARRAY |
|
|
|
* for normal data, GL_TEXTURE_COORD_ARRAY for texture coordinate data, |
|
|
|
* etc.). |
|
|
|
*/ |
|
|
|
GLenum key; |
|
|
|
GLenum key; |
|
|
|
|
|
|
|
/** |
|
|
|
* If this array can be used with the "classic" \c glDrawArrays protocol, |
|
|
|
* this is set to \c GL_TRUE. Otherwise, it is set to \c GL_FALSE. |
|
|
|
*/ |
|
|
|
GLboolean old_DrawArrays_possible; |
|
|
|
GLboolean old_DrawArrays_possible; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@@ -130,28 +131,29 @@ struct array_state { |
|
|
|
* Array state that is pushed / poped by \c glPushClientAttrib and |
|
|
|
* \c glPopClientAttrib. |
|
|
|
*/ |
|
|
|
struct array_stack_state { |
|
|
|
struct array_stack_state |
|
|
|
{ |
|
|
|
/** |
|
|
|
* Pointer to the application supplied data. |
|
|
|
*/ |
|
|
|
const void * data; |
|
|
|
|
|
|
|
const void *data; |
|
|
|
|
|
|
|
/** |
|
|
|
* Enum representing the type of the application supplied data. |
|
|
|
*/ |
|
|
|
GLenum data_type; |
|
|
|
GLenum data_type; |
|
|
|
|
|
|
|
/** |
|
|
|
* Stride value supplied by the application. This value is not used |
|
|
|
* internally. It is only kept so that it can be queried by the |
|
|
|
* application using glGet*v. |
|
|
|
*/ |
|
|
|
GLsizei user_stride; |
|
|
|
GLsizei user_stride; |
|
|
|
|
|
|
|
/** |
|
|
|
* Number of data values in each element. |
|
|
|
*/ |
|
|
|
GLint count; |
|
|
|
GLint count; |
|
|
|
|
|
|
|
/** |
|
|
|
* Per-array-type key. For most arrays, this will be the GL enum for |
|
|
@@ -159,30 +161,31 @@ struct array_stack_state { |
|
|
|
* for normal data, GL_TEXTURE_COORD_ARRAY for texture coordinate data, |
|
|
|
* etc.). |
|
|
|
*/ |
|
|
|
GLenum key; |
|
|
|
GLenum key; |
|
|
|
|
|
|
|
/** |
|
|
|
* For multi-arrayed data (e.g., texture coordinates, generic vertex |
|
|
|
* program attributes, etc.), this specifies which array this is. |
|
|
|
*/ |
|
|
|
unsigned index; |
|
|
|
unsigned index; |
|
|
|
|
|
|
|
/** |
|
|
|
* Set to \c GL_TRUE if this array is enabled. Otherwise, it is set |
|
|
|
* to \c GL_FALSE. |
|
|
|
*/ |
|
|
|
GLboolean enabled; |
|
|
|
GLboolean enabled; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Collection of all the vertex array state. |
|
|
|
*/ |
|
|
|
struct array_state_vector { |
|
|
|
struct array_state_vector |
|
|
|
{ |
|
|
|
/** |
|
|
|
* Number of arrays tracked by \c ::arrays. |
|
|
|
*/ |
|
|
|
size_t num_arrays; |
|
|
|
size_t num_arrays; |
|
|
|
|
|
|
|
/** |
|
|
|
* Array of vertex array state. This array contains all of the valid |
|
|
@@ -191,13 +194,13 @@ struct array_state_vector { |
|
|
|
* EXT_fog_coord, there won't be a GL_FOG_COORD_ARRAY entry in this |
|
|
|
* array. |
|
|
|
*/ |
|
|
|
struct array_state * arrays; |
|
|
|
struct array_state *arrays; |
|
|
|
|
|
|
|
/** |
|
|
|
* Number of currently enabled client-side arrays. The value of this |
|
|
|
* field is only valid if \c array_info_cache_valid is true. |
|
|
|
*/ |
|
|
|
size_t enabled_client_array_count; |
|
|
|
size_t enabled_client_array_count; |
|
|
|
|
|
|
|
/** |
|
|
|
* \name ARRAY_INFO cache. |
|
|
@@ -215,12 +218,12 @@ struct array_state_vector { |
|
|
|
* \c array_info_cache_buffer_size. \c array_info_cache_base stores a |
|
|
|
* pointer to the true start of the buffer (i.e., what malloc returned). |
|
|
|
*/ |
|
|
|
/*@{*/ |
|
|
|
size_t array_info_cache_size; |
|
|
|
size_t array_info_cache_buffer_size; |
|
|
|
void * array_info_cache; |
|
|
|
void * array_info_cache_base; |
|
|
|
/*@}*/ |
|
|
|
/*@{ */ |
|
|
|
size_t array_info_cache_size; |
|
|
|
size_t array_info_cache_buffer_size; |
|
|
|
void *array_info_cache; |
|
|
|
void *array_info_cache_base; |
|
|
|
/*@} */ |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
@@ -229,7 +232,7 @@ struct array_state_vector { |
|
|
|
* modifying the array settings for an enabled array and enabling / |
|
|
|
* disabling an array. |
|
|
|
*/ |
|
|
|
GLboolean array_info_cache_valid; |
|
|
|
GLboolean array_info_cache_valid; |
|
|
|
|
|
|
|
/** |
|
|
|
* Is it possible to use the GL 1.1 / EXT_vertex_arrays protocol? Use |
|
|
@@ -242,7 +245,7 @@ struct array_state_vector { |
|
|
|
* opcodes for \c glDrawArrays. For servers that advertise one or the |
|
|
|
* other, there should be a way to select which opcode to use. |
|
|
|
*/ |
|
|
|
GLboolean old_DrawArrays_possible; |
|
|
|
GLboolean old_DrawArrays_possible; |
|
|
|
|
|
|
|
/** |
|
|
|
* Is it possible to use the new GL X.X / ARB_vertex_buffer_object |
|
|
@@ -252,15 +255,15 @@ struct array_state_vector { |
|
|
|
* This protocol has not yet been defined by the ARB, but is currently a |
|
|
|
* work in progress. This field is a place-holder. |
|
|
|
*/ |
|
|
|
GLboolean new_DrawArrays_possible; |
|
|
|
GLboolean new_DrawArrays_possible; |
|
|
|
|
|
|
|
/** |
|
|
|
* Active texture unit set by \c glClientActiveTexture. |
|
|
|
* |
|
|
|
* \sa __glXGetActiveTextureUnit |
|
|
|
*/ |
|
|
|
unsigned active_texture_unit; |
|
|
|
|
|
|
|
unsigned active_texture_unit; |
|
|
|
|
|
|
|
/** |
|
|
|
* Number of supported texture units. Even if ARB_multitexture / |
|
|
|
* GL 1.3 are not supported, this will be at least 1. When multitexture |
|
|
@@ -272,7 +275,7 @@ struct array_state_vector { |
|
|
|
* instead (if GL 2.0 / ARB_fragment_shader / ARB_fragment_program / |
|
|
|
* NV_fragment_program are supported). |
|
|
|
*/ |
|
|
|
unsigned num_texture_units; |
|
|
|
unsigned num_texture_units; |
|
|
|
|
|
|
|
/** |
|
|
|
* Number of generic vertex program attribs. If GL_ARB_vertex_program |
|
|
@@ -280,7 +283,7 @@ struct array_state_vector { |
|
|
|
* queries by calling \c glGetProgramiv with \c GL_VERTEX_PROGRAM_ARB |
|
|
|
* and \c GL_MAX_PROGRAM_ATTRIBS_ARB. |
|
|
|
*/ |
|
|
|
unsigned num_vertex_program_attribs; |
|
|
|
unsigned num_vertex_program_attribs; |
|
|
|
|
|
|
|
/** |
|
|
|
* \n Methods for implementing various GL functions. |
|
|
@@ -295,15 +298,15 @@ struct array_state_vector { |
|
|
|
* \todo |
|
|
|
* Write code to plug these functions directly into the dispatch table. |
|
|
|
*/ |
|
|
|
/*@{*/ |
|
|
|
void (*DrawArrays)( GLenum, GLint, GLsizei ); |
|
|
|
void (*DrawElements)( GLenum mode, GLsizei count, GLenum type, |
|
|
|
const GLvoid *indices ); |
|
|
|
/*@}*/ |
|
|
|
|
|
|
|
struct array_stack_state * stack; |
|
|
|
unsigned active_texture_unit_stack[ __GL_CLIENT_ATTRIB_STACK_DEPTH ]; |
|
|
|
unsigned stack_index; |
|
|
|
/*@{ */ |
|
|
|
void (*DrawArrays) (GLenum, GLint, GLsizei); |
|
|
|
void (*DrawElements) (GLenum mode, GLsizei count, GLenum type, |
|
|
|
const GLvoid * indices); |
|
|
|
/*@} */ |
|
|
|
|
|
|
|
struct array_stack_state *stack; |
|
|
|
unsigned active_texture_unit_stack[__GL_CLIENT_ATTRIB_STACK_DEPTH]; |
|
|
|
unsigned stack_index; |
|
|
|
}; |
|
|
|
|
|
|
|
#endif /* _INDIRECT_VA_PRIVATE_ */ |