core | glapi | vbo | math | shader | swrast | swrast_setup | tnl | tnl_dd

bufferobj.h File Reference

#include "context.h"

Functions

static INLINE GLboolean _mesa_bufferobj_mapped (const struct gl_buffer_object *obj)
 Is the given buffer object currently mapped?
static INLINE GLboolean _mesa_is_bufferobj (const struct gl_buffer_object *obj)
 Is the given buffer object a user-created buffer object? Mesa uses default buffer objects in several places.
void _mesa_init_buffer_objects (GLcontext *ctx)
 Initialize the state associated with buffer objects.
void _mesa_update_default_objects_buffer_objects (GLcontext *ctx)
 Update the default buffer objects in the given context to reference those specified in the shared state and release those referencing the old shared state.
struct gl_buffer_object_mesa_lookup_bufferobj (GLcontext *ctx, GLuint buffer)
 Return the gl_buffer_object for the given ID.
void _mesa_initialize_buffer_object (struct gl_buffer_object *obj, GLuint name, GLenum target)
 Initialize a buffer object to default values.
void _mesa_reference_buffer_object (GLcontext *ctx, struct gl_buffer_object **ptr, struct gl_buffer_object *bufObj)
 Set ptr to bufObj w/ reference counting.
GLboolean _mesa_validate_pbo_access (GLuint dimensions, 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.
const GLvoid * _mesa_map_pbo_source (GLcontext *ctx, const struct gl_pixelstore_attrib *unpack, const GLvoid *src)
 For commands that read from a PBO (glDrawPixels, glTexImage, glPolygonStipple, etc), if we're reading from a PBO, map it read-only and return the pointer into the PBO.
const GLvoid * _mesa_map_validate_pbo_source (GLcontext *ctx, GLuint dimensions, const struct gl_pixelstore_attrib *unpack, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *ptr, const char *where)
 Combine PBO-read validation and mapping.
void _mesa_unmap_pbo_source (GLcontext *ctx, const struct gl_pixelstore_attrib *unpack)
 Counterpart to _mesa_map_pbo_source().
void * _mesa_map_pbo_dest (GLcontext *ctx, const struct gl_pixelstore_attrib *pack, GLvoid *dest)
 For commands that write to a PBO (glReadPixels, glGetColorTable, etc), if we're writing to a PBO, map it write-only and return the pointer into the PBO.
GLvoid * _mesa_map_validate_pbo_dest (GLcontext *ctx, GLuint dimensions, const struct gl_pixelstore_attrib *unpack, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *ptr, const char *where)
 Combine PBO-write validation and mapping.
void _mesa_unmap_pbo_dest (GLcontext *ctx, const struct gl_pixelstore_attrib *pack)
 Counterpart to _mesa_map_pbo_dest().
void _mesa_init_buffer_object_functions (struct dd_function_table *driver)
 Plug default/fallback buffer object functions into the device driver hooks.
void GLAPIENTRY _mesa_BindBufferARB (GLenum target, GLuint buffer)
void GLAPIENTRY _mesa_DeleteBuffersARB (GLsizei n, const GLuint *buffer)
 Delete a set of buffer objects.
void GLAPIENTRY _mesa_GenBuffersARB (GLsizei n, GLuint *buffer)
 Generate a set of unique buffer object IDs and store them in buffer.
GLboolean GLAPIENTRY _mesa_IsBufferARB (GLuint buffer)
 Determine if ID is the name of a buffer object.
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)
void GLAPIENTRY _mesa_CopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
void *GLAPIENTRY _mesa_MapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
 See GL_ARB_map_buffer_range spec.
void GLAPIENTRY _mesa_FlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length)
 See GL_ARB_map_buffer_range spec.


Function Documentation

void GLAPIENTRY _mesa_BindBufferARB ( GLenum  target,
GLuint  buffer 
)

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

static INLINE GLboolean _mesa_bufferobj_mapped ( const struct gl_buffer_object obj  )  [static]

Is the given buffer object currently mapped?

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

void GLAPIENTRY _mesa_CopyBufferSubData ( GLenum  readTarget,
GLenum  writeTarget,
GLintptr  readOffset,
GLintptr  writeOffset,
GLsizeiptr  size 
)

void GLAPIENTRY _mesa_DeleteBuffersARB ( GLsizei  n,
const GLuint *  ids 
)

Delete a set of buffer objects.

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

void GLAPIENTRY _mesa_FlushMappedBufferRange ( GLenum  target,
GLintptr  offset,
GLsizeiptr  length 
)

