core  array_cache  math  swrast  swrast_setup  tnl  tnl_dd 
Main Page   Data Structures   File List   Data Fields   Globals   Related Pages  

bufferobj.c File Reference

Functions for the GL_ARB_vertex_buffer_object extension. More...

#include "glheader.h"
#include "hash.h"
#include "imports.h"
#include "image.h"
#include "context.h"
#include "bufferobj.h"

Functions

INLINE struct gl_buffer_objectbuffer_object_get_target (GLcontext *ctx, GLenum target, const char *str)
 Get the buffer object bound to the specified target in a GL context. More...

gl_buffer_objectbuffer_object_subdata_range_good (GLcontext *ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, const char *str)
 Tests the subdata range parameters and sets the GL error code for glBufferSubDataARB and glGetBufferSubDataARB. More...

gl_buffer_object_mesa_new_buffer_object (GLcontext *ctx, GLuint name, GLenum target)
 Allocate and initialize a new buffer object. More...

void _mesa_delete_buffer_object (GLcontext *ctx, struct gl_buffer_object *bufObj)
 Delete a buffer object. More...

void _mesa_initialize_buffer_object (struct gl_buffer_object *obj, GLuint name, GLenum target)
 Initialize a buffer object to default values. More...

void _mesa_save_buffer_object (GLcontext *ctx, struct gl_buffer_object *obj)
 Add the given buffer object to the buffer object pool. More...

void _mesa_remove_buffer_object (GLcontext *ctx, struct gl_buffer_object *bufObj)
 Remove the given buffer object from the buffer object pool. More...

void _mesa_buffer_data (GLcontext *ctx, GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage, struct gl_buffer_object *bufObj)
 Allocate space for and store data in a buffer object. More...

void _mesa_buffer_subdata (GLcontext *ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data, struct gl_buffer_object *bufObj)
 Replace data in a subrange of buffer object. More...

void _mesa_buffer_get_subdata (GLcontext *ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data, struct gl_buffer_object *bufObj)
 Retrieve data from a subrange of buffer object. More...

void_mesa_buffer_map (GLcontext *ctx, GLenum target, GLenum access, struct gl_buffer_object *bufObj)
 Maps the private data buffer into the processor's address space. More...

void _mesa_init_buffer_objects (GLcontext *ctx)
 Initialize the state associated with buffer objects. More...

GLboolean _mesa_validate_pbo_access (const struct gl_pixelstore_attrib *pack, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *ptr)
 When we're about to read pixel data out of a PBO (via glDrawPixels, glTexImage, etc) or write data into a PBO (via glReadPixels, glGetTexImage, etc) we call this function to check that we're not going to read out of bounds. More...

void GLAPIENTRY _mesa_BindBufferARB (GLenum target, GLuint buffer)
void GLAPIENTRY _mesa_DeleteBuffersARB (GLsizei n, const GLuint *ids)
 Delete a set of buffer objects. More...

void GLAPIENTRY _mesa_GenBuffersARB (GLsizei n, GLuint *buffer)
 Generate a set of unique buffer object IDs and store them in buffer. More...

GLboolean GLAPIENTRY _mesa_IsBufferARB (GLuint id)
 Determine if ID is the name of a buffer object. More...

void GLAPIENTRY _mesa_BufferDataARB (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage)
void GLAPIENTRY _mesa_BufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data)
void GLAPIENTRY _mesa_GetBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, void *data)
void *GLAPIENTRY _mesa_MapBufferARB (GLenum target, GLenum access)
GLboolean GLAPIENTRY _mesa_UnmapBufferARB (GLenum target)
void GLAPIENTRY _mesa_GetBufferParameterivARB (GLenum target, GLenum pname, GLint *params)
void GLAPIENTRY _mesa_GetBufferPointervARB (GLenum target, GLenum pname, GLvoid **params)


Detailed Description

Functions for the GL_ARB_vertex_buffer_object extension.

Author:
Brian Paul, Ian Romanick

Function Documentation

