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

teximage.h File Reference


Detailed Description

Texture images manipulation functions.

#include "mtypes.h"

Functions

void * _mesa_alloc_texmemory (GLsizei bytes)
 We allocate texture memory on 512-byte boundaries so we can use MMX/SSE elsewhere.
void _mesa_free_texmemory (void *m)
 Free texture memory allocated with _mesa_alloc_texmemory().
Internal functions
GLint _mesa_base_tex_format (GLcontext *ctx, GLint internalFormat)
 Return the simple base format for a given internal texture format.
GLboolean _mesa_is_proxy_texture (GLenum target)
 Test if a target is a proxy target.
struct gl_texture_image_mesa_new_texture_image (GLcontext *ctx)
 Allocate a texture image structure.
void _mesa_delete_texture_image (GLcontext *ctx, struct gl_texture_image *teximage)
 Free texture image.
void _mesa_free_texture_image_data (GLcontext *ctx, struct gl_texture_image *texImage)
 Free texture image data.
void _mesa_init_teximage_fields (GLcontext *ctx, GLenum target, struct gl_texture_image *img, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum internalFormat)
 Initialize basic fields of the gl_texture_image struct.
void _mesa_clear_texture_image (GLcontext *ctx, struct gl_texture_image *texImage)
 Free and clear fields of the gl_texture_image struct.
void _mesa_set_tex_image (struct gl_texture_object *tObj, GLenum target, GLint level, struct gl_texture_image *texImage)
 Store a gl_texture_image pointer in a gl_texture_object structure according to the target and level parameters.
struct gl_texture_object_mesa_select_tex_object (GLcontext *ctx, const struct gl_texture_unit *texUnit, GLenum target)
 Get the texture object that corresponds to the target of the given texture unit.
struct gl_texture_image_mesa_select_tex_image (GLcontext *ctx, const struct gl_texture_object *texObj, GLenum target, GLint level)
 Get a texture image pointer from a texture object, given a texture target and mipmap level.
struct gl_texture_image_mesa_get_tex_image (GLcontext *ctx, struct gl_texture_object *texObj, GLenum target, GLint level)
 Like _mesa_select_tex_image() but if the image doesn't exist, allocate it and install it.
struct gl_texture_image_mesa_get_proxy_tex_image (GLcontext *ctx, GLenum target, GLint level)
 Return pointer to the specified proxy texture image.
GLint _mesa_max_texture_levels (GLcontext *ctx, GLenum target)
 Get the maximum number of allowed mipmap levels.
GLboolean _mesa_test_proxy_teximage (GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLenum format, GLenum type, GLint width, GLint height, GLint depth, GLint border)
 This is the fallback for Driver.TestProxyTexImage().
GLuint _mesa_tex_target_to_face (GLenum target)
 For cube map faces, return a face index in [0,5].
static INLINE void _mesa_lock_texture (GLcontext *ctx, struct gl_texture_object *texObj)
 Lock a texture for updating.
static INLINE void _mesa_unlock_texture (GLcontext *ctx, struct gl_texture_object *texObj)
API entry point functions
void GLAPIENTRY _mesa_TexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
void GLAPIENTRY _mesa_TexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
void GLAPIENTRY _mesa_TexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
void GLAPIENTRY _mesa_TexImage3DEXT (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
void GLAPIENTRY _mesa_TexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
void GLAPIENTRY _mesa_TexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
void GLAPIENTRY _mesa_TexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
void GLAPIENTRY _mesa_CopyTexImage1D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
void GLAPIENTRY _mesa_CopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
void GLAPIENTRY _mesa_CopyTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
void GLAPIENTRY _mesa_CopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
void GLAPIENTRY _mesa_CopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
void GLAPIENTRY _mesa_CompressedTexImage1DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)
void GLAPIENTRY _mesa_CompressedTexImage2DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
void GLAPIENTRY _mesa_CompressedTexImage3DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
void GLAPIENTRY _mesa_CompressedTexSubImage1DARB (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)
void GLAPIENTRY _mesa_CompressedTexSubImage2DARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
void GLAPIENTRY _mesa_CompressedTexSubImage3DARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)


