#include "context.h"
#include "bufferobj.h"
+
struct gl_buffer_object {
GLint RefCount;
GLuint Name;
void * data;
};
-void _mesa_initialize_buffer_object( struct gl_buffer_object *obj,
- GLuint name, GLenum target );
-
/**
* Get the buffer object bound to the specified target in a GL context.
* specified context or \c NULL if \c target is invalid or no
* buffer object is bound.
*/
-
-static __inline struct gl_buffer_object *
-_mesa_buffer_object_get_target( GLcontext *ctx, GLenum target,
- const char * str )
+static INLINE struct gl_buffer_object *
+buffer_object_get_target( GLcontext *ctx, GLenum target, const char * str )
{
struct gl_buffer_object * bufObj = NULL;
*
* \sa glBufferSubDataARB, glGetBufferSubDataARB
*/
-
static struct gl_buffer_object *
-_mesa_buffer_object_subdata_range_good( GLcontext * ctx, GLenum target,
- GLintptrARB offset, GLsizeiptrARB size,
- const char * str )
+buffer_object_subdata_range_good( GLcontext * ctx, GLenum target,
+ GLintptrARB offset, GLsizeiptrARB size,
+ const char * str )
{
struct gl_buffer_object *bufObj;
return NULL;
}
- bufObj = _mesa_buffer_object_get_target( ctx, target, str );
+ bufObj = buffer_object_get_target( ctx, target, str );
if ( bufObj == NULL ) {
return NULL;
}
* This function is intended to be called via
* \c dd_function_table::NewBufferObject.
*/
-
struct gl_buffer_object *
_mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target )
{
/**
* Initialize a buffer object to default values.
*/
-
void
_mesa_initialize_buffer_object( struct gl_buffer_object *obj,
GLuint name, GLenum target )
/**
* Add the given buffer object to the buffer object pool.
*/
-
void
_mesa_save_buffer_object( GLcontext *ctx, struct gl_buffer_object *obj )
{
* Remove the given buffer object from the buffer object pool.
* Do not deallocate the buffer object though.
*/
-
void
_mesa_remove_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj )
{
*
* \sa glBufferDataARB, dd_function_table::BufferData.
*/
-
void
_mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size,
const GLvoid * data, GLenum usage,
*
* \sa glBufferSubDataARB, dd_function_table::BufferSubData.
*/
-
void
_mesa_buffer_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset,
GLsizeiptrARB size, const GLvoid * data,
*
* \sa glBufferGetSubDataARB, dd_function_table::GetBufferSubData.
*/
-
void
_mesa_buffer_get_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset,
GLsizeiptrARB size, GLvoid * data,
*
* \sa glMapBufferARB, dd_function_table::MapBuffer
*/
-
void *
_mesa_buffer_map( GLcontext *ctx, GLenum target, GLenum access,
struct gl_buffer_object * bufObj )
struct gl_buffer_object *newBufObj = 0;
ASSERT_OUTSIDE_BEGIN_END(ctx);
- oldBufObj = _mesa_buffer_object_get_target( ctx, target, "BindBufferARB" );
+ oldBufObj = buffer_object_get_target( ctx, target, "BindBufferARB" );
if ( (oldBufObj != NULL) && (oldBufObj->Name == buffer) )
return; /* rebinding the same buffer object- no change */
* \param n Number of buffer objects to delete.
* \param buffer Array of \c n buffer object IDs.
*/
-
void
_mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
{
* \param n Number of IDs to generate.
* \param buffer Array of \c n locations to store the IDs.
*/
-
void
_mesa_GenBuffersARB(GLsizei n, GLuint *buffer)
{
* \return \c GL_TRUE if \c id is the name of a buffer object,
* \c GL_FALSE otherwise.
*/
-
GLboolean
_mesa_IsBufferARB(GLuint id)
{
return;
}
- bufObj = _mesa_buffer_object_get_target( ctx, target, "BufferDataARB" );
+ bufObj = buffer_object_get_target( ctx, target, "BufferDataARB" );
if ( bufObj == NULL ) {
return;
}
(*ctx->Driver.BufferData)( ctx, target, size, data, usage, bufObj );
}
+
void
_mesa_BufferSubDataARB(GLenum target, GLintptrARB offset,
GLsizeiptrARB size, const GLvoid * data)
struct gl_buffer_object *bufObj;
ASSERT_OUTSIDE_BEGIN_END(ctx);
- bufObj = _mesa_buffer_object_subdata_range_good( ctx, target, offset, size,
- "BufferSubDataARB" );
+ bufObj = buffer_object_subdata_range_good( ctx, target, offset, size,
+ "BufferSubDataARB" );
if ( bufObj != NULL ) {
ASSERT(ctx->Driver.BufferSubData);
(*ctx->Driver.BufferSubData)( ctx, target, offset, size, data, bufObj );
}
}
+
void
_mesa_GetBufferSubDataARB(GLenum target, GLintptrARB offset,
GLsizeiptrARB size, void * data)
struct gl_buffer_object *bufObj;
ASSERT_OUTSIDE_BEGIN_END(ctx);
- bufObj = _mesa_buffer_object_subdata_range_good( ctx, target, offset, size,
- "GetBufferSubDataARB" );
+ bufObj = buffer_object_subdata_range_good( ctx, target, offset, size,
+ "GetBufferSubDataARB" );
if ( bufObj != NULL ) {
ASSERT(ctx->Driver.GetBufferSubData);
(*ctx->Driver.GetBufferSubData)( ctx, target, offset, size, data, bufObj );
}
}
+
void *
_mesa_MapBufferARB(GLenum target, GLenum access)
{
return NULL;
}
- bufObj = _mesa_buffer_object_get_target( ctx, target,
- "MapBufferARB" );
+ bufObj = buffer_object_get_target( ctx, target, "MapBufferARB" );
if ( bufObj == NULL ) {
return NULL;
}
return bufObj->pointer;
}
+
GLboolean
_mesa_UnmapBufferARB(GLenum target)
{
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
- bufObj = _mesa_buffer_object_get_target( ctx, target,
- "UnmapBufferARB" );
+ bufObj = buffer_object_get_target( ctx, target, "UnmapBufferARB" );
if ( bufObj == NULL ) {
return GL_FALSE;
}
return status;
}
+
void
_mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params)
{
struct gl_buffer_object *bufObj;
ASSERT_OUTSIDE_BEGIN_END(ctx);
- bufObj = _mesa_buffer_object_get_target( ctx, target,
- "GetBufferParameterivARB" );
+ bufObj = buffer_object_get_target( ctx, target, "GetBufferParameterivARB" );
if ( bufObj == NULL ) {
return;
}
}
}
+
void
_mesa_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params)
{
return;
}
- bufObj = _mesa_buffer_object_get_target( ctx, target,
- "GetBufferPointervARB" );
+ bufObj = buffer_object_get_target( ctx, target, "GetBufferPointervARB" );
if ( bufObj == NULL ) {
return;
}
#define BUFFEROBJ_H
+/*
+ * Internal functions
+ */
+
+extern void
+_mesa_initialize_buffer_object( struct gl_buffer_object *obj,
+ GLuint name, GLenum target );
+
+extern struct gl_buffer_object *
+_mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target );
+
+extern void
+_mesa_initialize_buffer_object( struct gl_buffer_object *obj,
+ GLuint name, GLenum target );
+
+extern void
+_mesa_save_buffer_object( GLcontext *ctx, struct gl_buffer_object *obj );
+
+extern void
+_mesa_remove_buffer_object( GLcontext *ctx, 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 );
+
+
+
+/*
+ * API functions
+ */
+
extern void
_mesa_BindBufferARB(GLenum target, GLuint buffer);