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

texstore.c File Reference

#include "glheader.h"
#include "bufferobj.h"
#include "colormac.h"
#include "context.h"
#include "convolve.h"
#include "image.h"
#include "macros.h"
#include "mipmap.h"
#include "imports.h"
#include "texcompress.h"
#include "texformat.h"
#include "teximage.h"
#include "texstore.h"
#include "enums.h"

Defines

#define MAP1(x)   MAP4(x, ZERO, ZERO, ZERO)
#define MAP2(x, y)   MAP4(x, y, ZERO, ZERO)
#define MAP3(x, y, z)   MAP4(x, y, z, ZERO)
#define MAP4(x, y, z, w)   { x, y, z, w, ZERO, ONE }
#define SWZ_CPY(dst, src, count, dstComps, srcComps)
#define STRIDE_3D   0

Enumerations

enum  { ZERO = 4, ONE = 5 }
 The GL texture image functions in teximage.c basically just do error checking and data structure allocation. More...
enum  {
  IDX_LUMINANCE = 0, IDX_ALPHA, IDX_INTENSITY, IDX_LUMINANCE_ALPHA,
  IDX_RGB, IDX_RGBA, IDX_RED, IDX_GREEN,
  IDX_BLUE, IDX_BGR, IDX_BGRA, IDX_ABGR,
  MAX_IDX
}

Functions

static GLboolean can_swizzle (GLenum logicalBaseFormat)
 Return GL_TRUE if the given image format is one that be converted to another format by swizzling.
static int get_map_idx (GLenum value)
 Convert a GL image format enum to an IDX_* value (see above).
static void compute_component_mapping (GLenum inFormat, GLenum outFormat, GLubyte *map)
 When promoting texture formats (see below) we need to compute the mapping of dest components back to source components.
static void _mesa_adjust_image_for_convolution (GLcontext *ctx, GLuint dims, GLsizei *srcWidth, GLsizei *srcHeight)
static GLfloat * make_temp_float_image (GLcontext *ctx, GLuint dims, GLenum logicalBaseFormat, GLenum textureBaseFormat, GLint srcWidth, GLint srcHeight, GLint srcDepth, GLenum srcFormat, GLenum srcType, const GLvoid *srcAddr, const struct gl_pixelstore_attrib *srcPacking)
 Make a temporary (color) texture image with GLfloat components.
GLchan * _mesa_make_temp_chan_image (GLcontext *ctx, GLuint dims, GLenum logicalBaseFormat, GLenum textureBaseFormat, GLint srcWidth, GLint srcHeight, GLint srcDepth, GLenum srcFormat, GLenum srcType, const GLvoid *srcAddr, const struct gl_pixelstore_attrib *srcPacking)
 Make a temporary (color) texture image with GLchan components.
static void swizzle_copy (GLubyte *dst, GLuint dstComponents, const GLubyte *src, GLuint srcComponents, const GLubyte *map, GLuint count)
 Copy GLubyte pixels from <src> to <dst> with swizzling.
static const GLubyte * type_mapping (GLenum srcType)
static const GLubyte * byteswap_mapping (GLboolean swapBytes, GLenum srcType)
static void _mesa_swizzle_ubyte_image (GLcontext *ctx, GLuint dimensions, GLenum srcFormat, GLenum srcType, GLenum baseInternalFormat, const GLubyte *rgba2dst, GLuint dstComponents, GLvoid *dstAddr, GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, GLint dstRowStride, const GLuint *dstImageOffsets, GLint srcWidth, GLint srcHeight, GLint srcDepth, const GLvoid *srcAddr, const struct gl_pixelstore_attrib *srcPacking)
 Transfer a GLubyte texture image with component swizzling.
static void memcpy_texture (GLcontext *ctx, GLuint dimensions, const struct gl_texture_format *dstFormat, GLvoid *dstAddr, GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, GLint dstRowStride, const GLuint *dstImageOffsets, GLint srcWidth, GLint srcHeight, GLint srcDepth, GLenum srcFormat, GLenum srcType, const GLvoid *srcAddr, const struct gl_pixelstore_attrib *srcPacking)
 Teximage storage routine for when a simple memcpy will do.
