summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGareth Hughes <[email protected]>2001-03-28 20:40:51 +0000
committerGareth Hughes <[email protected]>2001-03-28 20:40:51 +0000
commit38f28665bf9fb5b2464738ca5074848ec2777ae1 (patch)
treed7df29f52814f6cd466b3ad9c3252c744ee5071c /src
parent53933fe9dbfae168dce0688b406810462a6d577b (diff)
More texture format updates. Drivers now need only plug an appropriate
format into texImage->TexFormat, the rest is handled by core Mesa.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/mtypes.h10
-rw-r--r--src/mesa/main/texformat.c135
-rw-r--r--src/mesa/main/teximage.c98
-rw-r--r--src/mesa/main/texstate.c6
-rw-r--r--src/mesa/main/texstore.c22
-rw-r--r--src/mesa/main/texutil.c93
-rw-r--r--src/mesa/swrast/s_texstore.c68
-rw-r--r--src/mesa/swrast/s_texture.c9
-rw-r--r--src/mesa/swrast/s_triangle.c8
9 files changed, 203 insertions, 246 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 5aa3619e62f..6ecb33d32e1 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1,4 +1,4 @@
-/* $Id: mtypes.h,v 1.33 2001/03/27 19:18:02 gareth Exp $ */
+/* $Id: mtypes.h,v 1.34 2001/03/28 20:40:51 gareth Exp $ */
/*
* Mesa 3-D graphics library
@@ -777,10 +777,10 @@ typedef void (*FetchTexelFunc)( const struct gl_texture_image *texImage,
/* Texture format record */
struct gl_texture_format {
- GLint IntFormat; /* One of the MESA_FORMAT_* values */
+ GLint MesaFormat; /* One of the MESA_FORMAT_* values */
- GLenum BaseFormat;
- GLenum BaseType;
+ GLenum IntFormat; /* Internal format as GL enum value */
+ GLenum Type; /* Internal type as GL enum value */
GLubyte RedBits; /* Bits per texel component */
GLubyte GreenBits;
@@ -804,8 +804,6 @@ struct gl_texture_image {
* GL_INTENSITY, GL_RGB, GL_RGBA,
* GL_COLOR_INDEX or GL_DEPTH_COMPONENT only.
*/
- GLenum Type; /* Texel type: GL_UNSIGNED_BYTE, etc. */
- GLenum IntFormat; /* Internal format as given by the user */
GLuint Border; /* 0 or 1 */
GLuint Width; /* = 2^WidthLog2 + 2*Border */
GLuint Height; /* = 2^HeightLog2 + 2*Border */
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index d24f6833eda..ec8aecc0f6b 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -1,4 +1,4 @@
-/* $Id: texformat.c,v 1.5 2001/03/27 20:26:37 brianp Exp $ */
+/* $Id: texformat.c,v 1.6 2001/03/28 20:40:51 gareth Exp $ */
/*
* Mesa 3-D graphics library
@@ -73,9 +73,9 @@ static void fetch_null_texel( const struct gl_texture_image *texImage,
*/
const struct gl_texture_format _mesa_texformat_rgba = {
- MESA_FORMAT_RGBA, /* IntFormat */
- GL_RGBA, /* BaseFormat */
- CHAN_TYPE, /* BaseType */
+ MESA_FORMAT_RGBA, /* MesaFormat */
+ GL_RGBA, /* IntFormat */
+ CHAN_TYPE, /* Type */
CHAN_BITS, /* RedBits */
CHAN_BITS, /* GreenBits */
CHAN_BITS, /* BlueBits */
@@ -91,9 +91,9 @@ const struct gl_texture_format _mesa_texformat_rgba = {
};
const struct gl_texture_format _mesa_texformat_rgb = {
- MESA_FORMAT_RGB, /* IntFormat */
- GL_RGB, /* BaseFormat */
- CHAN_TYPE, /* BaseType */
+ MESA_FORMAT_RGB, /* MesaFormat */
+ GL_RGB, /* IntFormat */
+ CHAN_TYPE, /* Type */
CHAN_BITS, /* RedBits */
CHAN_BITS, /* GreenBits */
CHAN_BITS, /* BlueBits */
@@ -109,9 +109,9 @@ const struct gl_texture_format _mesa_texformat_rgb = {
};
const struct gl_texture_format _mesa_texformat_alpha = {
- MESA_FORMAT_ALPHA, /* IntFormat */
- GL_ALPHA, /* BaseFormat */
- CHAN_TYPE, /* BaseType */
+ MESA_FORMAT_ALPHA, /* MesaFormat */
+ GL_ALPHA, /* IntFormat */
+ CHAN_TYPE, /* Type */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -127,9 +127,9 @@ const struct gl_texture_format _mesa_texformat_alpha = {
};
const struct gl_texture_format _mesa_texformat_luminance = {
- MESA_FORMAT_LUMINANCE, /* IntFormat */
- GL_LUMINANCE, /* BaseFormat */
- CHAN_TYPE, /* BaseType */
+ MESA_FORMAT_LUMINANCE, /* MesaFormat */
+ GL_LUMINANCE, /* IntFormat */
+ CHAN_TYPE, /* Type */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -145,9 +145,9 @@ const struct gl_texture_format _mesa_texformat_luminance = {
};
const struct gl_texture_format _mesa_texformat_luminance_alpha = {
- MESA_FORMAT_LUMINANCE_ALPHA, /* IntFormat */
- GL_LUMINANCE_ALPHA, /* BaseFormat */
- CHAN_TYPE, /* BaseType */
+ MESA_FORMAT_LUMINANCE_ALPHA, /* MesaFormat */
+ GL_LUMINANCE_ALPHA, /* IntFormat */
+ CHAN_TYPE, /* Type */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -163,9 +163,9 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha = {
};
const struct gl_texture_format _mesa_texformat_intensity = {
- MESA_FORMAT_INTENSITY, /* IntFormat */
- GL_INTENSITY, /* BaseFormat */
- CHAN_TYPE, /* BaseType */
+ MESA_FORMAT_INTENSITY, /* MesaFormat */
+ GL_INTENSITY, /* IntFormat */
+ CHAN_TYPE, /* Type */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -181,9 +181,9 @@ const struct gl_texture_format _mesa_texformat_intensity = {
};
const struct gl_texture_format _mesa_texformat_color_index = {
- MESA_FORMAT_COLOR_INDEX, /* IntFormat */
- GL_COLOR_INDEX, /* BaseFormat */
- CHAN_TYPE, /* BaseType */
+ MESA_FORMAT_COLOR_INDEX, /* MesaFormat */
+ GL_COLOR_INDEX, /* IntFormat */
+ CHAN_TYPE, /* Type */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -199,9 +199,9 @@ const struct gl_texture_format _mesa_texformat_color_index = {
};
const struct gl_texture_format _mesa_texformat_depth_component = {
- MESA_FORMAT_DEPTH_COMPONENT, /* IntFormat */
- GL_DEPTH_COMPONENT, /* BaseFormat */
- GL_FLOAT, /* BaseType */
+ MESA_FORMAT_DEPTH_COMPONENT, /* MesaFormat */
+ GL_DEPTH_COMPONENT, /* IntFormat */
+ GL_FLOAT, /* Type */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -222,9 +222,9 @@ const struct gl_texture_format _mesa_texformat_depth_component = {
*/
const struct gl_texture_format _mesa_texformat_rgba8888 = {
- MESA_FORMAT_RGBA8888, /* IntFormat */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_BYTE, /* BaseType */
+ MESA_FORMAT_RGBA8888, /* MesaFormat */
+ GL_RGBA, /* IntFormat */
+ GL_UNSIGNED_INT_8_8_8_8, /* Type */
8, /* RedBits */
8, /* GreenBits */
8, /* BlueBits */
@@ -240,9 +240,9 @@ const struct gl_texture_format _mesa_texformat_rgba8888 = {
};
const struct gl_texture_format _mesa_texformat_argb8888 = {
- MESA_FORMAT_ARGB8888, /* IntFormat */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_BYTE, /* FIXME: ??? */ /* BaseType */
+ MESA_FORMAT_ARGB8888, /* MesaFormat */
+ GL_BGRA, /* IntFormat */
+ GL_UNSIGNED_INT_8_8_8_8_REV, /* Type */
8, /* RedBits */
8, /* GreenBits */
8, /* BlueBits */
@@ -258,9 +258,9 @@ const struct gl_texture_format _mesa_texformat_argb8888 = {
};
const struct gl_texture_format _mesa_texformat_rgb888 = {
- MESA_FORMAT_RGB888, /* IntFormat */
- GL_RGB, /* BaseFormat */
- GL_UNSIGNED_BYTE, /* BaseType */
+ MESA_FORMAT_RGB888, /* MesaFormat */
+ GL_BGR, /* IntFormat */
+ GL_UNSIGNED_BYTE, /* Type */
8, /* RedBits */
8, /* GreenBits */
8, /* BlueBits */
@@ -276,9 +276,9 @@ const struct gl_texture_format _mesa_texformat_rgb888 = {
};
const struct gl_texture_format _mesa_texformat_rgb565 = {
- MESA_FORMAT_RGB565, /* IntFormat */
- GL_RGB, /* BaseFormat */
- GL_UNSIGNED_SHORT_5_6_5, /* BaseType */
+ MESA_FORMAT_RGB565, /* MesaFormat */
+ GL_RGB, /* IntFormat */
+ GL_UNSIGNED_SHORT_5_6_5, /* Type */
5, /* RedBits */
6, /* GreenBits */
5, /* BlueBits */
@@ -294,9 +294,9 @@ const struct gl_texture_format _mesa_texformat_rgb565 = {
};
const struct gl_texture_format _mesa_texformat_argb4444 = {
- MESA_FORMAT_ARGB4444, /* IntFormat */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_SHORT_4_4_4_4_REV, /* BaseType */
+ MESA_FORMAT_ARGB4444, /* MesaFormat */
+ GL_BGRA, /* IntFormat */
+ GL_UNSIGNED_SHORT_4_4_4_4_REV, /* Type */
4, /* RedBits */
4, /* GreenBits */
4, /* BlueBits */
@@ -312,9 +312,9 @@ const struct gl_texture_format _mesa_texformat_argb4444 = {
};
const struct gl_texture_format _mesa_texformat_argb1555 = {
- MESA_FORMAT_ARGB1555, /* IntFormat */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_SHORT_1_5_5_5_REV, /* BaseType */
+ MESA_FORMAT_ARGB1555, /* MesaFormat */
+ GL_BGRA, /* IntFormat */
+ GL_UNSIGNED_SHORT_1_5_5_5_REV, /* Type */
5, /* RedBits */
5, /* GreenBits */
5, /* BlueBits */
@@ -330,9 +330,9 @@ const struct gl_texture_format _mesa_texformat_argb1555 = {
};
const struct gl_texture_format _mesa_texformat_al88 = {
- MESA_FORMAT_AL88, /* IntFormat */
- GL_LUMINANCE_ALPHA, /* BaseFormat */
- GL_UNSIGNED_BYTE, /* BaseType */
+ MESA_FORMAT_AL88, /* MesaFormat */
+ GL_LUMINANCE_ALPHA, /* IntFormat */
+ GL_UNSIGNED_BYTE, /* Type */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -348,9 +348,9 @@ const struct gl_texture_format _mesa_texformat_al88 = {
};
const struct gl_texture_format _mesa_texformat_rgb332 = {
- MESA_FORMAT_RGB332, /* IntFormat */
- GL_RGB, /* BaseFormat */
- GL_UNSIGNED_BYTE_3_3_2, /* BaseType */
+ MESA_FORMAT_RGB332, /* MesaFormat */
+ GL_RGB, /* IntFormat */
+ GL_UNSIGNED_BYTE_3_3_2, /* Type */
3, /* RedBits */
3, /* GreenBits */
2, /* BlueBits */
@@ -366,9 +366,9 @@ const struct gl_texture_format _mesa_texformat_rgb332 = {
};
const struct gl_texture_format _mesa_texformat_a8 = {
- MESA_FORMAT_A8, /* IntFormat */
- GL_ALPHA, /* BaseFormat */
- GL_UNSIGNED_BYTE, /* BaseType */
+ MESA_FORMAT_A8, /* MesaFormat */
+ GL_ALPHA, /* IntFormat */
+ GL_UNSIGNED_BYTE, /* Type */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -384,9 +384,9 @@ const struct gl_texture_format _mesa_texformat_a8 = {
};
const struct gl_texture_format _mesa_texformat_l8 = {
- MESA_FORMAT_L8, /* IntFormat */
- GL_LUMINANCE, /* BaseFormat */
- GL_UNSIGNED_BYTE, /* BaseType */
+ MESA_FORMAT_L8, /* MesaFormat */
+ GL_LUMINANCE, /* IntFormat */
+ GL_UNSIGNED_BYTE, /* Type */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -402,9 +402,9 @@ const struct gl_texture_format _mesa_texformat_l8 = {
};
const struct gl_texture_format _mesa_texformat_i8 = {
- MESA_FORMAT_I8, /* IntFormat */
- GL_INTENSITY, /* BaseFormat */
- GL_UNSIGNED_BYTE, /* BaseType */
+ MESA_FORMAT_I8, /* MesaFormat */
+ GL_INTENSITY, /* IntFormat */
+ GL_UNSIGNED_BYTE, /* Type */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -420,9 +420,9 @@ const struct gl_texture_format _mesa_texformat_i8 = {
};
const struct gl_texture_format _mesa_texformat_ci8 = {
- MESA_FORMAT_CI8, /* IntFormat */
- GL_COLOR_INDEX, /* BaseFormat */
- GL_UNSIGNED_BYTE, /* BaseType */
+ MESA_FORMAT_CI8, /* MesaFormat */
+ GL_COLOR_INDEX, /* IntFormat */
+ GL_UNSIGNED_BYTE, /* Type */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -443,9 +443,9 @@ const struct gl_texture_format _mesa_texformat_ci8 = {
*/
const struct gl_texture_format _mesa_null_texformat = {
- -1, /* IntFormat */
- 0, /* BaseFormat */
- 0, /* BaseType */
+ -1, /* MesaFormat */
+ 0, /* IntFormat */
+ 0, /* Type */
0, /* RedBits */
0, /* GreenBits */
0, /* BlueBits */
@@ -472,8 +472,6 @@ void _mesa_init_tex_format( GLcontext *ctx, GLenum internalFormat,
{
const struct gl_texture_format *texFormat;
- texImage->IntFormat = internalFormat;
-
/* Ask the driver for the base format, if it doesn't know, it will
* return -1;
*/
@@ -583,10 +581,5 @@ void _mesa_init_tex_format( GLcontext *ctx, GLenum internalFormat,
return;
}
- /* Initialize the base format and type.
- */
- texImage->Format = texFormat->BaseFormat;
- texImage->Type = texFormat->BaseType;
-
texImage->TexFormat = texFormat;
}
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index a92172a39b2..4f9e2761ae6 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1,4 +1,4 @@
-/* $Id: teximage.c,v 1.87 2001/03/26 20:02:38 brianp Exp $ */
+/* $Id: teximage.c,v 1.88 2001/03/28 20:40:51 gareth Exp $ */
/*
* Mesa 3-D graphics library
@@ -108,7 +108,7 @@ static void PrintTexture(const struct gl_texture_image *img)
/*
* Compute log base 2 of n.
* If n isn't an exact power of two return -1.
- * If n<0 return -1.
+ * If n < 0 return -1.
*/
static int
logbase2( int n )
@@ -116,7 +116,7 @@ logbase2( int n )
GLint i = 1;
GLint log2 = 0;
- if (n<0) {
+ if (n < 0) {
return -1;
}
@@ -143,10 +143,10 @@ logbase2( int n )
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;
- */
+ /*
+ * 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) {
@@ -558,8 +558,6 @@ clear_teximage_fields(struct gl_texture_image *img)
{
ASSERT(img);
img->Format = 0;
- img->Type = 0;
- img->IntFormat = 0;
img->Border = 0;
img->Width = 0;
img->Height = 0;
@@ -588,8 +586,7 @@ init_teximage_fields(GLcontext *ctx,
GLint border, GLenum internalFormat)
{
ASSERT(img);
-
- img->IntFormat = internalFormat;
+ img->Format = _mesa_base_tex_format( ctx, internalFormat );
img->Border = border;
img->Width = width;
img->Height = height;
@@ -747,18 +744,17 @@ texture_error_check( GLcontext *ctx, GLenum target,
return GL_TRUE;
}
- if (!is_compressed_format(ctx, internalFormat)) {
- if (!_mesa_is_legal_format_and_type( format, type )) {
- /* Yes, generate GL_INVALID_OPERATION, not GL_INVALID_ENUM, if there
- * is a type/format mismatch. See 1.2 spec page 94, sec 3.6.4.
- */
- if (!isProxy) {
- char message[100];
- sprintf(message, "glTexImage%dD(format or type)", dimensions);
- _mesa_error(ctx, GL_INVALID_OPERATION, message);
- }
- return GL_TRUE;
+ if (!is_compressed_format( ctx, internalFormat ) &&
+ !_mesa_is_legal_format_and_type( format, type )) {
+ /* Yes, generate GL_INVALID_OPERATION, not GL_INVALID_ENUM, if there
+ * is a type/format mismatch. See 1.2 spec page 94, sec 3.6.4.
+ */
+ if (!isProxy) {
+ char message[100];
+ sprintf(message, "glTexImage%dD(format or type)", dimensions);
+ _mesa_error(ctx, GL_INVALID_OPERATION, message);
}
+ return GL_TRUE;
}
/* if we get here, the parameters are OK */
@@ -870,19 +866,18 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions,
_mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage3D(zoffset)");
return GL_TRUE;
}
- if (zoffset + depth > (GLint) (destTex->Depth+destTex->Border)) {
+ if (zoffset + depth > (GLint) (destTex->Depth + destTex->Border)) {
_mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage3D(zoffset+depth)");
return GL_TRUE;
}
}
- if (!is_compressed_format(ctx, destTex->IntFormat)) {
- if (!_mesa_is_legal_format_and_type(format, type)) {
- char message[100];
- sprintf(message, "glTexSubImage%dD(format or type)", dimensions);
- _mesa_error(ctx, GL_INVALID_ENUM, message);
- return GL_TRUE;
- }
+ if (!is_compressed_format(ctx, destTex->TexFormat->IntFormat) &&
+ !_mesa_is_legal_format_and_type(format, type)) {
+ char message[100];
+ sprintf(message, "glTexSubImage%dD(format or type)", dimensions);
+ _mesa_error(ctx, GL_INVALID_ENUM, message);
+ return GL_TRUE;
}
return GL_FALSE;
@@ -923,7 +918,7 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions,
}
/* Border */
- if (border!=0 && border!=1) {
+ if (border != 0 && border != 1) {
char message[100];
sprintf(message, "glCopyTexImage%dD(border)", dimensions);
_mesa_error(ctx, GL_INVALID_VALUE, message);
@@ -960,7 +955,7 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions,
}
/* Level */
- if (level<0 || level>=ctx->Const.MaxTextureLevels) {
+ if (level < 0 || level>=ctx->Const.MaxTextureLevels) {
char message[100];
sprintf(message, "glCopyTexImage%dD(level=%d)", dimensions, level);
_mesa_error(ctx, GL_INVALID_VALUE, message);
@@ -1050,7 +1045,7 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions,
_mesa_error(ctx, GL_INVALID_VALUE, message);
return GL_TRUE;
}
- if (xoffset+width > (GLint) (teximage->Width+teximage->Border)) {
+ if (xoffset + width > (GLint) (teximage->Width + teximage->Border)) {
char message[100];
sprintf(message, "glCopyTexSubImage%dD(xoffset+width)", dimensions);
_mesa_error(ctx, GL_INVALID_VALUE, message);
@@ -1064,7 +1059,7 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions,
return GL_TRUE;
}
/* NOTE: we're adding the border here, not subtracting! */
- if (yoffset+height > (GLint) (teximage->Height+teximage->Border)) {
+ if (yoffset + height > (GLint) (teximage->Height + teximage->Border)) {
char message[100];
sprintf(message, "glCopyTexSubImage%dD(yoffset+height)", dimensions);
_mesa_error(ctx, GL_INVALID_VALUE, message);
@@ -1079,7 +1074,7 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions,
_mesa_error(ctx, GL_INVALID_VALUE, message);
return GL_TRUE;
}
- if (zoffset > (GLint) (teximage->Depth+teximage->Border)) {
+ if (zoffset > (GLint) (teximage->Depth + teximage->Border)) {
char message[100];
sprintf(message, "glCopyTexSubImage%dD(zoffset+depth)", dimensions);
_mesa_error(ctx, GL_INVALID_VALUE, message);
@@ -1349,13 +1344,8 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
}
}
-#if 0
- /* one of these has to be non-zero! */
- ASSERT(texImage->RedBits || texImage->IndexBits || texImage->AlphaBits ||
- texImage->LuminanceBits || texImage->IntensityBits ||
- texImage->DepthBits);
- ASSERT(texImage->FetchTexel);
-#endif
+ ASSERT(texImage->TexFormat);
+ texImage->FetchTexel = texImage->TexFormat->FetchTexel1D;
/* state update */
texObj->Complete = GL_FALSE;
@@ -1404,7 +1394,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
if (is_color_format(internalFormat)) {
_mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
- &postConvHeight);
+ &postConvHeight);
}
if (target == GL_TEXTURE_2D ||
@@ -1463,13 +1453,8 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
}
}
-#if 0
- /* one of these has to be non-zero! */
- ASSERT(texImage->RedBits || texImage->IndexBits || texImage->AlphaBits ||
- texImage->LuminanceBits || texImage->IntensityBits ||
- texImage->DepthBits);
- ASSERT(texImage->FetchTexel);
-#endif
+ ASSERT(texImage->TexFormat);
+ texImage->FetchTexel = texImage->TexFormat->FetchTexel2D;
/* state update */
texObj->Complete = GL_FALSE;
@@ -1478,8 +1463,8 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
else if (target == GL_PROXY_TEXTURE_2D) {
/* Proxy texture: check for errors and update proxy state */
GLenum error = texture_error_check(ctx, target, level, internalFormat,
- format, type, 2,
- postConvWidth, postConvHeight, 1, border);
+ format, type, 2,
+ postConvWidth, postConvHeight, 1, border);
if (!error) {
struct gl_texture_unit *texUnit;
struct gl_texture_image *texImage;
@@ -1571,13 +1556,8 @@ _mesa_TexImage3D( GLenum target, GLint level, GLenum internalFormat,
}
}
-#if 0
- /* one of these has to be non-zero! */
- ASSERT(texImage->RedBits || texImage->IndexBits || texImage->AlphaBits ||
- texImage->LuminanceBits || texImage->IntensityBits ||
- texImage->DepthBits);
- ASSERT(texImage->FetchTexel);
-#endif
+ ASSERT(texImage->TexFormat);
+ texImage->FetchTexel = texImage->TexFormat->FetchTexel3D;
/* state update */
texObj->Complete = GL_FALSE;
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index 93d12e71915..5e98965730a 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -1,4 +1,4 @@
-/* $Id: texstate.c,v 1.39 2001/03/26 19:42:40 brianp Exp $ */
+/* $Id: texstate.c,v 1.40 2001/03/28 20:40:51 gareth Exp $ */
/*
* Mesa 3-D graphics library
@@ -956,8 +956,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
case GL_TEXTURE_DEPTH:
*params = img->Depth;
return;
- case GL_TEXTURE_COMPONENTS:
- *params = img->IntFormat;
+ case GL_TEXTURE_INTERNAL_FORMAT:
+ *params = img->TexFormat->IntFormat;
return;
case GL_TEXTURE_BORDER:
*params = img->Border;
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index c1d9dfc4bc8..0647b2c7d55 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -1,4 +1,4 @@
-/* $Id: texstore.c,v 1.20 2001/03/27 20:26:10 brianp Exp $ */
+/* $Id: texstore.c,v 1.21 2001/03/28 20:40:51 gareth Exp $ */
/*
* Mesa 3-D graphics library
@@ -406,7 +406,6 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
/* setup the teximage struct's fields */
_mesa_init_tex_format( ctx, internalFormat, texImage );
- texImage->FetchTexel = texImage->TexFormat->FetchTexel1D;
texelBytes = texImage->TexFormat->TexelBytes;
@@ -450,7 +449,6 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
/* setup the teximage struct's fields */
_mesa_init_tex_format( ctx, internalFormat, texImage );
- texImage->FetchTexel = texImage->TexFormat->FetchTexel2D;
texelBytes = texImage->TexFormat->TexelBytes;
@@ -490,7 +488,6 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level,
/* setup the teximage struct's fields */
_mesa_init_tex_format( ctx, internalFormat, texImage );
- texImage->FetchTexel = texImage->TexFormat->FetchTexel3D;
texelBytes = texImage->TexFormat->TexelBytes;
@@ -542,12 +539,10 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
- const GLint components = components_in_intformat(texImage->IntFormat);
- const GLint compSize = _mesa_sizeof_type(texImage->Type);
_mesa_transfer_teximage(ctx, 2, texImage->Format, texImage->Data,
width, height, 1, /* src size */
xoffset, yoffset, 0, /* dest offsets */
- texImage->Width * components * compSize,
+ texImage->Width * texImage->TexFormat->TexelBytes,
0, /* dstImageStride */
format, type, pixels, packing);
}
@@ -565,14 +560,12 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
- const GLint components = components_in_intformat(texImage->IntFormat);
- const GLint compSize = _mesa_sizeof_type(texImage->Type);
+ const GLint texelBytes = texImage->TexFormat->TexelBytes;
_mesa_transfer_teximage(ctx, 3, texImage->Format, texImage->Data,
width, height, depth, /* src size */
xoffset, yoffset, xoffset, /* dest offsets */
- texImage->Width * components * compSize,
- texImage->Width * texImage->Height * components
- * compSize,
+ texImage->Width * texelBytes,
+ texImage->Width * texImage->Height * texelBytes,
format, type, pixels, packing);
}
@@ -648,7 +641,6 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- const struct gl_texture_format *texFormat;
(void) format;
(void) type;
@@ -665,9 +657,5 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
/* setup the teximage struct's fields */
_mesa_init_tex_format( ctx, internalFormat, texImage );
- texFormat = texImage->TexFormat;
- texImage->Format = texFormat->BaseFormat;
- texImage->Type = texFormat->BaseType;
-
return GL_TRUE;
}
diff --git a/src/mesa/main/texutil.c b/src/mesa/main/texutil.c
index c6bf0c32da1..d96af2bee74 100644
--- a/src/mesa/main/texutil.c
+++ b/src/mesa/main/texutil.c
@@ -1,4 +1,4 @@
-/* $Id: texutil.c,v 1.20 2001/03/27 20:32:24 brianp Exp $ */
+/* $Id: texutil.c,v 1.21 2001/03/28 20:40:51 gareth Exp $ */
/*
* Mesa 3-D graphics library
@@ -75,7 +75,7 @@ typedef GLboolean (*convert_func)( struct gl_texture_convert *convert );
#define DST_TEXELS_PER_DWORD 1
#define CONVERT_TEXEL( dst, src ) \
- dst = PACK_COLOR_8888( src[3], src[2], src[1], src[0] )
+ dst = PACK_COLOR_8888( src[3], src[2], src[1], src[0] )
#define CONVERT_DIRECT
@@ -87,7 +87,7 @@ typedef GLboolean (*convert_func)( struct gl_texture_convert *convert );
#define CONVERT_TEXEL( dst, src ) \
- dst = PACK_COLOR_8888( src[0], src[1], src[2], src[3] )
+ dst = PACK_COLOR_8888( src[0], src[1], src[2], src[3] )
#define CONVERT_TEXEL_DWORD( dst, src ) CONVERT_TEXEL( dst, src )
@@ -99,7 +99,7 @@ typedef GLboolean (*convert_func)( struct gl_texture_convert *convert );
#define CONVERT_TEXEL( dst, src ) \
- dst = PACK_COLOR_8888( src[0], src[1], src[2], 0xff )
+ dst = PACK_COLOR_8888( src[0], src[1], src[2], 0xff )
#define CONVERT_TEXEL_DWORD( dst, src ) CONVERT_TEXEL( dst, src )
@@ -154,7 +154,7 @@ CONVERT_RGBA8888( texsubimage3d )
#define DST_TEXELS_PER_DWORD 1
#define CONVERT_TEXEL( dst, src ) \
- dst = PACK_COLOR_8888( src[3], src[2], src[1], src[0] )
+ dst = PACK_COLOR_8888( src[3], src[2], src[1], src[0] )
#define CONVERT_DIRECT
@@ -166,7 +166,7 @@ CONVERT_RGBA8888( texsubimage3d )
#define CONVERT_TEXEL( dst, src ) \
- dst = PACK_COLOR_8888( src[3], src[0], src[1], src[2] )
+ dst = PACK_COLOR_8888( src[3], src[0], src[1], src[2] )
#define CONVERT_TEXEL_DWORD( dst, src ) CONVERT_TEXEL( dst, src )
@@ -178,7 +178,7 @@ CONVERT_RGBA8888( texsubimage3d )
#define CONVERT_TEXEL( dst, src ) \
- dst = PACK_COLOR_8888( 0xff, src[0], src[1], src[2] )
+ dst = PACK_COLOR_8888( 0xff, src[0], src[1], src[2] )
#define CONVERT_TEXEL_DWORD( dst, src ) CONVERT_TEXEL( dst, src )
@@ -254,7 +254,7 @@ convert_texsubimage3d_rgb888( struct gl_texture_convert *convert )
#define DST_TEXELS_PER_DWORD 2
#define CONVERT_TEXEL( dst, src ) \
- dst = PACK_COLOR_565( src[0], src[1], src[2] )
+ dst = PACK_COLOR_565( src[0], src[1], src[2] )
#define CONVERT_DIRECT
@@ -266,11 +266,11 @@ convert_texsubimage3d_rgb888( struct gl_texture_convert *convert )
#define CONVERT_TEXEL( dst, src ) \
- dst = PACK_COLOR_565( src[0], src[1], src[2] )
+ dst = PACK_COLOR_565( src[0], src[1], src[2] )
#define CONVERT_TEXEL_DWORD( dst, src ) \
- dst = ((PACK_COLOR_565( src[0], src[1], src[2] )) | \
- (PACK_COLOR_565( src[3], src[4], src[5] ) << 16))
+ dst = ((PACK_COLOR_565( src[0], src[1], src[2] )) | \
+ (PACK_COLOR_565( src[3], src[4], src[5] ) << 16))
#define SRC_TEXEL_BYTES 3
@@ -280,11 +280,11 @@ convert_texsubimage3d_rgb888( struct gl_texture_convert *convert )
#define CONVERT_TEXEL( dst, src ) \
- dst = PACK_COLOR_565( src[0], src[1], src[2] )
+ dst = PACK_COLOR_565( src[0], src[1], src[2] )
#define CONVERT_TEXEL_DWORD( dst, src ) \
- dst = ((PACK_COLOR_565( src[0], src[1], src[2] )) | \
- (PACK_COLOR_565( src[4], src[5], src[6] ) << 16))
+ dst = ((PACK_COLOR_565( src[0], src[1], src[2] )) | \
+ (PACK_COLOR_565( src[4], src[5], src[6] ) << 16))
#define SRC_TEXEL_BYTES 4
@@ -336,7 +336,7 @@ CONVERT_RGB565( texsubimage3d )
#define DST_TEXELS_PER_DWORD 2
#define CONVERT_TEXEL( dst, src ) \
- dst = PACK_COLOR_4444( src[3], src[0], src[1], src[2] )
+ dst = PACK_COLOR_4444( src[3], src[0], src[1], src[2] )
#define CONVERT_DIRECT
@@ -348,15 +348,15 @@ CONVERT_RGB565( texsubimage3d )
#define CONVERT_TEXEL( dst, src ) \
- dst = PACK_COLOR_4444( src[3], src[0], src[1], src[2] )
+ dst = PACK_COLOR_4444( src[3], src[0], src[1], src[2] )
#define CONVERT_TEXEL_DWORD( dst, src ) \
- dst = ((PACK_COLOR_4444( src[3], src[0], src[1], src[2] )) |\
- (PACK_COLOR_4444( src[7], src[4], src[5], src[6] ) << 16))
+ dst = ((PACK_COLOR_4444( src[3], src[0], src[1], src[2] )) | \
+ (PACK_COLOR_4444( src[7], src[4], src[5], src[6] ) << 16))
#define SRC_TEXEL_BYTES 4
-#define TAG(x) x##_rgba8888_to_argb4444
+#define TAG(x) x##_abgr8888_to_argb4444
#include "texutil_tmp.h"
@@ -375,7 +375,7 @@ convert_##name##_argb4444( struct gl_texture_convert *convert ) \
else if ( convert->format == GL_RGBA && \
convert->type == GL_UNSIGNED_BYTE ) \
{ \
- tab = name##_tab_rgba8888_to_argb4444; \
+ tab = name##_tab_abgr8888_to_argb4444; \
} \
else \
{ \
@@ -399,7 +399,7 @@ CONVERT_ARGB4444( texsubimage3d )
#define DST_TEXELS_PER_DWORD 2
#define CONVERT_TEXEL( dst, src ) \
- dst = PACK_COLOR_1555( src[3], src[0], src[1], src[2] )
+ dst = PACK_COLOR_1555( src[3], src[0], src[1], src[2] )
#define CONVERT_DIRECT
@@ -411,13 +411,13 @@ CONVERT_ARGB4444( texsubimage3d )
#define CONVERT_TEXEL( dst, src ) \
- { const GLushort s = *(GLushort *)src; \
- dst = (s >> 1) | ((s & 1) << 15); }
+ { const GLushort s = *(GLushort *)src; \
+ dst = (s >> 1) | ((s & 1) << 15); }
#define CONVERT_TEXEL_DWORD( dst, src ) \
- { const GLuint s = *(GLuint *)src; \
- dst = (((s & 0xfffefffe) >> 1) | \
- ((s & 0x00010001) << 15)); }
+ { const GLuint s = *(GLuint *)src; \
+ dst = (((s & 0xfffefffe) >> 1) | \
+ ((s & 0x00010001) << 15)); }
#define SRC_TEXEL_BYTES 2
@@ -427,15 +427,15 @@ CONVERT_ARGB4444( texsubimage3d )
#define CONVERT_TEXEL( dst, src ) \
- dst = PACK_COLOR_1555( src[3], src[0], src[1], src[2] )
+ dst = PACK_COLOR_1555( src[3], src[0], src[1], src[2] )
#define CONVERT_TEXEL_DWORD( dst, src ) \
- dst = ((PACK_COLOR_1555( src[3], src[0], src[1], src[2] )) |\
- (PACK_COLOR_1555( src[7], src[4], src[5], src[6] ) << 16))
+ dst = ((PACK_COLOR_1555( src[3], src[0], src[1], src[2] )) | \
+ (PACK_COLOR_1555( src[7], src[4], src[5], src[6] ) << 16))
#define SRC_TEXEL_BYTES 4
-#define TAG(x) x##_rgba8888_to_argb1555
+#define TAG(x) x##_abgr8888_to_argb1555
#include "texutil_tmp.h"
@@ -459,7 +459,7 @@ convert_##name##_argb1555( struct gl_texture_convert *convert ) \
else if ( convert->format == GL_RGBA && \
convert->type == GL_UNSIGNED_BYTE ) \
{ \
- tab = name##_tab_rgba8888_to_argb1555; \
+ tab = name##_tab_abgr8888_to_argb1555; \
} \
else \
{ \
@@ -483,7 +483,7 @@ CONVERT_ARGB1555( texsubimage3d )
#define DST_TEXELS_PER_DWORD 2
#define CONVERT_TEXEL( dst, src ) \
- dst = PACK_COLOR_88( src[0], src[1] )
+ dst = PACK_COLOR_88( src[0], src[1] )
#define CONVERT_DIRECT
@@ -495,11 +495,11 @@ CONVERT_ARGB1555( texsubimage3d )
#define CONVERT_TEXEL( dst, src ) \
- dst = PACK_COLOR_88( src[0], 0x00 )
+ dst = PACK_COLOR_88( src[0], 0x00 )
#define CONVERT_TEXEL_DWORD( dst, src ) \
- dst = ((PACK_COLOR_88( src[0], 0x00 )) | \
- (PACK_COLOR_88( src[1], 0x00 ) << 16))
+ dst = ((PACK_COLOR_88( src[0], 0x00 )) | \
+ (PACK_COLOR_88( src[1], 0x00 ) << 16))
#define SRC_TEXEL_BYTES 1
@@ -509,11 +509,11 @@ CONVERT_ARGB1555( texsubimage3d )
#define CONVERT_TEXEL( dst, src ) \
- dst = PACK_COLOR_88( 0xff, src[0] )
+ dst = PACK_COLOR_88( 0xff, src[0] )
#define CONVERT_TEXEL_DWORD( dst, src ) \
- dst = ((PACK_COLOR_88( 0xff, src[0] )) | \
- (PACK_COLOR_88( 0xff, src[1] ) << 16))
+ dst = ((PACK_COLOR_88( 0xff, src[0] )) | \
+ (PACK_COLOR_88( 0xff, src[1] ) << 16))
#define SRC_TEXEL_BYTES 1
@@ -523,11 +523,11 @@ CONVERT_ARGB1555( texsubimage3d )
#define CONVERT_TEXEL( dst, src ) \
- dst = PACK_COLOR_88( src[3], src[0] )
+ dst = PACK_COLOR_88( src[3], src[0] )
#define CONVERT_TEXEL_DWORD( dst, src ) \
- dst = ((PACK_COLOR_88( src[3], src[0] )) | \
- (PACK_COLOR_88( src[7], src[1] ) << 16))
+ dst = ((PACK_COLOR_88( src[3], src[0] )) | \
+ (PACK_COLOR_88( src[7], src[1] ) << 16))
#define SRC_TEXEL_BYTES 4
@@ -743,13 +743,12 @@ _mesa_convert_texsubimage1d( GLint mesaFormat,
}
-/*
- * Convert a user's 2D image into a texture image. This basically repacks
- * pixel data into the special texture formats used by core Mesa and the DRI
- * drivers. This function can do full images or subimages.
+/* Convert a user's 2D image into a texture image. This basically
+ * repacks pixel data into the special texture formats used by core Mesa
+ * and the DRI drivers. This function can do full images or subimages.
*
- * We return a boolean because this function may not accept some kinds of
- * source image formats and/or types. For example, if the incoming
+ * We return a boolean because this function may not accept some kinds
+ * of source image formats and/or types. For example, if the incoming
* format/type = GL_BGR, GL_UNSIGNED_INT this function probably won't
* be able to do the conversion.
*
diff --git a/src/mesa/swrast/s_texstore.c b/src/mesa/swrast/s_texstore.c
index 5fd91ab6491..92afecf91db 100644
--- a/src/mesa/swrast/s_texstore.c
+++ b/src/mesa/swrast/s_texstore.c
@@ -1,4 +1,4 @@
-/* $Id: s_texstore.c,v 1.1 2001/03/19 02:28:59 keithw Exp $ */
+/* $Id: s_texstore.c,v 1.2 2001/03/28 20:40:52 gareth Exp $ */
/*
* Mesa 3-D graphics library
@@ -266,30 +266,31 @@ _swrast_copy_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
ASSERT(ctx->Driver.TexImage1D);
- if (is_depth_format(texImage->IntFormat)) {
- /* read depth image from framebuffer */
- GLfloat *image = read_depth_image(ctx, x, y, width, 1);
+ if (texImage->Format != GL_DEPTH_COMPONENT) {
+ /* read RGBA image from framebuffer */
+ GLchan *image = read_color_image(ctx, x, y, width, 1);
if (!image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage1D");
+ _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage1D" );
return;
}
- /* call glTexImage1D to redefine the texture */
+ /* now call glTexSubImage1D to do the real work */
(*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width,
- GL_DEPTH_COMPONENT, GL_FLOAT, image,
+ GL_RGBA, CHAN_TYPE, image,
&_mesa_native_packing, texObj, texImage);
FREE(image);
}
else {
- GLchan *image = read_color_image(ctx, x, y, width, 1);
+ /* read depth image from framebuffer */
+ GLfloat *image = read_depth_image(ctx, x, y, width, 1);
if (!image) {
- _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage1D" );
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage1D");
return;
}
- /* now call glTexSubImage1D to do the real work */
+ /* call glTexSubImage1D to redefine the texture */
(*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width,
- GL_RGBA, CHAN_TYPE, image,
+ GL_DEPTH_COMPONENT, GL_FLOAT, image,
&_mesa_native_packing, texObj, texImage);
FREE(image);
}
@@ -317,33 +318,33 @@ _swrast_copy_texsubimage2d( GLcontext *ctx,
ASSERT(ctx->Driver.TexImage2D);
- if (is_depth_format(texImage->IntFormat)) {
- /* read depth image from framebuffer */
- GLfloat *image = read_depth_image(ctx, x, y, width, height);
+ if (texImage->Format != GL_DEPTH_COMPONENT) {
+ /* read RGBA image from framebuffer */
+ GLchan *image = read_color_image(ctx, x, y, width, height);
if (!image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage2D");
+ _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage2D" );
return;
}
- /* call glTexImage1D to redefine the texture */
+ /* now call glTexSubImage2D to do the real work */
(*ctx->Driver.TexSubImage2D)(ctx, target, level,
xoffset, yoffset, width, height,
- GL_DEPTH_COMPONENT, GL_FLOAT, image,
+ GL_RGBA, CHAN_TYPE, image,
&_mesa_native_packing, texObj, texImage);
FREE(image);
}
else {
- /* read RGBA image from framebuffer */
- GLchan *image = read_color_image(ctx, x, y, width, height);
+ /* read depth image from framebuffer */
+ GLfloat *image = read_depth_image(ctx, x, y, width, height);
if (!image) {
- _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage2D" );
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage2D");
return;
}
- /* now call glTexSubImage2D to do the real work */
+ /* call glTexImage1D to redefine the texture */
(*ctx->Driver.TexSubImage2D)(ctx, target, level,
xoffset, yoffset, width, height,
- GL_RGBA, CHAN_TYPE, image,
+ GL_DEPTH_COMPONENT, GL_FLOAT, image,
&_mesa_native_packing, texObj, texImage);
FREE(image);
}
@@ -371,35 +372,34 @@ _swrast_copy_texsubimage3d( GLcontext *ctx,
ASSERT(ctx->Driver.TexImage3D);
- if (is_depth_format(texImage->IntFormat)) {
- /* read depth image from framebuffer */
- GLfloat *image = read_depth_image(ctx, x, y, width, height);
+ if (texImage->Format != GL_DEPTH_COMPONENT) {
+ /* read RGBA image from framebuffer */
+ GLchan *image = read_color_image(ctx, x, y, width, height);
if (!image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage3D");
+ _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage3D" );
return;
}
- /* call glTexImage1D to redefine the texture */
+ /* now call glTexSubImage3D to do the real work */
(*ctx->Driver.TexSubImage3D)(ctx, target, level,
xoffset, yoffset, zoffset, width, height, 1,
- GL_DEPTH_COMPONENT, GL_FLOAT, image,
+ GL_RGBA, CHAN_TYPE, image,
&_mesa_native_packing, texObj, texImage);
FREE(image);
}
else {
- /* read RGBA image from framebuffer */
- GLchan *image = read_color_image(ctx, x, y, width, height);
+ /* read depth image from framebuffer */
+ GLfloat *image = read_depth_image(ctx, x, y, width, height);
if (!image) {
- _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage3D" );
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage3D");
return;
}
- /* now call glTexSubImage3D to do the real work */
+ /* call glTexImage1D to redefine the texture */
(*ctx->Driver.TexSubImage3D)(ctx, target, level,
xoffset, yoffset, zoffset, width, height, 1,
- GL_RGBA, CHAN_TYPE, image,
+ GL_DEPTH_COMPONENT, GL_FLOAT, image,
&_mesa_native_packing, texObj, texImage);
FREE(image);
}
}
-
diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c
index 220d3a43660..73e1b6718d1 100644
--- a/src/mesa/swrast/s_texture.c
+++ b/src/mesa/swrast/s_texture.c
@@ -1,4 +1,4 @@
-/* $Id: s_texture.c,v 1.20 2001/03/26 19:42:40 brianp Exp $ */
+/* $Id: s_texture.c,v 1.21 2001/03/28 20:40:52 gareth Exp $ */
/*
* Mesa 3-D graphics library
@@ -31,6 +31,7 @@
#include "macros.h"
#include "mmath.h"
#include "mem.h"
+#include "texformat.h"
#include "teximage.h"
#include "s_context.h"
@@ -1671,15 +1672,13 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, GLuint texUnit,
if (t->WrapS == GL_REPEAT &&
t->WrapT == GL_REPEAT &&
t->Image[baseLevel]->Border == 0 &&
- t->Image[baseLevel]->Format == GL_RGB &&
- t->Image[baseLevel]->Type == CHAN_TYPE) {
+ t->Image[baseLevel]->TexFormat->MesaFormat == MESA_FORMAT_RGB) {
swrast->TextureSample[texUnit] = opt_sample_rgb_2d;
}
else if (t->WrapS == GL_REPEAT &&
t->WrapT == GL_REPEAT &&
t->Image[baseLevel]->Border == 0 &&
- t->Image[baseLevel]->Format==GL_RGBA &&
- t->Image[baseLevel]->Type == CHAN_TYPE) {
+ t->Image[baseLevel]->TexFormat->MesaFormat == MESA_FORMAT_RGBA) {
swrast->TextureSample[texUnit] = opt_sample_rgba_2d;
}
else
diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c
index e46a7963b54..32022bb678d 100644
--- a/src/mesa/swrast/s_triangle.c
+++ b/src/mesa/swrast/s_triangle.c
@@ -1,4 +1,4 @@
-/* $Id: s_triangle.c,v 1.21 2001/03/22 04:54:08 brianp Exp $ */
+/* $Id: s_triangle.c,v 1.22 2001/03/28 20:40:52 gareth Exp $ */
/*
* Mesa 3-D graphics library
@@ -28,7 +28,7 @@
/*
* When the device driver doesn't implement triangle rasterization it
* can hook in _swrast_Triangle, which eventually calls one of these
- * functions to draw triangles.
+ * functions to draw triangles.
*/
#include "glheader.h"
@@ -2284,7 +2284,7 @@ _swrast_choose_triangle( GLcontext *ctx )
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLboolean rgbmode = ctx->Visual.rgbMode;
- if (ctx->Polygon.CullFlag &&
+ if (ctx->Polygon.CullFlag &&
ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) {
USE(nodraw_triangle);
return;
@@ -2333,7 +2333,7 @@ _swrast_choose_triangle( GLcontext *ctx )
&& texObj2D->WrapT==GL_REPEAT
&& texImg->Border==0
&& (format == GL_RGB || format == GL_RGBA)
- && texImg->Type == CHAN_TYPE
+ && texImg->TexFormat->Type == CHAN_TYPE
&& minFilter == magFilter
&& ctx->Light.Model.ColorControl == GL_SINGLE_COLOR
&& ctx->Texture.Unit[0].EnvMode != GL_COMBINE_EXT) {