diff options
Diffstat (limited to 'src/mesa/vbo')
-rw-r--r-- | src/mesa/vbo/vbo.h | 19 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_context.c | 14 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_context.h | 4 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec.c | 6 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec.h | 14 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec_api.c | 57 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec_array.c | 258 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec_draw.c | 8 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec_eval.c | 2 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_rebase.c | 14 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_save.c | 8 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_save.h | 28 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_save_api.c | 67 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_save_draw.c | 8 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_save_loopback.c | 16 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_split.c | 2 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_split.h | 4 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_split_copy.c | 10 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_split_inplace.c | 4 |
19 files changed, 328 insertions, 215 deletions
diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h index 07d31f6ce36..7b8da8eb843 100644 --- a/src/mesa/vbo/vbo.h +++ b/src/mesa/vbo/vbo.h @@ -61,12 +61,12 @@ struct _mesa_index_buffer { -GLboolean _vbo_CreateContext( GLcontext *ctx ); -void _vbo_DestroyContext( GLcontext *ctx ); -void _vbo_InvalidateState( GLcontext *ctx, GLuint new_state ); +GLboolean _vbo_CreateContext( struct gl_context *ctx ); +void _vbo_DestroyContext( struct gl_context *ctx ); +void _vbo_InvalidateState( struct gl_context *ctx, GLuint new_state ); -typedef void (*vbo_draw_func)( GLcontext *ctx, +typedef void (*vbo_draw_func)( struct gl_context *ctx, const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, @@ -92,7 +92,7 @@ struct split_limits { }; -void vbo_split_prims( GLcontext *ctx, +void vbo_split_prims( struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, @@ -106,8 +106,9 @@ void vbo_split_prims( GLcontext *ctx, /* Helpers for dealing translating away non-zero min_index. */ GLboolean vbo_all_varyings_in_vbos( const struct gl_client_array *arrays[] ); +GLboolean vbo_any_varyings_in_vbos( const struct gl_client_array *arrays[] ); -void vbo_rebase_prims( GLcontext *ctx, +void vbo_rebase_prims( struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, @@ -116,14 +117,14 @@ void vbo_rebase_prims( GLcontext *ctx, GLuint max_index, vbo_draw_func draw ); void -vbo_get_minmax_index(GLcontext *ctx, const struct _mesa_prim *prim, +vbo_get_minmax_index(struct gl_context *ctx, const struct _mesa_prim *prim, const struct _mesa_index_buffer *ib, GLuint *min_index, GLuint *max_index); -void vbo_use_buffer_objects(GLcontext *ctx); +void vbo_use_buffer_objects(struct gl_context *ctx); -void vbo_set_draw_func(GLcontext *ctx, vbo_draw_func func); +void vbo_set_draw_func(struct gl_context *ctx, vbo_draw_func func); void GLAPIENTRY diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index 580850574c9..9992cc34739 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -49,7 +49,7 @@ static GLuint check_size( const GLfloat *attr ) } -static void init_legacy_currval(GLcontext *ctx) +static void init_legacy_currval(struct gl_context *ctx) { struct vbo_context *vbo = vbo_context(ctx); struct gl_client_array *arrays = vbo->legacy_currval; @@ -78,7 +78,7 @@ static void init_legacy_currval(GLcontext *ctx) } -static void init_generic_currval(GLcontext *ctx) +static void init_generic_currval(struct gl_context *ctx) { struct vbo_context *vbo = vbo_context(ctx); struct gl_client_array *arrays = vbo->generic_currval; @@ -104,7 +104,7 @@ static void init_generic_currval(GLcontext *ctx) } -static void init_mat_currval(GLcontext *ctx) +static void init_mat_currval(struct gl_context *ctx) { struct vbo_context *vbo = vbo_context(ctx); struct gl_client_array *arrays = vbo->mat_currval; @@ -149,7 +149,7 @@ static void init_mat_currval(GLcontext *ctx) } -GLboolean _vbo_CreateContext( GLcontext *ctx ) +GLboolean _vbo_CreateContext( struct gl_context *ctx ) { struct vbo_context *vbo = CALLOC_STRUCT(vbo_context); @@ -207,14 +207,14 @@ GLboolean _vbo_CreateContext( GLcontext *ctx ) } -void _vbo_InvalidateState( GLcontext *ctx, GLuint new_state ) +void _vbo_InvalidateState( struct gl_context *ctx, GLuint new_state ) { _ae_invalidate_state(ctx, new_state); vbo_exec_invalidate_state(ctx, new_state); } -void _vbo_DestroyContext( GLcontext *ctx ) +void _vbo_DestroyContext( struct gl_context *ctx ) { struct vbo_context *vbo = vbo_context(ctx); @@ -239,7 +239,7 @@ void _vbo_DestroyContext( GLcontext *ctx ) } -void vbo_set_draw_func(GLcontext *ctx, vbo_draw_func func) +void vbo_set_draw_func(struct gl_context *ctx, vbo_draw_func func) { struct vbo_context *vbo = vbo_context(ctx); vbo->draw_prims = func; diff --git a/src/mesa/vbo/vbo_context.h b/src/mesa/vbo/vbo_context.h index 00cfc522a0d..8d6f2a7ce6d 100644 --- a/src/mesa/vbo/vbo_context.h +++ b/src/mesa/vbo/vbo_context.h @@ -85,7 +85,7 @@ struct vbo_context { }; -static INLINE struct vbo_context *vbo_context(GLcontext *ctx) +static INLINE struct vbo_context *vbo_context(struct gl_context *ctx) { return (struct vbo_context *)(ctx->swtnl_im); } @@ -96,7 +96,7 @@ static INLINE struct vbo_context *vbo_context(GLcontext *ctx) * vertex transformation, an NV vertex program or ARB vertex program/shader. */ static INLINE enum vp_mode -get_program_mode( GLcontext *ctx ) +get_program_mode( struct gl_context *ctx ) { if (!ctx->VertexProgram._Current) return VP_NONE; diff --git a/src/mesa/vbo/vbo_exec.c b/src/mesa/vbo/vbo_exec.c index 046fa8105ba..e8d5b39b3f4 100644 --- a/src/mesa/vbo/vbo_exec.c +++ b/src/mesa/vbo/vbo_exec.c @@ -34,7 +34,7 @@ -void vbo_exec_init( GLcontext *ctx ) +void vbo_exec_init( struct gl_context *ctx ) { struct vbo_exec_context *exec = &vbo_context(ctx)->exec; @@ -62,7 +62,7 @@ void vbo_exec_init( GLcontext *ctx ) } -void vbo_exec_destroy( GLcontext *ctx ) +void vbo_exec_destroy( struct gl_context *ctx ) { struct vbo_exec_context *exec = &vbo_context(ctx)->exec; @@ -81,7 +81,7 @@ void vbo_exec_destroy( GLcontext *ctx ) * invoked according to the state flags. That will have to wait for a * mesa rework: */ -void vbo_exec_invalidate_state( GLcontext *ctx, GLuint new_state ) +void vbo_exec_invalidate_state( struct gl_context *ctx, GLuint new_state ) { struct vbo_exec_context *exec = &vbo_context(ctx)->exec; diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h index 33494f0cead..47e51f09c94 100644 --- a/src/mesa/vbo/vbo_exec.h +++ b/src/mesa/vbo/vbo_exec.h @@ -79,7 +79,7 @@ typedef void (*vbo_attrfv_func)( const GLfloat * ); struct vbo_exec_context { - GLcontext *ctx; + struct gl_context *ctx; GLvertexformat vtxfmt; struct { @@ -148,13 +148,13 @@ struct vbo_exec_context /* External API: */ -void vbo_exec_init( GLcontext *ctx ); -void vbo_exec_destroy( GLcontext *ctx ); -void vbo_exec_invalidate_state( GLcontext *ctx, GLuint new_state ); -void vbo_exec_FlushVertices_internal( GLcontext *ctx, GLboolean unmap ); +void vbo_exec_init( struct gl_context *ctx ); +void vbo_exec_destroy( struct gl_context *ctx ); +void vbo_exec_invalidate_state( struct gl_context *ctx, GLuint new_state ); +void vbo_exec_FlushVertices_internal( struct gl_context *ctx, GLboolean unmap ); -void vbo_exec_BeginVertices( GLcontext *ctx ); -void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags ); +void vbo_exec_BeginVertices( struct gl_context *ctx ); +void vbo_exec_FlushVertices( struct gl_context *ctx, GLuint flags ); /* Internal functions: diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 9df75a84065..1ef49174193 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -142,7 +142,7 @@ void vbo_exec_vtx_wrap( struct vbo_exec_context *exec ) */ static void vbo_exec_copy_to_current( struct vbo_exec_context *exec ) { - GLcontext *ctx = exec->ctx; + struct gl_context *ctx = exec->ctx; struct vbo_context *vbo = vbo_context(ctx); GLuint i; @@ -193,7 +193,7 @@ static void vbo_exec_copy_to_current( struct vbo_exec_context *exec ) static void vbo_exec_copy_from_current( struct vbo_exec_context *exec ) { - GLcontext *ctx = exec->ctx; + struct gl_context *ctx = exec->ctx; struct vbo_context *vbo = vbo_context(ctx); GLint i; @@ -217,7 +217,7 @@ static void vbo_exec_wrap_upgrade_vertex( struct vbo_exec_context *exec, GLuint attr, GLuint newsz ) { - GLcontext *ctx = exec->ctx; + struct gl_context *ctx = exec->ctx; struct vbo_context *vbo = vbo_context(ctx); GLint lastcount = exec->vtx.vert_count; GLfloat *tmp; @@ -318,7 +318,7 @@ static void vbo_exec_wrap_upgrade_vertex( struct vbo_exec_context *exec, } -static void vbo_exec_fixup_vertex( GLcontext *ctx, +static void vbo_exec_fixup_vertex( struct gl_context *ctx, GLuint attr, GLuint sz ) { struct vbo_exec_context *exec = &vbo_context(ctx)->exec; @@ -358,10 +358,12 @@ static void vbo_exec_fixup_vertex( GLcontext *ctx, #define ATTR( A, N, V0, V1, V2, V3 ) \ do { \ struct vbo_exec_context *exec = &vbo_context(ctx)->exec; \ - \ - if (exec->vtx.active_sz[A] != N) \ - vbo_exec_fixup_vertex(ctx, A, N); \ - \ + \ + if (unlikely(!(exec->ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT))) \ + ctx->Driver.BeginVertices( ctx ); \ + if (unlikely(exec->vtx.active_sz[A] != N)) \ + vbo_exec_fixup_vertex(ctx, A, N); \ + \ { \ GLfloat *dest = exec->vtx.attrptr[A]; \ if (N>0) dest[0] = V0; \ @@ -566,6 +568,28 @@ static void GLAPIENTRY vbo_exec_End( void ) } +/** + * Called via glPrimitiveRestartNV() + */ +static void GLAPIENTRY +vbo_exec_PrimitiveRestartNV(void) +{ + GLenum curPrim; + GET_CURRENT_CONTEXT( ctx ); + + curPrim = ctx->Driver.CurrentExecPrimitive; + + if (curPrim == PRIM_OUTSIDE_BEGIN_END) { + _mesa_error( ctx, GL_INVALID_OPERATION, "glPrimitiveRestartNV" ); + } + else { + vbo_exec_End(); + vbo_exec_Begin(curPrim); + } +} + + + static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec ) { GLvertexformat *vfmt = &exec->vtxfmt; @@ -574,6 +598,7 @@ static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec ) vfmt->Begin = vbo_exec_Begin; vfmt->End = vbo_exec_End; + vfmt->PrimitiveRestartNV = vbo_exec_PrimitiveRestartNV; _MESA_INIT_DLIST_VTXFMT(vfmt, _mesa_); _MESA_INIT_EVAL_VTXFMT(vfmt, vbo_exec_); @@ -740,7 +765,7 @@ static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec ) * This replaces the malloced buffer which was created in * vb_exec_vtx_init() below. */ -void vbo_use_buffer_objects(GLcontext *ctx) +void vbo_use_buffer_objects(struct gl_context *ctx) { struct vbo_exec_context *exec = &vbo_context(ctx)->exec; /* Any buffer name but 0 can be used here since this bufferobj won't @@ -769,7 +794,7 @@ void vbo_use_buffer_objects(GLcontext *ctx) void vbo_exec_vtx_init( struct vbo_exec_context *exec ) { - GLcontext *ctx = exec->ctx; + struct gl_context *ctx = exec->ctx; struct vbo_context *vbo = vbo_context(ctx); GLuint i; @@ -827,7 +852,7 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec ) void vbo_exec_vtx_destroy( struct vbo_exec_context *exec ) { /* using a real VBO for vertex data */ - GLcontext *ctx = exec->ctx; + struct gl_context *ctx = exec->ctx; unsigned i; /* True VBOs should already be unmapped @@ -858,7 +883,7 @@ void vbo_exec_vtx_destroy( struct vbo_exec_context *exec ) _mesa_reference_buffer_object(ctx, &exec->vtx.bufferobj, NULL); } -void vbo_exec_BeginVertices( GLcontext *ctx ) +void vbo_exec_BeginVertices( struct gl_context *ctx ) { struct vbo_exec_context *exec = &vbo_context(ctx)->exec; if (0) printf("%s\n", __FUNCTION__); @@ -868,7 +893,7 @@ void vbo_exec_BeginVertices( GLcontext *ctx ) exec->ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; } -void vbo_exec_FlushVertices_internal( GLcontext *ctx, GLboolean unmap ) +void vbo_exec_FlushVertices_internal( struct gl_context *ctx, GLboolean unmap ) { struct vbo_exec_context *exec = &vbo_context(ctx)->exec; @@ -886,7 +911,7 @@ void vbo_exec_FlushVertices_internal( GLcontext *ctx, GLboolean unmap ) /** * \param flags bitmask of FLUSH_STORED_VERTICES, FLUSH_UPDATE_CURRENT */ -void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags ) +void vbo_exec_FlushVertices( struct gl_context *ctx, GLuint flags ) { struct vbo_exec_context *exec = &vbo_context(ctx)->exec; @@ -911,10 +936,8 @@ void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags ) /* Need to do this to ensure BeginVertices gets called again: */ - if (exec->ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) { - _mesa_restore_exec_vtxfmt( ctx ); + if (exec->ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) exec->ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT; - } exec->ctx->Driver.NeedFlush &= ~flags; diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 1759e578870..dd36cc32a70 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -41,16 +41,20 @@ /** * Compute min and max elements by scanning the index buffer for * glDraw[Range]Elements() calls. + * If primitive restart is enabled, we need to ignore restart + * indexes when computing min/max. */ void -vbo_get_minmax_index(GLcontext *ctx, +vbo_get_minmax_index(struct gl_context *ctx, const struct _mesa_prim *prim, const struct _mesa_index_buffer *ib, GLuint *min_index, GLuint *max_index) { - GLuint i; - GLuint count = prim->count; + const GLboolean restart = ctx->Array.PrimitiveRestart; + const GLuint restartIndex = ctx->Array.RestartIndex; + const GLuint count = prim->count; const void *indices; + GLuint i; if (_mesa_is_bufferobj(ib->obj)) { const GLvoid *map = @@ -64,11 +68,21 @@ vbo_get_minmax_index(GLcontext *ctx, switch (ib->type) { case GL_UNSIGNED_INT: { const GLuint *ui_indices = (const GLuint *)indices; - GLuint max_ui = ui_indices[count-1]; - GLuint min_ui = ui_indices[0]; - for (i = 0; i < count; i++) { - if (ui_indices[i] > max_ui) max_ui = ui_indices[i]; - if (ui_indices[i] < min_ui) min_ui = ui_indices[i]; + GLuint max_ui = 0; + GLuint min_ui = ~0U; + if (restart) { + for (i = 0; i < count; i++) { + if (ui_indices[i] != restartIndex) { + if (ui_indices[i] > max_ui) max_ui = ui_indices[i]; + if (ui_indices[i] < min_ui) min_ui = ui_indices[i]; + } + } + } + else { + for (i = 0; i < count; i++) { + if (ui_indices[i] > max_ui) max_ui = ui_indices[i]; + if (ui_indices[i] < min_ui) min_ui = ui_indices[i]; + } } *min_index = min_ui; *max_index = max_ui; @@ -76,11 +90,21 @@ vbo_get_minmax_index(GLcontext *ctx, } case GL_UNSIGNED_SHORT: { const GLushort *us_indices = (const GLushort *)indices; - GLuint max_us = us_indices[count-1]; - GLuint min_us = us_indices[0]; - for (i = 0; i < count; i++) { - if (us_indices[i] > max_us) max_us = us_indices[i]; - if (us_indices[i] < min_us) min_us = us_indices[i]; + GLuint max_us = 0; + GLuint min_us = ~0U; + if (restart) { + for (i = 0; i < count; i++) { + if (us_indices[i] != restartIndex) { + if (us_indices[i] > max_us) max_us = us_indices[i]; + if (us_indices[i] < min_us) min_us = us_indices[i]; + } + } + } + else { + for (i = 0; i < count; i++) { + if (us_indices[i] > max_us) max_us = us_indices[i]; + if (us_indices[i] < min_us) min_us = us_indices[i]; + } } *min_index = min_us; *max_index = max_us; @@ -88,11 +112,21 @@ vbo_get_minmax_index(GLcontext *ctx, } case GL_UNSIGNED_BYTE: { const GLubyte *ub_indices = (const GLubyte *)indices; - GLuint max_ub = ub_indices[count-1]; - GLuint min_ub = ub_indices[0]; - for (i = 0; i < count; i++) { - if (ub_indices[i] > max_ub) max_ub = ub_indices[i]; - if (ub_indices[i] < min_ub) min_ub = ub_indices[i]; + GLuint max_ub = 0; + GLuint min_ub = ~0U; + if (restart) { + for (i = 0; i < count; i++) { + if (ub_indices[i] != restartIndex) { + if (ub_indices[i] > max_ub) max_ub = ub_indices[i]; + if (ub_indices[i] < min_ub) min_ub = ub_indices[i]; + } + } + } + else { + for (i = 0; i < count; i++) { + if (ub_indices[i] > max_ub) max_ub = ub_indices[i]; + if (ub_indices[i] < min_ub) min_ub = ub_indices[i]; + } } *min_index = min_ub; *max_index = max_ub; @@ -115,7 +149,7 @@ vbo_get_minmax_index(GLcontext *ctx, * For debugging purposes; not normally used. */ static void -check_array_data(GLcontext *ctx, struct gl_client_array *array, +check_array_data(struct gl_context *ctx, struct gl_client_array *array, GLuint attrib, GLuint j) { if (array->Enabled) { @@ -161,7 +195,7 @@ check_array_data(GLcontext *ctx, struct gl_client_array *array, * Unmap the buffer object referenced by given array, if mapped. */ static void -unmap_array_buffer(GLcontext *ctx, struct gl_client_array *array) +unmap_array_buffer(struct gl_context *ctx, struct gl_client_array *array) { if (array->Enabled && _mesa_is_bufferobj(array->BufferObj) && @@ -176,7 +210,7 @@ unmap_array_buffer(GLcontext *ctx, struct gl_client_array *array) * For debug purposes; not normally used. */ static void -check_draw_elements_data(GLcontext *ctx, GLsizei count, GLenum elemType, +check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType, const void *elements, GLint basevertex) { struct gl_array_object *arrayObj = ctx->Array.ArrayObj; @@ -244,7 +278,7 @@ check_draw_elements_data(GLcontext *ctx, GLsizei count, GLenum elemType, * Check array data, looking for NaNs, etc. */ static void -check_draw_arrays_data(GLcontext *ctx, GLint start, GLsizei count) +check_draw_arrays_data(struct gl_context *ctx, GLint start, GLsizei count) { /* TO DO */ } @@ -254,9 +288,11 @@ check_draw_arrays_data(GLcontext *ctx, GLint start, GLsizei count) * Print info/data for glDrawArrays(), for debugging. */ static void -print_draw_arrays(GLcontext *ctx, struct vbo_exec_context *exec, +print_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start, GLsizei count) { + struct vbo_context *vbo = vbo_context(ctx); + struct vbo_exec_context *exec = &vbo->exec; int i; printf("vbo_exec_DrawArrays(mode 0x%x, start %d, count %d):\n", @@ -303,7 +339,7 @@ print_draw_arrays(GLcontext *ctx, struct vbo_exec_context *exec, * Just translate the arrayobj into a sane layout. */ static void -bind_array_obj(GLcontext *ctx) +bind_array_obj(struct gl_context *ctx) { struct vbo_context *vbo = vbo_context(ctx); struct vbo_exec_context *exec = &vbo->exec; @@ -348,7 +384,7 @@ bind_array_obj(GLcontext *ctx) * to point at a zero-stride current value "array". */ static void -recalculate_input_bindings(GLcontext *ctx) +recalculate_input_bindings(struct gl_context *ctx) { struct vbo_context *vbo = vbo_context(ctx); struct vbo_exec_context *exec = &vbo->exec; @@ -464,13 +500,97 @@ recalculate_input_bindings(GLcontext *ctx) * must be done after this call. */ static void -bind_arrays(GLcontext *ctx) +bind_arrays(struct gl_context *ctx) { bind_array_obj(ctx); recalculate_input_bindings(ctx); } +/** + * Helper function called by the other DrawArrays() functions below. + * This is where we handle primitive restart for drawing non-indexed + * arrays. If primitive restart is enabled, it typically means + * splitting one DrawArrays() into two. + */ +static void +vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start, + GLsizei count, GLuint numInstances) +{ + struct vbo_context *vbo = vbo_context(ctx); + struct vbo_exec_context *exec = &vbo->exec; + struct _mesa_prim prim[2]; + + bind_arrays(ctx); + + /* Again... because we may have changed the bitmask of per-vertex varying + * attributes. If we regenerate the fixed-function vertex program now + * we may be able to prune down the number of vertex attributes which we + * need in the shader. + */ + if (ctx->NewState) + _mesa_update_state(ctx); + + prim[0].begin = 1; + prim[0].end = 1; + prim[0].weak = 0; + prim[0].pad = 0; + prim[0].mode = mode; + prim[0].start = 0; /* filled in below */ + prim[0].count = 0; /* filled in below */ + prim[0].indexed = 0; + prim[0].basevertex = 0; + prim[0].num_instances = numInstances; + + /* Implement the primitive restart index */ + if (ctx->Array.PrimitiveRestart && ctx->Array.RestartIndex < count) { + GLuint primCount = 0; + + if (ctx->Array.RestartIndex == start) { + /* special case: RestartIndex at beginning */ + if (count > 1) { + prim[0].start = start + 1; + prim[0].count = count - 1; + primCount = 1; + } + } + else if (ctx->Array.RestartIndex == start + count - 1) { + /* special case: RestartIndex at end */ + if (count > 1) { + prim[0].start = start; + prim[0].count = count - 1; + primCount = 1; + } + } + else { + /* general case: RestartIndex in middle, split into two prims */ + prim[0].start = start; + prim[0].count = ctx->Array.RestartIndex - start; + + prim[1] = prim[0]; + prim[1].start = ctx->Array.RestartIndex + 1; + prim[1].count = count - prim[1].start; + + primCount = 2; + } + + if (primCount > 0) { + /* draw one or two prims */ + vbo->draw_prims(ctx, exec->array.inputs, prim, primCount, NULL, + GL_TRUE, start, start + count - 1); + } + } + else { + /* no prim restart */ + prim[0].start = start; + prim[0].count = count; + + vbo->draw_prims(ctx, exec->array.inputs, prim, 1, NULL, + GL_TRUE, start, start + count - 1); + } +} + + /** * Called from glDrawArrays when in immediate mode (not display list mode). @@ -479,9 +599,6 @@ static void GLAPIENTRY vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count) { GET_CURRENT_CONTEXT(ctx); - struct vbo_context *vbo = vbo_context(ctx); - struct vbo_exec_context *exec = &vbo->exec; - struct _mesa_prim prim[1]; if (MESA_VERBOSE & VERBOSE_DRAW) _mesa_debug(ctx, "glDrawArrays(%s, %d, %d)\n", @@ -496,41 +613,13 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count) return; } -#if 0 - check_draw_arrays_data(ctx, start, count); -#else - (void) check_draw_arrays_data; -#endif - - bind_arrays( ctx ); - - /* Again... because we may have changed the bitmask of per-vertex varying - * attributes. If we regenerate the fixed-function vertex program now - * we may be able to prune down the number of vertex attributes which we - * need in the shader. - */ - if (ctx->NewState) - _mesa_update_state( ctx ); - - prim[0].begin = 1; - prim[0].end = 1; - prim[0].weak = 0; - prim[0].pad = 0; - prim[0].mode = mode; - prim[0].start = start; - prim[0].count = count; - prim[0].indexed = 0; - prim[0].basevertex = 0; - prim[0].num_instances = 1; + if (0) + check_draw_arrays_data(ctx, start, count); - vbo->draw_prims( ctx, exec->array.inputs, prim, 1, NULL, - GL_TRUE, start, start + count - 1 ); + vbo_draw_arrays(ctx, mode, start, count, 1); -#if 0 - print_draw_arrays(ctx, exec, mode, start, count); -#else - (void) print_draw_arrays; -#endif + if (0) + print_draw_arrays(ctx, mode, start, count); } @@ -543,9 +632,6 @@ vbo_exec_DrawArraysInstanced(GLenum mode, GLint start, GLsizei count, GLsizei primcount) { GET_CURRENT_CONTEXT(ctx); - struct vbo_context *vbo = vbo_context(ctx); - struct vbo_exec_context *exec = &vbo->exec; - struct _mesa_prim prim[1]; if (MESA_VERBOSE & VERBOSE_DRAW) _mesa_debug(ctx, "glDrawArraysInstanced(%s, %d, %d, %d)\n", @@ -560,37 +646,13 @@ vbo_exec_DrawArraysInstanced(GLenum mode, GLint start, GLsizei count, return; } -#if 0 /* debug */ - check_draw_arrays_data(ctx, start, count); -#endif + if (0) + check_draw_arrays_data(ctx, start, count); - bind_arrays( ctx ); + vbo_draw_arrays(ctx, mode, start, count, primcount); - /* Again... because we may have changed the bitmask of per-vertex varying - * attributes. If we regenerate the fixed-function vertex program now - * we may be able to prune down the number of vertex attributes which we - * need in the shader. - */ - if (ctx->NewState) - _mesa_update_state( ctx ); - - prim[0].begin = 1; - prim[0].end = 1; - prim[0].weak = 0; - prim[0].pad = 0; - prim[0].mode = mode; - prim[0].start = start; - prim[0].count = count; - prim[0].indexed = 0; - prim[0].basevertex = 0; - prim[0].num_instances = primcount; - - vbo->draw_prims( ctx, exec->array.inputs, prim, 1, NULL, - GL_TRUE, start, start + count - 1 ); - -#if 0 /* debug */ - print_draw_arrays(ctx, exec, mode, start, count); -#endif + if (0) + print_draw_arrays(ctx, mode, start, count); } @@ -599,7 +661,7 @@ vbo_exec_DrawArraysInstanced(GLenum mode, GLint start, GLsizei count, * For debugging. */ static void -dump_element_buffer(GLcontext *ctx, GLenum type) +dump_element_buffer(struct gl_context *ctx, GLenum type) { const GLvoid *map = ctx->Driver.MapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB, @@ -657,7 +719,7 @@ dump_element_buffer(GLcontext *ctx, GLenum type) * we've validated buffer bounds, etc. */ static void -vbo_validated_drawrangeelements(GLcontext *ctx, GLenum mode, +vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode, GLboolean index_bounds_valid, GLuint start, GLuint end, GLsizei count, GLenum type, @@ -939,7 +1001,7 @@ vbo_exec_DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, * This does the actual rendering after we've checked array indexes, etc. */ static void -vbo_validated_multidrawelements(GLcontext *ctx, GLenum mode, +vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount, const GLint *basevertex) @@ -1003,6 +1065,8 @@ vbo_validated_multidrawelements(GLcontext *ctx, GLenum mode, /* Check if we can handle this thing as a bunch of index offsets from the * same index pointer. If we can't, then we have to fall back to doing * a draw_prims per primitive. + * Check that the difference between each prim's indexes is a multiple of + * the index/element size. */ if (index_type_size != 1) { for (i = 0; i < primcount; i++) { diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index 84ae1b87f93..71ac0066cac 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -154,7 +154,7 @@ vbo_copy_vertices( struct vbo_exec_context *exec ) /* TODO: populate these as the vertex is defined: */ static void -vbo_exec_bind_arrays( GLcontext *ctx ) +vbo_exec_bind_arrays( struct gl_context *ctx ) { struct vbo_context *vbo = vbo_context(ctx); struct vbo_exec_context *exec = &vbo->exec; @@ -260,7 +260,7 @@ vbo_exec_vtx_unmap( struct vbo_exec_context *exec ) GLenum target = GL_ARRAY_BUFFER_ARB; if (_mesa_is_bufferobj(exec->vtx.bufferobj)) { - GLcontext *ctx = exec->ctx; + struct gl_context *ctx = exec->ctx; if (ctx->Driver.FlushMappedBufferRange) { GLintptr offset = exec->vtx.buffer_used - exec->vtx.bufferobj->Offset; @@ -289,7 +289,7 @@ vbo_exec_vtx_unmap( struct vbo_exec_context *exec ) void vbo_exec_vtx_map( struct vbo_exec_context *exec ) { - GLcontext *ctx = exec->ctx; + struct gl_context *ctx = exec->ctx; const GLenum target = GL_ARRAY_BUFFER_ARB; const GLenum access = GL_READ_WRITE_ARB; /* for MapBuffer */ const GLenum accessRange = GL_MAP_WRITE_BIT | /* for MapBufferRange */ @@ -363,7 +363,7 @@ vbo_exec_vtx_flush( struct vbo_exec_context *exec, GLboolean unmap ) exec->vtx.copied.nr = vbo_copy_vertices( exec ); if (exec->vtx.copied.nr != exec->vtx.vert_count) { - GLcontext *ctx = exec->ctx; + struct gl_context *ctx = exec->ctx; /* Before the update_state() as this may raise _NEW_ARRAY * from _mesa_set_varying_vp_inputs(). diff --git a/src/mesa/vbo/vbo_exec_eval.c b/src/mesa/vbo/vbo_exec_eval.c index 23ad12608fc..1e8c3c45bb5 100644 --- a/src/mesa/vbo/vbo_exec_eval.c +++ b/src/mesa/vbo/vbo_exec_eval.c @@ -67,7 +67,7 @@ static void set_active_eval2( struct vbo_exec_context *exec, GLuint attr, GLuint void vbo_exec_eval_update( struct vbo_exec_context *exec ) { - GLcontext *ctx = exec->ctx; + struct gl_context *ctx = exec->ctx; GLuint attr; /* Vertex program maps have priority over conventional attribs */ diff --git a/src/mesa/vbo/vbo_rebase.c b/src/mesa/vbo/vbo_rebase.c index ff7c7a6b0d5..9068ae240a6 100644 --- a/src/mesa/vbo/vbo_rebase.c +++ b/src/mesa/vbo/vbo_rebase.c @@ -85,6 +85,18 @@ GLboolean vbo_all_varyings_in_vbos( const struct gl_client_array *arrays[] ) return GL_TRUE; } +GLboolean vbo_any_varyings_in_vbos( const struct gl_client_array *arrays[] ) +{ + GLuint i; + + for (i = 0; i < VERT_ATTRIB_MAX; i++) + if (arrays[i]->StrideB && + arrays[i]->BufferObj->Name != 0) + return GL_TRUE; + + return GL_FALSE; +} + /* Adjust primitives, indices and vertex definitions so that min_index * becomes zero. There are lots of reasons for wanting to do this, eg: * @@ -104,7 +116,7 @@ GLboolean vbo_all_varyings_in_vbos( const struct gl_client_array *arrays[] ) * - can't save time by trying to upload half a vbo - typically it is * all or nothing. */ -void vbo_rebase_prims( GLcontext *ctx, +void vbo_rebase_prims( struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, diff --git a/src/mesa/vbo/vbo_save.c b/src/mesa/vbo/vbo_save.c index dd5570689e7..4e7bcddc970 100644 --- a/src/mesa/vbo/vbo_save.c +++ b/src/mesa/vbo/vbo_save.c @@ -36,7 +36,7 @@ #if FEATURE_dlist -static void vbo_save_callback_init( GLcontext *ctx ) +static void vbo_save_callback_init( struct gl_context *ctx ) { ctx->Driver.NewList = vbo_save_NewList; ctx->Driver.EndList = vbo_save_EndList; @@ -48,7 +48,7 @@ static void vbo_save_callback_init( GLcontext *ctx ) -void vbo_save_init( GLcontext *ctx ) +void vbo_save_init( struct gl_context *ctx ) { struct vbo_context *vbo = vbo_context(ctx); struct vbo_save_context *save = &vbo->save; @@ -79,7 +79,7 @@ void vbo_save_init( GLcontext *ctx ) } -void vbo_save_destroy( GLcontext *ctx ) +void vbo_save_destroy( struct gl_context *ctx ) { struct vbo_context *vbo = vbo_context(ctx); struct vbo_save_context *save = &vbo->save; @@ -108,7 +108,7 @@ void vbo_save_destroy( GLcontext *ctx ) /* Note that this can occur during the playback of a display list: */ -void vbo_save_fallback( GLcontext *ctx, GLboolean fallback ) +void vbo_save_fallback( struct gl_context *ctx, GLboolean fallback ) { struct vbo_save_context *save = &vbo_context(ctx)->save; diff --git a/src/mesa/vbo/vbo_save.h b/src/mesa/vbo/vbo_save.h index 82ba6c8afe7..f5a407ced14 100644 --- a/src/mesa/vbo/vbo_save.h +++ b/src/mesa/vbo/vbo_save.h @@ -117,7 +117,7 @@ struct vbo_save_primitive_store { struct vbo_save_context { - GLcontext *ctx; + struct gl_context *ctx; GLvertexformat vtxfmt; struct gl_client_array arrays[VBO_ATTRIB_MAX]; const struct gl_client_array *inputs[VBO_ATTRIB_MAX]; @@ -155,13 +155,13 @@ struct vbo_save_context { #if FEATURE_dlist -void vbo_save_init( GLcontext *ctx ); -void vbo_save_destroy( GLcontext *ctx ); -void vbo_save_fallback( GLcontext *ctx, GLboolean fallback ); +void vbo_save_init( struct gl_context *ctx ); +void vbo_save_destroy( struct gl_context *ctx ); +void vbo_save_fallback( struct gl_context *ctx, GLboolean fallback ); /* save_loopback.c: */ -void vbo_loopback_vertex_list( GLcontext *ctx, +void vbo_loopback_vertex_list( struct gl_context *ctx, const GLfloat *buffer, const GLubyte *attrsz, const struct _mesa_prim *prim, @@ -171,26 +171,26 @@ void vbo_loopback_vertex_list( GLcontext *ctx, /* Callbacks: */ -void vbo_save_EndList( GLcontext *ctx ); -void vbo_save_NewList( GLcontext *ctx, GLuint list, GLenum mode ); -void vbo_save_EndCallList( GLcontext *ctx ); -void vbo_save_BeginCallList( GLcontext *ctx, struct gl_display_list *list ); -void vbo_save_SaveFlushVertices( GLcontext *ctx ); -GLboolean vbo_save_NotifyBegin( GLcontext *ctx, GLenum mode ); +void vbo_save_EndList( struct gl_context *ctx ); +void vbo_save_NewList( struct gl_context *ctx, GLuint list, GLenum mode ); +void vbo_save_EndCallList( struct gl_context *ctx ); +void vbo_save_BeginCallList( struct gl_context *ctx, struct gl_display_list *list ); +void vbo_save_SaveFlushVertices( struct gl_context *ctx ); +GLboolean vbo_save_NotifyBegin( struct gl_context *ctx, GLenum mode ); -void vbo_save_playback_vertex_list( GLcontext *ctx, void *data ); +void vbo_save_playback_vertex_list( struct gl_context *ctx, void *data ); void vbo_save_api_init( struct vbo_save_context *save ); #else /* FEATURE_dlist */ static INLINE void -vbo_save_init( GLcontext *ctx ) +vbo_save_init( struct gl_context *ctx ) { } static INLINE void -vbo_save_destroy( GLcontext *ctx ) +vbo_save_destroy( struct gl_context *ctx ) { } diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index c3727cb52ac..19c4b15d5fb 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -99,7 +99,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * NOTE: Old 'parity' issue is gone, but copying can still be * wrong-footed on replay. */ -static GLuint _save_copy_vertices( GLcontext *ctx, +static GLuint _save_copy_vertices( struct gl_context *ctx, const struct vbo_save_vertex_list *node, const GLfloat *src_buffer) { @@ -170,7 +170,7 @@ static GLuint _save_copy_vertices( GLcontext *ctx, } -static struct vbo_save_vertex_store *alloc_vertex_store( GLcontext *ctx ) +static struct vbo_save_vertex_store *alloc_vertex_store( struct gl_context *ctx ) { struct vbo_save_vertex_store *vertex_store = CALLOC_STRUCT(vbo_save_vertex_store); @@ -198,7 +198,7 @@ static struct vbo_save_vertex_store *alloc_vertex_store( GLcontext *ctx ) return vertex_store; } -static void free_vertex_store( GLcontext *ctx, struct vbo_save_vertex_store *vertex_store ) +static void free_vertex_store( struct gl_context *ctx, struct vbo_save_vertex_store *vertex_store ) { assert(!vertex_store->buffer); @@ -209,7 +209,7 @@ static void free_vertex_store( GLcontext *ctx, struct vbo_save_vertex_store *ver FREE( vertex_store ); } -static GLfloat *map_vertex_store( GLcontext *ctx, struct vbo_save_vertex_store *vertex_store ) +static GLfloat *map_vertex_store( struct gl_context *ctx, struct vbo_save_vertex_store *vertex_store ) { assert(vertex_store->bufferobj); assert(!vertex_store->buffer); @@ -222,14 +222,14 @@ static GLfloat *map_vertex_store( GLcontext *ctx, struct vbo_save_vertex_store * return vertex_store->buffer + vertex_store->used; } -static void unmap_vertex_store( GLcontext *ctx, struct vbo_save_vertex_store *vertex_store ) +static void unmap_vertex_store( struct gl_context *ctx, struct vbo_save_vertex_store *vertex_store ) { ctx->Driver.UnmapBuffer( ctx, GL_ARRAY_BUFFER_ARB, vertex_store->bufferobj ); vertex_store->buffer = NULL; } -static struct vbo_save_primitive_store *alloc_prim_store( GLcontext *ctx ) +static struct vbo_save_primitive_store *alloc_prim_store( struct gl_context *ctx ) { struct vbo_save_primitive_store *store = CALLOC_STRUCT(vbo_save_primitive_store); (void) ctx; @@ -238,7 +238,7 @@ static struct vbo_save_primitive_store *alloc_prim_store( GLcontext *ctx ) return store; } -static void _save_reset_counters( GLcontext *ctx ) +static void _save_reset_counters( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; @@ -264,7 +264,7 @@ static void _save_reset_counters( GLcontext *ctx ) /* Insert the active immediate struct onto the display list currently * being built. */ -static void _save_compile_vertex_list( GLcontext *ctx ) +static void _save_compile_vertex_list( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; struct vbo_save_vertex_list *node; @@ -391,7 +391,7 @@ static void _save_compile_vertex_list( GLcontext *ctx ) /* TODO -- If no new vertices have been stored, don't bother saving * it. */ -static void _save_wrap_buffers( GLcontext *ctx ) +static void _save_wrap_buffers( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; GLint i = save->prim_count - 1; @@ -430,7 +430,7 @@ static void _save_wrap_buffers( GLcontext *ctx ) /* Called only when buffers are wrapped as the result of filling the * vertex_store struct. */ -static void _save_wrap_filled_vertex( GLcontext *ctx ) +static void _save_wrap_filled_vertex( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; GLfloat *data = save->copied.buffer; @@ -453,7 +453,7 @@ static void _save_wrap_filled_vertex( GLcontext *ctx ) } -static void _save_copy_to_current( GLcontext *ctx ) +static void _save_copy_to_current( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; GLuint i; @@ -469,7 +469,7 @@ static void _save_copy_to_current( GLcontext *ctx ) } -static void _save_copy_from_current( GLcontext *ctx ) +static void _save_copy_from_current( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; GLint i; @@ -490,7 +490,7 @@ static void _save_copy_from_current( GLcontext *ctx ) /* Flush existing data, set new attrib size, replay copied vertices. */ -static void _save_upgrade_vertex( GLcontext *ctx, +static void _save_upgrade_vertex( struct gl_context *ctx, GLuint attr, GLuint newsz ) { @@ -586,7 +586,7 @@ static void _save_upgrade_vertex( GLcontext *ctx, } } -static void save_fixup_vertex( GLcontext *ctx, GLuint attr, GLuint sz ) +static void save_fixup_vertex( struct gl_context *ctx, GLuint attr, GLuint sz ) { struct vbo_save_context *save = &vbo_context(ctx)->save; @@ -610,7 +610,7 @@ static void save_fixup_vertex( GLcontext *ctx, GLuint attr, GLuint sz ) save->active_sz[attr] = sz; } -static void _save_reset_vertex( GLcontext *ctx ) +static void _save_reset_vertex( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; GLuint i; @@ -673,7 +673,7 @@ do { \ * -- Flush current buffer * -- Fallback to opcodes for the rest of the begin/end object. */ -static void DO_FALLBACK( GLcontext *ctx ) +static void DO_FALLBACK( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; @@ -763,7 +763,7 @@ static void GLAPIENTRY _save_CallLists( GLsizei n, GLenum type, const GLvoid *v /* This begin is hooked into ... Updating of * ctx->Driver.CurrentSavePrimitive is already taken care of. */ -GLboolean vbo_save_NotifyBegin( GLcontext *ctx, GLenum mode ) +GLboolean vbo_save_NotifyBegin( struct gl_context *ctx, GLenum mode ) { struct vbo_save_context *save = &vbo_context(ctx)->save; @@ -896,6 +896,18 @@ static void GLAPIENTRY _save_Begin( GLenum mode ) } +static void GLAPIENTRY _save_PrimitiveRestartNV( void ) +{ + GLenum curPrim; + GET_CURRENT_CONTEXT( ctx ); + + curPrim = ctx->Driver.CurrentSavePrimitive; + + _save_End(); + _save_Begin(curPrim); +} + + /* Unlike the functions above, these are to be hooked into the vtxfmt * maintained in ctx->ListState, active when the list is known or * suspected to be outside any begin/end primitive. @@ -989,7 +1001,7 @@ static void GLAPIENTRY _save_OBE_DrawRangeElements(GLenum mode, -static void _save_vtxfmt_init( GLcontext *ctx ) +static void _save_vtxfmt_init( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; GLvertexformat *vfmt = &save->vtxfmt; @@ -1003,6 +1015,7 @@ static void _save_vtxfmt_init( GLcontext *ctx ) vfmt->Color4fv = _save_Color4fv; vfmt->EdgeFlag = _save_EdgeFlag; vfmt->End = _save_End; + vfmt->PrimitiveRestartNV = _save_PrimitiveRestartNV; vfmt->FogCoordfEXT = _save_FogCoordfEXT; vfmt->FogCoordfvEXT = _save_FogCoordfvEXT; vfmt->Indexf = _save_Indexf; @@ -1074,7 +1087,7 @@ static void _save_vtxfmt_init( GLcontext *ctx ) } -void vbo_save_SaveFlushVertices( GLcontext *ctx ) +void vbo_save_SaveFlushVertices( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; @@ -1094,7 +1107,7 @@ void vbo_save_SaveFlushVertices( GLcontext *ctx ) ctx->Driver.SaveNeedFlush = 0; } -void vbo_save_NewList( GLcontext *ctx, GLuint list, GLenum mode ) +void vbo_save_NewList( struct gl_context *ctx, GLuint list, GLenum mode ) { struct vbo_save_context *save = &vbo_context(ctx)->save; @@ -1113,7 +1126,7 @@ void vbo_save_NewList( GLcontext *ctx, GLuint list, GLenum mode ) ctx->Driver.SaveNeedFlush = 0; } -void vbo_save_EndList( GLcontext *ctx ) +void vbo_save_EndList( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; @@ -1147,13 +1160,13 @@ void vbo_save_EndList( GLcontext *ctx ) assert(save->vertex_size == 0); } -void vbo_save_BeginCallList( GLcontext *ctx, struct gl_display_list *dlist ) +void vbo_save_BeginCallList( struct gl_context *ctx, struct gl_display_list *dlist ) { struct vbo_save_context *save = &vbo_context(ctx)->save; save->replay_flags |= dlist->Flags; } -void vbo_save_EndCallList( GLcontext *ctx ) +void vbo_save_EndCallList( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; @@ -1166,7 +1179,7 @@ void vbo_save_EndCallList( GLcontext *ctx ) } -static void vbo_destroy_vertex_list( GLcontext *ctx, void *data ) +static void vbo_destroy_vertex_list( struct gl_context *ctx, void *data ) { struct vbo_save_vertex_list *node = (struct vbo_save_vertex_list *)data; (void) ctx; @@ -1184,7 +1197,7 @@ static void vbo_destroy_vertex_list( GLcontext *ctx, void *data ) } -static void vbo_print_vertex_list( GLcontext *ctx, void *data ) +static void vbo_print_vertex_list( struct gl_context *ctx, void *data ) { struct vbo_save_vertex_list *node = (struct vbo_save_vertex_list *)data; GLuint i; @@ -1209,7 +1222,7 @@ static void vbo_print_vertex_list( GLcontext *ctx, void *data ) } -static void _save_current_init( GLcontext *ctx ) +static void _save_current_init( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; GLint i; @@ -1234,7 +1247,7 @@ static void _save_current_init( GLcontext *ctx ) */ void vbo_save_api_init( struct vbo_save_context *save ) { - GLcontext *ctx = save->ctx; + struct gl_context *ctx = save->ctx; GLuint i; save->opcode_vertex_list = diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index 297fd8705bf..533c150a918 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -46,7 +46,7 @@ * last vertex to the saved state */ static void -_playback_copy_to_current(GLcontext *ctx, +_playback_copy_to_current(struct gl_context *ctx, const struct vbo_save_vertex_list *node) { struct vbo_context *vbo = vbo_context(ctx); @@ -124,7 +124,7 @@ _playback_copy_to_current(GLcontext *ctx, * Treat the vertex storage as a VBO, define vertex arrays pointing * into it: */ -static void vbo_bind_vertex_list(GLcontext *ctx, +static void vbo_bind_vertex_list(struct gl_context *ctx, const struct vbo_save_vertex_list *node) { struct vbo_context *vbo = vbo_context(ctx); @@ -209,7 +209,7 @@ static void vbo_bind_vertex_list(GLcontext *ctx, static void -vbo_save_loopback_vertex_list(GLcontext *ctx, +vbo_save_loopback_vertex_list(struct gl_context *ctx, const struct vbo_save_vertex_list *list) { const char *buffer = ctx->Driver.MapBuffer(ctx, @@ -236,7 +236,7 @@ vbo_save_loopback_vertex_list(GLcontext *ctx, * a drawing command. */ void -vbo_save_playback_vertex_list(GLcontext *ctx, void *data) +vbo_save_playback_vertex_list(struct gl_context *ctx, void *data) { const struct vbo_save_vertex_list *node = (const struct vbo_save_vertex_list *) data; diff --git a/src/mesa/vbo/vbo_save_loopback.c b/src/mesa/vbo/vbo_save_loopback.c index 5d1c7e48102..b1cfa9c2a8f 100644 --- a/src/mesa/vbo/vbo_save_loopback.c +++ b/src/mesa/vbo/vbo_save_loopback.c @@ -39,29 +39,29 @@ #if FEATURE_dlist -typedef void (*attr_func)( GLcontext *ctx, GLint target, const GLfloat * ); +typedef void (*attr_func)( struct gl_context *ctx, GLint target, const GLfloat * ); /* This file makes heavy use of the aliasing of NV vertex attributes * with the legacy attributes, and also with ARB and Material * attributes as currently implemented. */ -static void VertexAttrib1fvNV(GLcontext *ctx, GLint target, const GLfloat *v) +static void VertexAttrib1fvNV(struct gl_context *ctx, GLint target, const GLfloat *v) { CALL_VertexAttrib1fvNV(ctx->Exec, (target, v)); } -static void VertexAttrib2fvNV(GLcontext *ctx, GLint target, const GLfloat *v) +static void VertexAttrib2fvNV(struct gl_context *ctx, GLint target, const GLfloat *v) { CALL_VertexAttrib2fvNV(ctx->Exec, (target, v)); } -static void VertexAttrib3fvNV(GLcontext *ctx, GLint target, const GLfloat *v) +static void VertexAttrib3fvNV(struct gl_context *ctx, GLint target, const GLfloat *v) { CALL_VertexAttrib3fvNV(ctx->Exec, (target, v)); } -static void VertexAttrib4fvNV(GLcontext *ctx, GLint target, const GLfloat *v) +static void VertexAttrib4fvNV(struct gl_context *ctx, GLint target, const GLfloat *v) { CALL_VertexAttrib4fvNV(ctx->Exec, (target, v)); } @@ -83,7 +83,7 @@ struct loopback_attr { * wrapped vertices. If we get here, it's probably because the * precalculated wrapping is wrong. */ -static void loopback_prim( GLcontext *ctx, +static void loopback_prim( struct gl_context *ctx, const GLfloat *buffer, const struct _mesa_prim *prim, GLuint wrap_count, @@ -138,7 +138,7 @@ static void loopback_prim( GLcontext *ctx, * normally, otherwise need to track and discard the generated * primitives. */ -static void loopback_weak_prim( GLcontext *ctx, +static void loopback_weak_prim( struct gl_context *ctx, const struct _mesa_prim *prim ) { /* Use the prim_weak flag to ensure that if this primitive @@ -155,7 +155,7 @@ static void loopback_weak_prim( GLcontext *ctx, } -void vbo_loopback_vertex_list( GLcontext *ctx, +void vbo_loopback_vertex_list( struct gl_context *ctx, const GLfloat *buffer, const GLubyte *attrsz, const struct _mesa_prim *prim, diff --git a/src/mesa/vbo/vbo_split.c b/src/mesa/vbo/vbo_split.c index ce40cbbcc3d..54b2539b8ec 100644 --- a/src/mesa/vbo/vbo_split.c +++ b/src/mesa/vbo/vbo_split.c @@ -98,7 +98,7 @@ GLboolean split_prim_inplace(GLenum mode, GLuint *first, GLuint *incr) -void vbo_split_prims( GLcontext *ctx, +void vbo_split_prims( struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, diff --git a/src/mesa/vbo/vbo_split.h b/src/mesa/vbo/vbo_split.h index 05888d048cb..b7f0a9c5769 100644 --- a/src/mesa/vbo/vbo_split.h +++ b/src/mesa/vbo/vbo_split.h @@ -49,7 +49,7 @@ */ GLboolean split_prim_inplace(GLenum mode, GLuint *first, GLuint *incr); -void vbo_split_inplace( GLcontext *ctx, +void vbo_split_inplace( struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, @@ -61,7 +61,7 @@ void vbo_split_inplace( GLcontext *ctx, /* Requires ib != NULL: */ -void vbo_split_copy( GLcontext *ctx, +void vbo_split_copy( struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, diff --git a/src/mesa/vbo/vbo_split_copy.c b/src/mesa/vbo/vbo_split_copy.c index 2ec7d9b0fe3..26d0046e83d 100644 --- a/src/mesa/vbo/vbo_split_copy.c +++ b/src/mesa/vbo/vbo_split_copy.c @@ -49,7 +49,7 @@ */ struct copy_context { - GLcontext *ctx; + struct gl_context *ctx; const struct gl_client_array **array; const struct _mesa_prim *prim; GLuint nr_prims; @@ -137,7 +137,7 @@ check_flush( struct copy_context *copy ) * Dump the parameters/info for a vbo->draw() call. */ static void -dump_draw_info(GLcontext *ctx, +dump_draw_info(struct gl_context *ctx, const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, @@ -419,7 +419,7 @@ replay_elts( struct copy_context *copy ) static void replay_init( struct copy_context *copy ) { - GLcontext *ctx = copy->ctx; + struct gl_context *ctx = copy->ctx; GLuint i; GLuint offset; const GLvoid *srcptr; @@ -548,7 +548,7 @@ replay_init( struct copy_context *copy ) static void replay_finish( struct copy_context *copy ) { - GLcontext *ctx = copy->ctx; + struct gl_context *ctx = copy->ctx; GLuint i; /* Free our vertex and index buffers: @@ -577,7 +577,7 @@ replay_finish( struct copy_context *copy ) /** * Split VBO into smaller pieces, draw the pieces. */ -void vbo_split_copy( GLcontext *ctx, +void vbo_split_copy( struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, diff --git a/src/mesa/vbo/vbo_split_inplace.c b/src/mesa/vbo/vbo_split_inplace.c index 2fc866c5773..789cf31364b 100644 --- a/src/mesa/vbo/vbo_split_inplace.c +++ b/src/mesa/vbo/vbo_split_inplace.c @@ -41,7 +41,7 @@ * that. */ struct split_context { - GLcontext *ctx; + struct gl_context *ctx; const struct gl_client_array **array; const struct _mesa_prim *prim; GLuint nr_prims; @@ -249,7 +249,7 @@ static void split_prims( struct split_context *split) } -void vbo_split_inplace( GLcontext *ctx, +void vbo_split_inplace( struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, |