GLboolean _mesa_texstore_rgba (TEXSTORE_PARAMS)
 Store an image in any of the formats: _mesa_texformat_rgba _mesa_texformat_rgb _mesa_texformat_alpha _mesa_texformat_luminance _mesa_texformat_luminance_alpha _mesa_texformat_intensity.
GLboolean _mesa_texstore_z32 (TEXSTORE_PARAMS)
 Store a 32-bit integer depth component texture image.
GLboolean _mesa_texstore_z16 (TEXSTORE_PARAMS)
 Store a 16-bit integer depth component texture image.
GLboolean _mesa_texstore_rgb565 (TEXSTORE_PARAMS)
 Store an rgb565 or rgb565_rev texture image.
GLboolean _mesa_texstore_rgba8888 (TEXSTORE_PARAMS)
 Store a texture in MESA_FORMAT_RGBA8888 or MESA_FORMAT_RGBA8888_REV.
GLboolean _mesa_texstore_argb8888 (TEXSTORE_PARAMS)
GLboolean _mesa_texstore_rgb888 (TEXSTORE_PARAMS)
GLboolean _mesa_texstore_bgr888 (TEXSTORE_PARAMS)
GLboolean _mesa_texstore_rgba4444 (TEXSTORE_PARAMS)
GLboolean _mesa_texstore_argb4444 (TEXSTORE_PARAMS)
GLboolean _mesa_texstore_rgba5551 (TEXSTORE_PARAMS)
GLboolean _mesa_texstore_argb1555 (TEXSTORE_PARAMS)
GLboolean _mesa_texstore_al88 (TEXSTORE_PARAMS)
GLboolean _mesa_texstore_rgb332 (TEXSTORE_PARAMS)
GLboolean _mesa_texstore_a8 (TEXSTORE_PARAMS)
 Texstore for _mesa_texformat_a8, _mesa_texformat_l8, _mesa_texformat_i8.
GLboolean _mesa_texstore_ci8 (TEXSTORE_PARAMS)
GLboolean _mesa_texstore_ycbcr (TEXSTORE_PARAMS)
 Texstore for _mesa_texformat_ycbcr or _mesa_texformat_ycbcr_rev.
GLboolean _mesa_texstore_dudv8 (TEXSTORE_PARAMS)
GLboolean _mesa_texstore_signed_rgba8888 (TEXSTORE_PARAMS)
 Store a texture in MESA_FORMAT_SIGNED_RGBA8888 or MESA_FORMAT_SIGNED_RGBA8888_REV.
GLboolean _mesa_texstore_z24_s8 (TEXSTORE_PARAMS)
 Store a combined depth/stencil texture image.
GLboolean _mesa_texstore_s8_z24 (TEXSTORE_PARAMS)
 Store a combined depth/stencil texture image.
GLboolean _mesa_texstore_rgba_float32 (TEXSTORE_PARAMS)
 Store an image in any of the formats: _mesa_texformat_rgba_float32 _mesa_texformat_rgb_float32 _mesa_texformat_alpha_float32 _mesa_texformat_luminance_float32 _mesa_texformat_luminance_alpha_float32 _mesa_texformat_intensity_float32.
GLboolean _mesa_texstore_rgba_float16 (TEXSTORE_PARAMS)
 As above, but store 16-bit floats.
const GLvoid * _mesa_validate_pbo_teximage (GLcontext *ctx, GLuint dimensions, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *unpack, const char *funcName)
 Check if an unpack PBO is active prior to fetching a texture image.
const GLvoid * _mesa_validate_pbo_compressed_teximage (GLcontext *ctx, GLsizei imageSize, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, const char *funcName)
 Check if an unpack PBO is active prior to fetching a compressed texture image.
void _mesa_unmap_teximage_pbo (GLcontext *ctx, const struct gl_pixelstore_attrib *unpack)
 This function must be called after either of the validate_pbo_*_teximage() functions.
static void fetch_texel_float_to_chan (const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texelOut)
 Adaptor for fetching a GLchan texel from a float-valued texture.
static void fetch_texel_chan_to_float (const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texelOut)
 Adaptor for fetching a float texel from a GLchan-valued texture.
void _mesa_set_fetch_functions (struct gl_texture_image *texImage, GLuint dims)
 Initialize the texture image's FetchTexelc and FetchTexelf methods.
