summaryrefslogtreecommitdiffstats
path: root/src/glx/x11
diff options
context:
space:
mode:
Diffstat (limited to 'src/glx/x11')
-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 7b6045c7c21..0b0227f0e28 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 d8b43f3963f..d4e6ab99ca9 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,