See GL_ARB_map_buffer_range spec.

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_object_functions ( struct dd_function_table driver  ) 

Plug default/fallback buffer object functions into the device driver hooks.

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.

static INLINE GLboolean _mesa_is_bufferobj ( const struct gl_buffer_object obj  )  [static]

Is the given buffer object a user-created buffer object? Mesa uses default buffer objects in several places.

Default buffers always have Name==0. User created buffers have Name!=0.

GLboolean GLAPIENTRY _mesa_IsBufferARB ( GLuint  id  ) 

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.

struct gl_buffer_object* _mesa_lookup_bufferobj ( GLcontext ctx,
GLuint  buffer 
) [read]

Return the gl_buffer_object for the given ID.

Always return NULL for ID 0.

void* _mesa_map_pbo_dest ( GLcontext ctx,
const struct gl_pixelstore_attrib pack,
GLvoid *  dest 
)

For commands that write to a PBO (glReadPixels, glGetColorTable, etc), if we're writing to a PBO, map it write-only and return the pointer into the PBO.

If we're not writing to a PBO, return dst as-is. If non-null return, must call _mesa_unmap_pbo_dest() when done.

Returns:
NULL if error, else pointer to start of data

const GLvoid* _mesa_map_pbo_source ( GLcontext ctx,
const struct gl_pixelstore_attrib unpack,
const GLvoid *  src 
)

For commands that read from a PBO (glDrawPixels, glTexImage, glPolygonStipple, etc), if we're reading from a PBO, map it read-only and return the pointer into the PBO.

If we're not reading from a PBO, return src as-is. If non-null return, must call _mesa_unmap_pbo_source() when done.

Returns:
NULL if error, else pointer to start of data

GLvoid* _mesa_map_validate_pbo_dest ( GLcontext ctx,
GLuint  dimensions,
const struct gl_pixelstore_attrib unpack,
GLsizei  width,
GLsizei  height,
GLsizei  depth,
GLenum  format,
GLenum  type,
GLvoid *  ptr,
const char *  where 
)

Combine PBO-write validation and mapping.

If any GL errors are detected, they'll be recorded and NULL returned.

See also:
_mesa_validate_pbo_access

_mesa_map_pbo_dest A call to this function should have a matching call to _mesa_unmap_pbo_dest().

const GLvoid* _mesa_map_validate_pbo_source ( GLcontext ctx,
GLuint  dimensions,
const struct gl_pixelstore_attrib unpack,
GLsizei  width,
GLsizei  height,
GLsizei  depth,
GLenum  format,
GLenum  type,
const GLvoid *  ptr,
const char *  where 
)

Combine PBO-read validation and mapping.

If any GL errors are detected, they'll be recorded and NULL returned.

See also:
_mesa_validate_pbo_access

_mesa_map_pbo_source A call to this function should have a matching call to _mesa_unmap_pbo_source().

void* GLAPIENTRY _mesa_MapBufferARB ( GLenum  target,
GLenum  access 
)

void* GLAPIENTRY _mesa_MapBufferRange ( GLenum  target,
GLintptr  offset,
GLsizeiptr  length,
GLbitfield  access 
)

See GL_ARB_map_buffer_range spec.

void _mesa_reference_buffer_object ( GLcontext ctx,
struct gl_buffer_object **  ptr,
struct gl_buffer_object bufObj 
)

Set ptr to bufObj w/ reference counting.

void _mesa_unmap_pbo_dest ( GLcontext ctx,
const struct gl_pixelstore_attrib pack 
)

Counterpart to _mesa_map_pbo_dest().

void _mesa_unmap_pbo_source ( GLcontext ctx,
const struct gl_pixelstore_attrib unpack 
)

Counterpart to _mesa_map_pbo_source().

GLboolean GLAPIENTRY _mesa_UnmapBufferARB ( GLenum  target  ) 

void _mesa_update_default_objects_buffer_objects ( GLcontext ctx  ) 

Update the default buffer objects in the given context to reference those specified in the shared state and release those referencing the old shared state.

GLboolean _mesa_validate_pbo_access ( GLuint  dimensions,
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.

XXX This would also be a convenient time to check that the PBO isn't currently mapped. Whoever calls this function should check for that. Remember, we can't use a PBO when it's mapped!

If we're not using a PBO, this is a no-op.

Parameters:
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.


Generated on Sun Sep 27 06:47:45 2009 for Mesa Main by  doxygen 1.5.4