static void compute_texture_size (GLcontext *ctx, struct gl_texture_image *texImage)
void _mesa_store_teximage1d (GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage)
 This is the software fallback for Driver.TexImage1D() and Driver.CopyTexImage1D().
void _mesa_store_teximage2d (GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const void *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage)
 This is the software fallback for Driver.TexImage2D() and Driver.CopyTexImage2D().
void _mesa_store_teximage3d (GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, GLenum format, GLenum type, const void *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage)
 This is the software fallback for Driver.TexImage3D() and Driver.CopyTexImage3D().
void _mesa_store_texsubimage1d (GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint width, GLenum format, GLenum type, const void *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage)
void _mesa_store_texsubimage2d (GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint width, GLint height, GLenum format, GLenum type, const void *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage)
 This is the software fallback for Driver.TexSubImage2D() and Driver.CopyTexSubImage2D().
void _mesa_store_texsubimage3d (GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint width, GLint height, GLint depth, GLenum format, GLenum type, const void *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage)
void _mesa_store_compressed_teximage1d (GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage)
void _mesa_store_compressed_teximage2d (GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage)
 Fallback for Driver.CompressedTexImage2D().
void _mesa_store_compressed_teximage3d (GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage)
void _mesa_store_compressed_texsubimage1d (GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage)
 Fallback for Driver.CompressedTexSubImage1D().
void _mesa_store_compressed_texsubimage2d (GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage)
 Fallback for Driver.CompressedTexSubImage2D().
void _mesa_store_compressed_texsubimage3d (GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage)
 Fallback for Driver.CompressedTexSubImage3D().

Variables

struct {
   GLubyte   format_idx
   GLubyte   to_rgba [6]
   GLubyte   from_rgba [6]
mappings [MAX_IDX]
static const GLubyte map_identity [6] = { 0, 1, 2, 3, ZERO, ONE }
static const GLubyte map_3210 [6] = { 3, 2, 1, 0, ZERO, ONE }


Define Documentation

#define MAP1 (  )     MAP4(x, ZERO, ZERO, ZERO)

#define MAP2 ( x,
 )     MAP4(x, y, ZERO, ZERO)

#define MAP3 ( x,
y,
 )     MAP4(x, y, z, ZERO)

#define MAP4 ( x,
y,
z,
 )     { x, y, z, w, ZERO, ONE }

#define STRIDE_3D   0

#define SWZ_CPY ( dst,
src,
count,
dstComps,
srcComps   ) 

Value:

do {                                              \
      GLuint i;                                      \
      for (i = 0; i < count; i++) {                  \
         GLuint j;                                   \
         if (srcComps == 4) {                        \
            COPY_4UBV(tmp, src);                     \
         }                                           \
         else {                                      \
            for (j = 0; j < srcComps; j++) {         \
               tmp[j] = src[j];                      \
            }                                        \
         }                                           \
         src += srcComps;                            \
         for (j = 0; j < dstComps; j++) {            \
            dst[j] = tmp[map[j]];                    \
         }                                           \
         dst += dstComps;                            \
      }                                              \
   } while (0)


Enumeration Type Documentation

anonymous enum

The GL texture image functions in teximage.c basically just do error checking and data structure allocation.

They in turn call device driver functions which actually copy/convert/store the user's texture image data.

However, most device drivers will be able to use the fallback functions in this file. That is, most drivers will have the following bit of code: ctx->Driver.TexImage1D = _mesa_store_teximage1d; ctx->Driver.TexImage2D = _mesa_store_teximage2d; ctx->Driver.TexImage3D = _mesa_store_teximage3d; etc...

Texture image processing is actually kind of complicated. We have to do: Format/type conversions pixel unpacking pixel transfer (scale, bais, lookup, convolution!, etc)

These functions can handle most everything, including processing full images and sub-images.

Enumerator:
ZERO 
ONE 

anonymous enum

Enumerator:
IDX_LUMINANCE 
IDX_ALPHA 
IDX_INTENSITY 
IDX_LUMINANCE_ALPHA 
IDX_RGB 
IDX_RGBA 
IDX_RED 
IDX_GREEN 
IDX_BLUE 
IDX_BGR 
IDX_BGRA 
IDX_ABGR 
MAX_IDX 


