diff options
author | Brian Paul <[email protected]> | 2009-06-19 10:00:03 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-06-19 10:00:03 -0600 |
commit | 331eb58f68db26b54f706a908a3e1424a461b709 (patch) | |
tree | fcb32c0bb0b891fe43a1583b275432f9263abc01 | |
parent | 6629a35559ff7e3b993966f697f7c7f68e5a38d9 (diff) |
mesa: make buffer object-related driver fallback functions static
Plug them in via _mesa_init_buffer_object_functions().
-rw-r--r-- | src/mesa/drivers/common/driverfuncs.c | 19 | ||||
-rw-r--r-- | src/mesa/main/bufferobj.c | 46 | ||||
-rw-r--r-- | src/mesa/main/bufferobj.h | 48 |
3 files changed, 40 insertions, 73 deletions
diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index edc069deeeb..6c6b19538bd 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -202,21 +202,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->GetIntegerv = NULL; driver->GetPointerv = NULL; -#if FEATURE_ARB_vertex_buffer_object - driver->NewBufferObject = _mesa_new_buffer_object; - driver->DeleteBuffer = _mesa_delete_buffer_object; - driver->BindBuffer = NULL; - driver->BufferData = _mesa_buffer_data; - driver->BufferSubData = _mesa_buffer_subdata; - driver->GetBufferSubData = _mesa_buffer_get_subdata; - driver->MapBuffer = _mesa_buffer_map; - driver->UnmapBuffer = _mesa_buffer_unmap; -#endif - -#if FEATURE_ARB_map_buffer_range - driver->MapBufferRange = _mesa_buffer_map_range; - driver->FlushMappedBufferRange = _mesa_buffer_flush_mapped_range; -#endif + _mesa_init_buffer_object_functions(driver); #if FEATURE_EXT_framebuffer_object driver->NewFramebuffer = _mesa_new_framebuffer; @@ -243,9 +229,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->DeleteArrayObject = _mesa_delete_array_object; driver->BindArrayObject = NULL; - /* GL_ARB_copy_buffer */ - driver->CopyBufferSubData = _mesa_copy_buffer_subdata; - /* T&L stuff */ driver->NeedValidate = GL_FALSE; driver->ValidateTnlModule = NULL; diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index ba19e58cdb7..d640f5358e5 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -180,7 +180,7 @@ buffer_object_subdata_range_good( GLcontext * ctx, GLenum target, * * Default callback for the \c dd_function_table::NewBufferObject() hook. */ -struct gl_buffer_object * +static struct gl_buffer_object * _mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target ) { struct gl_buffer_object *obj; @@ -198,7 +198,7 @@ _mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target ) * * Default callback for the \c dd_function_table::DeleteBuffer() hook. */ -void +static void _mesa_delete_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ) { (void) ctx; @@ -316,7 +316,7 @@ _mesa_initialize_buffer_object( struct gl_buffer_object *obj, * * \sa glBufferDataARB, dd_function_table::BufferData. */ -void +static void _mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage, struct gl_buffer_object * bufObj ) @@ -355,7 +355,7 @@ _mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size, * * \sa glBufferSubDataARB, dd_function_table::BufferSubData. */ -void +static void _mesa_buffer_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data, struct gl_buffer_object * bufObj ) @@ -388,7 +388,7 @@ _mesa_buffer_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, * * \sa glBufferGetSubDataARB, dd_function_table::GetBufferSubData. */ -void +static void _mesa_buffer_get_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data, struct gl_buffer_object * bufObj ) @@ -415,7 +415,7 @@ _mesa_buffer_get_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, * * \sa glMapBufferARB, dd_function_table::MapBuffer */ -void * +static void * _mesa_buffer_map( GLcontext *ctx, GLenum target, GLenum access, struct gl_buffer_object *bufObj ) { @@ -436,7 +436,7 @@ _mesa_buffer_map( GLcontext *ctx, GLenum target, GLenum access, * Default fallback for \c dd_function_table::MapBufferRange(). * Called via glMapBufferRange(). */ -void * +static void * _mesa_buffer_map_range( GLcontext *ctx, GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, struct gl_buffer_object *bufObj ) @@ -455,7 +455,7 @@ _mesa_buffer_map_range( GLcontext *ctx, GLenum target, GLintptr offset, * Default fallback for \c dd_function_table::FlushMappedBufferRange(). * Called via glFlushMappedBufferRange(). */ -void +static void _mesa_buffer_flush_mapped_range( GLcontext *ctx, GLenum target, GLintptr offset, GLsizeiptr length, struct gl_buffer_object *obj ) @@ -476,7 +476,7 @@ _mesa_buffer_flush_mapped_range( GLcontext *ctx, GLenum target, * * \sa glUnmapBufferARB, dd_function_table::UnmapBuffer */ -GLboolean +static GLboolean _mesa_buffer_unmap( GLcontext *ctx, GLenum target, struct gl_buffer_object *bufObj ) { @@ -492,7 +492,7 @@ _mesa_buffer_unmap( GLcontext *ctx, GLenum target, * Default fallback for \c dd_function_table::CopyBufferSubData(). * Called via glCopyBuffserSubData(). */ -void +static void _mesa_copy_buffer_subdata(GLcontext *ctx, struct gl_buffer_object *src, struct gl_buffer_object *dst, @@ -863,6 +863,32 @@ unbind(GLcontext *ctx, } +/** + * Plug default/fallback buffer object functions into the device + * driver hooks. + */ +void +_mesa_init_buffer_object_functions(struct dd_function_table *driver) +{ + /* GL_ARB_vertex/pixel_buffer_object */ + driver->NewBufferObject = _mesa_new_buffer_object; + driver->DeleteBuffer = _mesa_delete_buffer_object; + driver->BindBuffer = NULL; + driver->BufferData = _mesa_buffer_data; + driver->BufferSubData = _mesa_buffer_subdata; + driver->GetBufferSubData = _mesa_buffer_get_subdata; + driver->MapBuffer = _mesa_buffer_map; + driver->UnmapBuffer = _mesa_buffer_unmap; + + /* GL_ARB_map_buffer_range */ + driver->MapBufferRange = _mesa_buffer_map_range; + driver->FlushMappedBufferRange = _mesa_buffer_flush_mapped_range; + + /* GL_ARB_copy_buffer */ + driver->CopyBufferSubData = _mesa_copy_buffer_subdata; +} + + /**********************************************************************/ /* API Functions */ diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h index a8e2dcef933..ef59ff83c84 100644 --- a/src/mesa/main/bufferobj.h +++ b/src/mesa/main/bufferobj.h @@ -42,11 +42,6 @@ _mesa_init_buffer_objects( GLcontext *ctx ); extern void _mesa_update_default_objects_buffer_objects(GLcontext *ctx); -extern struct gl_buffer_object * -_mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target ); - -extern void -_mesa_delete_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ); extern struct gl_buffer_object * _mesa_lookup_bufferobj(GLcontext *ctx, GLuint buffer); @@ -60,46 +55,6 @@ _mesa_reference_buffer_object(GLcontext *ctx, struct gl_buffer_object **ptr, struct gl_buffer_object *bufObj); -extern void -_mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size, - const GLvoid * data, GLenum usage, - struct gl_buffer_object * bufObj ); - -extern void -_mesa_buffer_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, - GLsizeiptrARB size, const GLvoid * data, - struct gl_buffer_object * bufObj ); - -extern void -_mesa_buffer_get_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, - GLsizeiptrARB size, GLvoid * data, - struct gl_buffer_object * bufObj ); - -extern void * -_mesa_buffer_map( GLcontext *ctx, GLenum target, GLenum access, - struct gl_buffer_object * bufObj ); - -extern void * -_mesa_buffer_map_range( GLcontext *ctx, GLenum target, GLintptr offset, - GLsizeiptr length, GLbitfield access, - struct gl_buffer_object *bufObj ); - -extern void -_mesa_buffer_flush_mapped_range( GLcontext *ctx, GLenum target, - GLintptr offset, GLsizeiptr length, - struct gl_buffer_object *obj ); - -extern GLboolean -_mesa_buffer_unmap( GLcontext *ctx, GLenum target, - struct gl_buffer_object * bufObj ); - -extern void -_mesa_copy_buffer_subdata(GLcontext *ctx, - struct gl_buffer_object *src, - struct gl_buffer_object *dst, - GLintptr readOffset, GLintptr writeOffset, - GLsizeiptr size); - extern GLboolean _mesa_validate_pbo_access(GLuint dimensions, const struct gl_pixelstore_attrib *pack, @@ -134,6 +89,9 @@ _mesa_unmap_readpix_pbo(GLcontext *ctx, const struct gl_pixelstore_attrib *pack); +extern void +_mesa_init_buffer_object_functions(struct dd_function_table *driver); + /* * API functions |