diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2008-07-15 12:19:14 -0700 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2008-07-15 12:19:14 -0700 |
commit | 9ddc3314208124a16e61a1a8c64d68f3d581c746 (patch) | |
tree | db625cfd35be8913897b84b0e0c6dd85e73ade9e | |
parent | 6a06771e359559436410c4aca07c233425feec04 (diff) |
glx: Track per-array buffer binding
When a gl*Pointer call is made, latch the currently bound buffer
object. This will allow the client to know whether or not it has to
send data to the server when, for example, glDrawArrays is called.
-rw-r--r-- | src/glx/x11/indirect_vertex_array.c | 39 | ||||
-rw-r--r-- | src/glx/x11/indirect_vertex_array_priv.h | 7 |
2 files changed, 26 insertions, 20 deletions
diff --git a/src/glx/x11/indirect_vertex_array.c b/src/glx/x11/indirect_vertex_array.c index 15e3ece148..fe5a4f4266 100644 --- a/src/glx/x11/indirect_vertex_array.c +++ b/src/glx/x11/indirect_vertex_array.c @@ -1054,13 +1054,14 @@ void __indirect_glMultiDrawElementsEXT(GLenum mode, const GLsizei *count, } -#define COMMON_ARRAY_DATA_INIT(a, PTR, TYPE, STRIDE, COUNT, NORMALIZED, HDR_SIZE, OPCODE) \ +#define COMMON_ARRAY_DATA_INIT(a, PTR, TYPE, STRIDE, COUNT, NORMALIZED, HDR_SIZE, OPCODE, BUFFER) \ do { \ (a)->data = PTR; \ (a)->data_type = TYPE; \ (a)->user_stride = STRIDE; \ (a)->count = COUNT; \ (a)->normalized = NORMALIZED; \ + (a)->buffer = BUFFER; \ \ (a)->element_size = __glXTypeSize( TYPE ) * COUNT; \ (a)->true_stride = (STRIDE == 0) \ @@ -1111,8 +1112,8 @@ void __indirect_glVertexPointer( GLint size, GLenum type, GLsizei stride, a = get_array_entry( arrays, GL_VERTEX_ARRAY, 0 ); assert( a != NULL ); - COMMON_ARRAY_DATA_INIT( a, pointer, type, stride, size, GL_FALSE, 4, - opcode ); + COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, size, GL_FALSE, 4, + opcode, state->buffer_bindings.array); if ( a->enabled ) { arrays->array_info_cache_valid = GL_FALSE; @@ -1148,8 +1149,8 @@ void __indirect_glNormalPointer( GLenum type, GLsizei stride, a = get_array_entry( arrays, GL_NORMAL_ARRAY, 0 ); assert( a != NULL ); - COMMON_ARRAY_DATA_INIT( a, pointer, type, stride, 3, GL_TRUE, 4, - opcode ); + COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, 3, GL_TRUE, 4, + opcode, state->buffer_bindings.array); if ( a->enabled ) { arrays->array_info_cache_valid = GL_FALSE; @@ -1212,8 +1213,8 @@ void __indirect_glColorPointer( GLint size, GLenum type, GLsizei stride, a = get_array_entry( arrays, GL_COLOR_ARRAY, 0 ); assert( a != NULL ); - COMMON_ARRAY_DATA_INIT( a, pointer, type, stride, size, GL_TRUE, 4, - opcode ); + COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, size, GL_TRUE, 4, + opcode, state->buffer_bindings.array); if ( a->enabled ) { arrays->array_info_cache_valid = GL_FALSE; @@ -1249,8 +1250,8 @@ void __indirect_glIndexPointer( GLenum type, GLsizei stride, a = get_array_entry( arrays, GL_INDEX_ARRAY, 0 ); assert( a != NULL ); - COMMON_ARRAY_DATA_INIT( a, pointer, type, stride, 1, GL_FALSE, 4, - opcode ); + COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, 1, GL_FALSE, 4, + opcode, state->buffer_bindings.array); if ( a->enabled ) { arrays->array_info_cache_valid = GL_FALSE; @@ -1274,8 +1275,8 @@ void __indirect_glEdgeFlagPointer( GLsizei stride, const GLvoid * pointer ) a = get_array_entry( arrays, GL_EDGE_FLAG_ARRAY, 0 ); assert( a != NULL ); - COMMON_ARRAY_DATA_INIT( a, pointer, GL_UNSIGNED_BYTE, stride, 1, GL_FALSE, - 4, X_GLrop_EdgeFlagv ); + COMMON_ARRAY_DATA_INIT(a, pointer, GL_UNSIGNED_BYTE, stride, 1, GL_FALSE, + 4, X_GLrop_EdgeFlagv, state->buffer_bindings.array); if ( a->enabled ) { arrays->array_info_cache_valid = GL_FALSE; @@ -1356,8 +1357,8 @@ void __indirect_glTexCoordPointer( GLint size, GLenum type, GLsizei stride, a = get_array_entry( arrays, GL_TEXTURE_COORD_ARRAY, index ); assert( a != NULL ); - COMMON_ARRAY_DATA_INIT( a, pointer, type, stride, size, GL_FALSE, - header_size, opcode ); + COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, size, GL_FALSE, + header_size, opcode, state->buffer_bindings.array); if ( a->enabled ) { arrays->array_info_cache_valid = GL_FALSE; @@ -1400,8 +1401,8 @@ void __indirect_glSecondaryColorPointerEXT( GLint size, GLenum type, GLsizei str return; } - COMMON_ARRAY_DATA_INIT( a, pointer, type, stride, size, GL_TRUE, 4, - opcode ); + COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, size, GL_TRUE, 4, + opcode, state->buffer_bindings.array); if ( a->enabled ) { arrays->array_info_cache_valid = GL_FALSE; @@ -1438,8 +1439,8 @@ void __indirect_glFogCoordPointerEXT( GLenum type, GLsizei stride, return; } - COMMON_ARRAY_DATA_INIT( a, pointer, type, stride, 1, GL_FALSE, 4, - opcode ); + COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, 1, GL_FALSE, 4, + opcode, state->buffer_bindings.array); if ( a->enabled ) { arrays->array_info_cache_valid = GL_FALSE; @@ -1531,8 +1532,8 @@ void __indirect_glVertexAttribPointerARB(GLuint index, GLint size, return; } - COMMON_ARRAY_DATA_INIT( a, pointer, type, stride, size, normalized, 8, - opcode ); + COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, size, normalized, 8, + opcode, state->buffer_bindings.array); true_immediate_size = __glXTypeSize(type) * true_immediate_count; ((uint16_t *) (a)->header)[0] = __GLX_PAD(a->header_size diff --git a/src/glx/x11/indirect_vertex_array_priv.h b/src/glx/x11/indirect_vertex_array_priv.h index ab97dc645f..0c8c313a7f 100644 --- a/src/glx/x11/indirect_vertex_array_priv.h +++ b/src/glx/x11/indirect_vertex_array_priv.h @@ -85,6 +85,11 @@ struct array_state { GLboolean normalized; /** + * Buffer object that backs this array. + */ + GLuint buffer; + + /** * Pre-calculated GLX protocol command header. */ uint32_t header[2]; @@ -244,7 +249,7 @@ struct array_state_vector { GLboolean old_DrawArrays_possible; /** - * Is it possible to use the new GL X.X / ARB_vertex_buffer_object + * Is it possible to use the new GL 1.5 / ARB_vertex_buffer_object * protocol? * * \todo |