Function Documentation

static void _mesa_adjust_image_for_convolution ( GLcontext ctx,
GLuint  dims,
GLsizei *  srcWidth,
GLsizei *  srcHeight 
) [static]

GLchan* _mesa_make_temp_chan_image ( GLcontext ctx,
GLuint  dims,
GLenum  logicalBaseFormat,
GLenum  textureBaseFormat,
GLint  srcWidth,
GLint  srcHeight,
GLint  srcDepth,
GLenum  srcFormat,
GLenum  srcType,
const GLvoid *  srcAddr,
const struct gl_pixelstore_attrib srcPacking 
)

Make a temporary (color) texture image with GLchan components.

Apply all needed pixel unpacking and pixel transfer operations. Note that there are both logicalBaseFormat and textureBaseFormat parameters. Suppose the user specifies GL_LUMINANCE as the internal texture format but the graphics hardware doesn't support luminance textures. So, might use an RGB hardware format instead. If logicalBaseFormat != textureBaseFormat we have some extra work to do.

Parameters:
ctx the rendering context
dims image dimensions: 1, 2 or 3
logicalBaseFormat basic texture derived from the user's internal texture format value
textureBaseFormat the actual basic format of the texture
srcWidth source image width
srcHeight source image height
srcDepth source image depth
srcFormat source image format
srcType source image type
srcAddr source image address
srcPacking source image pixel packing
Returns:
resulting image with format = textureBaseFormat and type = GLchan.

void _mesa_set_fetch_functions ( struct gl_texture_image texImage,
GLuint  dims 
)

Initialize the texture image's FetchTexelc and FetchTexelf methods.

void _mesa_store_compressed_teximage1d ( GLcontext ctx,
GLenum  target,
GLint  level,
GLint  internalFormat,
GLint  width,
GLint  border,
GLsizei  imageSize,
const GLvoid *  data,
struct gl_texture_object texObj,
struct gl_texture_image texImage 
)

void _mesa_store_compressed_teximage2d ( GLcontext ctx,
GLenum  target,
GLint  level,
GLint  internalFormat,
GLint  width,
GLint  height,
GLint  border,
GLsizei  imageSize,
const GLvoid *  data,
struct gl_texture_object texObj,
struct gl_texture_image texImage 
)

Fallback for Driver.CompressedTexImage2D().

void _mesa_store_compressed_teximage3d ( GLcontext ctx,
GLenum  target,
GLint  level,
GLint  internalFormat,
GLint  width,
GLint  height,
GLint  depth,
GLint  border,
GLsizei  imageSize,
const GLvoid *  data,
struct gl_texture_object texObj,
struct gl_texture_image texImage 
)

void _mesa_store_compressed_texsubimage1d ( GLcontext ctx,
GLenum  target,
GLint  level,
GLint  xoffset,
GLsizei  width,
GLenum  format,
GLsizei  imageSize,
const GLvoid *  data,
struct gl_texture_object texObj,
struct gl_texture_image texImage 
)

Fallback for Driver.CompressedTexSubImage1D().

void _mesa_store_compressed_texsubimage2d ( GLcontext ctx,
GLenum  target,
GLint  level,
GLint  xoffset,
GLint  yoffset,
GLsizei  width,
GLsizei  height,
GLenum  format,
GLsizei  imageSize,
const GLvoid *  data,
struct gl_texture_object texObj,
struct gl_texture_image texImage 
)

Fallback for Driver.CompressedTexSubImage2D().

void _mesa_store_compressed_texsubimage3d ( GLcontext ctx,
GLenum  target,
GLint  level,
GLint  xoffset,
GLint  yoffset,
GLint  zoffset,
GLsizei  width,
GLsizei  height,
GLsizei  depth,
GLenum  format,
GLsizei  imageSize,
const GLvoid *  data,
struct gl_texture_object texObj,
struct gl_texture_image texImage 
)

Fallback for Driver.CompressedTexSubImage3D().

void _mesa_store_teximage1d ( GLcontext ctx,
GLenum  target,
GLint  level,
GLint  internalFormat,
GLint  width,
GLint  border,
GLenum  format,
GLenum  type,
const GLvoid *  pixels,
const struct gl_pixelstore_attrib packing,
struct gl_texture_object texObj,
struct gl_texture_image texImage 
)

