diff options
author | Ian Romanick <[email protected]> | 2005-02-22 22:36:31 +0000 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2005-02-22 22:36:31 +0000 |
commit | fdb07636f2e6324c5250cd5ee97778b7f5933bea (patch) | |
tree | 7914282adbac014b4d48b8ab78c03c73b6a72052 /src/glx/x11/clientattrib.c | |
parent | cb83f62e307be90532fcc58a0e5dd3e8cc7411b2 (diff) |
Added __glExtensionBiIsEnabled and __GLXcontext::gl_extension_bits. This
enables libGL to query which extension are exported to applications.
Refactored array-query functionality (from glGet*v) in src/glx/x11/single2.c.
Massive re-write of indirect vertex array support. The most noticable
effect is that glDrawElements now generates DrawArrays protocol. The
side-effects (and the main reasons for the re-work) are that it is much
easier to add support for new arrays (e.g., GL_VERTEX_ATTRIB_ARRAY,
GL_WEIGHT_ARRAY_ARB, etc.) and it is much easier to add support for the new
DrawArrays protocol (required to support ARB_vertex_buffer_object).
These changes were primarilly tested with progs/demos/isosurf.
Diffstat (limited to 'src/glx/x11/clientattrib.c')
-rw-r--r-- | src/glx/x11/clientattrib.c | 81 |
1 files changed, 18 insertions, 63 deletions
diff --git a/src/glx/x11/clientattrib.c b/src/glx/x11/clientattrib.c index 298978fc0b6..9cfb3c9c39f 100644 --- a/src/glx/x11/clientattrib.c +++ b/src/glx/x11/clientattrib.c @@ -36,77 +36,34 @@ #include <assert.h> #include "glxclient.h" +#include "indirect_vertex_array.h" /*****************************************************************************/ -void __indirect_glEnableClientState(GLenum array) +static void +do_enable_disable(GLenum array, GLboolean val ) { __GLXcontext *gc = __glXGetCurrentContext(); __GLXattribute * state = (__GLXattribute *)(gc->client_state_private); + unsigned index = 0; + + if ( array == GL_TEXTURE_COORD_ARRAY ) { + index = __glXGetActiveTextureUnit( state ); + } - switch (array) { - case GL_COLOR_ARRAY: - ENABLE_ARRAY(state, color); - break; - case GL_EDGE_FLAG_ARRAY: - ENABLE_ARRAY(state, edgeFlag); - break; - case GL_INDEX_ARRAY: - ENABLE_ARRAY(state, index); - break; - case GL_NORMAL_ARRAY: - ENABLE_ARRAY(state, normal); - break; - case GL_TEXTURE_COORD_ARRAY: - ENABLE_TEXARRAY(state, state->vertArray.activeTexture); - break; - case GL_VERTEX_ARRAY: - ENABLE_ARRAY(state, vertex); - break; - case GL_SECONDARY_COLOR_ARRAY: - ENABLE_ARRAY(state, secondaryColor); - break; - case GL_FOG_COORD_ARRAY: - ENABLE_ARRAY(state, fogCoord); - break; - default: - __glXSetError(gc, GL_INVALID_ENUM); + if ( ! __glXSetArrayEnable( state, array, index, val ) ) { + __glXSetError(gc, GL_INVALID_ENUM); } } -void __indirect_glDisableClientState(GLenum array) +void __indirect_glEnableClientState(GLenum array) { - __GLXcontext *gc = __glXGetCurrentContext(); - __GLXattribute * state = (__GLXattribute *)(gc->client_state_private); + do_enable_disable( array, GL_TRUE ); +} - switch (array) { - case GL_COLOR_ARRAY: - DISABLE_ARRAY(state, color); - break; - case GL_EDGE_FLAG_ARRAY: - DISABLE_ARRAY(state, edgeFlag); - break; - case GL_INDEX_ARRAY: - DISABLE_ARRAY(state, index); - break; - case GL_NORMAL_ARRAY: - DISABLE_ARRAY(state, normal); - break; - case GL_TEXTURE_COORD_ARRAY: - DISABLE_TEXARRAY(state, state->vertArray.activeTexture); - break; - case GL_VERTEX_ARRAY: - DISABLE_ARRAY(state, vertex); - break; - case GL_SECONDARY_COLOR_ARRAY: - DISABLE_ARRAY(state, secondaryColor); - break; - case GL_FOG_COORD_ARRAY: - DISABLE_ARRAY(state, fogCoord); - break; - default: - __glXSetError(gc, GL_INVALID_ENUM); - } +void __indirect_glDisableClientState(GLenum array) +{ + do_enable_disable( array, GL_FALSE ); } /************************************************************************/ @@ -129,7 +86,7 @@ void __indirect_glPushClientAttrib(GLuint mask) sp->storeUnpack = state->storeUnpack; } if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) { - sp->vertArray = state->vertArray; + __glXPushArrayState( state ); } } else { __glXSetError(gc, GL_STACK_OVERFLOW); @@ -156,7 +113,7 @@ void __indirect_glPopClientAttrib(void) state->storeUnpack = sp->storeUnpack; } if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) { - state->vertArray = sp->vertArray; + __glXPopArrayState( state ); } sp->mask = 0; @@ -181,5 +138,3 @@ void __glFreeAttributeState(__GLXcontext *gc) } } } - - |