From 49993a1a9dc34b78ccd345b91087385917a40138 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 1 May 2013 19:15:33 -0600 Subject: mesa: simplify dispatch for glDraw* functions Remove all the glDraw* functions from the GLvertexformat structure. The point of that dispatch struct is to handle all the functions which dispatch differently depending on whether we're inside glBegin/End. glDraw* are never allowed inside glBegin/End so we can remove those entries. This simplifies the code paths and gets rid of quite a bit of code. Reviewed-by: Jose Fonseca --- src/mesa/vbo/vbo_exec.c | 2 - src/mesa/vbo/vbo_exec.h | 3 - src/mesa/vbo/vbo_exec_array.c | 36 --------- src/mesa/vbo/vbo_noop.c | 58 -------------- src/mesa/vbo/vbo_save_api.c | 173 ------------------------------------------ 5 files changed, 272 deletions(-) (limited to 'src/mesa/vbo') diff --git a/src/mesa/vbo/vbo_exec.c b/src/mesa/vbo/vbo_exec.c index 926e7b46ddb..2ff1c149412 100644 --- a/src/mesa/vbo/vbo_exec.c +++ b/src/mesa/vbo/vbo_exec.c @@ -48,7 +48,6 @@ void vbo_exec_init( struct gl_context *ctx ) return; vbo_exec_vtx_init( exec ); - vbo_exec_array_init( exec ); ctx->Driver.NeedFlush = 0; ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END; @@ -69,7 +68,6 @@ void vbo_exec_destroy( struct gl_context *ctx ) } vbo_exec_vtx_destroy( exec ); - vbo_exec_array_destroy( exec ); } diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h index bd3ab3ba6f3..01e2856f2bc 100644 --- a/src/mesa/vbo/vbo_exec.h +++ b/src/mesa/vbo/vbo_exec.h @@ -152,9 +152,6 @@ void vbo_exec_FlushVertices( struct gl_context *ctx, GLuint flags ); /* Internal functions: */ -void vbo_exec_array_init( struct vbo_exec_context *exec ); -void vbo_exec_array_destroy( struct vbo_exec_context *exec ); - void vbo_exec_vtx_init( struct vbo_exec_context *exec ); void vbo_exec_vtx_destroy( struct vbo_exec_context *exec ); diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 875c203ac6e..18011ec125e 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -1364,42 +1364,6 @@ vbo_exec_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name, vbo_draw_transform_feedback(ctx, mode, obj, stream, primcount); } -/** - * Plug in the immediate-mode vertex array drawing commands into the - * givven vbo_exec_context object. - */ -void -vbo_exec_array_init( struct vbo_exec_context *exec ) -{ - exec->vtxfmt.DrawArrays = vbo_exec_DrawArrays; - exec->vtxfmt.DrawElements = vbo_exec_DrawElements; - exec->vtxfmt.DrawRangeElements = vbo_exec_DrawRangeElements; - exec->vtxfmt.MultiDrawElementsEXT = vbo_exec_MultiDrawElements; - exec->vtxfmt.DrawElementsBaseVertex = vbo_exec_DrawElementsBaseVertex; - exec->vtxfmt.DrawRangeElementsBaseVertex = vbo_exec_DrawRangeElementsBaseVertex; - exec->vtxfmt.MultiDrawElementsBaseVertex = vbo_exec_MultiDrawElementsBaseVertex; - exec->vtxfmt.DrawArraysInstanced = vbo_exec_DrawArraysInstanced; - exec->vtxfmt.DrawArraysInstancedBaseInstance = vbo_exec_DrawArraysInstancedBaseInstance; - exec->vtxfmt.DrawElementsInstanced = vbo_exec_DrawElementsInstanced; - exec->vtxfmt.DrawElementsInstancedBaseInstance = vbo_exec_DrawElementsInstancedBaseInstance; - exec->vtxfmt.DrawElementsInstancedBaseVertex = vbo_exec_DrawElementsInstancedBaseVertex; - exec->vtxfmt.DrawElementsInstancedBaseVertexBaseInstance = vbo_exec_DrawElementsInstancedBaseVertexBaseInstance; - exec->vtxfmt.DrawTransformFeedback = vbo_exec_DrawTransformFeedback; - exec->vtxfmt.DrawTransformFeedbackStream = - vbo_exec_DrawTransformFeedbackStream; - exec->vtxfmt.DrawTransformFeedbackInstanced = - vbo_exec_DrawTransformFeedbackInstanced; - exec->vtxfmt.DrawTransformFeedbackStreamInstanced = - vbo_exec_DrawTransformFeedbackStreamInstanced; -} - - -void -vbo_exec_array_destroy( struct vbo_exec_context *exec ) -{ - /* nothing to do */ -} - /** * Initialize the dispatch table with the VBO functions for drawing. diff --git a/src/mesa/vbo/vbo_noop.c b/src/mesa/vbo/vbo_noop.c index bc43bc9e63c..41046e54db4 100644 --- a/src/mesa/vbo/vbo_noop.c +++ b/src/mesa/vbo/vbo_noop.c @@ -353,56 +353,6 @@ _mesa_noop_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) } -static void GLAPIENTRY -_mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count) -{ -} - -static void GLAPIENTRY -_mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type, - const GLvoid * indices) -{ -} - -static void GLAPIENTRY -_mesa_noop_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, - const GLvoid * indices, GLint basevertex) -{ -} - - -static void GLAPIENTRY -_mesa_noop_DrawRangeElements(GLenum mode, - GLuint start, GLuint end, - GLsizei count, GLenum type, - const GLvoid * indices) -{ -} - -static void GLAPIENTRY -_mesa_noop_MultiDrawElements(GLenum mode, const GLsizei * count, GLenum type, - const GLvoid ** indices, GLsizei primcount) -{ -} - -static void GLAPIENTRY -_mesa_noop_DrawRangeElementsBaseVertex(GLenum mode, - GLuint start, GLuint end, - GLsizei count, GLenum type, - const GLvoid * indices, - GLint basevertex) -{ -} - -static void GLAPIENTRY -_mesa_noop_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei * count, - GLenum type, - const GLvoid * const *indices, - GLsizei primcount, - const GLint * basevertex) -{ -} - static void GLAPIENTRY _mesa_noop_EvalMesh1(GLenum mode, GLint i1, GLint i2) { @@ -496,14 +446,6 @@ _mesa_noop_vtxfmt_init(GLvertexformat * vfmt) vfmt->VertexAttrib4fvARB = _mesa_noop_VertexAttrib4fvARB; vfmt->Rectf = _mesa_noop_Rectf; - - vfmt->DrawArrays = _mesa_noop_DrawArrays; - vfmt->DrawElements = _mesa_noop_DrawElements; - vfmt->DrawRangeElements = _mesa_noop_DrawRangeElements; - vfmt->MultiDrawElementsEXT = _mesa_noop_MultiDrawElements; - vfmt->DrawElementsBaseVertex = _mesa_noop_DrawElementsBaseVertex; - vfmt->DrawRangeElementsBaseVertex = _mesa_noop_DrawRangeElementsBaseVertex; - vfmt->MultiDrawElementsBaseVertex = _mesa_noop_MultiDrawElementsBaseVertex; } diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index 8644df828d4..a174ded2d29 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -993,162 +993,6 @@ _save_End(void) } -/* These are all errors as this vtxfmt is only installed inside - * begin/end pairs. - */ -static void GLAPIENTRY -_save_DrawElements(GLenum mode, GLsizei count, GLenum type, - const GLvoid * indices) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; - (void) count; - (void) type; - (void) indices; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, "glDrawElements"); -} - - -static void GLAPIENTRY -_save_DrawRangeElements(GLenum mode, GLuint start, GLuint end, - GLsizei count, GLenum type, const GLvoid * indices) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; - (void) start; - (void) end; - (void) count; - (void) type; - (void) indices; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, "glDrawRangeElements"); -} - - -static void GLAPIENTRY -_save_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, - const GLvoid * indices, GLint basevertex) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; - (void) count; - (void) type; - (void) indices; - (void) basevertex; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, "glDrawElements"); -} - - -static void GLAPIENTRY -_save_DrawRangeElementsBaseVertex(GLenum mode, - GLuint start, - GLuint end, - GLsizei count, - GLenum type, - const GLvoid * indices, GLint basevertex) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; - (void) start; - (void) end; - (void) count; - (void) type; - (void) indices; - (void) basevertex; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, "glDrawRangeElements"); -} - - -static void GLAPIENTRY -_save_DrawArrays(GLenum mode, GLint start, GLsizei count) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; - (void) start; - (void) count; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, "glDrawArrays"); -} - - -static void GLAPIENTRY -_save_MultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, - const GLvoid **indices, GLsizei primcount) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; - (void) count; - (void) type; - (void) indices; - (void) primcount; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, "glMultiDrawElements"); -} - - -static void GLAPIENTRY -_save_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, - GLenum type, const GLvoid * const *indices, - GLsizei primcount, const GLint *basevertex) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; - (void) count; - (void) type; - (void) indices; - (void) primcount; - (void) basevertex; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, - "glMultiDrawElementsBaseVertex"); -} - - -static void GLAPIENTRY -_save_DrawTransformFeedback(GLenum mode, GLuint name) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; - (void) name; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, "glDrawTransformFeedback"); -} - - -static void GLAPIENTRY -_save_DrawTransformFeedbackStream(GLenum mode, GLuint name, GLuint stream) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; - (void) name; - (void) stream; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, - "glDrawTransformFeedbackStream"); -} - - -static void GLAPIENTRY -_save_DrawTransformFeedbackInstanced(GLenum mode, GLuint name, - GLsizei primcount) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; - (void) name; - (void) primcount; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, - "glDrawTransformFeedbackInstanced"); -} - - -static void GLAPIENTRY -_save_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name, - GLuint stream, GLsizei primcount) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; - (void) name; - (void) stream; - (void) primcount; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, - "glDrawTransformFeedbackStreamInstanced"); -} - - static void GLAPIENTRY _save_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) { @@ -1535,18 +1379,6 @@ _save_vtxfmt_init(struct gl_context *ctx) */ vfmt->Begin = _save_Begin; vfmt->Rectf = _save_Rectf; - vfmt->DrawArrays = _save_DrawArrays; - vfmt->DrawElements = _save_DrawElements; - vfmt->DrawRangeElements = _save_DrawRangeElements; - vfmt->DrawElementsBaseVertex = _save_DrawElementsBaseVertex; - vfmt->DrawRangeElementsBaseVertex = _save_DrawRangeElementsBaseVertex; - vfmt->MultiDrawElementsEXT = _save_MultiDrawElements; - vfmt->MultiDrawElementsBaseVertex = _save_MultiDrawElementsBaseVertex; - vfmt->DrawTransformFeedback = _save_DrawTransformFeedback; - vfmt->DrawTransformFeedbackStream = _save_DrawTransformFeedbackStream; - vfmt->DrawTransformFeedbackInstanced = _save_DrawTransformFeedbackInstanced; - vfmt->DrawTransformFeedbackStreamInstanced = - _save_DrawTransformFeedbackStreamInstanced; } @@ -1762,9 +1594,4 @@ vbo_save_api_init(struct vbo_save_context *save) * ctx->ListState. */ ctx->ListState.ListVtxfmt.Rectf = _save_OBE_Rectf; - ctx->ListState.ListVtxfmt.DrawArrays = _save_OBE_DrawArrays; - ctx->ListState.ListVtxfmt.DrawElements = _save_OBE_DrawElements; - ctx->ListState.ListVtxfmt.DrawRangeElements = _save_OBE_DrawRangeElements; - ctx->ListState.ListVtxfmt.MultiDrawElementsEXT = _save_OBE_MultiDrawElements; - ctx->ListState.ListVtxfmt.MultiDrawElementsBaseVertex = _save_OBE_MultiDrawElementsBaseVertex; } -- cgit v1.2.3