This is the software fallback for Driver.TexImage1D() and Driver.CopyTexImage1D().

See also:
_mesa_store_teximage2d() Note that the width may not be the actual texture width since it may be changed by convolution w/ GL_REDUCE. The texImage->Width field will have the actual texture size.

void _mesa_store_teximage2d ( GLcontext ctx,
GLenum  target,
GLint  level,
GLint  internalFormat,
GLint  width,
GLint  height,
GLint  border,
GLenum  format,
GLenum  type,
const void *  pixels,
const struct gl_pixelstore_attrib packing,
struct gl_texture_object texObj,
struct gl_texture_image texImage 
)

This is the software fallback for Driver.TexImage2D() and Driver.CopyTexImage2D().

This function is oriented toward storing images in main memory, rather than VRAM. Device driver's can easily plug in their own replacement.

Note: width and height may be pre-convolved dimensions, but texImage->Width and texImage->Height will be post-convolved dimensions.

void _mesa_store_teximage3d ( GLcontext ctx,
GLenum  target,
GLint  level,
GLint  internalFormat,
GLint  width,
GLint  height,
GLint  depth,
GLint  border,
GLenum  format,
GLenum  type,
const void *  pixels,
const struct gl_pixelstore_attrib packing,
struct gl_texture_object texObj,
struct gl_texture_image texImage 
)

This is the software fallback for Driver.TexImage3D() and Driver.CopyTexImage3D().

See also:
_mesa_store_teximage2d()

void _mesa_store_texsubimage1d ( GLcontext ctx,
GLenum  target,
GLint  level,
GLint  xoffset,
GLint  width,
GLenum  format,
GLenum  type,
const void *  pixels,
const struct gl_pixelstore_attrib packing,
struct gl_texture_object texObj,
struct gl_texture_image texImage 
)

void _mesa_store_texsubimage2d ( GLcontext ctx,
GLenum  target,
GLint  level,
GLint  xoffset,
GLint  yoffset,
GLint  width,
GLint  height,
GLenum  format,
GLenum  type,
const void *  pixels,
const struct gl_pixelstore_attrib packing,
struct gl_texture_object texObj,
struct gl_texture_image texImage 
)

This is the software fallback for Driver.TexSubImage2D() and Driver.CopyTexSubImage2D().

void _mesa_store_texsubimage3d ( GLcontext ctx,
GLenum  target,
GLint  level,
GLint  xoffset,
GLint  yoffset,
GLint  zoffset,
GLint  width,
GLint  height,
GLint  depth,
GLenum  format,
GLenum  type,
const void *  pixels,
const struct gl_pixelstore_attrib packing,
struct gl_texture_object texObj,
struct gl_texture_image texImage 
)

static void _mesa_swizzle_ubyte_image ( GLcontext ctx,
GLuint  dimensions,
GLenum  srcFormat,
GLenum  srcType,
GLenum  baseInternalFormat,
const GLubyte *  rgba2dst,
GLuint  dstComponents,
GLvoid *  dstAddr,
GLint  dstXoffset,
GLint  dstYoffset,
GLint  dstZoffset,
GLint  dstRowStride,
const GLuint *  dstImageOffsets,
GLint  srcWidth,
GLint  srcHeight,
GLint  srcDepth,
const GLvoid *  srcAddr,
const struct gl_pixelstore_attrib srcPacking 
) [static]

Transfer a GLubyte texture image with component swizzling.

GLboolean _mesa_texstore_a8 ( TEXSTORE_PARAMS   ) 

Texstore for _mesa_texformat_a8, _mesa_texformat_l8, _mesa_texformat_i8.

GLboolean _mesa_texstore_al88 ( TEXSTORE_PARAMS   ) 

GLboolean _mesa_texstore_argb1555 ( TEXSTORE_PARAMS   ) 

GLboolean _mesa_texstore_argb4444 ( TEXSTORE_PARAMS   ) 

GLboolean _mesa_texstore_argb8888 ( TEXSTORE_PARAMS   ) 

GLboolean _mesa_texstore_bgr888 ( TEXSTORE_PARAMS   ) 