void GLAPIENTRY _mesa_BindBufferARB GLenum    target,
GLuint    buffer
 

void _mesa_buffer_data GLcontext   ctx,
GLenum    target,
GLsizeiptrARB    size,
const GLvoid *    data,
GLenum    usage,
struct gl_buffer_object   bufObj
 

Allocate space for and store data in a buffer object.

Any data that was previously stored in the buffer object is lost. If data is NULL, memory will be allocated, but no copy will occur.

This function is intended to be called via dd_function_table::BufferData. This function need not set GL error codes. The input parameters will have been tested before calling.

Parameters:
ctx  GL context.
target  Buffer object target on which to operate.
size  Size, in bytes, of the new data store.
data  Pointer to the data to store in the buffer object. This pointer may be NULL.
usage  Hints about how the data will be used.
bufObj  Object to be used.
See also:
glBufferDataARB, dd_function_table::BufferData.

void _mesa_buffer_get_subdata GLcontext   ctx,
GLenum    target,
GLintptrARB    offset,
GLsizeiptrARB    size,
GLvoid *    data,
struct gl_buffer_object   bufObj
 

Retrieve data from a subrange of buffer object.

If the data range specified by size + offset extends beyond the end of the buffer or if data is NULL, no copy is performed.

This function is intended to be called by dd_function_table::BufferGetSubData. This function need not set GL error codes. The input parameters will have been tested before calling.

Parameters:
ctx  GL context.
target  Buffer object target on which to operate.
offset  Offset of the first byte to be modified.
size  Size, in bytes, of the data range.
data  Pointer to the data to store in the buffer object.
bufObj  Object to be used.
See also:
glBufferGetSubDataARB, dd_function_table::GetBufferSubData.

void* _mesa_buffer_map GLcontext   ctx,
GLenum    target,
GLenum    access,
struct gl_buffer_object   bufObj
 

Maps the private data buffer into the processor's address space.

This function is intended to be called by dd_function_table::MapBuffer. This function need not set GL error codes. The input parameters will have been tested before calling.

Parameters:
ctx  GL context.
target  Buffer object target on which to operate.
access  Information about how the buffer will be accessed.
bufObj  Object to be used.
Returns:
A pointer to the object's internal data store that can be accessed by the processor
See also:
glMapBufferARB, dd_function_table::MapBuffer

void _mesa_buffer_subdata GLcontext   ctx,
GLenum    target,
GLintptrARB    offset,
GLsizeiptrARB    size,
const GLvoid *    data,
struct gl_buffer_object   bufObj
 

Replace data in a subrange of buffer object.

If the data range specified by size + offset extends beyond the end of the buffer or if data is NULL, no copy is performed.

This function is intended to be called by dd_function_table::BufferSubData. This function need not set GL error codes. The input parameters will have been tested before calling.

Parameters:
ctx  GL context.
target  Buffer object target on which to operate.
offset  Offset of the first byte to be modified.
size  Size, in bytes, of the data range.
data  Pointer to the data to store in the buffer object.
bufObj  Object to be used.
See also:
glBufferSubDataARB, dd_function_table::BufferSubData.

void GLAPIENTRY _mesa_BufferDataARB GLenum    target,
GLsizeiptrARB    size,
const GLvoid *    data,
GLenum    usage
 

void GLAPIENTRY _mesa_BufferSubDataARB GLenum    target,
GLintptrARB    offset,
GLsizeiptrARB    size,
const GLvoid *    data
 

void _mesa_delete_buffer_object GLcontext   ctx,
struct gl_buffer_object   bufObj
 

Delete a buffer object.

This function is intended to be called via dd_function_table::DeleteBuffer.

void GLAPIENTRY _mesa_DeleteBuffersARB GLsizei    n,
const GLuint *    buffer
 

Delete a set of buffer objects.

Parameters:
n  Number of buffer objects to delete.
buffer  Array of n buffer object IDs.

void GLAPIENTRY _mesa_GenBuffersARB GLsizei    n,
GLuint *    buffer
 

