diff options
author | Gareth Hughes <[email protected]> | 2001-03-28 20:40:51 +0000 |
---|---|---|
committer | Gareth Hughes <[email protected]> | 2001-03-28 20:40:51 +0000 |
commit | 38f28665bf9fb5b2464738ca5074848ec2777ae1 (patch) | |
tree | d7df29f52814f6cd466b3ad9c3252c744ee5071c /src/mesa/main/texformat.c | |
parent | 53933fe9dbfae168dce0688b406810462a6d577b (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/mesa/main/texformat.c')
-rw-r--r-- | src/mesa/main/texformat.c | 135 |
1 files changed, 64 insertions, 71 deletions
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; } |