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

texobj.h File Reference


Detailed Description

Texture object management.

#include "mtypes.h"

Functions

Internal functions
struct gl_texture_object_mesa_lookup_texture (GLcontext *ctx, GLuint id)
 Return the gl_texture_object for a given ID.
struct gl_texture_object_mesa_new_texture_object (GLcontext *ctx, GLuint name, GLenum target)
 Allocate and initialize a new texture object.
void _mesa_initialize_texture_object (struct gl_texture_object *obj, GLuint name, GLenum target)
 Initialize a new texture object to default values.
void _mesa_delete_texture_object (GLcontext *ctx, struct gl_texture_object *obj)
 Deallocate a texture object struct.
void _mesa_copy_texture_object (struct gl_texture_object *dest, const struct gl_texture_object *src)
 Copy texture object state from one texture object to another.
void _mesa_clear_texture_object (GLcontext *ctx, struct gl_texture_object *obj)
 Clear all texture images of the given texture object.
void _mesa_reference_texobj (struct gl_texture_object **ptr, struct gl_texture_object *tex)
 Reference (or unreference) a texture object.
void _mesa_test_texobj_completeness (const GLcontext *ctx, struct gl_texture_object *obj)
 Examine a texture object to determine if it is complete.
void _mesa_dirty_texobj (GLcontext *ctx, struct gl_texture_object *texObj, GLboolean invalidate_state)
 Mark a texture object dirty.
struct gl_texture_object_mesa_get_fallback_texture (GLcontext *ctx)
 Return pointer to a default/fallback texture.
void _mesa_unlock_context_textures (GLcontext *ctx)
void _mesa_lock_context_textures (GLcontext *ctx)
 Simplest implementation of texture locking: grab the shared tex mutex.
API functions
void GLAPIENTRY _mesa_GenTextures (GLsizei n, GLuint *textures)
 Generate texture names.
void GLAPIENTRY _mesa_DeleteTextures (GLsizei n, const GLuint *textures)
 Delete named textures.
void GLAPIENTRY _mesa_BindTexture (GLenum target, GLuint texture)
 Bind a named texture to a texturing target.
void GLAPIENTRY _mesa_PrioritizeTextures (GLsizei n, const GLuint *textures, const GLclampf *priorities)
 Set texture priorities.
GLboolean GLAPIENTRY _mesa_AreTexturesResident (GLsizei n, const GLuint *textures, GLboolean *residences)
 See if textures are loaded in texture memory.
GLboolean GLAPIENTRY _mesa_IsTexture (GLuint texture)
 See if a name corresponds to a texture.


Function Documentation

GLboolean GLAPIENTRY _mesa_AreTexturesResident ( GLsizei  n,
const GLuint *  texName,
GLboolean *  residences 
)

See if textures are loaded in texture memory.

Parameters:
n number of textures to query.
texName array with the texture names.
residences array which will hold the residence status.
Returns:
GL_TRUE if all textures are resident and residences is left unchanged,
See also:
glAreTexturesResident().
Looks up each texture in the hash and calls dd_function_table::IsTextureResident.

void GLAPIENTRY _mesa_BindTexture ( GLenum  target,
GLuint  texName 
)

Bind a named texture to a texturing target.

Parameters:
target texture target.
texName texture name.
See also:
glBindTexture().
Determines the old texture object bound and returns immediately if rebinding the same texture. Get the current texture which is either a default texture if name is null, a named texture from the hash, or a new texture if the given texture name is new. Increments its reference count, binds it, and calls dd_function_table::BindTexture. Decrements the old texture reference count and deletes it if it reaches zero.

void _mesa_clear_texture_object ( GLcontext ctx,
struct gl_texture_object texObj 
)

Clear all texture images of the given texture object.

Parameters:
ctx GL context.
t texture object.
See also:
_mesa_clear_texture_image().

void _mesa_copy_texture_object ( struct gl_texture_object dest,
const struct gl_texture_object src 
)

Copy texture object state from one texture object to another.

Use for glPush/PopAttrib.

Parameters:
dest destination texture object.
src source texture object.

void _mesa_delete_texture_object ( GLcontext ctx,
struct gl_texture_object texObj 
)

Deallocate a texture object struct.

It should have already been removed from the texture object pool. Called via ctx->Driver.DeleteTexture() if not overriden by a driver.

