Now gl_texture_image::TexFormat is a simple MESA_FORMAT_x enum.
ctx->Driver.ChooseTexture format also returns a MESA_FORMAT_x.
gl_texture_format will go away next.
texObj = _mesa_select_tex_object(ctx, texUnit, target);
texImage = _mesa_select_tex_image(ctx, texObj, target, level);
- format = _mesa_get_format_base_format(texImage->TexFormat->MesaFormat);
+ format = _mesa_get_format_base_format(texImage->TexFormat);
type = get_temp_image_type(ctx, format);
bpp = _mesa_bytes_per_pixel(format, type);
if (bpp <= 0) {
* little-endian Mesa formats.
*/
/*@{*/
-const struct gl_texture_format *_dri_texformat_rgba8888 = NULL;
-const struct gl_texture_format *_dri_texformat_argb8888 = NULL;
-const struct gl_texture_format *_dri_texformat_rgb565 = NULL;
-const struct gl_texture_format *_dri_texformat_argb4444 = NULL;
-const struct gl_texture_format *_dri_texformat_argb1555 = NULL;
-const struct gl_texture_format *_dri_texformat_al88 = NULL;
-const struct gl_texture_format *_dri_texformat_a8 = &_mesa_texformat_a8;
-const struct gl_texture_format *_dri_texformat_ci8 = &_mesa_texformat_ci8;
-const struct gl_texture_format *_dri_texformat_i8 = &_mesa_texformat_i8;
-const struct gl_texture_format *_dri_texformat_l8 = &_mesa_texformat_l8;
+gl_format _dri_texformat_rgba8888 = MESA_FORMAT_NONE;
+gl_format _dri_texformat_argb8888 = MESA_FORMAT_NONE;
+gl_format _dri_texformat_rgb565 = MESA_FORMAT_NONE;
+gl_format _dri_texformat_argb4444 = MESA_FORMAT_NONE;
+gl_format _dri_texformat_argb1555 = MESA_FORMAT_NONE;
+gl_format _dri_texformat_al88 = MESA_FORMAT_NONE;
+gl_format _dri_texformat_a8 = MESA_FORMAT_NONE;
+gl_format _dri_texformat_ci8 = MESA_FORMAT_NONE;
+gl_format _dri_texformat_i8 = MESA_FORMAT_NONE;
+gl_format _dri_texformat_l8 = MESA_FORMAT_NONE;
/*@}*/
const GLubyte littleEndian = *((const GLubyte *) &ui);
if (littleEndian) {
- _dri_texformat_rgba8888 = &_mesa_texformat_rgba8888;
- _dri_texformat_argb8888 = &_mesa_texformat_argb8888;
- _dri_texformat_rgb565 = &_mesa_texformat_rgb565;
- _dri_texformat_argb4444 = &_mesa_texformat_argb4444;
- _dri_texformat_argb1555 = &_mesa_texformat_argb1555;
- _dri_texformat_al88 = &_mesa_texformat_al88;
+ _dri_texformat_rgba8888 = MESA_FORMAT_RGBA8888;
+ _dri_texformat_argb8888 = MESA_FORMAT_ARGB8888;
+ _dri_texformat_rgb565 = MESA_FORMAT_RGB565;
+ _dri_texformat_argb4444 = MESA_FORMAT_ARGB4444;
+ _dri_texformat_argb1555 = MESA_FORMAT_ARGB1555;
+ _dri_texformat_al88 = MESA_FORMAT_AL88;
}
else {
- _dri_texformat_rgba8888 = &_mesa_texformat_rgba8888_rev;
- _dri_texformat_argb8888 = &_mesa_texformat_argb8888_rev;
- _dri_texformat_rgb565 = &_mesa_texformat_rgb565_rev;
- _dri_texformat_argb4444 = &_mesa_texformat_argb4444_rev;
- _dri_texformat_argb1555 = &_mesa_texformat_argb1555_rev;
- _dri_texformat_al88 = &_mesa_texformat_al88_rev;
+ _dri_texformat_rgba8888 = MESA_FORMAT_RGBA8888_REV;
+ _dri_texformat_argb8888 = MESA_FORMAT_ARGB8888_REV;
+ _dri_texformat_rgb565 = MESA_FORMAT_RGB565_REV;
+ _dri_texformat_argb4444 = MESA_FORMAT_ARGB4444_REV;
+ _dri_texformat_argb1555 = MESA_FORMAT_ARGB1555_REV;
+ _dri_texformat_al88 = MESA_FORMAT_AL88_REV;
}
}
#define DRI_TEXMEM_H
#include "main/mtypes.h"
+#include "main/formats.h"
#include "main/mm.h"
#include "xf86drm.h"
extern void driCalculateTextureFirstLastLevel( driTextureObject * t );
-extern const struct gl_texture_format *_dri_texformat_rgba8888;
-extern const struct gl_texture_format *_dri_texformat_argb8888;
-extern const struct gl_texture_format *_dri_texformat_rgb565;
-extern const struct gl_texture_format *_dri_texformat_argb4444;
-extern const struct gl_texture_format *_dri_texformat_argb1555;
-extern const struct gl_texture_format *_dri_texformat_al88;
-extern const struct gl_texture_format *_dri_texformat_a8;
-extern const struct gl_texture_format *_dri_texformat_ci8;
-extern const struct gl_texture_format *_dri_texformat_i8;
-extern const struct gl_texture_format *_dri_texformat_l8;
+extern gl_format _dri_texformat_rgba8888;
+extern gl_format _dri_texformat_argb8888;
+extern gl_format _dri_texformat_rgb565;
+extern gl_format _dri_texformat_argb4444;
+extern gl_format _dri_texformat_argb1555;
+extern gl_format _dri_texformat_al88;
+extern gl_format _dri_texformat_a8;
+extern gl_format _dri_texformat_ci8;
+extern gl_format _dri_texformat_i8;
+extern gl_format _dri_texformat_l8;
extern void driInitTextureFormats( void );
* The i810 only supports 5 texture modes that are useful to Mesa. That
* makes this routine pretty simple.
*/
-static const struct gl_texture_format *
+static gl_format
i810ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
GLenum format, GLenum type )
{
if ( ((format == GL_BGRA) && (type == GL_UNSIGNED_SHORT_1_5_5_5_REV))
|| ((format == GL_RGBA) && (type == GL_UNSIGNED_SHORT_5_5_5_1))
|| (internalFormat == GL_RGB5_A1) ) {
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
}
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case 3:
case GL_RGB:
case GL_RGB10:
case GL_RGB12:
case GL_RGB16:
- return &_mesa_texformat_rgb565;
+ return MESA_FORMAT_RGB565;
case GL_ALPHA:
case GL_ALPHA4:
case GL_INTENSITY12:
case GL_INTENSITY16:
case GL_COMPRESSED_INTENSITY:
- return &_mesa_texformat_al88;
+ return MESA_FORMAT_AL88;
case GL_YCBCR_MESA:
if (type == GL_UNSIGNED_SHORT_8_8_MESA ||
type == GL_UNSIGNED_BYTE)
- return &_mesa_texformat_ycbcr;
+ return MESA_FORMAT_YCBCR;
else
- return &_mesa_texformat_ycbcr_rev;
+ return MESA_FORMAT_YCBCR_REV;
default:
fprintf(stderr, "unexpected texture format in %s\n", __FUNCTION__);
- return NULL;
+ return MESA_FORMAT_NONE;
}
- return NULL; /* never get here */
+ return MESA_FORMAT_NONE; /* never get here */
}
/**
if (!image || !image->Data)
return;
- texelBytes = _mesa_get_format_bytes(image->TexFormat->MesaFormat);
+ texelBytes = _mesa_get_format_bytes(image->TexFormat);
if (image->Width * texelBytes == t->Pitch) {
GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[hwlevel].offset);
/* fprintf(stderr, "%s\n", __FUNCTION__); */
t->texelBytes = 2;
- switch (baseImage->TexFormat->MesaFormat) {
+ switch (baseImage->TexFormat) {
case MESA_FORMAT_ARGB1555:
textureFormat = MI1_FMT_16BPP | MI1_PF_16BPP_ARGB1555;
break;
0, intelObj->
firstLevel);
- format = translate_texture_format(firstImage->TexFormat->MesaFormat,
+ format = translate_texture_format(firstImage->TexFormat,
firstImage->InternalFormat);
pitch = intelObj->mt->pitch * intelObj->mt->cpp;
}
DSTORG_VERT_BIAS(0x8) | DEPTH_IS_Z); /* .5 */
if (irb != NULL) {
- switch (irb->texformat->MesaFormat) {
+ switch (irb->texformat) {
case MESA_FORMAT_ARGB8888:
value |= DV_PF_8888;
break;
break;
default:
_mesa_problem(ctx, "Bad renderbuffer format: %d\n",
- irb->texformat->MesaFormat);
+ irb->texformat);
}
}
0, intelObj->
firstLevel);
- format = translate_texture_format(firstImage->TexFormat->MesaFormat,
+ format = translate_texture_format(firstImage->TexFormat,
firstImage->InternalFormat,
tObj->DepthMode);
pitch = intelObj->mt->pitch * intelObj->mt->cpp;
/* YUV conversion:
*/
- if (firstImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR ||
- firstImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR_REV)
+ if (firstImage->TexFormat == MESA_FORMAT_YCBCR ||
+ firstImage->TexFormat == MESA_FORMAT_YCBCR_REV)
state[I915_TEXREG_SS2] |= SS2_COLORSPACE_CONVERSION;
/* Shadow:
DSTORG_VERT_BIAS(0x8) | /* .5 */
LOD_PRECLAMP_OGL | TEX_DEFAULT_COLOR_OGL);
if (irb != NULL) {
- switch (irb->texformat->MesaFormat) {
+ switch (irb->texformat) {
case MESA_FORMAT_ARGB8888:
value |= DV_PF_8888;
break;
break;
default:
_mesa_problem(ctx, "Bad renderbuffer format: %d\n",
- irb->texformat->MesaFormat);
+ irb->texformat);
}
}
const struct gl_texture_image *img = t->Image[0][t->BaseLevel];
if (img->InternalFormat == GL_YCBCR_MESA) {
key->yuvtex_mask |= 1 << i;
- if (img->TexFormat->MesaFormat == MESA_FORMAT_YCBCR)
+ if (img->TexFormat == MESA_FORMAT_YCBCR)
key->yuvtex_swap_mask |= 1 << i;
}
key.bo = NULL;
key.offset = intelObj->textureOffset;
} else {
- key.format = firstImage->TexFormat->MesaFormat;
+ key.format = firstImage->TexFormat;
key.internal_format = firstImage->InternalFormat;
key.pitch = intelObj->mt->pitch;
key.depth = firstImage->Depth;
region_bo = region->buffer;
key.surface_type = BRW_SURFACE_2D;
- switch (irb->texformat->MesaFormat) {
+ switch (irb->texformat) {
case MESA_FORMAT_ARGB8888:
key.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
break;
key.surface_format = BRW_SURFACEFORMAT_B4G4R4A4_UNORM;
break;
default:
- _mesa_problem(ctx, "Bad renderbuffer format: %d\n",
- irb->texformat->MesaFormat);
+ _mesa_problem(ctx, "Bad renderbuffer format: %d\n", irb->texformat);
}
key.tiling = region->tiling;
if (brw->intel.intelScreen->driScrnPriv->dri2.enabled) {
CLAMPED_FLOAT_TO_UBYTE(clear[2], color[2]);
CLAMPED_FLOAT_TO_UBYTE(clear[3], color[3]);
- switch (irb->texformat->MesaFormat) {
+ switch (irb->texformat) {
case MESA_FORMAT_ARGB8888:
clearVal = intel->ClearColor8888;
break;
break;
default:
_mesa_problem(ctx, "Unexpected renderbuffer format: %d\n",
- irb->texformat->MesaFormat);
+ irb->texformat);
clearVal = 0;
}
}
rb->RedBits = 5;
rb->GreenBits = 6;
rb->BlueBits = 5;
- irb->texformat = &_mesa_texformat_rgb565;
+ irb->texformat = MESA_FORMAT_RGB565;
cpp = 2;
break;
case GL_RGB:
rb->GreenBits = 8;
rb->BlueBits = 8;
rb->AlphaBits = 0;
- irb->texformat = &_mesa_texformat_argb8888; /* XXX: Need xrgb8888 */
+ irb->texformat = MESA_FORMAT_ARGB8888; /* XXX: Need xrgb8888 */
cpp = 4;
break;
case GL_RGBA:
rb->GreenBits = 8;
rb->BlueBits = 8;
rb->AlphaBits = 8;
- irb->texformat = &_mesa_texformat_argb8888;
+ irb->texformat = MESA_FORMAT_ARGB8888;
cpp = 4;
break;
case GL_STENCIL_INDEX:
rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
rb->StencilBits = 8;
cpp = 4;
- irb->texformat = &_mesa_texformat_s8_z24;
+ irb->texformat = MESA_FORMAT_S8_Z24;
break;
case GL_DEPTH_COMPONENT16:
rb->_ActualFormat = GL_DEPTH_COMPONENT16;
rb->DataType = GL_UNSIGNED_SHORT;
rb->DepthBits = 16;
cpp = 2;
- irb->texformat = &_mesa_texformat_z16;
+ irb->texformat = MESA_FORMAT_Z16;
break;
case GL_DEPTH_COMPONENT:
case GL_DEPTH_COMPONENT24:
rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
rb->DepthBits = 24;
cpp = 4;
- irb->texformat = &_mesa_texformat_s8_z24;
+ irb->texformat = MESA_FORMAT_S8_Z24;
break;
case GL_DEPTH_STENCIL_EXT:
case GL_DEPTH24_STENCIL8_EXT:
rb->DepthBits = 24;
rb->StencilBits = 8;
cpp = 4;
- irb->texformat = &_mesa_texformat_s8_z24;
+ irb->texformat = MESA_FORMAT_S8_Z24;
break;
default:
_mesa_problem(ctx,
irb->Base.GreenBits = 6;
irb->Base.BlueBits = 5;
irb->Base.DataType = GL_UNSIGNED_BYTE;
- irb->texformat = &_mesa_texformat_rgb565;
+ irb->texformat = MESA_FORMAT_RGB565;
break;
case GL_RGB8:
irb->Base._ActualFormat = GL_RGB8;
irb->Base.BlueBits = 8;
irb->Base.AlphaBits = 0;
irb->Base.DataType = GL_UNSIGNED_BYTE;
- irb->texformat = &_mesa_texformat_argb8888; /* XXX: Need xrgb8888 */
+ irb->texformat = MESA_FORMAT_ARGB8888; /* XXX: NEED XRGB8888 */
break;
case GL_RGBA8:
irb->Base._ActualFormat = GL_RGBA8;
irb->Base.BlueBits = 8;
irb->Base.AlphaBits = 8;
irb->Base.DataType = GL_UNSIGNED_BYTE;
- irb->texformat = &_mesa_texformat_argb8888;
+ irb->texformat = MESA_FORMAT_ARGB8888;
break;
case GL_STENCIL_INDEX8_EXT:
irb->Base._ActualFormat = GL_STENCIL_INDEX8_EXT;
irb->Base._BaseFormat = GL_STENCIL_INDEX;
irb->Base.StencilBits = 8;
irb->Base.DataType = GL_UNSIGNED_BYTE;
- irb->texformat = &_mesa_texformat_s8_z24;
+ irb->texformat = MESA_FORMAT_S8_Z24;
break;
case GL_DEPTH_COMPONENT16:
irb->Base._ActualFormat = GL_DEPTH_COMPONENT16;
irb->Base._BaseFormat = GL_DEPTH_COMPONENT;
irb->Base.DepthBits = 16;
irb->Base.DataType = GL_UNSIGNED_SHORT;
- irb->texformat = &_mesa_texformat_z16;
+ irb->texformat = MESA_FORMAT_Z16;
break;
case GL_DEPTH_COMPONENT24:
irb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT;
irb->Base._BaseFormat = GL_DEPTH_COMPONENT;
irb->Base.DepthBits = 24;
irb->Base.DataType = GL_UNSIGNED_INT;
- irb->texformat = &_mesa_texformat_s8_z24;
+ irb->texformat = MESA_FORMAT_S8_Z24;
break;
case GL_DEPTH24_STENCIL8_EXT:
irb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT;
irb->Base.DepthBits = 24;
irb->Base.StencilBits = 8;
irb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
- irb->texformat = &_mesa_texformat_s8_z24;
+ irb->texformat = MESA_FORMAT_S8_Z24;
break;
default:
_mesa_problem(NULL,
irb->texformat = texImage->TexFormat;
gl_format texFormat;
- if (texImage->TexFormat == &_mesa_texformat_argb8888) {
+ if (texImage->TexFormat == MESA_FORMAT_ARGB8888) {
irb->Base._ActualFormat = GL_RGBA8;
irb->Base._BaseFormat = GL_RGBA;
irb->Base.DataType = GL_UNSIGNED_BYTE;
DBG("Render to RGBA8 texture OK\n");
}
- else if (texImage->TexFormat == &_mesa_texformat_rgb565) {
+ else if (texImage->TexFormat == MESA_FORMAT_RGB565) {
irb->Base._ActualFormat = GL_RGB5;
irb->Base._BaseFormat = GL_RGB;
irb->Base.DataType = GL_UNSIGNED_BYTE;
DBG("Render to RGB5 texture OK\n");
}
- else if (texImage->TexFormat == &_mesa_texformat_argb1555) {
+ else if (texImage->TexFormat == MESA_FORMAT_ARGB1555) {
irb->Base._ActualFormat = GL_RGB5_A1;
irb->Base._BaseFormat = GL_RGBA;
irb->Base.DataType = GL_UNSIGNED_BYTE;
DBG("Render to ARGB1555 texture OK\n");
}
- else if (texImage->TexFormat == &_mesa_texformat_argb4444) {
+ else if (texImage->TexFormat == MESA_FORMAT_ARGB4444) {
irb->Base._ActualFormat = GL_RGBA4;
irb->Base._BaseFormat = GL_RGBA;
irb->Base.DataType = GL_UNSIGNED_BYTE;
DBG("Render to ARGB4444 texture OK\n");
}
- else if (texImage->TexFormat == &_mesa_texformat_z16) {
+ else if (texImage->TexFormat == MESA_FORMAT_Z16) {
irb->Base._ActualFormat = GL_DEPTH_COMPONENT16;
irb->Base._BaseFormat = GL_DEPTH_COMPONENT;
irb->Base.DataType = GL_UNSIGNED_SHORT;
DBG("Render to DEPTH16 texture OK\n");
}
- else if (texImage->TexFormat == &_mesa_texformat_s8_z24) {
+ else if (texImage->TexFormat == MESA_FORMAT_S8_Z24) {
irb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT;
irb->Base._BaseFormat = GL_DEPTH_STENCIL_EXT;
irb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
DBG("Render to DEPTH_STENCIL texture OK\n");
}
else {
- DBG("Render to texture BAD FORMAT %d\n",
- texImage->TexFormat->MesaFormat);
+ DBG("Render to texture BAD FORMAT %d\n", texImage->TexFormat);
return GL_FALSE;
}
- texFormat = texImage->TexFormat->MesaFormat;
+ texFormat = texImage->TexFormat;
irb->Base.InternalFormat = irb->Base._ActualFormat;
irb->Base.Width = texImage->Width;
continue;
}
- switch (irb->texformat->MesaFormat) {
+ switch (irb->texformat) {
case MESA_FORMAT_ARGB8888:
case MESA_FORMAT_RGB565:
case MESA_FORMAT_ARGB1555:
#ifndef INTEL_FBO_H
#define INTEL_FBO_H
+#include "main/formats.h"
#include "intel_screen.h"
struct intel_context;
struct gl_renderbuffer Base;
struct intel_region *region;
- const struct gl_texture_format *texformat;
+ gl_format texformat;
GLuint vbl_pending; /**< vblank sequence number of pending flip */
if (!image->IsCompressed &&
!mt->compressed &&
- _mesa_get_format_bytes(image->TexFormat->MesaFormat) != mt->cpp)
+ _mesa_get_format_bytes(image->TexFormat) != mt->cpp)
return GL_FALSE;
/* Test image dimensions against the base level image adjusted for
else
tiling = I915_TILING_NONE;
- switch (irb->texformat->MesaFormat) {
+ switch (irb->texformat) {
case MESA_FORMAT_RGB565:
switch (tiling) {
case I915_TILING_NONE:
#define INTELTEX_INC
#include "main/mtypes.h"
+#include "main/formats.h"
#include "intel_context.h"
#include "texmem.h"
void intelInitTextureCopyImageFuncs(struct dd_function_table *functions);
-const struct gl_texture_format *intelChooseTextureFormat(GLcontext * ctx,
- GLint internalFormat,
- GLenum format,
- GLenum type);
+gl_format intelChooseTextureFormat(GLcontext *ctx, GLint internalFormat,
+ GLenum format, GLenum type);
void intelSetTexOffset(__DRIcontext *pDRICtx, GLint texname,
unsigned long long offset, GLint depth, GLuint pitch);
* these if we take the step of simply swizzling the colors
* immediately after sampling...
*/
-const struct gl_texture_format *
+gl_format
intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat,
GLenum format, GLenum type)
{
case GL_COMPRESSED_RGBA:
if (format == GL_BGRA) {
if (type == GL_UNSIGNED_BYTE || type == GL_UNSIGNED_INT_8_8_8_8_REV) {
- return &_mesa_texformat_argb8888;
+ return MESA_FORMAT_ARGB8888;
}
else if (type == GL_UNSIGNED_SHORT_4_4_4_4_REV) {
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
}
else if (type == GL_UNSIGNED_SHORT_1_5_5_5_REV) {
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
}
}
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
+ return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444;
case 3:
case GL_RGB:
case GL_COMPRESSED_RGB:
if (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5) {
- return &_mesa_texformat_rgb565;
+ return MESA_FORMAT_RGB565;
}
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
+ return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565;
case GL_RGBA8:
case GL_RGB10_A2:
case GL_RGBA12:
case GL_RGBA16:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
+ return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444;
case GL_RGBA4:
case GL_RGBA2:
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
case GL_RGB8:
case GL_RGB10:
case GL_RGB12:
case GL_RGB16:
- return &_mesa_texformat_argb8888;
+ return MESA_FORMAT_ARGB8888;
case GL_RGB5:
case GL_RGB4:
case GL_R3_G3_B2:
- return &_mesa_texformat_rgb565;
+ return MESA_FORMAT_RGB565;
case GL_ALPHA:
case GL_ALPHA4:
case GL_ALPHA12:
case GL_ALPHA16:
case GL_COMPRESSED_ALPHA:
- return &_mesa_texformat_a8;
+ return MESA_FORMAT_A8;
case 1:
case GL_LUMINANCE:
case GL_LUMINANCE12:
case GL_LUMINANCE16:
case GL_COMPRESSED_LUMINANCE:
- return &_mesa_texformat_l8;
+ return MESA_FORMAT_L8;
case 2:
case GL_LUMINANCE_ALPHA:
case GL_LUMINANCE12_ALPHA12:
case GL_LUMINANCE16_ALPHA16:
case GL_COMPRESSED_LUMINANCE_ALPHA:
- return &_mesa_texformat_al88;
+ return MESA_FORMAT_AL88;
case GL_INTENSITY:
case GL_INTENSITY4:
case GL_INTENSITY12:
case GL_INTENSITY16:
case GL_COMPRESSED_INTENSITY:
- return &_mesa_texformat_i8;
+ return MESA_FORMAT_I8;
case GL_YCBCR_MESA:
if (type == GL_UNSIGNED_SHORT_8_8_MESA || type == GL_UNSIGNED_BYTE)
- return &_mesa_texformat_ycbcr;
+ return MESA_FORMAT_YCBCR;
else
- return &_mesa_texformat_ycbcr_rev;
+ return MESA_FORMAT_YCBCR_REV;
case GL_COMPRESSED_RGB_FXT1_3DFX:
- return &_mesa_texformat_rgb_fxt1;
+ return MESA_FORMAT_RGB_FXT1;
case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return &_mesa_texformat_rgba_fxt1;
+ return MESA_FORMAT_RGBA_FXT1;
case GL_RGB_S3TC:
case GL_RGB4_S3TC:
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgb_dxt1;
+ return MESA_FORMAT_RGB_DXT1;
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgba_dxt1;
+ return MESA_FORMAT_RGBA_DXT1;
case GL_RGBA_S3TC:
case GL_RGBA4_S3TC:
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- return &_mesa_texformat_rgba_dxt3;
+ return MESA_FORMAT_RGBA_DXT3;
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return &_mesa_texformat_rgba_dxt5;
+ return MESA_FORMAT_RGBA_DXT5;
case GL_DEPTH_COMPONENT:
case GL_DEPTH_COMPONENT16:
case GL_DEPTH_COMPONENT24:
case GL_DEPTH_COMPONENT32:
#if 0
- return &_mesa_texformat_z16;
+ return MESA_FORMAT_Z16;
#else
/* fall-through.
* 16bpp depth texture can't be paired with a stencil buffer so
#endif
case GL_DEPTH_STENCIL_EXT:
case GL_DEPTH24_STENCIL8_EXT:
- return &_mesa_texformat_s8_z24;
+ return MESA_FORMAT_S8_Z24;
#ifndef I915
case GL_SRGB_EXT:
case GL_COMPRESSED_SRGB_ALPHA_EXT:
case GL_COMPRESSED_SLUMINANCE_EXT:
case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:
- return &_mesa_texformat_sargb8;
+ return MESA_FORMAT_SARGB8;
case GL_SLUMINANCE_EXT:
case GL_SLUMINANCE8_EXT:
if (IS_G4X(intel->intelScreen->deviceID))
- return &_mesa_texformat_sl8;
+ return MESA_FORMAT_SL8;
else
- return &_mesa_texformat_sargb8;
+ return MESA_FORMAT_SARGB8;
case GL_SLUMINANCE_ALPHA_EXT:
case GL_SLUMINANCE8_ALPHA8_EXT:
if (IS_G4X(intel->intelScreen->deviceID))
- return &_mesa_texformat_sla8;
+ return MESA_FORMAT_SLA8;
else
- return &_mesa_texformat_sargb8;
+ return MESA_FORMAT_SARGB8;
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
- return &_mesa_texformat_srgb_dxt1;
+ return MESA_FORMAT_SRGB_DXT1;
/* i915 could also do this */
case GL_DUDV_ATI:
case GL_DU8DV8_ATI:
- return &_mesa_texformat_dudv8;
+ return MESA_FORMAT_DUDV8;
case GL_RGBA_SNORM:
case GL_RGBA8_SNORM:
- return &_mesa_texformat_signed_rgba8888_rev;
+ return MESA_FORMAT_SIGNED_RGBA8888_REV;
#endif
default:
fprintf(stderr, "unexpected texture format %s in %s\n",
_mesa_lookup_enum_by_nr(internalFormat), __FUNCTION__);
- return NULL;
+ return MESA_FORMAT_NONE;
}
- return NULL; /* never get here */
+ return MESA_FORMAT_NONE; /* never get here */
}
int intel_compressed_num_bytes(GLuint mesaFormat)
assert(!intelObj->mt);
if (intelImage->base.IsCompressed)
- comp_byte = intel_compressed_num_bytes(intelImage->base.TexFormat->MesaFormat);
+ comp_byte = intel_compressed_num_bytes(intelImage->base.TexFormat);
- texelBytes = _mesa_get_format_bytes(intelImage->base.TexFormat->MesaFormat);
+ texelBytes = _mesa_get_format_bytes(intelImage->base.TexFormat);
intelObj->mt = intel_miptree_create(intel,
intelObj->base.Target,
static GLboolean
check_pbo_format(GLint internalFormat,
GLenum format, GLenum type,
- const struct gl_texture_format *mesa_format)
+ gl_format mesa_format)
{
switch (internalFormat) {
case 4:
return (format == GL_BGRA &&
(type == GL_UNSIGNED_BYTE ||
type == GL_UNSIGNED_INT_8_8_8_8_REV) &&
- mesa_format == &_mesa_texformat_argb8888);
+ mesa_format == MESA_FORMAT_ARGB8888);
case 3:
case GL_RGB:
return (format == GL_RGB &&
type == GL_UNSIGNED_SHORT_5_6_5 &&
- mesa_format == &_mesa_texformat_rgb565);
+ mesa_format == MESA_FORMAT_RGB565);
case GL_YCBCR_MESA:
return (type == GL_UNSIGNED_SHORT_8_8_MESA || type == GL_UNSIGNED_BYTE);
default:
_mesa_set_fetch_functions(texImage, dims);
- if (_mesa_is_format_compressed(texImage->TexFormat->MesaFormat)) {
+ if (_mesa_is_format_compressed(texImage->TexFormat)) {
texelBytes = 0;
texImage->IsCompressed = GL_TRUE;
texImage->CompressedSize =
ctx->Driver.CompressedTextureSize(ctx, texImage->Width,
texImage->Height, texImage->Depth,
- texImage->TexFormat->MesaFormat);
+ texImage->TexFormat);
} else {
- texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat);
+ texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
/* Minimum pitch of 32 bytes */
if (postConvWidth * texelBytes < 32) {
assert(intelImage->mt);
} else if (intelImage->base.Border == 0) {
int comp_byte = 0;
- GLuint texelBytes = _mesa_get_format_bytes(intelImage->base.TexFormat->MesaFormat);
- GLenum baseFormat = _mesa_get_format_base_format(intelImage->base.TexFormat->MesaFormat);
+ GLuint texelBytes = _mesa_get_format_bytes(intelImage->base.TexFormat);
+ GLenum baseFormat = _mesa_get_format_base_format(intelImage->base.TexFormat);
if (intelImage->base.IsCompressed) {
comp_byte =
- intel_compressed_num_bytes(intelImage->base.TexFormat->MesaFormat);
+ intel_compressed_num_bytes(intelImage->base.TexFormat);
}
/* Didn't fit in the object miptree, but it's suitable for inclusion in
if (texImage->IsCompressed) {
sizeInBytes = texImage->CompressedSize;
dstRowStride =
- _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width);
+ _mesa_compressed_row_stride(texImage->TexFormat, width);
assert(dims != 3);
}
else {
else {
if (texImage->IsCompressed) {
dstRowStride =
- _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width);
+ _mesa_compressed_row_stride(texImage->TexFormat, width);
assert(dims != 3);
}
else {
- dstRowStride = texImage->RowStride * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat);
+ dstRowStride = texImage->RowStride * _mesa_get_format_bytes(texImage->TexFormat);
}
}
}
if (firstImage->base.IsCompressed) {
- comp_byte = intel_compressed_num_bytes(firstImage->base.TexFormat->MesaFormat);
+ comp_byte = intel_compressed_num_bytes(firstImage->base.TexFormat);
cpp = comp_byte;
}
else
- cpp = _mesa_get_format_bytes(firstImage->base.TexFormat->MesaFormat);
+ cpp = _mesa_get_format_bytes(firstImage->base.TexFormat);
/* Check tree can hold all active levels. Check tree matches
* target, imageFormat, etc.
/* Called by the _mesa_store_teximage[123]d() functions. */
-static const struct gl_texture_format *
+static gl_format
mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
GLenum format, GLenum type )
{
case GL_RGBA2:
case GL_COMPRESSED_RGBA:
if (mmesa->mach64Screen->cpp == 4)
- return &_mesa_texformat_argb8888;
+ return MESA_FORMAT_ARGB8888;
else
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case GL_RGB5_A1:
if (mmesa->mach64Screen->cpp == 4)
- return &_mesa_texformat_argb8888;
+ return MESA_FORMAT_ARGB8888;
else
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
case GL_RGBA8:
case GL_RGB10_A2:
case GL_RGBA16:
case GL_RGBA4:
if (mmesa->mach64Screen->cpp == 4)
- return &_mesa_texformat_argb8888;
+ return MESA_FORMAT_ARGB8888;
else
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case 3:
case GL_RGB:
case GL_RGB16:
case GL_COMPRESSED_RGB:
if (mmesa->mach64Screen->cpp == 4)
- return &_mesa_texformat_argb8888;
+ return MESA_FORMAT_ARGB8888;
else
- return &_mesa_texformat_rgb565;
+ return MESA_FORMAT_RGB565;
case 1:
case GL_LUMINANCE:
case GL_LUMINANCE16:
case GL_COMPRESSED_LUMINANCE:
if (mmesa->mach64Screen->cpp == 4)
- return &_mesa_texformat_argb8888; /* inefficient but accurate */
+ return MESA_FORMAT_ARGB8888; /* inefficient but accurate */
else
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
case GL_INTENSITY4:
case GL_INTENSITY:
case GL_INTENSITY16:
case GL_COMPRESSED_INTENSITY:
if (mmesa->mach64Screen->cpp == 4)
- return &_mesa_texformat_argb8888; /* inefficient but accurate */
+ return MESA_FORMAT_ARGB8888; /* inefficient but accurate */
else
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case GL_COLOR_INDEX:
case GL_COLOR_INDEX1_EXT:
case GL_COLOR_INDEX8_EXT:
case GL_COLOR_INDEX12_EXT:
case GL_COLOR_INDEX16_EXT:
- return &_mesa_texformat_ci8;
+ return MESA_FORMAT_CI8;
case GL_YCBCR_MESA:
if (type == GL_UNSIGNED_SHORT_8_8_APPLE ||
type == GL_UNSIGNED_BYTE)
- return &_mesa_texformat_ycbcr;
+ return MESA_FORMAT_YCBCR;
else
- return &_mesa_texformat_ycbcr_rev;
+ return MESA_FORMAT_YCBCR_REV;
default:
_mesa_problem( ctx, "unexpected format in %s", __FUNCTION__ );
- return NULL;
+ return MESA_FORMAT_NONE;
}
}
if ( !image )
return;
- texelBytes = _mesa_get_format_bytes(image->TexFormat->MesaFormat);
+ texelBytes = _mesa_get_format_bytes(image->TexFormat);
switch ( texelBytes ) {
case 1: texelsPerDword = 4; break;
if ( !image )
return;
- texelBytes = _mesa_get_format_bytes(image->TexFormat->MesaFormat);
+ texelBytes = _mesa_get_format_bytes(image->TexFormat);
switch ( texelBytes ) {
case 1: texelsPerDword = 4; break;
if ( MACH64_DEBUG & DEBUG_VERBOSE_API )
fprintf( stderr, "%s( %p )\n", __FUNCTION__, tObj );
- switch (baseImage->TexFormat->MesaFormat) {
+ switch (baseImage->TexFormat) {
case MESA_FORMAT_ARGB8888:
t->textureFormat = MACH64_DATATYPE_ARGB8888;
break;
totalSize = ( baseImage->Height *
baseImage->Width *
- _mesa_get_format_bytes(baseImage->TexFormat->MesaFormat) );
+ _mesa_get_format_bytes(baseImage->TexFormat) );
totalSize = (totalSize + 31) & ~31;
return;
}
#else
- if ( (baseImage->TexFormat->MesaFormat >= TMC_nr_tformat)
- || (TMC_tformat[ baseImage->TexFormat->MesaFormat ] == 0) )
+ if ( (baseImage->TexFormat >= TMC_nr_tformat)
+ || (TMC_tformat[ baseImage->TexFormat ] == 0) )
{
_mesa_problem(NULL, "unexpected texture format in %s", __FUNCTION__);
return;
}
- txformat = TMC_tformat[ baseImage->TexFormat->MesaFormat ];
+ txformat = TMC_tformat[ baseImage->TexFormat ];
#endif /* MGA_USE_TABLE_FOR_FORMAT */
break;
size = texImage->Width * texImage->Height *
- _mesa_get_format_bytes(baseImage->TexFormat->MesaFormat);
+ _mesa_get_format_bytes(baseImage->TexFormat);
t->offsets[i] = totalSize;
t->base.dirty_images[0] |= (1<<i);
}
-static const struct gl_texture_format *
+static gl_format
mgaChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
GLenum format, GLenum type )
{
switch ( type ) {
case GL_UNSIGNED_INT_10_10_10_2:
case GL_UNSIGNED_INT_2_10_10_10_REV:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555;
+ return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB1555;
case GL_UNSIGNED_SHORT_4_4_4_4:
case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case GL_UNSIGNED_SHORT_5_5_5_1:
case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
default:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
+ return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444;
}
case 3:
switch ( type ) {
case GL_UNSIGNED_SHORT_4_4_4_4:
case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case GL_UNSIGNED_SHORT_5_5_5_1:
case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
case GL_UNSIGNED_SHORT_5_6_5:
case GL_UNSIGNED_SHORT_5_6_5_REV:
- return &_mesa_texformat_rgb565;
+ return MESA_FORMAT_RGB565;
default:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
+ return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565;
}
case GL_RGBA8:
case GL_RGBA12:
case GL_RGBA16:
return !force16bpt ?
- &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
+ MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444;
case GL_RGBA4:
case GL_RGBA2:
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
case GL_RGB8:
case GL_RGB10:
case GL_RGB12:
case GL_RGB16:
- return !force16bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
+ return !force16bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565;
case GL_RGB5:
case GL_RGB4:
case GL_R3_G3_B2:
- return &_mesa_texformat_rgb565;
+ return MESA_FORMAT_RGB565;
case GL_ALPHA:
case GL_ALPHA4:
case GL_ALPHA16:
case GL_COMPRESSED_ALPHA:
/* FIXME: This will report incorrect component sizes... */
- return MGA_IS_G400(mmesa) ? &_mesa_texformat_al88 : &_mesa_texformat_argb4444;
+ return MGA_IS_G400(mmesa) ? MESA_FORMAT_AL88 : MESA_FORMAT_ARGB4444;
case 1:
case GL_LUMINANCE:
case GL_LUMINANCE16:
case GL_COMPRESSED_LUMINANCE:
/* FIXME: This will report incorrect component sizes... */
- return MGA_IS_G400(mmesa) ? &_mesa_texformat_al88 : &_mesa_texformat_rgb565;
+ return MGA_IS_G400(mmesa) ? MESA_FORMAT_AL88 : MESA_FORMAT_RGB565;
case 2:
case GL_LUMINANCE_ALPHA:
case GL_LUMINANCE16_ALPHA16:
case GL_COMPRESSED_LUMINANCE_ALPHA:
/* FIXME: This will report incorrect component sizes... */
- return MGA_IS_G400(mmesa) ? &_mesa_texformat_al88 : &_mesa_texformat_argb4444;
+ return MGA_IS_G400(mmesa) ? MESA_FORMAT_AL88 : MESA_FORMAT_ARGB4444;
case GL_INTENSITY:
case GL_INTENSITY4:
case GL_INTENSITY16:
case GL_COMPRESSED_INTENSITY:
/* FIXME: This will report incorrect component sizes... */
- return MGA_IS_G400(mmesa) ? &_mesa_texformat_i8 : &_mesa_texformat_argb4444;
+ return MGA_IS_G400(mmesa) ? MESA_FORMAT_I8 : MESA_FORMAT_ARGB4444;
case GL_YCBCR_MESA:
if (MGA_IS_G400(mmesa) &&
(type == GL_UNSIGNED_SHORT_8_8_APPLE ||
type == GL_UNSIGNED_BYTE))
- return &_mesa_texformat_ycbcr;
+ return MESA_FORMAT_YCBCR;
else
- return &_mesa_texformat_ycbcr_rev;
+ return MESA_FORMAT_YCBCR_REV;
case GL_COLOR_INDEX:
case GL_COLOR_INDEX1_EXT:
case GL_COLOR_INDEX8_EXT:
case GL_COLOR_INDEX12_EXT:
case GL_COLOR_INDEX16_EXT:
- return &_mesa_texformat_ci8;
+ return MESA_FORMAT_CI8;
default:
_mesa_problem( ctx, "unexpected texture format in %s", __FUNCTION__ );
- return NULL;
+ return MESA_FORMAT_NONE;
}
- return NULL; /* never get here */
+ return MESA_FORMAT_NONE; /* never get here */
}
* directly used by the hardware for texturing.
*/
- texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat);
+ texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
length = texImage->Width * texImage->Height * texelBytes;
if ( t->base.heap->heapId == MGA_CARD_HEAP ) {
unsigned tex_offset = 0;
/* Called by the _mesa_store_teximage[123]d() functions. */
-static const struct gl_texture_format *
+static gl_format
r128ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
GLenum format, GLenum type )
{
case GL_YCBCR_MESA:
if (type == GL_UNSIGNED_SHORT_8_8_APPLE ||
type == GL_UNSIGNED_BYTE)
- return &_mesa_texformat_ycbcr;
+ return MESA_FORMAT_YCBCR;
else
- return &_mesa_texformat_ycbcr_rev;
+ return MESA_FORMAT_YCBCR_REV;
default:
_mesa_problem( ctx, "unexpected format in %s", __FUNCTION__ );
- return NULL;
+ return MESA_FORMAT_NONE;
}
}
if ( !image )
return;
- switch ( _mesa_get_format_bytes(image->TexFormat->MesaFormat) ) {
+ switch ( _mesa_get_format_bytes(image->TexFormat) ) {
case 1: texelsPerDword = 4; break;
case 2: texelsPerDword = 2; break;
case 4: texelsPerDword = 1; break;
/* Copy the next chunck of the texture image into the blit buffer */
{
const GLuint texelBytes =
- _mesa_get_format_bytes(image->TexFormat->MesaFormat);
+ _mesa_get_format_bytes(image->TexFormat);
const GLubyte *src = (const GLubyte *) image->Data +
(y * image->Width + x) * texelBytes;
const GLuint bytes = width * height * texelBytes;
if ( R128_DEBUG & DEBUG_VERBOSE_API )
fprintf( stderr, "%s( %p )\n", __FUNCTION__, (void *) tObj );
- switch (baseImage->TexFormat->MesaFormat) {
+ switch (baseImage->TexFormat) {
case MESA_FORMAT_ARGB8888:
case MESA_FORMAT_ARGB8888_REV:
t->textureFormat = R128_DATATYPE_ARGB8888;
totalSize += (tObj->Image[0][i]->Height *
tObj->Image[0][i]->Width *
- _mesa_get_format_bytes(tObj->Image[0][i]->TexFormat->MesaFormat));
+ _mesa_get_format_bytes(tObj->Image[0][i]->TexFormat));
/* Offsets must be 32-byte aligned for host data blits and tiling */
totalSize = (totalSize + 31) & ~31;
log2Width = firstImage->WidthLog2;
log2Height = firstImage->HeightLog2;
log2Depth = firstImage->DepthLog2;
- texelBytes = _mesa_get_format_bytes(firstImage->TexFormat->MesaFormat);
+ texelBytes = _mesa_get_format_bytes(firstImage->TexFormat);
if (!t->image_override) {
- if (VALID_FORMAT(firstImage->TexFormat->MesaFormat)) {
+ if (VALID_FORMAT(firstImage->TexFormat)) {
const struct tx_table *table = _mesa_little_endian() ? tx_table_le :
tx_table_be;
R200_TXFORMAT_ALPHA_IN_MAP);
t->pp_txfilter &= ~R200_YUV_TO_RGB;
- t->pp_txformat |= table[ firstImage->TexFormat->MesaFormat ].format;
- t->pp_txfilter |= table[ firstImage->TexFormat->MesaFormat ].filter;
+ t->pp_txformat |= table[ firstImage->TexFormat ].format;
+ t->pp_txfilter |= table[ firstImage->TexFormat ].filter;
} else {
_mesa_problem(NULL, "unexpected texture format in %s",
__FUNCTION__);
t = radeon_tex_obj(tObj);
- switch (tObj->Image[0][tObj->BaseLevel]->TexFormat->MesaFormat) {
+ switch (tObj->Image[0][tObj->BaseLevel]->TexFormat) {
case MESA_FORMAT_Z16:
format = formats[0];
break;
firstImage = t->base.Image[0][firstlevel];
if (!t->image_override
- && VALID_FORMAT(firstImage->TexFormat->MesaFormat)) {
+ && VALID_FORMAT(firstImage->TexFormat)) {
if (firstImage->_BaseFormat == GL_DEPTH_COMPONENT) {
r300SetDepthTexMode(&t->base);
} else {
- t->pp_txformat = tx_table[firstImage->TexFormat->MesaFormat].format;
+ t->pp_txformat = tx_table[firstImage->TexFormat].format;
}
- t->pp_txfilter |= tx_table[firstImage->TexFormat->MesaFormat].filter;
+ t->pp_txfilter |= tx_table[firstImage->TexFormat].filter;
} else if (!t->image_override) {
_mesa_problem(NULL, "unexpected texture format in %s",
__FUNCTION__);
t = radeon_tex_obj(tObj);
- r600GetTexFormat(tObj, tObj->Image[0][tObj->BaseLevel]->TexFormat->MesaFormat);
+ r600GetTexFormat(tObj, tObj->Image[0][tObj->BaseLevel]->TexFormat);
}
firstImage = t->base.Image[0][firstlevel];
if (!t->image_override) {
- if (!r600GetTexFormat(texObj, firstImage->TexFormat->MesaFormat)) {
+ if (!r600GetTexFormat(texObj, firstImage->TexFormat)) {
radeon_error("unexpected texture format in %s\n",
__FUNCTION__);
return;
gl_format texFormat;
restart:
- if (texImage->TexFormat == &_mesa_texformat_argb8888) {
+ if (texImage->TexFormat == MESA_FORMAT_ARGB8888) {
rrb->cpp = 4;
rrb->base._ActualFormat = GL_RGBA8;
rrb->base._BaseFormat = GL_RGBA;
rrb->base.DataType = GL_UNSIGNED_BYTE;
DBG("Render to RGBA8 texture OK\n");
}
- else if (texImage->TexFormat == &_mesa_texformat_rgb565) {
+ else if (texImage->TexFormat == MESA_FORMAT_RGB565) {
rrb->cpp = 2;
rrb->base._ActualFormat = GL_RGB5;
rrb->base._BaseFormat = GL_RGB;
rrb->base.DataType = GL_UNSIGNED_BYTE;
DBG("Render to RGB5 texture OK\n");
}
- else if (texImage->TexFormat == &_mesa_texformat_argb1555) {
+ else if (texImage->TexFormat == MESA_FORMAT_ARGB1555) {
rrb->cpp = 2;
rrb->base._ActualFormat = GL_RGB5_A1;
rrb->base._BaseFormat = GL_RGBA;
rrb->base.DataType = GL_UNSIGNED_BYTE;
DBG("Render to ARGB1555 texture OK\n");
}
- else if (texImage->TexFormat == &_mesa_texformat_argb4444) {
+ else if (texImage->TexFormat == MESA_FORMAT_ARGB4444) {
rrb->cpp = 2;
rrb->base._ActualFormat = GL_RGBA4;
rrb->base._BaseFormat = GL_RGBA;
rrb->base.DataType = GL_UNSIGNED_BYTE;
DBG("Render to ARGB1555 texture OK\n");
}
- else if (texImage->TexFormat == &_mesa_texformat_z16) {
+ else if (texImage->TexFormat == MESA_FORMAT_Z16) {
rrb->cpp = 2;
rrb->base._ActualFormat = GL_DEPTH_COMPONENT16;
rrb->base._BaseFormat = GL_DEPTH_COMPONENT;
rrb->base.DataType = GL_UNSIGNED_SHORT;
DBG("Render to DEPTH16 texture OK\n");
}
- else if (texImage->TexFormat == &_mesa_texformat_s8_z24) {
+ else if (texImage->TexFormat == MESA_FORMAT_S8_Z24) {
rrb->cpp = 4;
rrb->base._ActualFormat = GL_DEPTH24_STENCIL8_EXT;
rrb->base._BaseFormat = GL_DEPTH_STENCIL_EXT;
/* try redoing the FBO */
if (retry == 1) {
DBG("Render to texture BAD FORMAT %d\n",
- texImage->TexFormat->MesaFormat);
+ texImage->TexFormat);
return GL_FALSE;
}
texImage->TexFormat = radeonChooseTextureFormat(ctx, texImage->InternalFormat, 0,
- _mesa_get_format_datatype(texImage->TexFormat->MesaFormat),
+ _mesa_get_format_datatype(texImage->TexFormat),
1);
retry++;
goto restart;
}
- texFormat = texImage->TexFormat->MesaFormat;
+ texFormat = texImage->TexFormat;
rrb->pitch = texImage->Width * rrb->cpp;
rrb->base.InternalFormat = rrb->base._ActualFormat;
rrb->base.Width = texImage->Width;
rrb->base.Height = texImage->Height;
- rrb->Base.RedBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE);
- rrb->Base.GreenBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE);
- rrb->Base.BlueBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_BLUE_SIZE);
- rrb->Base.AlphaBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_ALPHA_SIZE);
- rrb->Base.DepthBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_DEPTH_SIZE_ARB);
- rrb->Base.StencilBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_STENCIL_SIZE_EXT);
+ rrb->base.RedBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE);
+ rrb->base.GreenBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE);
+ rrb->base.BlueBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_BLUE_SIZE);
+ rrb->base.AlphaBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_ALPHA_SIZE);
+ rrb->base.DepthBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_DEPTH_SIZE_ARB);
+ rrb->base.StencilBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_STENCIL_SIZE_EXT);
+
rrb->base.Delete = radeon_delete_renderbuffer;
rrb->base.AllocStorage = radeon_nop_alloc_storage;
if (!texImage->IsCompressed &&
!mt->compressed &&
- _mesa_get_format_bytes(texImage->TexFormat->MesaFormat) != mt->bpp)
+ _mesa_get_format_bytes(texImage->TexFormat) != mt->bpp)
return GL_FALSE;
lvl = &mt->levels[level - mt->firstLevel];
numfaces = 6;
firstImage = texObj->Image[0][firstLevel];
- compressed = firstImage->IsCompressed ? firstImage->TexFormat->MesaFormat : 0;
- texelBytes = _mesa_get_format_bytes(firstImage->TexFormat->MesaFormat);
+ compressed = firstImage->IsCompressed ? firstImage->TexFormat : 0;
+ texelBytes = _mesa_get_format_bytes(firstImage->TexFormat);
return (mt->firstLevel == firstLevel &&
mt->lastLevel == lastLevel &&
void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t,
radeon_texture_image *image, GLuint face, GLuint level)
{
- GLuint compressed = image->base.IsCompressed ? image->base.TexFormat->MesaFormat : 0;
+ GLuint compressed = image->base.IsCompressed ? image->base.TexFormat : 0;
GLuint numfaces = 1;
GLuint firstLevel, lastLevel;
GLuint texelBytes;
if (level != firstLevel || face >= numfaces)
return;
- texelBytes = _mesa_get_format_bytes(image->base.TexFormat->MesaFormat);
+ texelBytes = _mesa_get_format_bytes(image->base.TexFormat);
t->mt = radeon_miptree_create(rmesa, t, t->base.Target,
image->base.InternalFormat,
log2Width = firstImage->WidthLog2;
log2Height = firstImage->HeightLog2;
log2Depth = firstImage->DepthLog2;
- texelBytes = _mesa_get_format_bytes(firstImage->TexFormat->MesaFormat);
+ texelBytes = _mesa_get_format_bytes(firstImage->TexFormat);
if (!t->image_override) {
- if (VALID_FORMAT(firstImage->TexFormat->MesaFormat)) {
+ if (VALID_FORMAT(firstImage->TexFormat)) {
const struct tx_table *table = tx_table;
t->pp_txformat &= ~(RADEON_TXFORMAT_FORMAT_MASK |
RADEON_TXFORMAT_ALPHA_IN_MAP);
t->pp_txfilter &= ~RADEON_YUV_TO_RGB;
- t->pp_txformat |= table[ firstImage->TexFormat->MesaFormat ].format;
- t->pp_txfilter |= table[ firstImage->TexFormat->MesaFormat ].filter;
+ t->pp_txformat |= table[ firstImage->TexFormat ].format;
+ t->pp_txfilter |= table[ firstImage->TexFormat ].filter;
} else {
_mesa_problem(NULL, "unexpected texture format in %s",
__FUNCTION__);
/* try to find a format which will only need a memcopy */
-static const struct gl_texture_format *radeonChoose8888TexFormat(radeonContextPtr rmesa,
- GLenum srcFormat,
- GLenum srcType, GLboolean fbo)
+static gl_format radeonChoose8888TexFormat(radeonContextPtr rmesa,
+ GLenum srcFormat,
+ GLenum srcType, GLboolean fbo)
{
const GLuint ui = 1;
const GLubyte littleEndian = *((const GLubyte *)&ui);
(srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE && !littleEndian) ||
(srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_INT_8_8_8_8_REV) ||
(srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_BYTE && littleEndian)) {
- return &_mesa_texformat_rgba8888;
+ return MESA_FORMAT_RGBA8888;
} else if ((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8_REV) ||
(srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE && littleEndian) ||
(srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_INT_8_8_8_8) ||
(srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_BYTE && !littleEndian)) {
- return &_mesa_texformat_rgba8888_rev;
+ return MESA_FORMAT_RGBA8888_REV;
} else if (IS_R200_CLASS(rmesa->radeonScreen)) {
return _dri_texformat_argb8888;
} else if (srcFormat == GL_BGRA && ((srcType == GL_UNSIGNED_BYTE && !littleEndian) ||
srcType == GL_UNSIGNED_INT_8_8_8_8)) {
- return &_mesa_texformat_argb8888_rev;
+ return MESA_FORMAT_ARGB8888_REV;
} else if (srcFormat == GL_BGRA && ((srcType == GL_UNSIGNED_BYTE && littleEndian) ||
srcType == GL_UNSIGNED_INT_8_8_8_8_REV)) {
- return &_mesa_texformat_argb8888;
+ return MESA_FORMAT_ARGB8888;
} else
return _dri_texformat_argb8888;
}
-const struct gl_texture_format *radeonChooseTextureFormat_mesa(GLcontext * ctx,
- GLint internalFormat,
- GLenum format,
- GLenum type)
+gl_format radeonChooseTextureFormat_mesa(GLcontext * ctx,
+ GLint internalFormat,
+ GLenum format,
+ GLenum type)
{
return radeonChooseTextureFormat(ctx, internalFormat, format,
type, 0);
}
-const struct gl_texture_format *radeonChooseTextureFormat(GLcontext * ctx,
- GLint internalFormat,
- GLenum format,
- GLenum type, GLboolean fbo)
+gl_format radeonChooseTextureFormat(GLcontext * ctx,
+ GLint internalFormat,
+ GLenum format,
+ GLenum type, GLboolean fbo)
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
const GLboolean do32bpt =
case GL_YCBCR_MESA:
if (type == GL_UNSIGNED_SHORT_8_8_APPLE ||
type == GL_UNSIGNED_BYTE)
- return &_mesa_texformat_ycbcr;
+ return MESA_FORMAT_YCBCR;
else
- return &_mesa_texformat_ycbcr_rev;
+ return MESA_FORMAT_YCBCR_REV;
case GL_RGB_S3TC:
case GL_RGB4_S3TC:
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgb_dxt1;
+ return MESA_FORMAT_RGB_DXT1;
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgba_dxt1;
+ return MESA_FORMAT_RGBA_DXT1;
case GL_RGBA_S3TC:
case GL_RGBA4_S3TC:
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- return &_mesa_texformat_rgba_dxt3;
+ return MESA_FORMAT_RGBA_DXT3;
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return &_mesa_texformat_rgba_dxt5;
+ return MESA_FORMAT_RGBA_DXT5;
case GL_ALPHA16F_ARB:
- return &_mesa_texformat_alpha_float16;
+ return MESA_FORMAT_ALPHA_FLOAT16;
case GL_ALPHA32F_ARB:
- return &_mesa_texformat_alpha_float32;
+ return MESA_FORMAT_ALPHA_FLOAT32;
case GL_LUMINANCE16F_ARB:
- return &_mesa_texformat_luminance_float16;
+ return MESA_FORMAT_LUMINANCE_FLOAT16;
case GL_LUMINANCE32F_ARB:
- return &_mesa_texformat_luminance_float32;
+ return MESA_FORMAT_LUMINANCE_FLOAT32;
case GL_LUMINANCE_ALPHA16F_ARB:
- return &_mesa_texformat_luminance_alpha_float16;
+ return MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16;
case GL_LUMINANCE_ALPHA32F_ARB:
- return &_mesa_texformat_luminance_alpha_float32;
+ return MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32;
case GL_INTENSITY16F_ARB:
- return &_mesa_texformat_intensity_float16;
+ return MESA_FORMAT_INTENSITY_FLOAT16;
case GL_INTENSITY32F_ARB:
- return &_mesa_texformat_intensity_float32;
+ return MESA_FORMAT_INTENSITY_FLOAT32;
case GL_RGB16F_ARB:
- return &_mesa_texformat_rgba_float16;
+ return MESA_FORMAT_RGBA_FLOAT16;
case GL_RGB32F_ARB:
- return &_mesa_texformat_rgba_float32;
+ return MESA_FORMAT_RGBA_FLOAT32;
case GL_RGBA16F_ARB:
- return &_mesa_texformat_rgba_float16;
+ return MESA_FORMAT_RGBA_FLOAT16;
case GL_RGBA32F_ARB:
- return &_mesa_texformat_rgba_float32;
+ return MESA_FORMAT_RGBA_FLOAT32;
case GL_DEPTH_COMPONENT:
case GL_DEPTH_COMPONENT16:
case GL_DEPTH_COMPONENT32:
case GL_DEPTH_STENCIL_EXT:
case GL_DEPTH24_STENCIL8_EXT:
- return &_mesa_texformat_s8_z24;
+ return MESA_FORMAT_S8_Z24;
/* EXT_texture_sRGB */
case GL_SRGB:
case GL_SRGB8_ALPHA8:
case GL_COMPRESSED_SRGB:
case GL_COMPRESSED_SRGB_ALPHA:
- return &_mesa_texformat_srgba8;
+ return MESA_FORMAT_SRGBA8;
case GL_SLUMINANCE:
case GL_SLUMINANCE8:
case GL_COMPRESSED_SLUMINANCE:
- return &_mesa_texformat_sl8;
+ return MESA_FORMAT_SL8;
case GL_SLUMINANCE_ALPHA:
case GL_SLUMINANCE8_ALPHA8:
case GL_COMPRESSED_SLUMINANCE_ALPHA:
- return &_mesa_texformat_sla8;
+ return MESA_FORMAT_SLA8;
default:
_mesa_problem(ctx,
"unexpected internalFormat 0x%x in %s",
(int)internalFormat, __func__);
- return NULL;
+ return MESA_FORMAT_NONE;
}
- return NULL; /* never get here */
+ return MESA_FORMAT_NONE; /* never get here */
}
/**
texImage->TexFormat = radeonChooseTextureFormat(ctx, internalFormat, format, type, 0);
_mesa_set_fetch_functions(texImage, dims);
- if (_mesa_is_format_compressed(texImage->TexFormat->MesaFormat)) {
+ if (_mesa_is_format_compressed(texImage->TexFormat)) {
texelBytes = 0;
texImage->IsCompressed = GL_TRUE;
texImage->CompressedSize =
ctx->Driver.CompressedTextureSize(ctx, texImage->Width,
texImage->Height, texImage->Depth,
- texImage->TexFormat->MesaFormat);
+ texImage->TexFormat);
} else {
texImage->IsCompressed = GL_FALSE;
texImage->CompressedSize = 0;
- texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat);
+ texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
/* Minimum pitch of 32 bytes */
if (postConvWidth * texelBytes < 32) {
postConvWidth = 32 / texelBytes;
if (texImage->IsCompressed) {
size = texImage->CompressedSize;
} else {
- size = texImage->Width * texImage->Height * texImage->Depth * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat);
+ size = texImage->Width * texImage->Height * texImage->Depth * _mesa_get_format_bytes(texImage->TexFormat);
}
texImage->Data = _mesa_alloc_texmemory(size);
}
if (compressed) {
if (image->mt) {
uint32_t srcRowStride, bytesPerRow, rows;
- srcRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width);
+ srcRowStride = _mesa_compressed_row_stride(texImage->TexFormat, width);
bytesPerRow = srcRowStride;
rows = (height + 3) / 4;
copy_rows(texImage->Data, image->mt->levels[level].rowstride,
radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel];
dstRowStride = lvl->rowstride;
} else {
- dstRowStride = texImage->Width * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat);
+ dstRowStride = texImage->Width * _mesa_get_format_bytes(texImage->TexFormat);
}
if (dims == 3) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage");
for (i = 0; i < depth; ++i) {
- dstImageOffsets[i] = dstRowStride/_mesa_get_format_bytes(texImage->TexFormat->MesaFormat) * height * i;
+ dstImageOffsets[i] = dstRowStride/_mesa_get_format_bytes(texImage->TexFormat) * height * i;
}
} else {
dstImageOffsets = texImage->ImageOffsets;
radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel];
dstRowStride = lvl->rowstride;
} else {
- dstRowStride = texImage->RowStride * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat);
+ dstRowStride = texImage->RowStride * _mesa_get_format_bytes(texImage->TexFormat);
}
if (compressed) {
uint32_t srcRowStride, bytesPerRow, rows;
GLubyte *img_start;
if (!image->mt) {
- dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, texImage->Width);
+ dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, texImage->Width);
img_start = _mesa_compressed_image_address(xoffset, yoffset, 0,
- texImage->TexFormat->MesaFormat,
+ texImage->TexFormat,
texImage->Width, texImage->Data);
}
else {
uint32_t blocks_x = dstRowStride / (image->mt->bpp * 4);
img_start = texImage->Data + image->mt->bpp * 4 * (blocks_x * (yoffset / 4) + xoffset / 4);
}
- srcRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width);
+ srcRowStride = _mesa_compressed_row_stride(texImage->TexFormat, width);
bytesPerRow = srcRowStride;
rows = (height + 3) / 4;
/* need to confirm this value is correct */
if (mt->compressed) {
height = (image->base.Height + 3) / 4;
- srcrowstride = _mesa_compressed_row_stride(image->base.TexFormat->MesaFormat, image->base.Width);
+ srcrowstride = _mesa_compressed_row_stride(image->base.TexFormat, image->base.Width);
} else {
height = image->base.Height * image->base.Depth;
- srcrowstride = image->base.Width * _mesa_get_format_bytes(image->base.TexFormat->MesaFormat);
+ srcrowstride = image->base.Width * _mesa_get_format_bytes(image->base.TexFormat);
}
// if (mt->tilebits)
#ifndef RADEON_TEXTURE_H
#define RADEON_TEXTURE_H
+
+#include "main/formats.h"
+
+
struct gl_texture_image *radeonNewTextureImage(GLcontext *ctx);
void radeonFreeTexImageData(GLcontext *ctx, struct gl_texture_image *timage);
void radeonGenerateMipmap(GLcontext* ctx, GLenum target, struct gl_texture_object *texObj);
int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *texObj);
GLuint radeon_face_for_target(GLenum target);
-const struct gl_texture_format *radeonChooseTextureFormat_mesa(GLcontext * ctx,
- GLint internalFormat,
- GLenum format,
- GLenum type);
-const struct gl_texture_format *radeonChooseTextureFormat(GLcontext * ctx,
- GLint internalFormat,
- GLenum format,
- GLenum type, GLboolean fbo);
+
+gl_format radeonChooseTextureFormat_mesa(GLcontext * ctx,
+ GLint internalFormat,
+ GLenum format,
+ GLenum type);
+
+gl_format radeonChooseTextureFormat(GLcontext * ctx,
+ GLint internalFormat,
+ GLenum format,
+ GLenum type, GLboolean fbo);
void radeonTexImage1D(GLcontext * ctx, GLenum target, GLint level,
GLint internalFormat,
* components to white. This way we get the correct result.
*/
+#if 0
+/* Using MESA_FORMAT_RGBA8888 to store alpha-only textures should
+ * work but is space inefficient.
+ */
+
static GLboolean
_savage_texstore_a1114444(TEXSTORE_PARAMS);
return GL_FALSE;
_mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
+ GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
GLubyte *dstRow = (GLubyte *) dstAddr
- + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstImageOffsets[dstZoffset + img] * texelBytes
+ dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
+ + dstXoffset * texelBytes;
for (row = 0; row < srcHeight; row++) {
GLushort *dstUI = (GLushort *) dstRow;
for (col = 0; col < srcWidth; col++) {
return GL_FALSE;
_mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
for (img = 0; img < srcDepth; img++) {
+ GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
GLubyte *dstRow = (GLubyte *) dstAddr
- + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ + dstImageOffsets[dstZoffset + img] * texelBytes
+ dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
+ + dstXoffset * texelBytes;
for (row = 0; row < srcHeight; row++) {
GLuint *dstUI = (GLuint *) dstRow;
for (col = 0; col < srcWidth; col++) {
return GL_TRUE;
}
+#endif
/* Called by the _mesa_store_teximage[123]d() functions. */
-static const struct gl_texture_format *
+static gl_format
savageChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
GLenum format, GLenum type )
{
switch ( type ) {
case GL_UNSIGNED_INT_10_10_10_2:
case GL_UNSIGNED_INT_2_10_10_10_REV:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555;
+ return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB1555;
case GL_UNSIGNED_SHORT_4_4_4_4:
case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case GL_UNSIGNED_SHORT_5_5_5_1:
case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
default:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
+ return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444;
}
case 3:
switch ( type ) {
case GL_UNSIGNED_SHORT_4_4_4_4:
case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case GL_UNSIGNED_SHORT_5_5_5_1:
case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
case GL_UNSIGNED_SHORT_5_6_5:
case GL_UNSIGNED_SHORT_5_6_5_REV:
- return &_mesa_texformat_rgb565;
+ return MESA_FORMAT_RGB565;
default:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
+ return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565;
}
case GL_RGBA8:
case GL_RGBA12:
case GL_RGBA16:
return !force16bpt ?
- &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
+ MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444;
case GL_RGB10_A2:
return !force16bpt ?
- &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555;
+ MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB1555;
case GL_RGBA4:
case GL_RGBA2:
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
case GL_RGB8:
case GL_RGB10:
case GL_RGB12:
case GL_RGB16:
- return !force16bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
+ return !force16bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565;
case GL_RGB5:
case GL_RGB4:
case GL_R3_G3_B2:
- return &_mesa_texformat_rgb565;
+ return MESA_FORMAT_RGB565;
case GL_ALPHA:
case GL_COMPRESSED_ALPHA:
- return isSavage4 ? &_mesa_texformat_a8 : (
+#if 0
+ return isSavage4 ? MESA_FORMAT_a8 : (
do32bpt ? &_savage_texformat_a1118888 : &_savage_texformat_a1114444);
+#else
+ if (isSavage4)
+ return MESA_FORMAT_A8;
+ else if (do32bpt)
+ return MESA_FORMAT_ARGB8888;
+ else
+ return MESA_FORMAT_ARGB4444;
+#endif
case GL_ALPHA4:
- return isSavage4 ? &_mesa_texformat_a8 : &_savage_texformat_a1114444;
+#if 0
+ return isSavage4 ? MESA_FORMAT_a8 : &_savage_texformat_a1114444;
+#else
+ if (isSavage4)
+ return MESA_FORMAT_A8;
+ else
+ return MESA_FORMAT_ARGB4444;
+#endif
case GL_ALPHA8:
case GL_ALPHA12:
case GL_ALPHA16:
- return isSavage4 ? &_mesa_texformat_a8 : (
+#if 0
+ return isSavage4 ? MESA_FORMAT_a8 : (
!force16bpt ? &_savage_texformat_a1118888 : &_savage_texformat_a1114444);
-
+#else
+ if (isSavage4)
+ return MESA_FORMAT_A8;
+ else if (force16bpt)
+ return MESA_FORMAT_ARGB4444;
+ else
+ return MESA_FORMAT_ARGB8888;
+#endif
case 1:
case GL_LUMINANCE:
case GL_COMPRESSED_LUMINANCE:
/* no alpha, but use argb1555 in 16bit case to get pure grey values */
- return isSavage4 ? &_mesa_texformat_l8 : (
- do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555);
+ return isSavage4 ? MESA_FORMAT_L8 : (
+ do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB1555);
case GL_LUMINANCE4:
- return isSavage4 ? &_mesa_texformat_l8 : &_mesa_texformat_argb1555;
+ return isSavage4 ? MESA_FORMAT_L8 : MESA_FORMAT_ARGB1555;
case GL_LUMINANCE8:
case GL_LUMINANCE12:
case GL_LUMINANCE16:
- return isSavage4 ? &_mesa_texformat_l8 : (
- !force16bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555);
+ return isSavage4 ? MESA_FORMAT_L8 : (
+ !force16bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB1555);
case 2:
case GL_LUMINANCE_ALPHA:
case GL_COMPRESSED_LUMINANCE_ALPHA:
/* Savage4 has a al44 texture format. But it's not supported by Mesa. */
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
+ return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444;
case GL_LUMINANCE4_ALPHA4:
case GL_LUMINANCE6_ALPHA2:
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case GL_LUMINANCE8_ALPHA8:
case GL_LUMINANCE12_ALPHA4:
case GL_LUMINANCE12_ALPHA12:
case GL_LUMINANCE16_ALPHA16:
- return !force16bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
+ return !force16bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444;
#if 0
/* TFT_I8 produces garbage on ProSavageDDR and subsequent texture
* disable keeps rendering garbage. Disabled for now. */
case GL_INTENSITY:
case GL_COMPRESSED_INTENSITY:
- return isSavage4 ? &_mesa_texformat_i8 : (
- do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444);
+ return isSavage4 ? MESA_FORMAT_i8 : (
+ do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444);
case GL_INTENSITY4:
- return isSavage4 ? &_mesa_texformat_i8 : &_mesa_texformat_argb4444;
+ return isSavage4 ? MESA_FORMAT_i8 : MESA_FORMAT_ARGB4444;
case GL_INTENSITY8:
case GL_INTENSITY12:
case GL_INTENSITY16:
- return isSavage4 ? &_mesa_texformat_i8 : (
- !force16bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444);
+ return isSavage4 ? MESA_FORMAT_i8 : (
+ !force16bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444);
#else
case GL_INTENSITY:
case GL_COMPRESSED_INTENSITY:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
+ return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444;
case GL_INTENSITY4:
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case GL_INTENSITY8:
case GL_INTENSITY12:
case GL_INTENSITY16:
- return !force16bpt ? &_mesa_texformat_argb8888 :
- &_mesa_texformat_argb4444;
+ return !force16bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444;
#endif
case GL_RGB_S3TC:
case GL_RGB4_S3TC:
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgb_dxt1;
+ return MESA_FORMAT_RGB_DXT1;
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgba_dxt1;
+ return MESA_FORMAT_RGBA_DXT1;
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- return &_mesa_texformat_rgba_dxt3;
+ return MESA_FORMAT_RGBA_DXT3;
case GL_RGBA_S3TC:
case GL_RGBA4_S3TC:
if (!isSavage4)
/* Not the best choice but Savage3D/MX/IX don't support DXT3 or DXT5. */
- return &_mesa_texformat_rgba_dxt1;
+ return MESA_FORMAT_RGBA_DXT1;
/* fall through */
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return &_mesa_texformat_rgba_dxt5;
+ return MESA_FORMAT_RGBA_DXT5;
/*
case GL_COLOR_INDEX:
*/
default:
_mesa_problem(ctx, "unexpected texture format in %s", __FUNCTION__);
- return NULL;
+ return MESA_FORMAT_NONE;
}
}
assert(t);
assert(image);
- switch (image->TexFormat->MesaFormat) {
+ switch (image->TexFormat) {
case MESA_FORMAT_ARGB8888:
textureFormat = TFT_ARGB8888;
t->texelBytes = tileIndex = 4;
/* Texel fetching with our custom texture formats works just like
* the standard argb formats. */
+#if 0
_savage_texformat_a1114444.FetchTexel1D = _mesa_texformat_argb4444.FetchTexel1D;
_savage_texformat_a1114444.FetchTexel2D = _mesa_texformat_argb4444.FetchTexel2D;
_savage_texformat_a1114444.FetchTexel3D = _mesa_texformat_argb4444.FetchTexel3D;
_savage_texformat_a1118888.FetchTexel1Df= _mesa_texformat_argb8888.FetchTexel1Df;
_savage_texformat_a1118888.FetchTexel2Df= _mesa_texformat_argb8888.FetchTexel2Df;
_savage_texformat_a1118888.FetchTexel3Df= _mesa_texformat_argb8888.FetchTexel3Df;
+#endif
}
if (t->format == 0) {
t->format = image->_BaseFormat;
- switch (image->TexFormat->MesaFormat)
+ switch (image->TexFormat)
{
case MESA_FORMAT_ARGB8888:
t->hwformat = TEXEL_ARGB_8888_32;
t->hwformat = TEXEL_VUY422;
break;
default:
- sis_fatal_error("Bad texture format 0x%x.\n",
- image->TexFormat->MesaFormat);
+ sis_fatal_error("Bad texture format 0x%x.\n", image->TexFormat);
}
}
assert(t->format == image->_BaseFormat);
- texel_size = _mesa_get_format_bytes(image->TexFormat->MesaFormat);
+ texel_size = _mesa_get_format_bytes(image->TexFormat);
size = image->Width * image->Height * texel_size + TEXTURE_HW_PLUS;
addr = sisAllocFB( smesa, size, &t->image[level].handle );
return (texObj->DriverData != NULL);
}
-static const struct gl_texture_format *
+static gl_format
sisChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
GLenum format, GLenum type )
{
switch ( type ) {
case GL_UNSIGNED_INT_10_10_10_2:
case GL_UNSIGNED_INT_2_10_10_10_REV:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555;
+ return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB1555;
case GL_UNSIGNED_SHORT_4_4_4_4:
case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case GL_UNSIGNED_SHORT_5_5_5_1:
case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
default:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
+ return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444;
}
case 3:
switch ( type ) {
case GL_UNSIGNED_SHORT_4_4_4_4:
case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case GL_UNSIGNED_SHORT_5_5_5_1:
case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
case GL_UNSIGNED_SHORT_5_6_5:
case GL_UNSIGNED_SHORT_5_6_5_REV:
- return &_mesa_texformat_rgb565;
+ return MESA_FORMAT_RGB565;
default:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
+ return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565;
}
case GL_RGBA8:
case GL_RGBA12:
case GL_RGBA16:
return !force16bpt ?
- &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
+ MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444;
case GL_RGB10_A2:
return !force16bpt ?
- &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555;
+ MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB1555;
case GL_RGBA4:
case GL_RGBA2:
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
case GL_RGB8:
case GL_RGB10:
case GL_RGB12:
case GL_RGB16:
- return !force16bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
+ return !force16bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565;
case GL_RGB5:
case GL_RGB4:
- return &_mesa_texformat_rgb565;
+ return MESA_FORMAT_RGB565;
case GL_R3_G3_B2:
- return &_mesa_texformat_rgb332;
+ return MESA_FORMAT_RGB332;
case GL_ALPHA:
case GL_ALPHA4: /* FIXME: This could use its own texstore */
case GL_ALPHA12:
case GL_ALPHA16:
case GL_COMPRESSED_ALPHA:
- return &_mesa_texformat_a8;
+ return MESA_FORMAT_A8;
case 1:
case GL_LUMINANCE:
case GL_LUMINANCE12:
case GL_LUMINANCE16:
case GL_COMPRESSED_LUMINANCE:
- return &_mesa_texformat_l8;
+ return MESA_FORMAT_L8;
case 2:
case GL_LUMINANCE_ALPHA:
case GL_LUMINANCE12_ALPHA12:
case GL_LUMINANCE16_ALPHA16:
case GL_COMPRESSED_LUMINANCE_ALPHA:
- return &_mesa_texformat_al88;
+ return MESA_FORMAT_AL88;
case GL_INTENSITY:
case GL_INTENSITY4:
case GL_INTENSITY12:
case GL_INTENSITY16:
case GL_COMPRESSED_INTENSITY:
- return &_mesa_texformat_i8;
+ return MESA_FORMAT_I8;
case GL_YCBCR_MESA:
if (type == GL_UNSIGNED_SHORT_8_8_APPLE ||
type == GL_UNSIGNED_BYTE)
- return &_mesa_texformat_ycbcr;
+ return MESA_FORMAT_YCBCR;
else
- return &_mesa_texformat_ycbcr_rev;
+ return MESA_FORMAT_YCBCR_REV;
default:
_mesa_problem(ctx, "unexpected format in sisDDChooseTextureFormat: %d",
internalFormat);
- return NULL;
+ return MESA_FORMAT_NONE;
}
}
/* Upload the texture */
WaitEngIdle(smesa);
- texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat);
+ texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
copySize = width * texelBytes;
src = (char *)texImage->Data + xoffset * texelBytes;
/* Upload the texture */
WaitEngIdle(smesa);
- texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat);
+ texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
copySize = width * texelBytes;
src = (char *)texImage->Data + (xoffset + yoffset * texImage->Width) *
GLubyte *_d = NULL;
GLenum _t = 0;
- if (texImage->TexFormat->MesaFormat == MESA_FORMAT_RGB565) {
+ if (texImage->TexFormat == MESA_FORMAT_RGB565) {
_t = GL_UNSIGNED_SHORT_5_6_5_REV;
bpt = bytesPerPixel;
- } else if (texImage->TexFormat->MesaFormat == MESA_FORMAT_ARGB4444) {
+ } else if (texImage->TexFormat == MESA_FORMAT_ARGB4444) {
_t = GL_UNSIGNED_SHORT_4_4_4_4_REV;
bpt = bytesPerPixel;
- } else if (texImage->TexFormat->MesaFormat == MESA_FORMAT_ARGB1555) {
+ } else if (texImage->TexFormat == MESA_FORMAT_ARGB1555) {
_t = GL_UNSIGNED_SHORT_1_5_5_5_REV;
bpt = bytesPerPixel;
}
_s = src = MALLOC(srcRowStride * srcHeight);
_d = dst = MALLOC(dstWidth * bytesPerPixel * dstHeight);
_mesa_texstore(ctx, 2, GL_RGBA,
- &_mesa_texformat_rgba8888_rev, src,
+ MESA_FORMAT_RGBA8888_REV, src,
0, 0, 0, /* dstX/Y/Zoffset */
srcRowStride, /* dstRowStride */
&dstImageOffsets,
const tdfxMipMapLevel *mml;
texImage = _mesa_get_tex_image(ctx, texObj, target, level);
+ texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
assert(!texImage->IsCompressed);
mml = TDFX_TEXIMAGE_DATA(texImage);
#endif
-static const struct gl_texture_format *
+static gl_format
tdfxChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
GLenum srcFormat, GLenum srcType )
{
case GL_ALPHA12:
case GL_ALPHA16:
case GL_COMPRESSED_ALPHA:
- return &_mesa_texformat_a8;
+ return MESA_FORMAT_A8;
case 1:
case GL_LUMINANCE:
case GL_LUMINANCE4:
case GL_LUMINANCE12:
case GL_LUMINANCE16:
case GL_COMPRESSED_LUMINANCE:
- return &_mesa_texformat_l8;
+ return MESA_FORMAT_L8;
case 2:
case GL_LUMINANCE_ALPHA:
case GL_LUMINANCE4_ALPHA4:
case GL_LUMINANCE12_ALPHA12:
case GL_LUMINANCE16_ALPHA16:
case GL_COMPRESSED_LUMINANCE_ALPHA:
- return &_mesa_texformat_al88;
+ return MESA_FORMAT_AL88;
case GL_INTENSITY:
case GL_INTENSITY4:
case GL_INTENSITY8:
case GL_INTENSITY12:
case GL_INTENSITY16:
case GL_COMPRESSED_INTENSITY:
- return &_mesa_texformat_i8;
+ return MESA_FORMAT_I8;
case GL_R3_G3_B2:
case GL_RGB4:
case GL_RGB5:
- return &_mesa_texformat_rgb565;
+ return MESA_FORMAT_RGB565;
case GL_COMPRESSED_RGB:
/* intentional fall-through */
case 3:
case GL_RGB:
if ( srcFormat == GL_RGB && srcType == GL_UNSIGNED_SHORT_5_6_5 ) {
- return &_mesa_texformat_rgb565;
+ return MESA_FORMAT_RGB565;
}
/* intentional fall through */
case GL_RGB8:
case GL_RGB10:
case GL_RGB12:
case GL_RGB16:
- return (allow32bpt) ? &_mesa_texformat_argb8888
- : &_mesa_texformat_rgb565;
+ return (allow32bpt) ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565;
case GL_RGBA2:
case GL_RGBA4:
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case GL_COMPRESSED_RGBA:
/* intentional fall-through */
case 4:
case GL_RGBA:
if ( srcFormat == GL_BGRA ) {
if ( srcType == GL_UNSIGNED_INT_8_8_8_8_REV ) {
- return &_mesa_texformat_argb8888;
+ return MESA_FORMAT_ARGB8888;
}
else if ( srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV ) {
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
}
else if ( srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ) {
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
}
}
/* intentional fall through */
case GL_RGB10_A2:
case GL_RGBA12:
case GL_RGBA16:
- return allow32bpt ? &_mesa_texformat_argb8888
- : &_mesa_texformat_argb4444;
+ return allow32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444;
case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
case GL_COLOR_INDEX:
case GL_COLOR_INDEX1_EXT:
case GL_COLOR_INDEX2_EXT:
case GL_COLOR_INDEX8_EXT:
case GL_COLOR_INDEX12_EXT:
case GL_COLOR_INDEX16_EXT:
- return &_mesa_texformat_ci8;
+ return MESA_FORMAT_CI8;
/* GL_EXT_texture_compression_s3tc */
/* GL_S3_s3tc */
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
case GL_RGB_S3TC:
case GL_RGB4_S3TC:
- return &_mesa_texformat_rgb_dxt1;
+ return MESA_FORMAT_RGB_DXT1;
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgba_dxt1;
+ return MESA_FORMAT_RGBA_DXT1;
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
case GL_RGBA_S3TC:
case GL_RGBA4_S3TC:
- return &_mesa_texformat_rgba_dxt3;
+ return MESA_FORMAT_RGBA_DXT3;
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return &_mesa_texformat_rgba_dxt5;
+ return MESA_FORMAT_RGBA_DXT5;
/* GL_3DFX_texture_compression_FXT1 */
case GL_COMPRESSED_RGB_FXT1_3DFX:
- return &_mesa_texformat_rgb_fxt1;
+ return MESA_FORMAT_RGB_FXT1;
case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return &_mesa_texformat_rgba_fxt1;
+ return MESA_FORMAT_RGBA_FXT1;
default:
_mesa_problem(ctx, "unexpected format in tdfxChooseTextureFormat");
- return NULL;
+ return MESA_FORMAT_NONE;
}
}
i = i * mml->wScale;
j = j * mml->hScale;
+ /* XXX Get fetch func from _mesa_get_texel_fetch_func()
_mesa_texformat_rgb_dxt1.FetchTexel2D(texImage, i, j, k, rgba);
+ */
}
i = i * mml->wScale;
j = j * mml->hScale;
+ /* XXX Get fetch func from _mesa_get_texel_fetch_func()
_mesa_texformat_rgba_dxt1.FetchTexel2D(texImage, i, j, k, rgba);
+ */
}
i = i * mml->wScale;
j = j * mml->hScale;
+ /* XXX Get fetch func from _mesa_get_texel_fetch_func()
_mesa_texformat_rgba_dxt3.FetchTexel2D(texImage, i, j, k, rgba);
+ */
}
i = i * mml->wScale;
j = j * mml->hScale;
+ /* XXX Get fetch func from _mesa_get_texel_fetch_func()
_mesa_texformat_rgba_dxt5.FetchTexel2D(texImage, i, j, k, rgba);
+ */
}
}
/* unpack image, apply transfer ops and store in rawImage */
_mesa_texstore(ctx, 2, GL_RGBA,
- &_mesa_texformat_rgba8888_rev, rawImage,
+ MESA_FORMAT_RGBA8888_REV, rawImage,
0, 0, 0, /* dstX/Y/Zoffset */
width * rawBytes, /* dstRowStride */
&dstImageOffsets,
texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
internalFormat, format, type);
assert(texImage->TexFormat);
- mesaFormat = texImage->TexFormat->MesaFormat;
+ mesaFormat = texImage->TexFormat;
mml->glideFormat = fxGlideFormat(mesaFormat);
ti->info.format = mml->glideFormat;
texImage->FetchTexelc = fxFetchFunction(mesaFormat);
- texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat);
+ texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
if (texImage->IsCompressed) {
texImage->CompressedSize = _mesa_compressed_texture_size(ctx,
mml->height,
1,
mesaFormat);
- dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, mml->width);
+ dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, mml->width);
texImage->Data = _mesa_alloc_texmemory(texImage->CompressedSize);
} else {
dstRowStride = mml->width * texelBytes;
assert(texImage->Data); /* must have an existing texture image! */
assert(texImage->_BaseFormat);
- texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat);
+ texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
if (texImage->IsCompressed) {
- dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, mml->width);
+ dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, mml->width);
} else {
dstRowStride = mml->width * texelBytes;
}
/* Determine the appropriate Glide texel format,
* given the user's internal texture format hint.
*/
- mesaFormat = texImage->TexFormat->MesaFormat;
+ mesaFormat = texImage->TexFormat;
mml->glideFormat = fxGlideFormat(mesaFormat);
ti->info.format = mml->glideFormat;
texImage->FetchTexelc = fxFetchFunction(mesaFormat);
* we replicate the data over the padded area.
* For now, we take 2) + 3) but texelfetchers will be wrong!
*/
- const GLuint mesaFormat = texImage->TexFormat->MesaFormat;
+ const GLuint mesaFormat = texImage->TexFormat;
GLuint srcRowStride = _mesa_compressed_row_stride(mesaFormat, width);
GLuint destRowStride = _mesa_compressed_row_stride(mesaFormat,
GLint destRowStride, srcRowStride;
GLint i, rows;
GLubyte *dest;
- const GLuint mesaFormat = texImage->TexFormat->MesaFormat;
+ const GLuint mesaFormat = texImage->TexFormat;
if (TDFX_DEBUG & DEBUG_VERBOSE_DRI) {
fprintf(stderr, "tdfxCompressedTexSubImage2D: id=%d\n", texObj->Name);
#include "via_ioctl.h"
#include "via_3d_reg.h"
-static const struct gl_texture_format *
+static gl_format
viaChooseTexFormat( GLcontext *ctx, GLint internalFormat,
GLenum format, GLenum type )
{
if ( format == GL_BGRA ) {
if ( type == GL_UNSIGNED_INT_8_8_8_8_REV ||
type == GL_UNSIGNED_BYTE ) {
- return &_mesa_texformat_argb8888;
+ return MESA_FORMAT_ARGB8888;
}
else if ( type == GL_UNSIGNED_SHORT_4_4_4_4_REV ) {
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
}
else if ( type == GL_UNSIGNED_SHORT_1_5_5_5_REV ) {
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
}
}
else if ( type == GL_UNSIGNED_BYTE ||
type == GL_UNSIGNED_INT_8_8_8_8_REV ||
type == GL_UNSIGNED_INT_8_8_8_8 ) {
- return &_mesa_texformat_argb8888;
+ return MESA_FORMAT_ARGB8888;
}
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
+ return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444;
case 3:
case GL_RGB:
case GL_COMPRESSED_RGB:
if ( format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 ) {
- return &_mesa_texformat_rgb565;
+ return MESA_FORMAT_RGB565;
}
else if ( type == GL_UNSIGNED_BYTE ) {
- return &_mesa_texformat_argb8888;
+ return MESA_FORMAT_ARGB8888;
}
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
+ return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565;
case GL_RGBA8:
case GL_RGB10_A2:
case GL_RGBA12:
case GL_RGBA16:
- return &_mesa_texformat_argb8888;
+ return MESA_FORMAT_ARGB8888;
case GL_RGBA4:
case GL_RGBA2:
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
case GL_RGB8:
case GL_RGB10:
case GL_RGB12:
case GL_RGB16:
- return &_mesa_texformat_argb8888;
+ return MESA_FORMAT_ARGB8888;
case GL_RGB5:
case GL_RGB4:
case GL_R3_G3_B2:
- return &_mesa_texformat_rgb565;
+ return MESA_FORMAT_RGB565;
case GL_ALPHA:
case GL_ALPHA4:
case GL_ALPHA12:
case GL_ALPHA16:
case GL_COMPRESSED_ALPHA:
- return &_mesa_texformat_a8;
+ return MESA_FORMAT_A8;
case 1:
case GL_LUMINANCE:
case GL_LUMINANCE12:
case GL_LUMINANCE16:
case GL_COMPRESSED_LUMINANCE:
- return &_mesa_texformat_l8;
+ return MESA_FORMAT_L8;
case 2:
case GL_LUMINANCE_ALPHA:
case GL_LUMINANCE12_ALPHA12:
case GL_LUMINANCE16_ALPHA16:
case GL_COMPRESSED_LUMINANCE_ALPHA:
- return &_mesa_texformat_al88;
+ return MESA_FORMAT_AL88;
case GL_INTENSITY:
case GL_INTENSITY4:
case GL_INTENSITY12:
case GL_INTENSITY16:
case GL_COMPRESSED_INTENSITY:
- return &_mesa_texformat_i8;
+ return MESA_FORMAT_I8;
case GL_YCBCR_MESA:
if (type == GL_UNSIGNED_SHORT_8_8_MESA ||
type == GL_UNSIGNED_BYTE)
- return &_mesa_texformat_ycbcr;
+ return MESA_FORMAT_YCBCR;
else
- return &_mesa_texformat_ycbcr_rev;
+ return MESA_FORMAT_YCBCR_REV;
case GL_COMPRESSED_RGB_FXT1_3DFX:
- return &_mesa_texformat_rgb_fxt1;
+ return MESA_FORMAT_RGB_FXT1;
case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return &_mesa_texformat_rgba_fxt1;
+ return MESA_FORMAT_RGBA_FXT1;
case GL_RGB_S3TC:
case GL_RGB4_S3TC:
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgb_dxt1;
+ return MESA_FORMAT_RGB_DXT1;
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgba_dxt1;
+ return MESA_FORMAT_RGBA_DXT1;
case GL_RGBA_S3TC:
case GL_RGBA4_S3TC:
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- return &_mesa_texformat_rgba_dxt3;
+ return MESA_FORMAT_RGBA_DXT3;
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return &_mesa_texformat_rgba_dxt5;
+ return MESA_FORMAT_RGBA_DXT5;
case GL_COLOR_INDEX:
case GL_COLOR_INDEX1_EXT:
case GL_COLOR_INDEX8_EXT:
case GL_COLOR_INDEX12_EXT:
case GL_COLOR_INDEX16_EXT:
- return &_mesa_texformat_ci8;
+ return MESA_FORMAT_CI8;
default:
fprintf(stderr, "unexpected texture format %s in %s\n",
_mesa_lookup_enum_by_nr(internalFormat),
__FUNCTION__);
- return NULL;
+ return MESA_FORMAT_NONE;
}
- return NULL; /* never get here */
+ return MESA_FORMAT_NONE; /* never get here */
}
static int logbase2(int n)
GLuint widthExp = 0;
GLuint heightExp = 0;
- switch (baseImage->image.TexFormat->MesaFormat) {
+ switch (baseImage->image.TexFormat) {
case MESA_FORMAT_ARGB8888:
texFormat = HC_HTXnFM_ARGB8888;
break;
_mesa_set_fetch_functions(texImage, dims);
- texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat);
+ texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
if (texelBytes == 0) {
/* compressed format */
texImage->CompressedSize =
ctx->Driver.CompressedTextureSize(ctx, texImage->Width,
texImage->Height, texImage->Depth,
- texImage->TexFormat->MesaFormat);
+ texImage->TexFormat);
}
/* Minimum pitch of 32 bytes */
GLboolean success;
if (texImage->IsCompressed) {
- dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width);
+ dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, width);
}
else {
- dstRowStride = postConvWidth * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat);
+ dstRowStride = postConvWidth * _mesa_get_format_bytes(texImage->TexFormat);
}
success = _mesa_texstore(ctx, dims,
texImage->_BaseFormat,
#endif
-const struct gl_texture_format *
+gl_format
fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
GLenum srcFormat, GLenum srcType )
{
case 3:
case GL_RGB:
if ( srcFormat == GL_RGB && srcType == GL_UNSIGNED_SHORT_5_6_5 ) {
- return &_mesa_texformat_rgb565;
+ return MESA_FORMAT_RGB565;
}
/* intentional fall through */
case GL_RGB8:
case GL_RGB10:
case GL_RGB12:
case GL_RGB16:
- return (allow32bpt) ? &_mesa_texformat_argb8888
- : &_mesa_texformat_rgb565;
+ return (allow32bpt) ? MESA_FORMAT_ARGB8888
+ : MESA_FORMAT_RGB565;
case GL_RGBA2:
case GL_RGBA4:
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case GL_COMPRESSED_RGBA:
/* intentional fall through */
case 4:
case GL_RGBA:
if ( srcFormat == GL_BGRA ) {
if ( srcType == GL_UNSIGNED_INT_8_8_8_8_REV ) {
- return &_mesa_texformat_argb8888;
+ return MESA_FORMAT_ARGB8888;
}
else if ( srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV ) {
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
}
else if ( srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ) {
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
}
}
/* intentional fall through */
case GL_RGB10_A2:
case GL_RGBA12:
case GL_RGBA16:
- return (allow32bpt) ? &_mesa_texformat_argb8888
- : &_mesa_texformat_argb4444;
+ return (allow32bpt) ? MESA_FORMAT_ARGB8888
+ : MESA_FORMAT_ARGB4444;
case GL_INTENSITY:
case GL_INTENSITY4:
case GL_INTENSITY8:
case GL_INTENSITY12:
case GL_INTENSITY16:
case GL_COMPRESSED_INTENSITY:
- return &_mesa_texformat_i8;
+ return MESA_FORMAT_I8;
case 1:
case GL_LUMINANCE:
case GL_LUMINANCE4:
case GL_LUMINANCE12:
case GL_LUMINANCE16:
case GL_COMPRESSED_LUMINANCE:
- return &_mesa_texformat_l8;
+ return MESA_FORMAT_L8;
case GL_ALPHA:
case GL_ALPHA4:
case GL_ALPHA8:
case GL_ALPHA12:
case GL_ALPHA16:
case GL_COMPRESSED_ALPHA:
- return &_mesa_texformat_a8;
+ return MESA_FORMAT_A8;
case GL_COLOR_INDEX:
case GL_COLOR_INDEX1_EXT:
case GL_COLOR_INDEX2_EXT:
case GL_COLOR_INDEX8_EXT:
case GL_COLOR_INDEX12_EXT:
case GL_COLOR_INDEX16_EXT:
- return &_mesa_texformat_ci8;
+ return MESA_FORMAT_CI8;
case 2:
case GL_LUMINANCE_ALPHA:
case GL_LUMINANCE4_ALPHA4:
case GL_LUMINANCE12_ALPHA12:
case GL_LUMINANCE16_ALPHA16:
case GL_COMPRESSED_LUMINANCE_ALPHA:
- return &_mesa_texformat_al88;
+ return MESA_FORMAT_AL88;
case GL_R3_G3_B2:
case GL_RGB4:
case GL_RGB5:
- return &_mesa_texformat_rgb565;
+ return MESA_FORMAT_RGB565;
case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
/* GL_EXT_texture_compression_s3tc */
/* GL_S3_s3tc */
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
case GL_RGB_S3TC:
case GL_RGB4_S3TC:
- return &_mesa_texformat_rgb_dxt1;
+ return MESA_FORMAT_RGB_DXT1;
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgba_dxt1;
+ return MESA_FORMAT_RGBA_DXT1;
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
case GL_RGBA_S3TC:
case GL_RGBA4_S3TC:
- return &_mesa_texformat_rgba_dxt3;
+ return MESA_FORMAT_RGBA_DXT3;
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return &_mesa_texformat_rgba_dxt5;
+ return MESA_FORMAT_RGBA_DXT5;
/* GL_3DFX_texture_compression_FXT1 */
case GL_COMPRESSED_RGB_FXT1_3DFX:
- return &_mesa_texformat_rgb_fxt1;
+ return MESA_FORMAT_RGB_FXT1;
case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return &_mesa_texformat_rgba_fxt1;
+ return MESA_FORMAT_RGBA_FXT1;
default:
_mesa_problem(NULL, "unexpected format in fxDDChooseTextureFormat");
- return NULL;
+ return MESA_FORMAT_NONE;
}
}
/**
* In SW, we don't really compress GL_COMPRESSED_RGB[A] textures!
*/
-static const struct gl_texture_format *
+static gl_format
choose_tex_format( GLcontext *ctx, GLint internalFormat,
GLenum format, GLenum type )
{
switch (internalFormat) {
case GL_COMPRESSED_RGB_ARB:
- return &_mesa_texformat_rgb;
+ return MESA_FORMAT_RGB;
case GL_COMPRESSED_RGBA_ARB:
- return &_mesa_texformat_rgba;
+ return MESA_FORMAT_RGBA;
default:
return _mesa_choose_tex_format(ctx, internalFormat, format, type);
}
* functions. The driver should examine \p internalFormat and return a
* pointer to an appropriate gl_texture_format.
*/
- const struct gl_texture_format *(*ChooseTextureFormat)( GLcontext *ctx,
- GLint internalFormat, GLenum srcFormat, GLenum srcType );
+ GLuint (*ChooseTextureFormat)( GLcontext *ctx, GLint internalFormat,
+ GLenum srcFormat, GLenum srcType );
/**
* Called by glTexImage1D().
if (texImg) {
_mesa_printf(" Image %u: %d x %d x %d, format %u at %p\n", i,
texImg->Width, texImg->Height, texImg->Depth,
- texImg->TexFormat->MesaFormat, texImg->Data);
+ texImg->TexFormat, texImg->Data);
if (DumpImages && !written) {
GLuint face = 0;
write_texture_image(texObj, face, i);
return;
}
- baseFormat = _mesa_get_format_base_format(texImage->TexFormat->MesaFormat);
+ baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
if (format == GL_COLOR) {
if (baseFormat != GL_RGB &&
att->Complete = GL_FALSE;
return;
}
- if (_mesa_is_format_compressed(texImage->TexFormat->MesaFormat)) {
+ if (_mesa_is_format_compressed(texImage->TexFormat)) {
att_incomplete("compressed internalformat");
att->Complete = GL_FALSE;
return;
}
else {
/* uncompressed */
- convertFormat = srcImage->TexFormat->MesaFormat;
+ convertFormat = srcImage->TexFormat;
}
_mesa_format_to_type_and_comps(convertFormat, &datatype, &comps);
= ctx->Driver.CompressedTextureSize(ctx, dstImage->Width,
dstImage->Height,
dstImage->Depth,
- dstImage->TexFormat->MesaFormat);
+ dstImage->TexFormat);
ASSERT(dstImage->CompressedSize > 0);
}
ASSERT(dstData);
}
else {
- bytesPerTexel = _mesa_get_format_bytes(dstImage->TexFormat->MesaFormat);
+ bytesPerTexel = _mesa_get_format_bytes(dstImage->TexFormat);
ASSERT(dstWidth * dstHeight * dstDepth * bytesPerTexel > 0);
dstImage->Data = _mesa_alloc_texmemory(dstWidth * dstHeight
* dstDepth * bytesPerTexel);
/* compress image from dstData into dstImage->Data */
const GLenum srcFormat = _mesa_get_format_base_format(convertFormat);
GLint dstRowStride
- = _mesa_compressed_row_stride(dstImage->TexFormat->MesaFormat, dstWidth);
+ = _mesa_compressed_row_stride(dstImage->TexFormat, dstWidth);
ASSERT(srcFormat == GL_RGB || srcFormat == GL_RGBA);
_mesa_texstore(ctx, 2, dstImage->_BaseFormat,
GLboolean IsClientData; /**< Data owned by client? */
GLboolean _IsPowerOfTwo; /**< Are all dimensions powers of two? */
- const struct gl_texture_format *TexFormat;
+ GLuint TexFormat; /**< XXX Really gl_format */
struct gl_texture_object *TexObject; /**< Pointer back to parent object */
const GLint texWidth = dstRowStride * 8 / 16; /* a bit of a hack */
const GLchan *tempImage = NULL;
- ASSERT(dstFormat == &_mesa_texformat_rgb_fxt1);
+ ASSERT(dstFormat == MESA_FORMAT_RGB_FXT1);
ASSERT(dstXoffset % 8 == 0);
ASSERT(dstYoffset % 4 == 0);
ASSERT(dstZoffset == 0);
/* convert image to RGB/GLchan */
tempImage = _mesa_make_temp_chan_image(ctx, dims,
baseInternalFormat,
- dstFormat->BaseFormat,
+ _mesa_get_format_base_format(dstFormat),
srcWidth, srcHeight, srcDepth,
srcFormat, srcType, srcAddr,
srcPacking);
}
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- dstFormat->MesaFormat,
+ dstFormat,
texWidth, (GLubyte *) dstAddr);
fxt1_encode(srcWidth, srcHeight, 3, pixels, srcRowStride,
GLint texWidth = dstRowStride * 8 / 16; /* a bit of a hack */
const GLchan *tempImage = NULL;
- ASSERT(dstFormat == &_mesa_texformat_rgba_fxt1);
+ ASSERT(dstFormat == MESA_FORMAT_RGBA_FXT1);
ASSERT(dstXoffset % 8 == 0);
ASSERT(dstYoffset % 4 == 0);
ASSERT(dstZoffset == 0);
/* convert image to RGBA/GLchan */
tempImage = _mesa_make_temp_chan_image(ctx, dims,
baseInternalFormat,
- dstFormat->BaseFormat,
+ _mesa_get_format_base_format(dstFormat),
srcWidth, srcHeight, srcDepth,
srcFormat, srcType, srcAddr,
srcPacking);
}
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- dstFormat->MesaFormat,
+ dstFormat,
texWidth, (GLubyte *) dstAddr);
fxt1_encode(srcWidth, srcHeight, 4, pixels, srcRowStride,
const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */
const GLchan *tempImage = NULL;
- ASSERT(dstFormat == &_mesa_texformat_rgb_dxt1);
+ ASSERT(dstFormat == MESA_FORMAT_RGB_DXT1);
ASSERT(dstXoffset % 4 == 0);
ASSERT(dstYoffset % 4 == 0);
ASSERT(dstZoffset % 4 == 0);
/* convert image to RGB/GLchan */
tempImage = _mesa_make_temp_chan_image(ctx, dims,
baseInternalFormat,
- dstFormat->BaseFormat,
+ _mesa_get_format_base_format(dstFormat),
srcWidth, srcHeight, srcDepth,
srcFormat, srcType, srcAddr,
srcPacking);
}
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- dstFormat->MesaFormat,
+ dstFormat,
texWidth, (GLubyte *) dstAddr);
if (ext_tx_compress_dxtn) {
const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */
const GLchan *tempImage = NULL;
- ASSERT(dstFormat == &_mesa_texformat_rgba_dxt1);
+ ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT1);
ASSERT(dstXoffset % 4 == 0);
ASSERT(dstYoffset % 4 == 0);
ASSERT(dstZoffset % 4 == 0);
/* convert image to RGBA/GLchan */
tempImage = _mesa_make_temp_chan_image(ctx, dims,
baseInternalFormat,
- dstFormat->BaseFormat,
+ _mesa_get_format_base_format(dstFormat),
srcWidth, srcHeight, srcDepth,
srcFormat, srcType, srcAddr,
srcPacking);
}
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- dstFormat->MesaFormat,
+ dstFormat,
texWidth, (GLubyte *) dstAddr);
if (ext_tx_compress_dxtn) {
(*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,
const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */
const GLchan *tempImage = NULL;
- ASSERT(dstFormat == &_mesa_texformat_rgba_dxt3);
+ ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT3);
ASSERT(dstXoffset % 4 == 0);
ASSERT(dstYoffset % 4 == 0);
ASSERT(dstZoffset % 4 == 0);
/* convert image to RGBA/GLchan */
tempImage = _mesa_make_temp_chan_image(ctx, dims,
baseInternalFormat,
- dstFormat->BaseFormat,
+ _mesa_get_format_base_format(dstFormat),
srcWidth, srcHeight, srcDepth,
srcFormat, srcType, srcAddr,
srcPacking);
}
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- dstFormat->MesaFormat,
+ dstFormat,
texWidth, (GLubyte *) dstAddr);
if (ext_tx_compress_dxtn) {
(*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,
const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */
const GLchan *tempImage = NULL;
- ASSERT(dstFormat == &_mesa_texformat_rgba_dxt5);
+ ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT5);
ASSERT(dstXoffset % 4 == 0);
ASSERT(dstYoffset % 4 == 0);
ASSERT(dstZoffset % 4 == 0);
/* convert image to RGBA/GLchan */
tempImage = _mesa_make_temp_chan_image(ctx, dims,
baseInternalFormat,
- dstFormat->BaseFormat,
+ _mesa_get_format_base_format(dstFormat),
srcWidth, srcHeight, srcDepth,
srcFormat, srcType, srcAddr,
srcPacking);
}
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- dstFormat->MesaFormat,
+ dstFormat,
texWidth, (GLubyte *) dstAddr);
if (ext_tx_compress_dxtn) {
(*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,
/***************************************************************/
/** \name Default GLchan-based formats */
/*@{*/
-
+#if 0
const struct gl_texture_format _mesa_texformat_rgba = {
MESA_FORMAT_RGBA, /* MesaFormat */
GL_RGBA, /* BaseFormat */
0, /* StencilBits */
0, /* TexelBytes */
};
+#endif
/*@}*/
* This is called via dd_function_table::ChooseTextureFormat. Hardware drivers
* will typically override this function with a specialized version.
*/
-const struct gl_texture_format *
+gl_format
_mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
GLenum format, GLenum type )
{
case GL_RGB10_A2:
case GL_RGBA12:
case GL_RGBA16:
- return &_mesa_texformat_rgba;
+ return MESA_FORMAT_RGBA;
case GL_RGBA8:
- return &_mesa_texformat_rgba8888;
+ return MESA_FORMAT_RGBA8888;
case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
case GL_RGBA2:
- return &_mesa_texformat_argb4444_rev; /* just to test another format*/
+ return MESA_FORMAT_ARGB4444_REV; /* just to test another format*/
case GL_RGBA4:
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
/* RGB formats */
case 3:
case GL_RGB10:
case GL_RGB12:
case GL_RGB16:
- return &_mesa_texformat_rgb;
+ return MESA_FORMAT_RGB;
case GL_RGB8:
- return &_mesa_texformat_rgb888;
+ return MESA_FORMAT_RGB888;
case GL_R3_G3_B2:
- return &_mesa_texformat_rgb332;
+ return MESA_FORMAT_RGB332;
case GL_RGB4:
- return &_mesa_texformat_rgb565_rev; /* just to test another format */
+ return MESA_FORMAT_RGB565_REV; /* just to test another format */
case GL_RGB5:
- return &_mesa_texformat_rgb565;
+ return MESA_FORMAT_RGB565;
/* Alpha formats */
case GL_ALPHA:
case GL_ALPHA4:
case GL_ALPHA12:
case GL_ALPHA16:
- return &_mesa_texformat_alpha;
+ return MESA_FORMAT_ALPHA;
case GL_ALPHA8:
- return &_mesa_texformat_a8;
+ return MESA_FORMAT_A8;
/* Luminance formats */
case 1:
case GL_LUMINANCE4:
case GL_LUMINANCE12:
case GL_LUMINANCE16:
- return &_mesa_texformat_luminance;
+ return MESA_FORMAT_LUMINANCE;
case GL_LUMINANCE8:
- return &_mesa_texformat_l8;
+ return MESA_FORMAT_L8;
/* Luminance/Alpha formats */
case 2:
case GL_LUMINANCE12_ALPHA4:
case GL_LUMINANCE12_ALPHA12:
case GL_LUMINANCE16_ALPHA16:
- return &_mesa_texformat_luminance_alpha;
+ return MESA_FORMAT_LUMINANCE_ALPHA;
case GL_LUMINANCE8_ALPHA8:
- return &_mesa_texformat_al88;
+ return MESA_FORMAT_AL88;
case GL_INTENSITY:
case GL_INTENSITY4:
case GL_INTENSITY12:
case GL_INTENSITY16:
- return &_mesa_texformat_intensity;
+ return MESA_FORMAT_INTENSITY;
case GL_INTENSITY8:
- return &_mesa_texformat_i8;
+ return MESA_FORMAT_I8;
case GL_COLOR_INDEX:
case GL_COLOR_INDEX1_EXT:
case GL_COLOR_INDEX12_EXT:
case GL_COLOR_INDEX16_EXT:
case GL_COLOR_INDEX8_EXT:
- return &_mesa_texformat_ci8;
+ return MESA_FORMAT_CI8;
default:
; /* fallthrough */
case GL_DEPTH_COMPONENT:
case GL_DEPTH_COMPONENT24:
case GL_DEPTH_COMPONENT32:
- return &_mesa_texformat_z32;
+ return MESA_FORMAT_Z32;
case GL_DEPTH_COMPONENT16:
- return &_mesa_texformat_z16;
+ return MESA_FORMAT_Z16;
default:
; /* fallthrough */
}
switch (internalFormat) {
case GL_COMPRESSED_ALPHA_ARB:
- return &_mesa_texformat_alpha;
+ return MESA_FORMAT_ALPHA;
case GL_COMPRESSED_LUMINANCE_ARB:
- return &_mesa_texformat_luminance;
+ return MESA_FORMAT_LUMINANCE;
case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:
- return &_mesa_texformat_luminance_alpha;
+ return MESA_FORMAT_LUMINANCE_ALPHA;
case GL_COMPRESSED_INTENSITY_ARB:
- return &_mesa_texformat_intensity;
+ return MESA_FORMAT_INTENSITY;
case GL_COMPRESSED_RGB_ARB:
#if FEATURE_texture_fxt1
if (ctx->Extensions.TDFX_texture_compression_FXT1)
- return &_mesa_texformat_rgb_fxt1;
+ return MESA_FORMAT_RGB_FXT1;
#endif
#if FEATURE_texture_s3tc
if (ctx->Extensions.EXT_texture_compression_s3tc ||
ctx->Extensions.S3_s3tc)
- return &_mesa_texformat_rgb_dxt1;
+ return MESA_FORMAT_RGB_DXT1;
#endif
- return &_mesa_texformat_rgb;
+ return MESA_FORMAT_RGB;
case GL_COMPRESSED_RGBA_ARB:
#if FEATURE_texture_fxt1
if (ctx->Extensions.TDFX_texture_compression_FXT1)
- return &_mesa_texformat_rgba_fxt1;
+ return MESA_FORMAT_RGBA_FXT1;
#endif
#if FEATURE_texture_s3tc
if (ctx->Extensions.EXT_texture_compression_s3tc ||
ctx->Extensions.S3_s3tc)
- return &_mesa_texformat_rgba_dxt3; /* Not rgba_dxt1, see spec */
+ return MESA_FORMAT_RGBA_DXT3; /* Not rgba_dxt1, see spec */
#endif
- return &_mesa_texformat_rgba;
+ return MESA_FORMAT_RGBA;
default:
; /* fallthrough */
}
if (ctx->Extensions.MESA_ycbcr_texture) {
if (internalFormat == GL_YCBCR_MESA) {
if (type == GL_UNSIGNED_SHORT_8_8_MESA)
- return &_mesa_texformat_ycbcr;
+ return MESA_FORMAT_YCBCR;
else
- return &_mesa_texformat_ycbcr_rev;
+ return MESA_FORMAT_YCBCR_REV;
}
}
if (ctx->Extensions.TDFX_texture_compression_FXT1) {
switch (internalFormat) {
case GL_COMPRESSED_RGB_FXT1_3DFX:
- return &_mesa_texformat_rgb_fxt1;
+ return MESA_FORMAT_RGB_FXT1;
case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return &_mesa_texformat_rgba_fxt1;
+ return MESA_FORMAT_RGBA_FXT1;
default:
; /* fallthrough */
}
if (ctx->Extensions.EXT_texture_compression_s3tc) {
switch (internalFormat) {
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgb_dxt1;
+ return MESA_FORMAT_RGB_DXT1;
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgba_dxt1;
+ return MESA_FORMAT_RGBA_DXT1;
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- return &_mesa_texformat_rgba_dxt3;
+ return MESA_FORMAT_RGBA_DXT3;
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return &_mesa_texformat_rgba_dxt5;
+ return MESA_FORMAT_RGBA_DXT5;
default:
; /* fallthrough */
}
switch (internalFormat) {
case GL_RGB_S3TC:
case GL_RGB4_S3TC:
- return &_mesa_texformat_rgb_dxt1;
+ return MESA_FORMAT_RGB_DXT1;
case GL_RGBA_S3TC:
case GL_RGBA4_S3TC:
- return &_mesa_texformat_rgba_dxt3;
+ return MESA_FORMAT_RGBA_DXT3;
default:
; /* fallthrough */
}
if (ctx->Extensions.ARB_texture_float) {
switch (internalFormat) {
case GL_ALPHA16F_ARB:
- return &_mesa_texformat_alpha_float16;
+ return MESA_FORMAT_ALPHA_FLOAT16;
case GL_ALPHA32F_ARB:
- return &_mesa_texformat_alpha_float32;
+ return MESA_FORMAT_ALPHA_FLOAT32;
case GL_LUMINANCE16F_ARB:
- return &_mesa_texformat_luminance_float16;
+ return MESA_FORMAT_LUMINANCE_FLOAT16;
case GL_LUMINANCE32F_ARB:
- return &_mesa_texformat_luminance_float32;
+ return MESA_FORMAT_LUMINANCE_FLOAT32;
case GL_LUMINANCE_ALPHA16F_ARB:
- return &_mesa_texformat_luminance_alpha_float16;
+ return MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16;
case GL_LUMINANCE_ALPHA32F_ARB:
- return &_mesa_texformat_luminance_alpha_float32;
+ return MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32;
case GL_INTENSITY16F_ARB:
- return &_mesa_texformat_intensity_float16;
+ return MESA_FORMAT_INTENSITY_FLOAT16;
case GL_INTENSITY32F_ARB:
- return &_mesa_texformat_intensity_float32;
+ return MESA_FORMAT_INTENSITY_FLOAT32;
case GL_RGB16F_ARB:
- return &_mesa_texformat_rgb_float16;
+ return MESA_FORMAT_RGB_FLOAT16;
case GL_RGB32F_ARB:
- return &_mesa_texformat_rgb_float32;
+ return MESA_FORMAT_RGB_FLOAT32;
case GL_RGBA16F_ARB:
- return &_mesa_texformat_rgba_float16;
+ return MESA_FORMAT_RGBA_FLOAT16;
case GL_RGBA32F_ARB:
- return &_mesa_texformat_rgba_float32;
+ return MESA_FORMAT_RGBA_FLOAT32;
default:
; /* fallthrough */
}
switch (internalFormat) {
case GL_DEPTH_STENCIL_EXT:
case GL_DEPTH24_STENCIL8_EXT:
- return &_mesa_texformat_z24_s8;
+ return MESA_FORMAT_Z24_S8;
default:
; /* fallthrough */
}
switch (internalFormat) {
case GL_DUDV_ATI:
case GL_DU8DV8_ATI:
- return &_mesa_texformat_dudv8;
+ return MESA_FORMAT_DUDV8;
default:
; /* fallthrough */
}
switch (internalFormat) {
case GL_RGBA_SNORM:
case GL_RGBA8_SNORM:
- return &_mesa_texformat_signed_rgba8888;
+ return MESA_FORMAT_SIGNED_RGBA8888;
default:
; /* fallthrough */
}
switch (internalFormat) {
case GL_SRGB_EXT:
case GL_SRGB8_EXT:
- return &_mesa_texformat_srgb8;
+ return MESA_FORMAT_SRGB8;
case GL_SRGB_ALPHA_EXT:
case GL_SRGB8_ALPHA8_EXT:
- return &_mesa_texformat_srgba8;
+ return MESA_FORMAT_SRGBA8;
case GL_SLUMINANCE_EXT:
case GL_SLUMINANCE8_EXT:
- return &_mesa_texformat_sl8;
+ return MESA_FORMAT_SL8;
case GL_SLUMINANCE_ALPHA_EXT:
case GL_SLUMINANCE8_ALPHA8_EXT:
- return &_mesa_texformat_sla8;
+ return MESA_FORMAT_SLA8;
case GL_COMPRESSED_SLUMINANCE_EXT:
- return &_mesa_texformat_sl8;
+ return MESA_FORMAT_SL8;
case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:
- return &_mesa_texformat_sla8;
+ return MESA_FORMAT_SLA8;
case GL_COMPRESSED_SRGB_EXT:
#if FEATURE_texture_s3tc
if (ctx->Extensions.EXT_texture_compression_s3tc)
- return &_mesa_texformat_srgb_dxt1;
+ return MESA_FORMAT_SRGB_DXT1;
#endif
- return &_mesa_texformat_srgb8;
+ return MESA_FORMAT_SRGB8;
case GL_COMPRESSED_SRGB_ALPHA_EXT:
#if FEATURE_texture_s3tc
if (ctx->Extensions.EXT_texture_compression_s3tc)
- return &_mesa_texformat_srgba_dxt3; /* Not srgba_dxt1, see spec */
+ return MESA_FORMAT_SRGBA_DXT3; /* Not srgba_dxt1, see spec */
#endif
- return &_mesa_texformat_srgba8;
+ return MESA_FORMAT_SRGBA8;
#if FEATURE_texture_s3tc
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
if (ctx->Extensions.EXT_texture_compression_s3tc)
- return &_mesa_texformat_srgb_dxt1;
+ return MESA_FORMAT_SRGB_DXT1;
break;
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
if (ctx->Extensions.EXT_texture_compression_s3tc)
- return &_mesa_texformat_srgba_dxt1;
+ return MESA_FORMAT_SRGBA_DXT1;
break;
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
if (ctx->Extensions.EXT_texture_compression_s3tc)
- return &_mesa_texformat_srgba_dxt3;
+ return MESA_FORMAT_SRGBA_DXT3;
break;
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
if (ctx->Extensions.EXT_texture_compression_s3tc)
- return &_mesa_texformat_srgba_dxt5;
+ return MESA_FORMAT_SRGBA_DXT5;
break;
#endif
default:
#endif /* FEATURE_EXT_texture_sRGB */
_mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()");
- return NULL;
+ return MESA_FORMAT_NONE;
}
#include "mtypes.h"
#include "formats.h"
-
+#if 0
/** GLchan-valued formats */
/*@{*/
extern const struct gl_texture_format _mesa_texformat_rgba;
/*@{*/
extern const struct gl_texture_format _mesa_null_texformat;
/*@}*/
+#endif
-
-extern const struct gl_texture_format *
+extern gl_format
_mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
GLenum format, GLenum type );
const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
const GLfloat scale = 1.0F / (GLfloat) 0xffffff;
texel[0] = ((*src) >> 8) * scale;
- ASSERT(texImage->TexFormat->MesaFormat == MESA_FORMAT_Z24_S8);
+ ASSERT(texImage->TexFormat == MESA_FORMAT_Z24_S8);
ASSERT(texel[0] >= 0.0F);
ASSERT(texel[0] <= 1.0F);
}
const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
const GLfloat scale = 1.0F / (GLfloat) 0xffffff;
texel[0] = ((*src) & 0x00ffffff) * scale;
- ASSERT(texImage->TexFormat->MesaFormat == MESA_FORMAT_S8_Z24);
+ ASSERT(texImage->TexFormat == MESA_FORMAT_S8_Z24);
ASSERT(texel[0] >= 0.0F);
ASSERT(texel[0] <= 1.0F);
}
static GLboolean
is_srgb_teximage(const struct gl_texture_image *texImage)
{
- switch (texImage->TexFormat->MesaFormat) {
+ switch (texImage->TexFormat) {
case MESA_FORMAT_SRGB8:
case MESA_FORMAT_SRGBA8:
case MESA_FORMAT_SARGB8:
if (format == GL_COLOR_INDEX) {
GLuint indexRow[MAX_WIDTH];
GLint col;
- GLuint indexBits = _mesa_get_format_bits(texImage->TexFormat->MesaFormat, GL_TEXTURE_INDEX_SIZE_EXT);
+ GLuint indexBits = _mesa_get_format_bits(texImage->TexFormat, GL_TEXTURE_INDEX_SIZE_EXT);
/* Can't use FetchTexel here because that returns RGBA */
if (indexBits == 8) {
const GLubyte *src = (const GLubyte *) texImage->Data;
(const GLushort *) texImage->Data + row * rowstride,
width * sizeof(GLushort));
/* check for byte swapping */
- if ((texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR
+ if ((texImage->TexFormat == MESA_FORMAT_YCBCR
&& type == GL_UNSIGNED_SHORT_8_8_REV_MESA) ||
- (texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR_REV
+ (texImage->TexFormat == MESA_FORMAT_YCBCR_REV
&& type == GL_UNSIGNED_SHORT_8_8_MESA)) {
if (!ctx->Pack.SwapBytes)
_mesa_swap2((GLushort *) dest, width);
GLint col;
GLbitfield transferOps = 0x0;
GLenum dataType =
- _mesa_get_format_datatype(texImage->TexFormat->MesaFormat);
+ _mesa_get_format_datatype(texImage->TexFormat);
/* clamp does not apply to GetTexImage (final conversion)?
* Looks like we need clamp though when going from format
/* don't use texImage->CompressedSize since that may be padded out */
size = _mesa_compressed_texture_size(ctx, texImage->Width, texImage->Height,
texImage->Depth,
- texImage->TexFormat->MesaFormat);
+ texImage->TexFormat);
/* just memcpy, no pixelstore or pixel transfer */
_mesa_memcpy(img, texImage->Data, size);
return GL_TRUE;
}
- baseFormat = _mesa_get_format_base_format(texImage->TexFormat->MesaFormat);
+ baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
/* Make sure the requested image format is compatible with the
* texture's format. Note that a color index texture can be converted
img->HeightLog2 = 0;
img->DepthLog2 = 0;
img->Data = NULL;
- img->TexFormat = &_mesa_null_texformat;
+ img->TexFormat = MESA_FORMAT_NONE;
img->FetchTexelc = NULL;
img->FetchTexelf = NULL;
img->IsCompressed = 0;
_mesa_init_teximage_fields(ctx, target, texImage,
postConvWidth, 1, 1,
border, internalFormat);
- texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
- internalFormat, format, type);
+ texImage->TexFormat =
+ ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type);
}
}
else {
_mesa_init_teximage_fields(ctx, target, texImage,
postConvWidth, postConvHeight, 1,
border, internalFormat);
- texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
- internalFormat, format, type);
+ texImage->TexFormat =
+ ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type);
}
}
else {
/* no error, set the tex image parameters */
_mesa_init_teximage_fields(ctx, target, texImage, width, height,
depth, border, internalFormat);
- texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
- internalFormat, format, type);
+ texImage->TexFormat =
+ ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type);
}
}
else {
goto out;
}
- texFormat = img->TexFormat->MesaFormat;
+ texFormat = img->TexFormat;
isProxy = _mesa_is_proxy_texture(target);
trb->TexImage = att->Texture->Image[att->CubeMapFace][att->TextureLevel];
ASSERT(trb->TexImage);
- trb->Store = _mesa_get_texel_store_func(trb->TexImage->TexFormat->MesaFormat);
+ trb->Store = _mesa_get_texel_store_func(trb->TexImage->TexFormat);
if (!trb->Store) {
/* we'll never draw into some textures (compressed formats) */
trb->Store = store_nop;
trb->Zoffset = att->Zoffset;
}
- texFormat = trb->TexImage->TexFormat->MesaFormat;
+ texFormat = trb->TexImage->TexFormat;
trb->Base.Width = trb->TexImage->Width;
trb->Base.Height = trb->TexImage->Height;
trb->Base.InternalFormat = trb->TexImage->InternalFormat;
/* XXX may need more special cases here */
- if (trb->TexImage->TexFormat->MesaFormat == MESA_FORMAT_Z24_S8) {
+ if (trb->TexImage->TexFormat == MESA_FORMAT_Z24_S8) {
trb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT;
trb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
}
- else if (trb->TexImage->TexFormat->MesaFormat == MESA_FORMAT_Z16) {
+ else if (trb->TexImage->TexFormat == MESA_FORMAT_Z16) {
trb->Base._ActualFormat = GL_DEPTH_COMPONENT;
trb->Base.DataType = GL_UNSIGNED_SHORT;
}
- else if (trb->TexImage->TexFormat->MesaFormat == MESA_FORMAT_Z32) {
+ else if (trb->TexImage->TexFormat == MESA_FORMAT_Z32) {
trb->Base._ActualFormat = GL_DEPTH_COMPONENT;
trb->Base.DataType = GL_UNSIGNED_INT;
}
static void
memcpy_texture(GLcontext *ctx,
GLuint dimensions,
- const struct gl_texture_format *dstFormat,
+ gl_format dstFormat,
GLvoid *dstAddr,
GLint dstXoffset, GLint dstYoffset, GLint dstZoffset,
GLint dstRowStride,
srcWidth, srcHeight, srcFormat, srcType);
const GLubyte *srcImage = (const GLubyte *) _mesa_image_address(dimensions,
srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, 0, 0, 0);
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat);
+ const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
const GLint bytesPerRow = srcWidth * texelBytes;
#if 0
_mesa_texstore_rgba(TEXSTORE_PARAMS)
{
const GLint components = _mesa_components_in_format(baseInternalFormat);
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat);
-
- ASSERT(dstFormat == &_mesa_texformat_rgba ||
- dstFormat == &_mesa_texformat_rgb ||
- dstFormat == &_mesa_texformat_alpha ||
- dstFormat == &_mesa_texformat_luminance ||
- dstFormat == &_mesa_texformat_luminance_alpha ||
- dstFormat == &_mesa_texformat_intensity);
+ const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+ const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
+
+ ASSERT(dstFormat == MESA_FORMAT_RGBA ||
+ dstFormat == MESA_FORMAT_RGB ||
+ dstFormat == MESA_FORMAT_ALPHA ||
+ dstFormat == MESA_FORMAT_LUMINANCE ||
+ dstFormat == MESA_FORMAT_LUMINANCE_ALPHA ||
+ dstFormat == MESA_FORMAT_INTENSITY);
ASSERT(baseInternalFormat == GL_RGBA ||
baseInternalFormat == GL_RGB ||
baseInternalFormat == GL_ALPHA ||
}
else if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
- dstFormat == &_mesa_texformat_rgb &&
+ dstFormat == MESA_FORMAT_RGB &&
srcFormat == GL_RGBA &&
srcType == CHAN_TYPE) {
/* extract RGB from RGBA */
/* dstmap - how to swizzle from RGBA to dst format:
*/
- if (dstFormat == &_mesa_texformat_rgba) {
+ if (dstFormat == MESA_FORMAT_RGBA) {
dstmap = mappings[IDX_RGBA].from_rgba;
components = 4;
}
- else if (dstFormat == &_mesa_texformat_rgb) {
+ else if (dstFormat == MESA_FORMAT_RGB) {
dstmap = mappings[IDX_RGB].from_rgba;
components = 3;
}
- else if (dstFormat == &_mesa_texformat_alpha) {
+ else if (dstFormat == MESA_FORMAT_ALPHA) {
dstmap = mappings[IDX_ALPHA].from_rgba;
components = 1;
}
- else if (dstFormat == &_mesa_texformat_luminance) {
+ else if (dstFormat == MESA_FORMAT_LUMINANCE) {
dstmap = mappings[IDX_LUMINANCE].from_rgba;
components = 1;
}
- else if (dstFormat == &_mesa_texformat_luminance_alpha) {
+ else if (dstFormat == MESA_FORMAT_LUMINANCE_ALPHA) {
dstmap = mappings[IDX_LUMINANCE_ALPHA].from_rgba;
components = 2;
}
- else if (dstFormat == &_mesa_texformat_intensity) {
+ else if (dstFormat == MESA_FORMAT_INTENSITY) {
dstmap = mappings[IDX_INTENSITY].from_rgba;
components = 1;
}
_mesa_texstore_z32(TEXSTORE_PARAMS)
{
const GLuint depthScale = 0xffffffff;
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat);
+ const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
(void) dims;
- ASSERT(dstFormat == &_mesa_texformat_z32);
+ ASSERT(dstFormat == MESA_FORMAT_Z32);
ASSERT(texelBytes == sizeof(GLuint));
if (ctx->Pixel.DepthScale == 1.0f &&
_mesa_texstore_z16(TEXSTORE_PARAMS)
{
const GLuint depthScale = 0xffff;
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat);
+ const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
(void) dims;
- ASSERT(dstFormat == &_mesa_texformat_z16);
+ ASSERT(dstFormat == MESA_FORMAT_Z16);
ASSERT(texelBytes == sizeof(GLushort));
if (ctx->Pixel.DepthScale == 1.0f &&
static GLboolean
_mesa_texstore_rgb565(TEXSTORE_PARAMS)
{
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat);
+ const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+ const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
- ASSERT(dstFormat == &_mesa_texformat_rgb565 ||
- dstFormat == &_mesa_texformat_rgb565_rev);
+ ASSERT(dstFormat == MESA_FORMAT_RGB565 ||
+ dstFormat == MESA_FORMAT_RGB565_REV);
ASSERT(texelBytes == 2);
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
- dstFormat == &_mesa_texformat_rgb565 &&
+ dstFormat == MESA_FORMAT_RGB565 &&
baseInternalFormat == GL_RGB &&
srcFormat == GL_RGB &&
srcType == GL_UNSIGNED_SHORT_5_6_5) {
const GLubyte *srcUB = (const GLubyte *) src;
GLushort *dstUS = (GLushort *) dst;
/* check for byteswapped format */
- if (dstFormat == &_mesa_texformat_rgb565) {
+ if (dstFormat == MESA_FORMAT_RGB565) {
for (col = 0; col < srcWidth; col++) {
dstUS[col] = PACK_COLOR_565( srcUB[0], srcUB[1], srcUB[2] );
srcUB += 3;
for (row = 0; row < srcHeight; row++) {
GLushort *dstUS = (GLushort *) dstRow;
/* check for byteswapped format */
- if (dstFormat == &_mesa_texformat_rgb565) {
+ if (dstFormat == MESA_FORMAT_RGB565) {
for (col = 0; col < srcWidth; col++) {
dstUS[col] = PACK_COLOR_565( CHAN_TO_UBYTE(src[RCOMP]),
CHAN_TO_UBYTE(src[GCOMP]),
_mesa_texstore_rgba8888(TEXSTORE_PARAMS)
{
const GLboolean littleEndian = _mesa_little_endian();
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat);
+ const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+ const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
- ASSERT(dstFormat == &_mesa_texformat_rgba8888 ||
- dstFormat == &_mesa_texformat_rgba8888_rev);
+ ASSERT(dstFormat == MESA_FORMAT_RGBA8888 ||
+ dstFormat == MESA_FORMAT_RGBA8888_REV);
ASSERT(texelBytes == 4);
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
- dstFormat == &_mesa_texformat_rgba8888 &&
+ dstFormat == MESA_FORMAT_RGBA8888 &&
baseInternalFormat == GL_RGBA &&
((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8) ||
(srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE && !littleEndian) ||
}
else if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
- dstFormat == &_mesa_texformat_rgba8888_rev &&
+ dstFormat == MESA_FORMAT_RGBA8888_REV &&
baseInternalFormat == GL_RGBA &&
((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8_REV) ||
(srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE && littleEndian) ||
/* dstmap - how to swizzle from RGBA to dst format:
*/
- if ((littleEndian && dstFormat == &_mesa_texformat_rgba8888) ||
- (!littleEndian && dstFormat == &_mesa_texformat_rgba8888_rev)) {
+ if ((littleEndian && dstFormat == MESA_FORMAT_RGBA8888) ||
+ (!littleEndian && dstFormat == MESA_FORMAT_RGBA8888_REV)) {
dstmap[3] = 0;
dstmap[2] = 1;
dstmap[1] = 2;
+ dstXoffset * texelBytes;
for (row = 0; row < srcHeight; row++) {
GLuint *dstUI = (GLuint *) dstRow;
- if (dstFormat == &_mesa_texformat_rgba8888) {
+ if (dstFormat == MESA_FORMAT_RGBA8888) {
for (col = 0; col < srcWidth; col++) {
dstUI[col] = PACK_COLOR_8888( CHAN_TO_UBYTE(src[RCOMP]),
CHAN_TO_UBYTE(src[GCOMP]),
_mesa_texstore_argb8888(TEXSTORE_PARAMS)
{
const GLboolean littleEndian = _mesa_little_endian();
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat);
+ const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+ const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
- ASSERT(dstFormat == &_mesa_texformat_argb8888 ||
- dstFormat == &_mesa_texformat_argb8888_rev);
+ ASSERT(dstFormat == MESA_FORMAT_ARGB8888 ||
+ dstFormat == MESA_FORMAT_ARGB8888_REV);
ASSERT(texelBytes == 4);
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
- dstFormat == &_mesa_texformat_argb8888 &&
+ dstFormat == MESA_FORMAT_ARGB8888 &&
baseInternalFormat == GL_RGBA &&
srcFormat == GL_BGRA &&
((srcType == GL_UNSIGNED_BYTE && littleEndian) ||
}
else if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
- dstFormat == &_mesa_texformat_argb8888_rev &&
+ dstFormat == MESA_FORMAT_ARGB8888_REV &&
baseInternalFormat == GL_RGBA &&
srcFormat == GL_BGRA &&
((srcType == GL_UNSIGNED_BYTE && !littleEndian) ||
}
else if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
- dstFormat == &_mesa_texformat_argb8888 &&
+ dstFormat == MESA_FORMAT_ARGB8888 &&
srcFormat == GL_RGB &&
(baseInternalFormat == GL_RGBA ||
baseInternalFormat == GL_RGB) &&
}
else if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
- dstFormat == &_mesa_texformat_argb8888 &&
+ dstFormat == MESA_FORMAT_ARGB8888 &&
srcFormat == GL_RGBA &&
baseInternalFormat == GL_RGBA &&
srcType == GL_UNSIGNED_BYTE) {
/* dstmap - how to swizzle from RGBA to dst format:
*/
- if ((littleEndian && dstFormat == &_mesa_texformat_argb8888) ||
- (!littleEndian && dstFormat == &_mesa_texformat_argb8888_rev)) {
+ if ((littleEndian && dstFormat == MESA_FORMAT_ARGB8888) ||
+ (!littleEndian && dstFormat == MESA_FORMAT_ARGB8888_REV)) {
dstmap[3] = 3; /* alpha */
dstmap[2] = 0; /* red */
dstmap[1] = 1; /* green */
dstmap[0] = 2; /* blue */
}
else {
- assert((littleEndian && dstFormat == &_mesa_texformat_argb8888_rev) ||
- (!littleEndian && dstFormat == &_mesa_texformat_argb8888));
+ assert((littleEndian && dstFormat == MESA_FORMAT_ARGB8888_REV) ||
+ (!littleEndian && dstFormat == MESA_FORMAT_ARGB8888));
dstmap[3] = 2;
dstmap[2] = 1;
dstmap[1] = 0;
+ dstXoffset * texelBytes;
for (row = 0; row < srcHeight; row++) {
GLuint *dstUI = (GLuint *) dstRow;
- if (dstFormat == &_mesa_texformat_argb8888) {
+ if (dstFormat == MESA_FORMAT_ARGB8888) {
for (col = 0; col < srcWidth; col++) {
dstUI[col] = PACK_COLOR_8888( CHAN_TO_UBYTE(src[ACOMP]),
CHAN_TO_UBYTE(src[RCOMP]),
_mesa_texstore_rgb888(TEXSTORE_PARAMS)
{
const GLboolean littleEndian = _mesa_little_endian();
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat);
+ const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+ const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
- ASSERT(dstFormat == &_mesa_texformat_rgb888);
+ ASSERT(dstFormat == MESA_FORMAT_RGB888);
ASSERT(texelBytes == 3);
if (!ctx->_ImageTransferState &&
_mesa_texstore_bgr888(TEXSTORE_PARAMS)
{
const GLboolean littleEndian = _mesa_little_endian();
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat);
+ const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+ const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
- ASSERT(dstFormat == &_mesa_texformat_bgr888);
+ ASSERT(dstFormat == MESA_FORMAT_BGR888);
ASSERT(texelBytes == 3);
if (!ctx->_ImageTransferState &&
static GLboolean
_mesa_texstore_rgba4444(TEXSTORE_PARAMS)
{
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat);
+ const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+ const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
- ASSERT(dstFormat == &_mesa_texformat_rgba4444);
+ ASSERT(dstFormat == MESA_FORMAT_RGBA4444);
ASSERT(texelBytes == 2);
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
- dstFormat == &_mesa_texformat_rgba4444 &&
+ dstFormat == MESA_FORMAT_RGBA4444 &&
baseInternalFormat == GL_RGBA &&
srcFormat == GL_RGBA &&
srcType == GL_UNSIGNED_SHORT_4_4_4_4){
static GLboolean
_mesa_texstore_argb4444(TEXSTORE_PARAMS)
{
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat);
+ const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+ const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
- ASSERT(dstFormat == &_mesa_texformat_argb4444 ||
- dstFormat == &_mesa_texformat_argb4444_rev);
+ ASSERT(dstFormat == MESA_FORMAT_ARGB4444 ||
+ dstFormat == MESA_FORMAT_ARGB4444_REV);
ASSERT(texelBytes == 2);
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
- dstFormat == &_mesa_texformat_argb4444 &&
+ dstFormat == MESA_FORMAT_ARGB4444 &&
baseInternalFormat == GL_RGBA &&
srcFormat == GL_BGRA &&
srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV) {
+ dstXoffset * texelBytes;
for (row = 0; row < srcHeight; row++) {
GLushort *dstUS = (GLushort *) dstRow;
- if (dstFormat == &_mesa_texformat_argb4444) {
+ if (dstFormat == MESA_FORMAT_ARGB4444) {
for (col = 0; col < srcWidth; col++) {
dstUS[col] = PACK_COLOR_4444( CHAN_TO_UBYTE(src[ACOMP]),
CHAN_TO_UBYTE(src[RCOMP]),
static GLboolean
_mesa_texstore_rgba5551(TEXSTORE_PARAMS)
{
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat);
+ const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+ const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
- ASSERT(dstFormat == &_mesa_texformat_rgba5551);
+ ASSERT(dstFormat == MESA_FORMAT_RGBA5551);
ASSERT(texelBytes == 2);
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
- dstFormat == &_mesa_texformat_rgba5551 &&
+ dstFormat == MESA_FORMAT_RGBA5551 &&
baseInternalFormat == GL_RGBA &&
srcFormat == GL_RGBA &&
srcType == GL_UNSIGNED_SHORT_5_5_5_1) {
static GLboolean
_mesa_texstore_argb1555(TEXSTORE_PARAMS)
{
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat);
+ const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+ const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
- ASSERT(dstFormat == &_mesa_texformat_argb1555 ||
- dstFormat == &_mesa_texformat_argb1555_rev);
+ ASSERT(dstFormat == MESA_FORMAT_ARGB1555 ||
+ dstFormat == MESA_FORMAT_ARGB1555_REV);
ASSERT(texelBytes == 2);
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
- dstFormat == &_mesa_texformat_argb1555 &&
+ dstFormat == MESA_FORMAT_ARGB1555 &&
baseInternalFormat == GL_RGBA &&
srcFormat == GL_BGRA &&
srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV) {
+ dstXoffset * texelBytes;
for (row = 0; row < srcHeight; row++) {
GLushort *dstUS = (GLushort *) dstRow;
- if (dstFormat == &_mesa_texformat_argb1555) {
+ if (dstFormat == MESA_FORMAT_ARGB1555) {
for (col = 0; col < srcWidth; col++) {
dstUS[col] = PACK_COLOR_1555( CHAN_TO_UBYTE(src[ACOMP]),
CHAN_TO_UBYTE(src[RCOMP]),
_mesa_texstore_al88(TEXSTORE_PARAMS)
{
const GLboolean littleEndian = _mesa_little_endian();
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat);
+ const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+ const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
- ASSERT(dstFormat == &_mesa_texformat_al88 ||
- dstFormat == &_mesa_texformat_al88_rev);
+ ASSERT(dstFormat == MESA_FORMAT_AL88 ||
+ dstFormat == MESA_FORMAT_AL88_REV);
ASSERT(texelBytes == 2);
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
- dstFormat == &_mesa_texformat_al88 &&
+ dstFormat == MESA_FORMAT_AL88 &&
baseInternalFormat == GL_LUMINANCE_ALPHA &&
srcFormat == GL_LUMINANCE_ALPHA &&
srcType == GL_UNSIGNED_BYTE &&
/* dstmap - how to swizzle from RGBA to dst format:
*/
- if ((littleEndian && dstFormat == &_mesa_texformat_al88) ||
- (!littleEndian && dstFormat == &_mesa_texformat_al88_rev)) {
+ if ((littleEndian && dstFormat == MESA_FORMAT_AL88) ||
+ (!littleEndian && dstFormat == MESA_FORMAT_AL88_REV)) {
dstmap[0] = 0;
dstmap[1] = 3;
}
+ dstXoffset * texelBytes;
for (row = 0; row < srcHeight; row++) {
GLushort *dstUS = (GLushort *) dstRow;
- if (dstFormat == &_mesa_texformat_al88) {
+ if (dstFormat == MESA_FORMAT_AL88) {
for (col = 0; col < srcWidth; col++) {
/* src[0] is luminance, src[1] is alpha */
dstUS[col] = PACK_COLOR_88( CHAN_TO_UBYTE(src[1]),
static GLboolean
_mesa_texstore_rgb332(TEXSTORE_PARAMS)
{
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat);
+ const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+ const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
- ASSERT(dstFormat == &_mesa_texformat_rgb332);
+ ASSERT(dstFormat == MESA_FORMAT_RGB332);
ASSERT(texelBytes == 1);
if (!ctx->_ImageTransferState &&
static GLboolean
_mesa_texstore_a8(TEXSTORE_PARAMS)
{
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat);
+ const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+ const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
- ASSERT(dstFormat == &_mesa_texformat_a8 ||
- dstFormat == &_mesa_texformat_l8 ||
- dstFormat == &_mesa_texformat_i8);
+ ASSERT(dstFormat == MESA_FORMAT_A8 ||
+ dstFormat == MESA_FORMAT_L8 ||
+ dstFormat == MESA_FORMAT_I8);
ASSERT(texelBytes == 1);
if (!ctx->_ImageTransferState &&
/* dstmap - how to swizzle from RGBA to dst format:
*/
- if (dstFormat == &_mesa_texformat_a8) {
+ if (dstFormat == MESA_FORMAT_A8) {
dstmap[0] = 3;
}
else {
static GLboolean
_mesa_texstore_ci8(TEXSTORE_PARAMS)
{
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat);
+ const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
(void) dims; (void) baseInternalFormat;
- ASSERT(dstFormat == &_mesa_texformat_ci8);
+ ASSERT(dstFormat == MESA_FORMAT_CI8);
ASSERT(texelBytes == 1);
ASSERT(baseInternalFormat == GL_COLOR_INDEX);
/**
- * Texstore for _mesa_texformat_ycbcr or _mesa_texformat_ycbcr_rev.
+ * Texstore for _mesa_texformat_ycbcr or _mesa_texformat_ycbcr_REV.
*/
static GLboolean
_mesa_texstore_ycbcr(TEXSTORE_PARAMS)
{
const GLboolean littleEndian = _mesa_little_endian();
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat);
+ const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
(void) ctx; (void) dims; (void) baseInternalFormat;
- ASSERT((dstFormat == &_mesa_texformat_ycbcr) ||
- (dstFormat == &_mesa_texformat_ycbcr_rev));
+ ASSERT((dstFormat == MESA_FORMAT_YCBCR) ||
+ (dstFormat == MESA_FORMAT_YCBCR_REV));
ASSERT(texelBytes == 2);
ASSERT(ctx->Extensions.MESA_ycbcr_texture);
ASSERT(srcFormat == GL_YCBCR_MESA);
/* XXX the logic here _might_ be wrong */
if (srcPacking->SwapBytes ^
(srcType == GL_UNSIGNED_SHORT_8_8_REV_MESA) ^
- (dstFormat == &_mesa_texformat_ycbcr_rev) ^
+ (dstFormat == MESA_FORMAT_YCBCR_REV) ^
!littleEndian) {
GLint img, row;
for (img = 0; img < srcDepth; img++) {
_mesa_texstore_dudv8(TEXSTORE_PARAMS)
{
const GLboolean littleEndian = _mesa_little_endian();
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat);
+ const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
- ASSERT(dstFormat == &_mesa_texformat_dudv8);
+ ASSERT(dstFormat == MESA_FORMAT_DUDV8);
ASSERT(texelBytes == 2);
ASSERT(ctx->Extensions.ATI_envmap_bumpmap);
ASSERT((srcFormat == GL_DU8DV8_ATI) ||
_mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS)
{
const GLboolean littleEndian = _mesa_little_endian();
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat);
+ const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+ const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
- ASSERT(dstFormat == &_mesa_texformat_signed_rgba8888 ||
- dstFormat == &_mesa_texformat_signed_rgba8888_rev);
+ ASSERT(dstFormat == MESA_FORMAT_SIGNED_RGBA8888 ||
+ dstFormat == MESA_FORMAT_SIGNED_RGBA8888_REV);
ASSERT(texelBytes == 4);
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
- dstFormat == &_mesa_texformat_signed_rgba8888 &&
+ dstFormat == MESA_FORMAT_SIGNED_RGBA8888 &&
baseInternalFormat == GL_RGBA &&
((srcFormat == GL_RGBA && srcType == GL_BYTE && !littleEndian) ||
(srcFormat == GL_ABGR_EXT && srcType == GL_BYTE && littleEndian))) {
}
else if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
- dstFormat == &_mesa_texformat_signed_rgba8888_rev &&
+ dstFormat == MESA_FORMAT_SIGNED_RGBA8888_REV &&
baseInternalFormat == GL_RGBA &&
((srcFormat == GL_RGBA && srcType == GL_BYTE && littleEndian) ||
(srcFormat == GL_ABGR_EXT && srcType == GL_BYTE && !littleEndian))) {
/* dstmap - how to swizzle from RGBA to dst format:
*/
- if ((littleEndian && dstFormat == &_mesa_texformat_signed_rgba8888) ||
- (!littleEndian && dstFormat == &_mesa_texformat_signed_rgba8888_rev)) {
+ if ((littleEndian && dstFormat == MESA_FORMAT_SIGNED_RGBA8888) ||
+ (!littleEndian && dstFormat == MESA_FORMAT_SIGNED_RGBA8888_REV)) {
dstmap[3] = 0;
dstmap[2] = 1;
dstmap[1] = 2;
+ dstXoffset * texelBytes;
for (row = 0; row < srcHeight; row++) {
GLuint *dstUI = (GLuint *) dstRow;
- if (dstFormat == &_mesa_texformat_signed_rgba8888) {
+ if (dstFormat == MESA_FORMAT_SIGNED_RGBA8888) {
for (col = 0; col < srcWidth; col++) {
dstUI[col] = PACK_COLOR_8888( FLOAT_TO_BYTE_TEX(srcRow[RCOMP]),
FLOAT_TO_BYTE_TEX(srcRow[GCOMP]),
/ sizeof(GLuint);
GLint img, row;
- ASSERT(dstFormat == &_mesa_texformat_z24_s8);
+ ASSERT(dstFormat == MESA_FORMAT_Z24_S8);
ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat == GL_DEPTH_COMPONENT);
ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT || srcType == GL_UNSIGNED_INT_24_8_EXT);
/ sizeof(GLuint);
GLint img, row;
- ASSERT(dstFormat == &_mesa_texformat_s8_z24);
+ ASSERT(dstFormat == MESA_FORMAT_S8_Z24);
ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat == GL_DEPTH_COMPONENT);
ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT || srcType == GL_UNSIGNED_INT_24_8_EXT);
static GLboolean
_mesa_texstore_rgba_float32(TEXSTORE_PARAMS)
{
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat);
+ const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+ const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
const GLint components = _mesa_components_in_format(baseFormat);
- ASSERT(dstFormat == &_mesa_texformat_rgba_float32 ||
- dstFormat == &_mesa_texformat_rgb_float32 ||
- dstFormat == &_mesa_texformat_alpha_float32 ||
- dstFormat == &_mesa_texformat_luminance_float32 ||
- dstFormat == &_mesa_texformat_luminance_alpha_float32 ||
- dstFormat == &_mesa_texformat_intensity_float32);
+ ASSERT(dstFormat == MESA_FORMAT_RGBA_FLOAT32 ||
+ dstFormat == MESA_FORMAT_RGB_FLOAT32 ||
+ dstFormat == MESA_FORMAT_ALPHA_FLOAT32 ||
+ dstFormat == MESA_FORMAT_LUMINANCE_FLOAT32 ||
+ dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32 ||
+ dstFormat == MESA_FORMAT_INTENSITY_FLOAT32);
ASSERT(baseInternalFormat == GL_RGBA ||
baseInternalFormat == GL_RGB ||
baseInternalFormat == GL_ALPHA ||
static GLboolean
_mesa_texstore_rgba_float16(TEXSTORE_PARAMS)
{
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat);
+ const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+ const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
const GLint components = _mesa_components_in_format(baseFormat);
- ASSERT(dstFormat == &_mesa_texformat_rgba_float16 ||
- dstFormat == &_mesa_texformat_rgb_float16 ||
- dstFormat == &_mesa_texformat_alpha_float16 ||
- dstFormat == &_mesa_texformat_luminance_float16 ||
- dstFormat == &_mesa_texformat_luminance_alpha_float16 ||
- dstFormat == &_mesa_texformat_intensity_float16);
+ ASSERT(dstFormat == MESA_FORMAT_RGBA_FLOAT16 ||
+ dstFormat == MESA_FORMAT_RGB_FLOAT16 ||
+ dstFormat == MESA_FORMAT_ALPHA_FLOAT16 ||
+ dstFormat == MESA_FORMAT_LUMINANCE_FLOAT16 ||
+ dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16 ||
+ dstFormat == MESA_FORMAT_INTENSITY_FLOAT16);
ASSERT(baseInternalFormat == GL_RGBA ||
baseInternalFormat == GL_RGB ||
baseInternalFormat == GL_ALPHA ||
static GLboolean
_mesa_texstore_srgb8(TEXSTORE_PARAMS)
{
- const struct gl_texture_format *newDstFormat;
+ gl_format newDstFormat;
GLboolean k;
- ASSERT(dstFormat == &_mesa_texformat_srgb8);
+ ASSERT(dstFormat == MESA_FORMAT_SRGB8);
/* reuse normal rgb texstore code */
- newDstFormat = &_mesa_texformat_rgb888;
+ newDstFormat = MESA_FORMAT_RGB888;
k = _mesa_texstore_rgb888(ctx, dims, baseInternalFormat,
newDstFormat, dstAddr,
static GLboolean
_mesa_texstore_srgba8(TEXSTORE_PARAMS)
{
- const struct gl_texture_format *newDstFormat;
+ gl_format newDstFormat;
GLboolean k;
- ASSERT(dstFormat == &_mesa_texformat_srgba8);
+ ASSERT(dstFormat == MESA_FORMAT_SRGBA8);
/* reuse normal rgba texstore code */
- newDstFormat = &_mesa_texformat_rgba8888;
+ newDstFormat = MESA_FORMAT_RGBA8888;
k = _mesa_texstore_rgba8888(ctx, dims, baseInternalFormat,
newDstFormat, dstAddr,
dstXoffset, dstYoffset, dstZoffset,
static GLboolean
_mesa_texstore_sargb8(TEXSTORE_PARAMS)
{
- const struct gl_texture_format *newDstFormat;
+ gl_format newDstFormat;
GLboolean k;
- ASSERT(dstFormat == &_mesa_texformat_sargb8);
+ ASSERT(dstFormat == MESA_FORMAT_SARGB8);
/* reuse normal rgba texstore code */
- newDstFormat = &_mesa_texformat_argb8888;
+ newDstFormat = MESA_FORMAT_ARGB8888;
k = _mesa_texstore_argb8888(ctx, dims, baseInternalFormat,
newDstFormat, dstAddr,
static GLboolean
_mesa_texstore_sl8(TEXSTORE_PARAMS)
{
- const struct gl_texture_format *newDstFormat;
+ gl_format newDstFormat;
GLboolean k;
- ASSERT(dstFormat == &_mesa_texformat_sl8);
+ ASSERT(dstFormat == MESA_FORMAT_SL8);
- newDstFormat = &_mesa_texformat_l8;
+ newDstFormat = MESA_FORMAT_L8;
/* _mesa_textore_a8 handles luminance8 too */
k = _mesa_texstore_a8(ctx, dims, baseInternalFormat,
static GLboolean
_mesa_texstore_sla8(TEXSTORE_PARAMS)
{
- const struct gl_texture_format *newDstFormat;
+ gl_format newDstFormat;
GLboolean k;
- ASSERT(dstFormat == &_mesa_texformat_sla8);
+ ASSERT(dstFormat == MESA_FORMAT_SLA8);
/* reuse normal luminance/alpha texstore code */
- newDstFormat = &_mesa_texformat_al88;
+ newDstFormat = MESA_FORMAT_AL88;
k = _mesa_texstore_al88(ctx, dims, baseInternalFormat,
newDstFormat, dstAddr,
StoreTexImageFunc storeImage;
GLboolean success;
- storeImage = _mesa_get_texstore_func(dstFormat->MesaFormat);
+ storeImage = _mesa_get_texstore_func(dstFormat);
assert(storeImage);
GLint i, GLint j, GLint k, GLchan *texelOut)
{
GLfloat temp[4];
- GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat->MesaFormat);
+ GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
ASSERT(texImage->FetchTexelf);
texImage->FetchTexelf(texImage, i, j, k, temp);
GLint i, GLint j, GLint k, GLfloat *texelOut)
{
GLchan temp[4];
- GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat->MesaFormat);
+ GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
ASSERT(texImage->FetchTexelc);
texImage->FetchTexelc(texImage, i, j, k, temp);
ASSERT(texImage->TexFormat);
texImage->FetchTexelf =
- _mesa_get_texel_fetch_func(texImage->TexFormat->MesaFormat, dims);
+ _mesa_get_texel_fetch_func(texImage->TexFormat, dims);
/* now check if we need to use a float/chan adaptor */
if (!texImage->FetchTexelc) {
compute_texture_size(GLcontext *ctx, struct gl_texture_image *texImage)
{
texImage->IsCompressed =
- _mesa_is_format_compressed(texImage->TexFormat->MesaFormat);
+ _mesa_is_format_compressed(texImage->TexFormat);
if (texImage->IsCompressed) {
texImage->CompressedSize =
ctx->Driver.CompressedTextureSize(ctx, texImage->Width,
texImage->Height, texImage->Depth,
- texImage->TexFormat->MesaFormat);
+ texImage->TexFormat);
}
else {
/* non-compressed format */
if (texImage->IsCompressed)
sizeInBytes = texImage->CompressedSize;
else
- sizeInBytes = texImage->Width * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat);
+ sizeInBytes = texImage->Width * _mesa_get_format_bytes(texImage->TexFormat);
texImage->Data = _mesa_alloc_texmemory(sizeInBytes);
if (!texImage->Data) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
_mesa_set_fetch_functions(texImage, 2);
compute_texture_size(ctx, texImage);
- texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat);
+ texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
/* allocate memory */
if (texImage->IsCompressed)
if (texImage->IsCompressed) {
dstRowStride
- = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width);
+ = _mesa_compressed_row_stride(texImage->TexFormat, width);
}
else {
dstRowStride = texImage->RowStride * texelBytes;
_mesa_set_fetch_functions(texImage, 3);
compute_texture_size(ctx, texImage);
- texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat);
+ texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
/* allocate memory */
if (texImage->IsCompressed)
if (texImage->IsCompressed) {
dstRowStride
- = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width);
+ = _mesa_compressed_row_stride(texImage->TexFormat, width);
}
else {
dstRowStride = texImage->RowStride * texelBytes;
GLboolean success;
if (texImage->IsCompressed) {
- dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat,
+ dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat,
texImage->Width);
}
else {
dstRowStride = texImage->RowStride *
- _mesa_get_format_bytes(texImage->TexFormat->MesaFormat);
+ _mesa_get_format_bytes(texImage->TexFormat);
}
success = _mesa_texstore(ctx, 2, texImage->_BaseFormat,
GLboolean success;
if (texImage->IsCompressed) {
- dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat,
+ dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat,
texImage->Width);
}
else {
dstRowStride = texImage->RowStride *
- _mesa_get_format_bytes(texImage->TexFormat->MesaFormat);
+ _mesa_get_format_bytes(texImage->TexFormat);
}
success = _mesa_texstore(ctx, 3, texImage->_BaseFormat,
GLint i, rows;
GLubyte *dest;
const GLubyte *src;
- const gl_format texFormat = texImage->TexFormat->MesaFormat;
+ const gl_format texFormat = texImage->TexFormat;
(void) format;
#define TEXSTORE_PARAMS \
GLcontext *ctx, GLuint dims, \
GLenum baseInternalFormat, \
- const struct gl_texture_format *dstFormat, \
+ gl_format dstFormat, \
GLvoid *dstAddr, \
GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, \
GLint dstRowStride, const GLuint *dstImageOffsets, \
GLcontext *ctx = st->ctx;
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
- const struct gl_texture_format *mformat;
+ gl_format mformat;
struct pipe_texture *pt;
enum pipe_format pipeFormat;
GLuint cpp;
mformat = st_ChooseTextureFormat(ctx, baseFormat, format, type);
assert(mformat);
- pipeFormat = st_mesa_format_to_pipe_format(mformat->MesaFormat);
+ pipeFormat = st_mesa_format_to_pipe_format(mformat);
assert(pipeFormat);
cpp = st_sizeof_format(pipeFormat);
* format.
*/
static GLuint
-compressed_num_bytes(GLuint mesaFormat)
+compressed_num_bytes(gl_format format)
{
- switch(mesaFormat) {
+ switch (format) {
#if FEATURE_texture_fxt1
case MESA_FORMAT_RGB_FXT1:
case MESA_FORMAT_RGBA_FXT1:
static GLboolean
-is_compressed_mesa_format(const struct gl_texture_format *format)
+is_compressed_mesa_format(gl_format format)
{
- switch (format->MesaFormat) {
+ switch (format) {
case MESA_FORMAT_RGB_DXT1:
case MESA_FORMAT_RGBA_DXT1:
case MESA_FORMAT_RGBA_DXT3:
lastLevel = firstLevel + MAX2(MAX2(l2width, l2height), l2depth);
}
- fmt = st_mesa_format_to_pipe_format(stImage->base.TexFormat->MesaFormat);
+ fmt = st_mesa_format_to_pipe_format(stImage->base.TexFormat);
usage = default_usage(fmt);
const GLuint dstImageOffsets[1] = {0};
struct st_texture_image *stImage = st_texture_image(texImage);
struct pipe_screen *screen = ctx->st->pipe->screen;
- const struct gl_texture_format *mesa_format;
+ gl_format mesa_format;
struct pipe_texture templ;
struct pipe_texture *src_tex;
struct pipe_surface *dst_surface;
*/
memset(&templ, 0, sizeof(templ));
templ.target = PIPE_TEXTURE_2D;
- templ.format = st_mesa_format_to_pipe_format(mesa_format->MesaFormat);
+ templ.format = st_mesa_format_to_pipe_format(mesa_format);
pf_get_block(templ.format, &templ.block);
templ.width[0] = width;
templ.height[0] = height;
_mesa_set_fetch_functions(texImage, dims);
- if (_mesa_is_format_compressed(texImage->TexFormat->MesaFormat)) {
+ if (_mesa_is_format_compressed(texImage->TexFormat)) {
/* must be a compressed format */
texelBytes = 0;
texImage->IsCompressed = GL_TRUE;
texImage->CompressedSize =
ctx->Driver.CompressedTextureSize(ctx, texImage->Width,
texImage->Height, texImage->Depth,
- texImage->TexFormat->MesaFormat);
+ texImage->TexFormat);
}
else {
- texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat);
+ texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
/* Minimum pitch of 32 bytes */
if (postConvWidth * texelBytes < 32) {
if (texImage->IsCompressed) {
sizeInBytes = texImage->CompressedSize;
dstRowStride =
- _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width);
+ _mesa_compressed_row_stride(texImage->TexFormat, width);
assert(dims != 3);
}
else {
/* FIXME: determine format block instead of cpp */
if (firstImage->base.IsCompressed) {
- cpp = compressed_num_bytes(firstImage->base.TexFormat->MesaFormat);
+ cpp = compressed_num_bytes(firstImage->base.TexFormat);
}
else {
- cpp = _mesa_get_format_bytes(firstImage->base.TexFormat->MesaFormat);
+ cpp = _mesa_get_format_bytes(firstImage->base.TexFormat);
}
/* If we already have a gallium texture, check that it matches the texture
*/
if (stObj->pt) {
const enum pipe_format fmt =
- st_mesa_format_to_pipe_format(firstImage->base.TexFormat->MesaFormat);
+ st_mesa_format_to_pipe_format(firstImage->base.TexFormat);
if (stObj->pt->target != gl_target_to_pipe(stObj->base.Target) ||
stObj->pt->format != fmt ||
stObj->pt->last_level < stObj->lastLevel ||
*/
if (!stObj->pt) {
const enum pipe_format fmt =
- st_mesa_format_to_pipe_format(firstImage->base.TexFormat->MesaFormat);
+ st_mesa_format_to_pipe_format(firstImage->base.TexFormat);
GLuint usage = default_usage(fmt);
stObj->pt = st_texture_create(ctx->st,
}
-static const struct gl_texture_format *
+static gl_format
translate_gallium_format_to_mesa_format(enum pipe_format format)
{
switch (format) {
case PIPE_FORMAT_A8R8G8B8_UNORM:
- return &_mesa_texformat_argb8888;
+ return MESA_FORMAT_ARGB8888;
case PIPE_FORMAT_A1R5G5B5_UNORM:
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
case PIPE_FORMAT_A4R4G4B4_UNORM:
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case PIPE_FORMAT_R5G6B5_UNORM:
- return &_mesa_texformat_rgb565;
+ return MESA_FORMAT_RGB565;
case PIPE_FORMAT_A8L8_UNORM:
- return &_mesa_texformat_al88;
+ return MESA_FORMAT_AL88;
case PIPE_FORMAT_A8_UNORM:
- return &_mesa_texformat_a8;
+ return MESA_FORMAT_A8;
case PIPE_FORMAT_L8_UNORM:
- return &_mesa_texformat_l8;
+ return MESA_FORMAT_L8;
case PIPE_FORMAT_I8_UNORM:
- return &_mesa_texformat_i8;
+ return MESA_FORMAT_I8;
case PIPE_FORMAT_Z16_UNORM:
- return &_mesa_texformat_z16;
+ return MESA_FORMAT_Z16;
case PIPE_FORMAT_Z32_UNORM:
- return &_mesa_texformat_z32;
+ return MESA_FORMAT_Z32;
case PIPE_FORMAT_Z24S8_UNORM:
- return &_mesa_texformat_z24_s8;
+ return MESA_FORMAT_Z24_S8;
case PIPE_FORMAT_S8Z24_UNORM:
- return &_mesa_texformat_s8_z24;
+ return MESA_FORMAT_S8_Z24;
case PIPE_FORMAT_YCBCR:
- return &_mesa_texformat_ycbcr;
+ return MESA_FORMAT_YCBCR;
case PIPE_FORMAT_YCBCR_REV:
- return &_mesa_texformat_ycbcr_rev;
+ return MESA_FORMAT_YCBCR_REV;
#if FEATURE_texture_s3tc
case PIPE_FORMAT_DXT1_RGB:
- return &_mesa_texformat_rgb_dxt1;
+ return MESA_FORMAT_RGB_DXT1;
case PIPE_FORMAT_DXT1_RGBA:
- return &_mesa_texformat_rgba_dxt1;
+ return MESA_FORMAT_RGBA_DXT1;
case PIPE_FORMAT_DXT3_RGBA:
- return &_mesa_texformat_rgba_dxt3;
+ return MESA_FORMAT_RGBA_DXT3;
case PIPE_FORMAT_DXT5_RGBA:
- return &_mesa_texformat_rgba_dxt5;
+ return MESA_FORMAT_RGBA_DXT5;
#if FEATURE_EXT_texture_sRGB
case PIPE_FORMAT_DXT1_SRGB:
- return &_mesa_texformat_srgb_dxt1;
+ return MESA_FORMAT_SRGB_DXT1;
case PIPE_FORMAT_DXT1_SRGBA:
- return &_mesa_texformat_srgba_dxt1;
+ return MESA_FORMAT_SRGBA_DXT1;
case PIPE_FORMAT_DXT3_SRGBA:
- return &_mesa_texformat_srgba_dxt3;
+ return MESA_FORMAT_SRGBA_DXT3;
case PIPE_FORMAT_DXT5_SRGBA:
- return &_mesa_texformat_srgba_dxt5;
+ return MESA_FORMAT_SRGBA_DXT5;
#endif
#endif
#if FEATURE_EXT_texture_sRGB
case PIPE_FORMAT_A8L8_SRGB:
- return &_mesa_texformat_sla8;
+ return MESA_FORMAT_SLA8;
case PIPE_FORMAT_L8_SRGB:
- return &_mesa_texformat_sl8;
+ return MESA_FORMAT_SL8;
case PIPE_FORMAT_R8G8B8_SRGB:
- return &_mesa_texformat_srgb8;
+ return MESA_FORMAT_SRGB8;
case PIPE_FORMAT_R8G8B8A8_SRGB:
- return &_mesa_texformat_srgba8;
+ return MESA_FORMAT_SRGBA8;
case PIPE_FORMAT_A8R8G8B8_SRGB:
- return &_mesa_texformat_sargb8;
+ return MESA_FORMAT_SARGB8;
#endif
/* XXX add additional cases */
default:
assert(0);
- return NULL;
+ return MESA_FORMAT_NONE;
}
}
/**
* Called via ctx->Driver.chooseTextureFormat().
*/
-const struct gl_texture_format *
+gl_format
st_ChooseTextureFormat(GLcontext *ctx, GLint internalFormat,
GLenum format, GLenum type)
{
pFormat = st_choose_format(ctx->st->pipe, internalFormat, PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_SAMPLER);
if (pFormat == PIPE_FORMAT_NONE)
- return NULL;
+ return MESA_FORMAT_NONE;
return translate_gallium_format_to_mesa_format(pFormat);
}
#ifndef ST_FORMAT_H
#define ST_FORMAT_H
+#include "main/formats.h"
struct pipe_format_info
{
st_choose_renderbuffer_format(struct pipe_context *pipe, GLenum internalFormat);
-extern const struct gl_texture_format *
+extern gl_format
st_ChooseTextureFormat(GLcontext * ctx, GLint internalFormat,
GLenum format, GLenum type);
assert(target != GL_TEXTURE_3D); /* not done yet */
- _mesa_format_to_type_and_comps(texObj->Image[face][baseLevel]->TexFormat->MesaFormat,
+ _mesa_format_to_type_and_comps(texObj->Image[face][baseLevel]->TexFormat,
&datatype, &comps);
for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
/* Check if this image's format matches the established texture's format.
*/
- if (st_mesa_format_to_pipe_format(image->TexFormat->MesaFormat) != pt->format)
+ if (st_mesa_format_to_pipe_format(image->TexFormat) != pt->format)
return GL_FALSE;
/* Test if this image's size matches what's expected in the
const struct gl_texture_image *img,
GLfloat rgba[4])
{
- switch (img->TexFormat->BaseFormat) {
+ switch (img->_BaseFormat) {
case GL_RGB:
rgba[0] = tObj->BorderColor[0];
rgba[1] = tObj->BorderColor[1];
ASSERT(tObj->WrapS == GL_REPEAT);
ASSERT(tObj->WrapT == GL_REPEAT);
ASSERT(img->Border == 0);
- ASSERT(img->TexFormat->BaseFormat != GL_COLOR_INDEX);
+ ASSERT(img->_BaseFormat != GL_COLOR_INDEX);
ASSERT(img->_IsPowerOfTwo);
linear_repeat_texel_location(width, texcoord[0], &i0, &i1, &wi);
ASSERT(tObj->WrapS==GL_REPEAT);
ASSERT(tObj->WrapT==GL_REPEAT);
ASSERT(img->Border==0);
- ASSERT(img->TexFormat->MesaFormat==MESA_FORMAT_RGB);
+ ASSERT(img->TexFormat == MESA_FORMAT_RGB);
ASSERT(img->_IsPowerOfTwo);
for (k=0; k<n; k++) {
ASSERT(tObj->WrapS==GL_REPEAT);
ASSERT(tObj->WrapT==GL_REPEAT);
ASSERT(img->Border==0);
- ASSERT(img->TexFormat->MesaFormat==MESA_FORMAT_RGBA);
+ ASSERT(img->TexFormat == MESA_FORMAT_RGBA);
ASSERT(img->_IsPowerOfTwo);
for (i = 0; i < n; i++) {
const GLboolean repeatNoBorderPOT = (tObj->WrapS == GL_REPEAT)
&& (tObj->WrapT == GL_REPEAT)
&& (tImg->Border == 0 && (tImg->Width == tImg->RowStride))
- && (tImg->TexFormat->BaseFormat != GL_COLOR_INDEX)
+ && (tImg->_BaseFormat != GL_COLOR_INDEX)
&& tImg->_IsPowerOfTwo;
ASSERT(lambda != NULL);
switch (tObj->MinFilter) {
case GL_NEAREST:
if (repeatNoBorderPOT) {
- switch (tImg->TexFormat->MesaFormat) {
+ switch (tImg->TexFormat) {
case MESA_FORMAT_RGB:
opt_sample_rgb_2d(ctx, tObj, m, texcoords + minStart,
NULL, rgba + minStart);
switch (tObj->MagFilter) {
case GL_NEAREST:
if (repeatNoBorderPOT) {
- switch (tImg->TexFormat->MesaFormat) {
+ switch (tImg->TexFormat) {
case MESA_FORMAT_RGB:
opt_sample_rgb_2d(ctx, tObj, m, texcoords + magStart,
NULL, rgba + magStart);
ASSERT(tObj->WrapT == GL_CLAMP ||
tObj->WrapT == GL_CLAMP_TO_EDGE ||
tObj->WrapT == GL_CLAMP_TO_BORDER);
- ASSERT(img->TexFormat->BaseFormat != GL_COLOR_INDEX);
+ ASSERT(img->_BaseFormat != GL_COLOR_INDEX);
for (i = 0; i < n; i++) {
GLint row, col;
ASSERT(tObj->WrapT == GL_CLAMP ||
tObj->WrapT == GL_CLAMP_TO_EDGE ||
tObj->WrapT == GL_CLAMP_TO_BORDER);
- ASSERT(img->TexFormat->BaseFormat != GL_COLOR_INDEX);
+ ASSERT(img->_BaseFormat != GL_COLOR_INDEX);
for (i = 0; i < n; i++) {
GLint i0, j0, i1, j1;
(void) lambda;
- ASSERT(img->TexFormat->BaseFormat == GL_DEPTH_COMPONENT ||
- img->TexFormat->BaseFormat == GL_DEPTH_STENCIL_EXT);
+ ASSERT(img->_BaseFormat == GL_DEPTH_COMPONENT ||
+ img->_BaseFormat == GL_DEPTH_STENCIL_EXT);
ASSERT(tObj->Target == GL_TEXTURE_1D ||
tObj->Target == GL_TEXTURE_2D ||
}
else {
const GLboolean needLambda = (GLboolean) (t->MinFilter != t->MagFilter);
- const GLenum format = t->Image[0][t->BaseLevel]->TexFormat->BaseFormat;
+ const GLenum format = t->Image[0][t->BaseLevel]->_BaseFormat;
switch (t->Target) {
case GL_TEXTURE_1D:
t->WrapT == GL_REPEAT &&
img->_IsPowerOfTwo &&
img->Border == 0 &&
- img->TexFormat->MesaFormat == MESA_FORMAT_RGB) {
+ img->TexFormat == MESA_FORMAT_RGB) {
return &opt_sample_rgb_2d;
}
else if (t->WrapS == GL_REPEAT &&
t->WrapT == GL_REPEAT &&
img->_IsPowerOfTwo &&
img->Border == 0 &&
- img->TexFormat->MesaFormat == MESA_FORMAT_RGBA) {
+ img->TexFormat == MESA_FORMAT_RGBA) {
return &opt_sample_rgba_2d;
}
else {
const struct gl_texture_object *texObj2D;
const struct gl_texture_image *texImg;
GLenum minFilter, magFilter, envMode;
- GLint format;
+ gl_format format;
texObj2D = ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX];
texImg = texObj2D ? texObj2D->Image[0][texObj2D->BaseLevel] : NULL;
- format = texImg ? texImg->TexFormat->MesaFormat : -1;
+ format = texImg ? texImg->TexFormat : -1;
minFilter = texObj2D ? texObj2D->MinFilter : (GLenum) 0;
magFilter = texObj2D ? texObj2D->MagFilter : (GLenum) 0;
envMode = ctx->Texture.Unit[0].EnvMode;