[Mesa-dev] [PATCH 5/8] mesa/es: Pass context to _mesa_init_bufferobj_dispatch
Ian Romanick
idr at freedesktop.org
Mon Aug 13 18:23:58 PDT 2012
From: Ian Romanick <ian.d.romanick at intel.com>
With this change _mesa_init_bufferobj_dispatch won't set function
pointers that don't exist in OpenGL ES.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/mesa/main/api_exec.c | 2 +-
src/mesa/main/bufferobj.c | 10 +++++++---
src/mesa/main/bufferobj.h | 3 ++-
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c
index 51fb520..66c4a67 100644
--- a/src/mesa/main/api_exec.c
+++ b/src/mesa/main/api_exec.c
@@ -653,7 +653,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
#endif
/* ARB 28. GL_ARB_vertex_buffer_object */
- _mesa_init_bufferobj_dispatch(exec);
+ _mesa_init_bufferobj_dispatch(ctx, exec);
/* ARB 29. GL_ARB_occlusion_query */
_mesa_init_queryobj_dispatch(exec);
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 22d7927..396408f 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -2201,7 +2201,7 @@ _mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer)
}
void
-_mesa_init_bufferobj_dispatch(struct _glapi_table *disp)
+_mesa_init_bufferobj_dispatch(struct gl_context *ctx, struct _glapi_table *disp)
{
SET_BindBufferARB(disp, _mesa_BindBufferARB);
SET_BufferDataARB(disp, _mesa_BufferDataARB);
@@ -2214,6 +2214,10 @@ _mesa_init_bufferobj_dispatch(struct _glapi_table *disp)
SET_IsBufferARB(disp, _mesa_IsBufferARB);
SET_MapBufferARB(disp, _mesa_MapBufferARB);
SET_UnmapBufferARB(disp, _mesa_UnmapBufferARB);
- SET_BindBufferRangeEXT(disp, _mesa_BindBufferRange);
- SET_BindBufferBaseEXT(disp, _mesa_BindBufferBase);
+
+ if (ctx->API == API_OPENGL || ctx->API == API_OPENGL_CORE
+ || (ctx->API == API_OPENGLES2 && ctx->Version >= 30)) {
+ SET_BindBufferRangeEXT(disp, _mesa_BindBufferRange);
+ SET_BindBufferBaseEXT(disp, _mesa_BindBufferBase);
+ }
}
diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
index e1d0f7a..15fdb9c 100644
--- a/src/mesa/main/bufferobj.h
+++ b/src/mesa/main/bufferobj.h
@@ -167,6 +167,7 @@ _mesa_BindBufferRange(GLenum target, GLuint index,
GLuint buffer, GLintptr offset, GLsizeiptr size);
extern void
-_mesa_init_bufferobj_dispatch(struct _glapi_table *disp);
+_mesa_init_bufferobj_dispatch(struct gl_context *ctx,
+ struct _glapi_table *disp);
#endif
--
1.7.6.5
More information about the mesa-dev
mailing list