[Mesa-dev] [PATCH 05/10] vbo: add new vbo_initialize_exec_dispatch(), vbo_initialize_save_dispatch()
Brian Paul
brianp at vmware.com
Sun Apr 28 14:42:26 PDT 2013
First step in simplifying the vertex array / glDraw dispatch code.
---
src/mesa/vbo/vbo.h | 9 +++++++++
src/mesa/vbo/vbo_exec_array.c | 41 +++++++++++++++++++++++++++++++++++++++++
src/mesa/vbo/vbo_save_api.c | 18 ++++++++++++++++++
3 files changed, 68 insertions(+), 0 deletions(-)
diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h
index 5639272..9f800d8 100644
--- a/src/mesa/vbo/vbo.h
+++ b/src/mesa/vbo/vbo.h
@@ -73,6 +73,15 @@ void _vbo_DestroyContext( struct gl_context *ctx );
void _vbo_InvalidateState( struct gl_context *ctx, GLuint new_state );
+void
+vbo_initialize_exec_dispatch(const struct gl_context *ctx,
+ struct _glapi_table *exec);
+
+void
+vbo_initialize_save_dispatch(const struct gl_context *ctx,
+ struct _glapi_table *exec);
+
+
typedef void (*vbo_draw_func)( struct gl_context *ctx,
const struct _mesa_prim *prims,
GLuint nr_prims,
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 7e61f7b..0cbc406 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -30,6 +30,7 @@
#include "main/context.h"
#include "main/state.h"
#include "main/api_validate.h"
+#include "main/dispatch.h"
#include "main/varray.h"
#include "main/bufferobj.h"
#include "main/enums.h"
@@ -1396,6 +1397,46 @@ vbo_exec_array_destroy( struct vbo_exec_context *exec )
}
+/**
+ * Initialize the dispatch table with the VBO functions for drawing.
+ */
+void
+vbo_initialize_exec_dispatch(const struct gl_context *ctx,
+ struct _glapi_table *exec)
+{
+ SET_DrawArrays(exec, vbo_exec_DrawArrays);
+ SET_DrawElements(exec, vbo_exec_DrawElements);
+
+ if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
+ SET_DrawRangeElements(exec, vbo_exec_DrawRangeElements);
+ }
+
+ SET_MultiDrawElementsEXT(exec, vbo_exec_MultiDrawElements);
+
+ if (_mesa_is_desktop_gl(ctx)) {
+ SET_DrawElementsBaseVertex(exec, vbo_exec_DrawElementsBaseVertex);
+ SET_DrawRangeElementsBaseVertex(exec, vbo_exec_DrawRangeElementsBaseVertex);
+ SET_MultiDrawElementsBaseVertex(exec, vbo_exec_MultiDrawElementsBaseVertex);
+ SET_DrawArraysInstancedBaseInstance(exec, vbo_exec_DrawArraysInstancedBaseInstance);
+ SET_DrawElementsInstancedBaseInstance(exec, vbo_exec_DrawElementsInstancedBaseInstance);
+ SET_DrawElementsInstancedBaseVertex(exec, vbo_exec_DrawElementsInstancedBaseVertex);
+ SET_DrawElementsInstancedBaseVertexBaseInstance(exec, vbo_exec_DrawElementsInstancedBaseVertexBaseInstance);
+ }
+
+ if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
+ SET_DrawArraysInstancedARB(exec, vbo_exec_DrawArraysInstanced);
+ SET_DrawElementsInstancedARB(exec, vbo_exec_DrawElementsInstanced);
+ }
+
+ if (_mesa_is_desktop_gl(ctx)) {
+ SET_DrawTransformFeedback(exec, vbo_exec_DrawTransformFeedback);
+ SET_DrawTransformFeedbackStream(exec, vbo_exec_DrawTransformFeedbackStream);
+ SET_DrawTransformFeedbackInstanced(exec, vbo_exec_DrawTransformFeedbackInstanced);
+ SET_DrawTransformFeedbackStreamInstanced(exec, vbo_exec_DrawTransformFeedbackStreamInstanced);
+ }
+}
+
+
/**
* The following functions are only used for OpenGL ES 1/2 support.
diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
index f7beab7..8644df8 100644
--- a/src/mesa/vbo/vbo_save_api.c
+++ b/src/mesa/vbo/vbo_save_api.c
@@ -1550,6 +1550,24 @@ _save_vtxfmt_init(struct gl_context *ctx)
}
+/**
+ * Initialize the dispatch table with the VBO functions for display
+ * list compilation.
+ */
+void
+vbo_initialize_save_dispatch(const struct gl_context *ctx,
+ struct _glapi_table *exec)
+{
+ SET_DrawArrays(exec, _save_OBE_DrawArrays);
+ SET_DrawElements(exec, _save_OBE_DrawElements);
+ SET_DrawRangeElements(exec, _save_OBE_DrawRangeElements);
+ SET_MultiDrawElementsEXT(exec, _save_OBE_MultiDrawElements);
+ SET_MultiDrawElementsBaseVertex(exec, _save_OBE_MultiDrawElementsBaseVertex);
+ /* Note: other glDraw functins aren't compiled into display lists */
+}
+
+
+
void
vbo_save_SaveFlushVertices(struct gl_context *ctx)
{
--
1.7.3.4
More information about the mesa-dev
mailing list