GLboolean _mesa_texstore_ci8 ( TEXSTORE_PARAMS   ) 

GLboolean _mesa_texstore_dudv8 ( TEXSTORE_PARAMS   ) 

GLboolean _mesa_texstore_rgb332 ( TEXSTORE_PARAMS   ) 

GLboolean _mesa_texstore_rgb565 ( TEXSTORE_PARAMS   ) 

Store an rgb565 or rgb565_rev texture image.

GLboolean _mesa_texstore_rgb888 ( TEXSTORE_PARAMS   ) 

GLboolean _mesa_texstore_rgba ( TEXSTORE_PARAMS   ) 

Store an image in any of the formats: _mesa_texformat_rgba _mesa_texformat_rgb _mesa_texformat_alpha _mesa_texformat_luminance _mesa_texformat_luminance_alpha _mesa_texformat_intensity.

GLboolean _mesa_texstore_rgba4444 ( TEXSTORE_PARAMS   ) 

GLboolean _mesa_texstore_rgba5551 ( TEXSTORE_PARAMS   ) 

GLboolean _mesa_texstore_rgba8888 ( TEXSTORE_PARAMS   ) 

Store a texture in MESA_FORMAT_RGBA8888 or MESA_FORMAT_RGBA8888_REV.

GLboolean _mesa_texstore_rgba_float16 ( TEXSTORE_PARAMS   ) 

As above, but store 16-bit floats.

GLboolean _mesa_texstore_rgba_float32 ( TEXSTORE_PARAMS   ) 

Store an image in any of the formats: _mesa_texformat_rgba_float32 _mesa_texformat_rgb_float32 _mesa_texformat_alpha_float32 _mesa_texformat_luminance_float32 _mesa_texformat_luminance_alpha_float32 _mesa_texformat_intensity_float32.

GLboolean _mesa_texstore_s8_z24 ( TEXSTORE_PARAMS   ) 

Store a combined depth/stencil texture image.

GLboolean _mesa_texstore_signed_rgba8888 ( TEXSTORE_PARAMS   ) 

Store a texture in MESA_FORMAT_SIGNED_RGBA8888 or MESA_FORMAT_SIGNED_RGBA8888_REV.

GLboolean _mesa_texstore_ycbcr ( TEXSTORE_PARAMS   ) 

Texstore for _mesa_texformat_ycbcr or _mesa_texformat_ycbcr_rev.

GLboolean _mesa_texstore_z16 ( TEXSTORE_PARAMS   ) 

Store a 16-bit integer depth component texture image.

GLboolean _mesa_texstore_z24_s8 ( TEXSTORE_PARAMS   ) 

Store a combined depth/stencil texture image.

GLboolean _mesa_texstore_z32 ( TEXSTORE_PARAMS   ) 

Store a 32-bit integer depth component texture image.

void _mesa_unmap_teximage_pbo ( GLcontext ctx,
const struct gl_pixelstore_attrib unpack 
)

This function must be called after either of the validate_pbo_*_teximage() functions.

It unmaps the PBO buffer if it was mapped earlier.

const GLvoid* _mesa_validate_pbo_compressed_teximage ( GLcontext ctx,
GLsizei  imageSize,
const GLvoid *  pixels,
const struct gl_pixelstore_attrib packing,
const char *  funcName 
)

Check if an unpack PBO is active prior to fetching a compressed texture image.

If so, do bounds checking and map the buffer into main memory. Any errors detected will be recorded. The caller _must_ call _mesa_unmap_teximage_pbo() too!

const GLvoid* _mesa_validate_pbo_teximage ( GLcontext ctx,
GLuint  dimensions,
GLsizei  width,
GLsizei  height,
GLsizei  depth,
GLenum  format,
GLenum  type,
const GLvoid *  pixels,
const struct gl_pixelstore_attrib unpack,
const char *  funcName 
)

Check if an unpack PBO is active prior to fetching a texture image.

If so, do bounds checking and map the buffer into main memory. Any errors detected will be recorded. The caller _must_ call _mesa_unmap_teximage_pbo() too!

static const GLubyte* byteswap_mapping ( GLboolean  swapBytes,
GLenum  srcType 
) [static]

