summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgareth <gareth>2001-03-05 05:04:32 +0000
committergareth <gareth>2001-03-05 05:04:32 +0000
commita25b52adcd8c430d9b94158f75a815b38ef19a16 (patch)
treed1e6695af430d085666863ad804658c175a1c07b
parent801be1988da3e6aaadec4151e1e302be4d5e665b (diff)
Grab latest Mesa 3.4 code.
-rw-r--r--xc/extras/Mesa/src/texformat.c5
-rw-r--r--xc/extras/Mesa/src/texformat.h2
-rw-r--r--xc/extras/Mesa/src/teximage.c212
-rw-r--r--xc/extras/Mesa/src/texutil.c6
-rw-r--r--xc/extras/Mesa/src/texutil_tmp.h4
-rw-r--r--xc/extras/Mesa/src/types.h20
6 files changed, 102 insertions, 147 deletions
diff --git a/xc/extras/Mesa/src/texformat.c b/xc/extras/Mesa/src/texformat.c
index c4ec4f285..f85725843 100644
--- a/xc/extras/Mesa/src/texformat.c
+++ b/xc/extras/Mesa/src/texformat.c
@@ -240,9 +240,8 @@ void _mesa_init_texture_format( GLcontext *ctx,
{
texImage->IntFormat = internalFormat;
- /*
- * Ask the driver for the base format, if it doesn't
- * know, it will return -1;
+ /* Ask the driver for the base format, if it doesn't know, it will
+ * return -1;
*/
if ( ctx->Driver.BaseCompressedTexFormat ) {
GLint format = 0; /* Silence compiler warning */
diff --git a/xc/extras/Mesa/src/texformat.h b/xc/extras/Mesa/src/texformat.h
index 7db372611..8f5e7de75 100644
--- a/xc/extras/Mesa/src/texformat.h
+++ b/xc/extras/Mesa/src/texformat.h
@@ -50,7 +50,7 @@ enum _format { /* ---- ---- ---- ---- ---- ---- ---- ---- */
MESA_FORMAT_A8, /* AAAA AAAA */
MESA_FORMAT_L8, /* LLLL LLLL */
MESA_FORMAT_I8, /* IIII IIII */
- MESA_FORMAT_CI8, /* CCCC CCCC */
+ MESA_FORMAT_CI8 /* CCCC CCCC */
};
diff --git a/xc/extras/Mesa/src/teximage.c b/xc/extras/Mesa/src/teximage.c
index 4e3d131c5..fc610cb0b 100644
--- a/xc/extras/Mesa/src/teximage.c
+++ b/xc/extras/Mesa/src/teximage.c
@@ -134,6 +134,89 @@ logbase2( int n )
/*
* Given an internal texture format enum or 1, 2, 3, 4 return the
* corresponding _base_ internal format: GL_ALPHA, GL_LUMINANCE,
+ * GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, or GL_RGBA.
+ * Return -1 if invalid enum.
+ */
+GLint
+_mesa_base_tex_format( GLcontext *ctx, GLint format )
+{
+ /*
+ * Ask the driver for the base format, if it doesn't
+ * know, it will return -1;
+ */
+ if (ctx->Driver.BaseCompressedTexFormat) {
+ GLint ifmt = (*ctx->Driver.BaseCompressedTexFormat)(ctx, format);
+ if (ifmt >= 0) {
+ return ifmt;
+ }
+ }
+ switch (format) {
+ case GL_ALPHA:
+ case GL_ALPHA4:
+ case GL_ALPHA8:
+ case GL_ALPHA12:
+ case GL_ALPHA16:
+ return GL_ALPHA;
+ case 1:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE4:
+ case GL_LUMINANCE8:
+ case GL_LUMINANCE12:
+ case GL_LUMINANCE16:
+ return GL_LUMINANCE;
+ case 2:
+ case GL_LUMINANCE_ALPHA:
+ case GL_LUMINANCE4_ALPHA4:
+ case GL_LUMINANCE6_ALPHA2:
+ case GL_LUMINANCE8_ALPHA8:
+ case GL_LUMINANCE12_ALPHA4:
+ case GL_LUMINANCE12_ALPHA12:
+ case GL_LUMINANCE16_ALPHA16:
+ return GL_LUMINANCE_ALPHA;
+ case GL_INTENSITY:
+ case GL_INTENSITY4:
+ case GL_INTENSITY8:
+ case GL_INTENSITY12:
+ case GL_INTENSITY16:
+ return GL_INTENSITY;
+ case 3:
+ case GL_RGB:
+ case GL_R3_G3_B2:
+ case GL_RGB4:
+ case GL_RGB5:
+ case GL_RGB8:
+ case GL_RGB10:
+ case GL_RGB12:
+ case GL_RGB16:
+ return GL_RGB;
+ case 4:
+ case GL_RGBA:
+ case GL_RGBA2:
+ case GL_RGBA4:
+ case GL_RGB5_A1:
+ case GL_RGBA8:
+ case GL_RGB10_A2:
+ case GL_RGBA12:
+ case GL_RGBA16:
+ return GL_RGBA;
+ case GL_COLOR_INDEX:
+ case GL_COLOR_INDEX1_EXT:
+ case GL_COLOR_INDEX2_EXT:
+ case GL_COLOR_INDEX4_EXT:
+ case GL_COLOR_INDEX8_EXT:
+ case GL_COLOR_INDEX12_EXT:
+ case GL_COLOR_INDEX16_EXT:
+ return GL_COLOR_INDEX;
+ default:
+ return -1; /* error */
+ }
+}
+
+
+
+/*
+ * Given an internal texture format enum or 1, 2, 3, 4 return the
+ * corresponding _base_ internal format: GL_ALPHA, GL_LUMINANCE,
* GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, or GL_RGBA. Return the
* number of components for the format. Return -1 if invalid enum.
*/
@@ -218,117 +301,6 @@ is_compressed_format(GLcontext *ctx, GLenum internalFormat)
-#if 0
-/*
- * Examine the texImage->Format field and set the Red, Green, Blue, etc
- * texel component sizes to default values.
- * These fields are set only here by core Mesa but device drivers may
- * overwritting these fields to indicate true texel resolution.
- */
-static void
-set_teximage_component_sizes( struct gl_texture_image *texImage )
-{
- switch (texImage->Format) {
- case GL_ALPHA:
- texImage->RedBits = 0;
- texImage->GreenBits = 0;
- texImage->BlueBits = 0;
- texImage->AlphaBits = 8;
- texImage->IntensityBits = 0;
- texImage->LuminanceBits = 0;
- texImage->IndexBits = 0;
- break;
- case GL_LUMINANCE:
- texImage->RedBits = 0;
- texImage->GreenBits = 0;
- texImage->BlueBits = 0;
- texImage->AlphaBits = 0;
- texImage->IntensityBits = 0;
- texImage->LuminanceBits = 8;
- texImage->IndexBits = 0;
- break;
- case GL_LUMINANCE_ALPHA:
- texImage->RedBits = 0;
- texImage->GreenBits = 0;
- texImage->BlueBits = 0;
- texImage->AlphaBits = 8;
- texImage->IntensityBits = 0;
- texImage->LuminanceBits = 8;
- texImage->IndexBits = 0;
- break;
- case GL_INTENSITY:
- texImage->RedBits = 0;
- texImage->GreenBits = 0;
- texImage->BlueBits = 0;
- texImage->AlphaBits = 0;
- texImage->IntensityBits = 8;
- texImage->LuminanceBits = 0;
- texImage->IndexBits = 0;
- break;
- case GL_RED:
- texImage->RedBits = 8;
- texImage->GreenBits = 0;
- texImage->BlueBits = 0;
- texImage->AlphaBits = 0;
- texImage->IntensityBits = 0;
- texImage->LuminanceBits = 0;
- texImage->IndexBits = 0;
- break;
- case GL_GREEN:
- texImage->RedBits = 0;
- texImage->GreenBits = 8;
- texImage->BlueBits = 0;
- texImage->AlphaBits = 0;
- texImage->IntensityBits = 0;
- texImage->LuminanceBits = 0;
- texImage->IndexBits = 0;
- break;
- case GL_BLUE:
- texImage->RedBits = 0;
- texImage->GreenBits = 0;
- texImage->BlueBits = 8;
- texImage->AlphaBits = 0;
- texImage->IntensityBits = 0;
- texImage->LuminanceBits = 0;
- texImage->IndexBits = 0;
- break;
- case GL_RGB:
- case GL_BGR:
- texImage->RedBits = 8;
- texImage->GreenBits = 8;
- texImage->BlueBits = 8;
- texImage->AlphaBits = 0;
- texImage->IntensityBits = 0;
- texImage->LuminanceBits = 0;
- texImage->IndexBits = 0;
- break;
- case GL_RGBA:
- case GL_BGRA:
- case GL_ABGR_EXT:
- texImage->RedBits = 8;
- texImage->GreenBits = 8;
- texImage->BlueBits = 8;
- texImage->AlphaBits = 8;
- texImage->IntensityBits = 0;
- texImage->LuminanceBits = 0;
- texImage->IndexBits = 0;
- break;
- case GL_COLOR_INDEX:
- texImage->RedBits = 0;
- texImage->GreenBits = 0;
- texImage->BlueBits = 0;
- texImage->AlphaBits = 0;
- texImage->IntensityBits = 0;
- texImage->LuminanceBits = 0;
- texImage->IndexBits = 8;
- break;
- default:
- gl_problem(NULL, "unexpected format in set_teximage_component_sizes");
- }
-}
-#endif
-
-
static void
set_tex_image(struct gl_texture_object *tObj,
GLenum target, GLint level,
@@ -387,12 +359,7 @@ init_texture_image( GLcontext *ctx,
{
ASSERT(img);
ASSERT(!img->Data);
-#if 0
- img->Format = (GLenum) _mesa_base_tex_format(ctx, internalFormat);
- set_teximage_component_sizes( img );
-#else
_mesa_init_texture_format( ctx, img, internalFormat );
-#endif
img->Border = border;
img->Width = width;
img->Height = height;
@@ -774,15 +741,6 @@ clear_proxy_teximage(struct gl_texture_image *img)
ASSERT(img);
img->Format = 0;
img->IntFormat = 0;
-#if 0
- img->RedBits = 0;
- img->GreenBits = 0;
- img->BlueBits = 0;
- img->AlphaBits = 0;
- img->IntensityBits = 0;
- img->LuminanceBits = 0;
- img->IndexBits = 0;
-#endif
img->Border = 0;
img->Width = 0;
img->Height = 0;
@@ -913,7 +871,6 @@ texture_error_check( GLcontext *ctx, GLenum target,
return GL_TRUE;
}
-#if 0
iformat = _mesa_base_tex_format( ctx, internalFormat );
if (iformat < 0) {
if (!isProxy) {
@@ -923,7 +880,6 @@ texture_error_check( GLcontext *ctx, GLenum target,
}
return GL_TRUE;
}
-#endif
if (!is_compressed_format(ctx, internalFormat)) {
if (!_mesa_is_legal_format_and_type( format, type )) {
@@ -1142,7 +1098,6 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions,
return GL_TRUE;
}
-#if 0
iformat = _mesa_base_tex_format( ctx, internalFormat );
if (iformat < 0) {
char message[100];
@@ -1150,7 +1105,6 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions,
gl_error(ctx, GL_INVALID_VALUE, message);
return GL_TRUE;
}
-#endif
/* if we get here, the parameters are OK */
return GL_FALSE;
diff --git a/xc/extras/Mesa/src/texutil.c b/xc/extras/Mesa/src/texutil.c
index 12f01a913..4143830c1 100644
--- a/xc/extras/Mesa/src/texutil.c
+++ b/xc/extras/Mesa/src/texutil.c
@@ -1187,7 +1187,7 @@ void _mesa_unconvert_teximage1d( GLint mesaFormat, GLenum format, GLint width,
convert.srcImage = srcImage;
convert.dstImage = dstImage;
- return gl_unconvert_teximage_tab[mesaFormat]( &convert );
+ gl_unconvert_teximage_tab[mesaFormat]( &convert );
}
void _mesa_unconvert_teximage2d( GLint mesaFormat, GLenum format,
@@ -1211,7 +1211,7 @@ void _mesa_unconvert_teximage2d( GLint mesaFormat, GLenum format,
convert.srcImage = srcImage;
convert.dstImage = dstImage;
- return gl_unconvert_teximage_tab[mesaFormat]( &convert );
+ gl_unconvert_teximage_tab[mesaFormat]( &convert );
}
void _mesa_unconvert_teximage3d( GLint mesaFormat, GLenum format,
@@ -1235,7 +1235,7 @@ void _mesa_unconvert_teximage3d( GLint mesaFormat, GLenum format,
convert.srcImage = srcImage;
convert.dstImage = dstImage;
- return gl_unconvert_teximage_tab[mesaFormat]( &convert );
+ gl_unconvert_teximage_tab[mesaFormat]( &convert );
}
diff --git a/xc/extras/Mesa/src/texutil_tmp.h b/xc/extras/Mesa/src/texutil_tmp.h
index 11fdbd8fc..ea6c4ee52 100644
--- a/xc/extras/Mesa/src/texutil_tmp.h
+++ b/xc/extras/Mesa/src/texutil_tmp.h
@@ -1,4 +1,6 @@
-
+/*
+ * NOTE: All 3D code is untested and most definitely broken...
+ */
#define DST_TEXEL_BYTES (4 / DST_TEXELS_PER_DWORD)
#define DST_ROW_WIDTH (convert->width * DST_TEXEL_BYTES)
diff --git a/xc/extras/Mesa/src/types.h b/xc/extras/Mesa/src/types.h
index 3f507ca35..5c297eb2a 100644
--- a/xc/extras/Mesa/src/types.h
+++ b/xc/extras/Mesa/src/types.h
@@ -171,18 +171,18 @@ typedef void (*TextureSampleFunc)( const struct gl_texture_object *tObj,
const GLfloat u[], const GLfloat lambda[],
GLubyte rgba[][4] );
-/* Texture format */
+/* Texture format record */
/* GH: This is an interim structure until 3.5 */
struct gl_texture_format {
GLint IntFormat; /* One of the MESA_FORMAT_* values */
- GLint RedBits;
- GLint GreenBits;
- GLint BlueBits;
- GLint AlphaBits;
- GLint LuminanceBits;
- GLint IntensityBits;
- GLint IndexBits;
+ GLubyte RedBits; /* Bits per texel component */
+ GLubyte GreenBits;
+ GLubyte BlueBits;
+ GLubyte AlphaBits;
+ GLubyte LuminanceBits;
+ GLubyte IntensityBits;
+ GLubyte IndexBits;
GLint TexelBytes;
};
@@ -207,11 +207,11 @@ struct gl_texture_image {
GLuint MaxLog2; /* = MAX(WidthLog2, HeightLog2) */
GLubyte *Data; /* Image data as unsigned bytes */
+ const struct gl_texture_format *TexFormat;
+
GLboolean IsCompressed; /* GL_ARB_texture_compression */
GLuint CompressedSize; /* GL_ARB_texture_compression */
- const struct gl_texture_format *TexFormat;
-
/* For device driver: */
void *DriverData; /* Arbitrary device driver data */
};