Generate a set of unique buffer object IDs and store them in buffer.

Parameters:
n  Number of IDs to generate.
buffer  Array of n locations to store the IDs.

void GLAPIENTRY _mesa_GetBufferParameterivARB GLenum    target,
GLenum    pname,
GLint *    params
 

void GLAPIENTRY _mesa_GetBufferPointervARB GLenum    target,
GLenum    pname,
GLvoid **    params
 

void GLAPIENTRY _mesa_GetBufferSubDataARB GLenum    target,
GLintptrARB    offset,
GLsizeiptrARB    size,
void   data
 

void _mesa_init_buffer_objects GLcontext   ctx
 

Initialize the state associated with buffer objects.

void _mesa_initialize_buffer_object struct gl_buffer_object   obj,
GLuint    name,
GLenum    target
 

Initialize a buffer object to default values.

GLboolean GLAPIENTRY _mesa_IsBufferARB GLuint    buffer
 

Determine if ID is the name of a buffer object.

Parameters:
id  ID of the potential buffer object.
Returns:
GL_TRUE if id is the name of a buffer object, GL_FALSE otherwise.

void* GLAPIENTRY _mesa_MapBufferARB GLenum    target,
GLenum    access
 

struct gl_buffer_object* _mesa_new_buffer_object GLcontext   ctx,
GLuint    name,
GLenum    target
 

Allocate and initialize a new buffer object.

This function is intended to be called via dd_function_table::NewBufferObject.

void _mesa_remove_buffer_object GLcontext   ctx,
struct gl_buffer_object   bufObj
 

Remove the given buffer object from the buffer object pool.

Do not deallocate the buffer object though.

void _mesa_save_buffer_object GLcontext   ctx,
struct gl_buffer_object   obj
 

Add the given buffer object to the buffer object pool.

GLboolean GLAPIENTRY _mesa_UnmapBufferARB GLenum    target
 

GLboolean _mesa_validate_pbo_access const struct gl_pixelstore_attrib   pack,
GLsizei    width,
GLsizei    height,
GLsizei    depth,
GLenum    format,
GLenum    type,
const GLvoid *    ptr
 

When we're about to read pixel data out of a PBO (via glDrawPixels, glTexImage, etc) or write data into a PBO (via glReadPixels, glGetTexImage, etc) we call this function to check that we're not going to read out of bounds.

Parameters:
ctx  the rendering context
width  width of image to read/write
height  height of image to read/write
depth  depth of image to read/write
format  format of image to read/write
type  datatype of image to read/write
ptr  the user-provided pointer/offset
Returns:
GL_TRUE if the PBO access is OK, GL_FALSE if the access would go out of bounds.

INLINE struct gl_buffer_object* buffer_object_get_target GLcontext   ctx,
GLenum    target,
const char *    str
[static]
 

Get the buffer object bound to the specified target in a GL context.

Parameters:
ctx  GL context
target  Buffer object target to be retrieved. Currently this must be either GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER.
str  Name of caller for logging errors.
Returns:
A pointer to the buffer object bound to target in the specified context or NULL if target is invalid or no buffer object is bound.

struct gl_buffer_object* buffer_object_subdata_range_good GLcontext   ctx,
GLenum    target,
GLintptrARB    offset,
GLsizeiptrARB    size,
const char *    str
[static]
 

Tests the subdata range parameters and sets the GL error code for glBufferSubDataARB and glGetBufferSubDataARB.

Parameters:
ctx  GL context.
target  Buffer object target on which to operate.
offset  Offset of the first byte of the subdata range.
size  Size, in bytes, of the subdata range.
str  Name of caller for logging errors.
Returns:
A pointer to the buffer object bound to target in the specified context or NULL if any of the parameter or state conditions for glBufferSubDataARB or glGetBufferSubDataARB are invalid.
See also:
glBufferSubDataARB, glGetBufferSubDataARB


Generated on Sun May 16 15:55:11 2004 for Mesa Core by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001