static GLboolean can_swizzle ( GLenum  logicalBaseFormat  )  [static]

Return GL_TRUE if the given image format is one that be converted to another format by swizzling.

static void compute_component_mapping ( GLenum  inFormat,
GLenum  outFormat,
GLubyte *  map 
) [static]

When promoting texture formats (see below) we need to compute the mapping of dest components back to source components.

This function does that.

Parameters:
inFormat the incoming format of the texture
outFormat the final texture format
Returns:
map[6] a full 6-component map

static void compute_texture_size ( GLcontext ctx,
struct gl_texture_image texImage 
) [static]

static void fetch_texel_chan_to_float ( const struct gl_texture_image texImage,
GLint  i,
GLint  j,
GLint  k,
GLfloat *  texelOut 
) [static]

Adaptor for fetching a float texel from a GLchan-valued texture.

static void fetch_texel_float_to_chan ( const struct gl_texture_image texImage,
GLint  i,
GLint  j,
GLint  k,
GLchan *  texelOut 
) [static]

Adaptor for fetching a GLchan texel from a float-valued texture.

static int get_map_idx ( GLenum  value  )  [static]

Convert a GL image format enum to an IDX_* value (see above).

static GLfloat* make_temp_float_image ( GLcontext ctx,
GLuint  dims,
GLenum  logicalBaseFormat,
GLenum  textureBaseFormat,
GLint  srcWidth,
GLint  srcHeight,
GLint  srcDepth,
GLenum  srcFormat,
GLenum  srcType,
const GLvoid *  srcAddr,
const struct gl_pixelstore_attrib srcPacking 
) [static]

Make a temporary (color) texture image with GLfloat components.

Apply all needed pixel unpacking and pixel transfer operations. Note that there are both logicalBaseFormat and textureBaseFormat parameters. Suppose the user specifies GL_LUMINANCE as the internal texture format but the graphics hardware doesn't support luminance textures. So, might use an RGB hardware format instead. If logicalBaseFormat != textureBaseFormat we have some extra work to do.

Parameters:
ctx the rendering context
dims image dimensions: 1, 2 or 3
logicalBaseFormat basic texture derived from the user's internal texture format value
textureBaseFormat the actual basic format of the texture
srcWidth source image width
srcHeight source image height
srcDepth source image depth
srcFormat source image format
srcType source image type
srcAddr source image address
srcPacking source image pixel packing
Returns:
resulting image with format = textureBaseFormat and type = GLfloat.

static void memcpy_texture ( GLcontext ctx,
GLuint  dimensions,
const struct gl_texture_format dstFormat,
GLvoid *  dstAddr,
GLint  dstXoffset,
GLint  dstYoffset,
GLint  dstZoffset,
GLint  dstRowStride,
const GLuint *  dstImageOffsets,
GLint  srcWidth,
GLint  srcHeight,
GLint  srcDepth,
GLenum  srcFormat,
GLenum  srcType,
const GLvoid *  srcAddr,
const struct gl_pixelstore_attrib srcPacking 
) [static]

Teximage storage routine for when a simple memcpy will do.

No pixel transfer operations or special texel encodings allowed. 1D, 2D and 3D images supported.

static void swizzle_copy ( GLubyte *  dst,
GLuint  dstComponents,
const GLubyte *  src,
GLuint  srcComponents,
const GLubyte *  map,
GLuint  count 
) [static]

Copy GLubyte pixels from <src> to <dst> with swizzling.

Parameters:
dst destination pixels
dstComponents number of color components in destination pixels
src source pixels
srcComponents number of color components in source pixels
map the swizzle mapping. map[X] says where to find the X component in the source image's pixels. For example, if the source image is GL_BGRA and X = red, map[0] yields 2.
count number of pixels to copy/swizzle.

static const GLubyte* type_mapping ( GLenum  srcType  )  [static]


Variable Documentation

GLubyte format_idx

GLubyte from_rgba[6]

const GLubyte map_3210[6] = { 3, 2, 1, 0, ZERO, ONE } [static]

const GLubyte map_identity[6] = { 0, 1, 2, 3, ZERO, ONE } [static]

struct { ... } mappings[MAX_IDX] [static]

GLubyte to_rgba[6]


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