summaryrefslogtreecommitdiff
path: root/src/glx
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2005-03-17 20:36:20 +0000
committerIan Romanick <idr@us.ibm.com>2005-03-17 20:36:20 +0000
commit979f35fb78f39cec5de53795ce91f674bfb9df52 (patch)
tree89e5878f0090cad5239975d3fc261b4787883291 /src/glx
parentb81efaaa1ac8676a1092e4354079ffcbe7960af2 (diff)
Minor vertex array support tweaks. These are in preparation for the
(eventual) addition of support for ARB_vertex_buffer_object. Elminitate the need for array_state_vector::large_header. Make some very minor tweaks to the handling of the indices pointer in emit_DrawElements_old.
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/x11/indirect_va_private.h14
-rw-r--r--src/glx/x11/indirect_vertex_array.c29
2 files changed, 22 insertions, 21 deletions
diff --git a/src/glx/x11/indirect_va_private.h b/src/glx/x11/indirect_va_private.h
index 7b6045c7c2..0b0227f0e2 100644
--- a/src/glx/x11/indirect_va_private.h
+++ b/src/glx/x11/indirect_va_private.h
@@ -207,22 +207,16 @@ struct array_state_vector {
* the buffer. This will always be greater than or equal to
* \c array_info_cache_size.
*
- * \c large_header doesn't completely belong in this group. This is a
- * pointer to a buffer to hold the header information for DrawArrays in
- * a RenderLarge command. This buffer is immediately before
- * \c array_info_cache. The idea is that the header data will be written
- * to \c large_header and a single call to \c __glXSendLargeChunk can be
- * made to send the header and the ARRAY_INFO data.
- *
* \note
- * \c array_info_cache_size and \c array_info_cache_buffer_size do
- * NOT include the size of \c large_header.
+ * There are some bytes of extra data before \c array_info_cache that is
+ * used to hold the header for RenderLarge commands. This is
+ * \b not included in \c array_info_cache_size or
+ * \c array_info_cache_buffer_size.
*/
/*@{*/
size_t array_info_cache_size;
size_t array_info_cache_buffer_size;
void * array_info_cache;
- GLubyte * large_header;
/*@}*/
diff --git a/src/glx/x11/indirect_vertex_array.c b/src/glx/x11/indirect_vertex_array.c
index d8b43f3963..d4e6ab99ca 100644
--- a/src/glx/x11/indirect_vertex_array.c
+++ b/src/glx/x11/indirect_vertex_array.c
@@ -151,7 +151,7 @@ __glXInitVertexArrayState( __GLXcontext * gc )
* GL_COLOR_ARRAY, GL_INDEX_ARRAY, GL_TEXTURE_COORD_ARRAY, and
* GL_EDGE_FLAG_ARRAY are supported.
*/
-
+
array_count = 5;
if ( __glExtensionBitIsEnabled( gc, GL_EXT_fog_coord_bit )
@@ -380,15 +380,16 @@ static GLboolean
allocate_array_info_cache( struct array_state_vector * arrays,
size_t required_size )
{
+#define MAX_HEADER_SIZE 20
if ( arrays->array_info_cache_buffer_size < required_size ) {
- GLubyte * temp = realloc( arrays->array_info_cache, required_size + 20 );
+ GLubyte * temp = realloc( arrays->array_info_cache, required_size
+ + MAX_HEADER_SIZE );
if ( temp == NULL ) {
return GL_FALSE;
}
- arrays->large_header = temp;
- arrays->array_info_cache = temp + 20;
+ arrays->array_info_cache = temp + MAX_HEADER_SIZE;
arrays->array_info_cache_buffer_size = required_size;
}
@@ -590,7 +591,7 @@ emit_DrawArrays_header_old( __GLXcontext * gc,
command_size += 4;
- pc = arrays->large_header;
+ pc = ((GLubyte *) arrays->array_info_cache) - (header_size + 4);
*(uint32_t *)(pc + 0) = command_size;
*(uint32_t *)(pc + 4) = X_GLrop_DrawArrays;
*(uint32_t *)(pc + 8) = count;
@@ -774,9 +775,6 @@ emit_DrawElements_old( GLenum mode, GLsizei count, GLenum type,
unsigned total_requests = 0;
unsigned i;
unsigned req;
- const GLuint * ui_ptr = (const GLuint *) indices;
- const GLushort * us_ptr = (const GLushort *) indices;
- const GLubyte * ub_ptr = (const GLubyte *) indices;
pc = emit_DrawArrays_header_old( gc, arrays, & elements_per_request,
@@ -793,25 +791,34 @@ emit_DrawElements_old( GLenum mode, GLsizei count, GLenum type,
}
switch( type ) {
- case GL_UNSIGNED_INT:
+ case GL_UNSIGNED_INT: {
+ const GLuint * ui_ptr = (const GLuint *) indices;
+
for ( i = 0 ; i < elements_per_request ; i++ ) {
const GLint index = (GLint) *(ui_ptr++);
pc = emit_element_old( pc, arrays, index );
}
break;
- case GL_UNSIGNED_SHORT:
+ }
+ case GL_UNSIGNED_SHORT: {
+ const GLushort * us_ptr = (const GLushort *) indices;
+
for ( i = 0 ; i < elements_per_request ; i++ ) {
const GLint index = (GLint) *(us_ptr++);
pc = emit_element_old( pc, arrays, index );
}
break;
- case GL_UNSIGNED_BYTE:
+ }
+ case GL_UNSIGNED_BYTE: {
+ const GLubyte * ub_ptr = (const GLubyte *) indices;
+
for ( i = 0 ; i < elements_per_request ; i++ ) {
const GLint index = (GLint) *(ub_ptr++);
pc = emit_element_old( pc, arrays, index );
}
break;
}
+ }
if ( total_requests != 0 ) {
__glXSendLargeChunk( gc, req, total_requests, gc->pc,