Function Documentation

void* _mesa_alloc_texmemory ( GLsizei  bytes  ) 

We allocate texture memory on 512-byte boundaries so we can use MMX/SSE elsewhere.

GLint _mesa_base_tex_format ( GLcontext ctx,
GLint  internalFormat 
)

Return the simple base format for a given internal texture format.

For example, given GL_LUMINANCE12_ALPHA4, return GL_LUMINANCE_ALPHA.

Parameters:
ctx GL context.
internalFormat the internal texture format token or 1, 2, 3, or 4.
Returns:
the corresponding base internal format (GL_ALPHA, GL_LUMINANCE, GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, or GL_RGBA), or -1 if invalid enum.
This is the format which is used during texture application (i.e. the texture format and env mode determine the arithmetic used.

XXX this could be static

void _mesa_clear_texture_image ( GLcontext ctx,
struct gl_texture_image texImage 
)

Free and clear fields of the gl_texture_image struct.

Parameters:
ctx GL context.
texImage texture image structure to be cleared.
After the call, texImage will have no data associated with it. Its fields are cleared so that its parent object will test incomplete.

void GLAPIENTRY _mesa_CompressedTexImage1DARB ( GLenum  target,
GLint  level,
GLenum  internalformat,
GLsizei  width,
GLint  border,
GLsizei  imageSize,
const GLvoid *  data 
)

void GLAPIENTRY _mesa_CompressedTexImage2DARB ( GLenum  target,
GLint  level,
GLenum  internalformat,
GLsizei  width,
GLsizei  height,
GLint  border,
GLsizei  imageSize,
const GLvoid *  data 
)

void GLAPIENTRY _mesa_CompressedTexImage3DARB ( GLenum  target,
GLint  level,
GLenum  internalformat,
GLsizei  width,
GLsizei  height,
GLsizei  depth,
GLint  border,
GLsizei  imageSize,
const GLvoid *  data 
)

void GLAPIENTRY _mesa_CompressedTexSubImage1DARB ( GLenum  target,
GLint  level,
GLint  xoffset,
GLsizei  width,
GLenum  format,
GLsizei  imageSize,
const GLvoid *  data 
)

void GLAPIENTRY _mesa_CompressedTexSubImage2DARB ( GLenum  target,
GLint  level,
GLint  xoffset,
GLint  yoffset,
GLsizei  width,
GLsizei  height,
GLenum  format,
GLsizei  imageSize,
const GLvoid *  data 
)

void GLAPIENTRY _mesa_CompressedTexSubImage3DARB ( GLenum  target,
GLint  level,
GLint  xoffset,
GLint  yoffset,
GLint  zoffset,
GLsizei  width,
GLsizei  height,
GLsizei  depth,
GLenum  format,
GLsizei  imageSize,
const GLvoid *  data 
)

void GLAPIENTRY _mesa_CopyTexImage1D ( GLenum  target,
GLint  level,
GLenum  internalformat,
GLint  x,
GLint  y,
GLsizei  width,
GLint  border 
)

void GLAPIENTRY _mesa_CopyTexImage2D ( GLenum  target,
GLint  level,
GLenum  internalformat,
GLint  x,
GLint  y,
GLsizei  width,
GLsizei  height,
GLint  border 
)

void GLAPIENTRY _mesa_CopyTexSubImage1D ( GLenum  target,
GLint  level,
GLint  xoffset,
GLint  x,
GLint  y,
GLsizei  width 
)

void GLAPIENTRY _mesa_CopyTexSubImage2D ( GLenum  target,
GLint  level,
GLint  xoffset,
GLint  yoffset,
GLint  x,
GLint  y,
GLsizei  width,
GLsizei  height 
)

void GLAPIENTRY _mesa_CopyTexSubImage3D ( GLenum  target,
GLint  level,
GLint  xoffset,
GLint  yoffset,
GLint  zoffset,
GLint  x,
GLint  y,
GLsizei  width,
GLsizei  height 
)

void _mesa_delete_texture_image ( GLcontext ctx,
struct gl_texture_image texImage 
)

Free texture image.

Parameters:
texImage texture image.
Free the texture image structure and the associated image data.

void _mesa_free_texmemory ( void *  m  ) 

Free texture memory allocated with _mesa_alloc_texmemory().

void _mesa_free_texture_image_data ( GLcontext ctx,
struct gl_texture_image texImage 
)

Free texture image data.

This function is a fallback called via ctx->Driver.FreeTexImageData().

Parameters:
texImage texture image.
Free the texture image data if it's not marked as client data.

struct gl_texture_image* _mesa_get_proxy_tex_image ( GLcontext ctx,
GLenum  target,
GLint  level 
) [read]

Return pointer to the specified proxy texture image.

Note that proxy textures are per-context, not per-texture unit.

Returns:
pointer to texture image or NULL if invalid target, invalid level, or out of memory.

struct gl_texture_image* _mesa_get_tex_image ( GLcontext ctx,
struct gl_texture_object texObj,
GLenum  target,
GLint  level 
) [read]

Like _mesa_select_tex_image() but if the image doesn't exist, allocate it and install it.

Only return NULL if passed a bad parameter or run out of memory.

void _mesa_init_teximage_fields ( GLcontext ctx,
GLenum  target,
struct gl_texture_image img,
GLsizei  width,
GLsizei  height,
GLsizei  depth,
GLint  border,
GLenum  internalFormat 
)

Initialize basic fields of the gl_texture_image struct.

Parameters:
ctx GL context.
target texture target (GL_TEXTURE_1D, GL_TEXTURE_RECTANGLE, etc).
img texture image structure to be initialized.
width image width.
height image height.
depth image depth.
border image border.
internalFormat internal format.
Fills in the fields of img with the given information. Note: width, height and depth include the border.

GLboolean _mesa_is_proxy_texture ( GLenum  target  ) 

Test if a target is a proxy target.

Parameters:
target texture target.
Returns:
GL_TRUE if the target is a proxy target, GL_FALSE otherwise.

static INLINE void _mesa_lock_texture ( GLcontext ctx,
struct gl_texture_object texObj 
) [static]

Lock a texture for updating.

See also _mesa_lock_context_textures().

GLint _mesa_max_texture_levels ( GLcontext ctx,
GLenum  target 
)

Get the maximum number of allowed mipmap levels.

Parameters:
ctx GL context.
target texture target.
Returns:
the maximum number of allowed mipmap levels for the given texture target, or zero if passed a bad target.
See also:
gl_constants.

struct gl_texture_image* _mesa_new_texture_image ( GLcontext ctx  )  [read]

Allocate a texture image structure.

Called via ctx->Driver.NewTextureImage() unless overriden by a device driver.

Returns:
a pointer to gl_texture_image struct with all fields initialized to zero.

struct gl_texture_image* _mesa_select_tex_image ( GLcontext ctx,
const struct gl_texture_object texObj,
GLenum  target,
GLint  level 
) [read]

Get a texture image pointer from a texture object, given a texture target and mipmap level.

The target and level parameters should have already been error-checked.

Parameters:
ctx GL context.
texObj texture unit.
target texture target.
level image level.
Returns:
pointer to the texture image structure, or NULL on failure.

struct gl_texture_object* _mesa_select_tex_object ( GLcontext ctx,
const struct gl_texture_unit texUnit,
GLenum  target 
) [read]

Get the texture object that corresponds to the target of the given texture unit.

Parameters:
ctx GL context.
texUnit texture unit.
target texture target.
Returns:
pointer to the texture object on success, or NULL on failure.
See also:
gl_texture_unit.

void _mesa_set_tex_image ( struct gl_texture_object tObj,
GLenum  target,
GLint  level,
struct gl_texture_image texImage 
)

Store a gl_texture_image pointer in a gl_texture_object structure according to the target and level parameters.

Parameters:
tObj texture object.
target texture target.
level image level.
texImage texture image.
This was basically prompted by the introduction of cube maps.

GLboolean _mesa_test_proxy_teximage ( GLcontext ctx,
GLenum  target,
GLint  level,
GLint  internalFormat,
GLenum  format,
GLenum  type,
GLint  width,
GLint  height,
GLint  depth,
GLint  border 
)

This is the fallback for Driver.TestProxyTexImage().

Test the texture level, width, height and depth against the ctx->Const limits for textures.

A hardware driver might override this function if, for example, the max 3D texture size is 512x512x64 (i.e. not a cube).

Note that width, height, depth == 0 is not an error. However, a texture with zero width/height/depth will be considered "incomplete" and texturing will effectively be disabled.

Parameters:
target one of GL_PROXY_TEXTURE_1D, GL_PROXY_TEXTURE_2D, GL_PROXY_TEXTURE_3D, GL_PROXY_TEXTURE_RECTANGLE_NV, GL_PROXY_TEXTURE_CUBE_MAP_ARB.
level as passed to glTexImage
internalFormat as passed to glTexImage
format as passed to glTexImage
type as passed to glTexImage
width as passed to glTexImage
height as passed to glTexImage
depth as passed to glTexImage
border as passed to glTexImage
Returns:
GL_TRUE if the image is acceptable, GL_FALSE if not acceptable.

GLuint _mesa_tex_target_to_face ( GLenum  target  ) 

For cube map faces, return a face index in [0,5].

For other targets return 0;

void GLAPIENTRY _mesa_TexImage1D ( GLenum  target,
GLint  level,
GLint  internalformat,
GLsizei  width,
GLint  border,
GLenum  format,
GLenum  type,
const GLvoid *  pixels 
)

void GLAPIENTRY _mesa_TexImage2D ( GLenum  target,
GLint  level,
GLint  internalformat,
GLsizei  width,
GLsizei  height,
GLint  border,
GLenum  format,
GLenum  type,
const GLvoid *  pixels 
)

void GLAPIENTRY _mesa_TexImage3D ( GLenum  target,
GLint  level,
GLint  internalformat,
GLsizei  width,
GLsizei  height,
GLsizei  depth,
GLint  border,
GLenum  format,
GLenum  type,
const GLvoid *  pixels 
)

void GLAPIENTRY _mesa_TexImage3DEXT ( GLenum  target,
GLint  level,
GLenum  internalformat,
GLsizei  width,
GLsizei  height,
GLsizei  depth,
GLint  border,
GLenum  format,
GLenum  type,
const GLvoid *  pixels 
)

void GLAPIENTRY _mesa_TexSubImage1D ( GLenum  target,
GLint  level,
GLint  xoffset,
GLsizei  width,
GLenum  format,
GLenum  type,
const GLvoid *  pixels 
)

void GLAPIENTRY _mesa_TexSubImage2D ( GLenum  target,
GLint  level,
GLint  xoffset,
GLint  yoffset,
GLsizei  width,
GLsizei  height,
GLenum  format,
GLenum  type,
const GLvoid *  pixels 
)

void GLAPIENTRY _mesa_TexSubImage3D ( GLenum  target,
GLint  level,
GLint  xoffset,
GLint  yoffset,
GLint  zoffset,
GLsizei  width,
GLsizei  height,
GLsizei  depth,
GLenum  format,
GLenum  type,
const GLvoid *  pixels 
)

static INLINE void _mesa_unlock_texture ( GLcontext ctx,
struct gl_texture_object texObj 
) [static]


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