Parameters:
shared the shared GL state to which the object belongs.
texObj the texture object to delete.

void GLAPIENTRY _mesa_DeleteTextures ( GLsizei  n,
const GLuint *  textures 
)

Delete named textures.

Parameters:
n number of textures to be deleted.
textures array of texture IDs to be deleted.
See also:
glDeleteTextures().
If we're about to delete a texture that's currently bound to any texture unit, unbind the texture first. Decrement the reference count on the texture object and delete it if it's zero. Recall that texture objects can be shared among several rendering contexts.

void _mesa_dirty_texobj ( GLcontext ctx,
struct gl_texture_object texObj,
GLboolean  invalidate_state 
)

Mark a texture object dirty.

It forces the object to be incomplete and optionally forces the context to re-validate its state.

Parameters:
ctx GL context.
texObj texture object.
invalidate_state also invalidate context state.

void GLAPIENTRY _mesa_GenTextures ( GLsizei  n,
GLuint *  textures 
)

Generate texture names.

Parameters:
n number of texture names to be generated.
textures an array in which will hold the generated texture names.
See also:
glGenTextures().
Calls _mesa_HashFindFreeKeyBlock() to find a block of free texture IDs which are stored in textures. Corresponding empty texture objects are also generated.

struct gl_texture_object* _mesa_get_fallback_texture ( GLcontext ctx  )  [read]

Return pointer to a default/fallback texture.

The texture is a 2D 8x8 RGBA texture with all texels = (0,0,0,1). That's the value a sampler should get when sampling from an incomplete texture.

void _mesa_initialize_texture_object ( struct gl_texture_object obj,
GLuint  name,
GLenum  target 
)

Initialize a new texture object to default values.

Parameters:
obj the texture object
name the texture name
target the texture target

GLboolean GLAPIENTRY _mesa_IsTexture ( GLuint  texture  ) 

See if a name corresponds to a texture.

Parameters:
texture texture name.
Returns:
GL_TRUE if texture name corresponds to a texture, or GL_FALSE otherwise.
See also:
glIsTexture().
Calls _mesa_HashLookup().

void _mesa_lock_context_textures ( GLcontext ctx  ) 

Simplest implementation of texture locking: grab the shared tex mutex.

Examine the shared context state timestamp and if there has been a change, set the appropriate bits in ctx->NewState.

This is used to deal with synchronizing things when a texture object is used/modified by different contexts (or threads) which are sharing the texture.

See also _mesa_lock/unlock_texture() in teximage.h

struct gl_texture_object* _mesa_lookup_texture ( GLcontext ctx,
GLuint  id 
) [read]

Return the gl_texture_object for a given ID.

struct gl_texture_object* _mesa_new_texture_object ( GLcontext ctx,
GLuint  name,
GLenum  target 
) [read]

Allocate and initialize a new texture object.

But don't put it into the texture object hash table.

Called via ctx->Driver.NewTextureObject, unless overridden by a device driver.

Parameters:
shared the shared GL state structure to contain the texture object
name integer name for the texture object
target either GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D, GL_TEXTURE_CUBE_MAP_ARB or GL_TEXTURE_RECTANGLE_NV. zero is ok for the sake of GenTextures()
Returns:
pointer to new texture object.

void GLAPIENTRY _mesa_PrioritizeTextures ( GLsizei  n,
const GLuint *  texName,
const GLclampf *  priorities 
)

Set texture priorities.

Parameters:
n number of textures.
texName texture names.
priorities corresponding texture priorities.
See also:
glPrioritizeTextures().
Looks up each texture in the hash, clamps the corresponding priority between 0.0 and 1.0, and calls dd_function_table::PrioritizeTexture.

void _mesa_reference_texobj ( struct gl_texture_object **  ptr,
struct gl_texture_object tex 
)

Reference (or unreference) a texture object.

If '*ptr', decrement *ptr's refcount (and delete if it becomes zero). If 'tex' is non-null, increment its refcount.

void _mesa_test_texobj_completeness ( const GLcontext ctx,
struct gl_texture_object t 
)

Examine a texture object to determine if it is complete.

The gl_texture_object::Complete flag will be set to GL_TRUE or GL_FALSE accordingly.

Parameters:
ctx GL context.
t texture object.
According to the texture target, verifies that each of the mipmaps is present and has the expected size.

void _mesa_unlock_context_textures ( GLcontext ctx  ) 


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