summaryrefslogtreecommitdiff
path: root/xc/lib/GL/mesa/src/drv/mga/mgatex.c
diff options
context:
space:
mode:
Diffstat (limited to 'xc/lib/GL/mesa/src/drv/mga/mgatex.c')
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgatex.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatex.c b/xc/lib/GL/mesa/src/drv/mga/mgatex.c
index 8a8daee32..40f5c13a9 100644
--- a/xc/lib/GL/mesa/src/drv/mga/mgatex.c
+++ b/xc/lib/GL/mesa/src/drv/mga/mgatex.c
@@ -22,14 +22,11 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors:
- * Keith Whitwell <keithw@valinux.com>
+ * Keith Whitwell <keith@tungstengraphics.com>
*/
/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatex.c,v 1.13 2002/02/22 21:44:55 dawes Exp $ */
-#include <stdlib.h>
-#include <stdio.h>
-#include <GL/gl.h>
-
+#include "glheader.h"
#include "mm.h"
#include "mgacontext.h"
#include "mgatex.h"
@@ -39,7 +36,7 @@
#include "enums.h"
#include "simple_list.h"
-#include "mem.h"
+#include "imports.h"
#include "macros.h"
#include "texformat.h"
#include "texstore.h"
@@ -189,8 +186,9 @@ static GLint mgaChooseTexFormat( mgaContextPtr mmesa,
* got to be better than sticking them way down the end of this
* huge list.
*/
- case GL_RGBA:
case 4:
+ case GL_RGBA:
+ case GL_COMPRESSED_RGBA:
if ( format == GL_BGRA ) {
if ( type == GL_UNSIGNED_INT_8_8_8_8_REV ) {
SET_FORMAT( TMC_tformat_tw32, _mesa_texformat_argb8888 );
@@ -207,8 +205,9 @@ static GLint mgaChooseTexFormat( mgaContextPtr mmesa,
TMC_tformat_tw12, _mesa_texformat_argb4444 );
break;
- case GL_RGB:
case 3:
+ case GL_RGB:
+ case GL_COMPRESSED_RGB:
if ( format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 ) {
SET_FORMAT( TMC_tformat_tw16, _mesa_texformat_rgb565 );
break;
@@ -256,6 +255,7 @@ static GLint mgaChooseTexFormat( mgaContextPtr mmesa,
case GL_ALPHA8:
case GL_ALPHA12:
case GL_ALPHA16:
+ case GL_COMPRESSED_ALPHA:
/* FIXME: This will report incorrect component sizes... */
SET_FORMAT( TMC_tformat_tw12, _mesa_texformat_argb4444 );
break;
@@ -266,6 +266,7 @@ static GLint mgaChooseTexFormat( mgaContextPtr mmesa,
case GL_LUMINANCE8:
case GL_LUMINANCE12:
case GL_LUMINANCE16:
+ case GL_COMPRESSED_LUMINANCE:
/* FIXME: This will report incorrect component sizes... */
SET_FORMAT( TMC_tformat_tw16, _mesa_texformat_rgb565 );
break;
@@ -278,6 +279,7 @@ static GLint mgaChooseTexFormat( mgaContextPtr mmesa,
case GL_LUMINANCE12_ALPHA4:
case GL_LUMINANCE12_ALPHA12:
case GL_LUMINANCE16_ALPHA16:
+ case GL_COMPRESSED_LUMINANCE_ALPHA:
/* FIXME: This will report incorrect component sizes... */
SET_FORMAT( TMC_tformat_tw12, _mesa_texformat_argb4444 );
break;
@@ -287,6 +289,7 @@ static GLint mgaChooseTexFormat( mgaContextPtr mmesa,
case GL_INTENSITY8:
case GL_INTENSITY12:
case GL_INTENSITY16:
+ case GL_COMPRESSED_INTENSITY:
/* FIXME: This will report incorrect component sizes... */
SET_FORMAT( TMC_tformat_tw12, _mesa_texformat_argb4444 );
break;
@@ -417,7 +420,7 @@ static void mgaCreateTexObj(mgaContextPtr mmesa,
/* set all the register values for filtering, border, etc */
mgaSetTexWrapping( t, tObj->WrapS, tObj->WrapT );
mgaSetTexFilter( t, tObj->MinFilter, tObj->MagFilter );
- mgaSetTexBorderColor( t, tObj->BorderColor );
+ mgaSetTexBorderColor( t, tObj->_BorderChan );
}
@@ -669,7 +672,7 @@ static void mgaUpdateTextureObject( GLcontext *ctx, int hw_unit )
enabled = ctx->Texture.Unit[gl_unit]._ReallyEnabled;
tObj = ctx->Texture.Unit[gl_unit]._Current;
- if (enabled != TEXTURE0_2D) {
+ if (enabled != TEXTURE_2D_BIT) {
if (enabled)
FALLBACK( ctx, MGA_FALLBACK_TEXTURE, GL_TRUE );
return;
@@ -702,7 +705,8 @@ static void mgaUpdateTextureObject( GLcontext *ctx, int hw_unit )
/* mgaUpdateTexLRU( mmesa, t ); */
t->setup.texctl2 &= ~TMC_dualtex_enable;
- if (ctx->Texture._ReallyEnabled == (TEXTURE0_2D|TEXTURE1_2D))
+ if (ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT &&
+ ctx->Texture.Unit[1]._ReallyEnabled == TEXTURE_2D_BIT)
t->setup.texctl2 |= TMC_dualtex_enable;
t->setup.texctl2 &= ~TMC_specen_enable;
@@ -732,7 +736,8 @@ void mgaUpdateTextureState( GLcontext *ctx )
mmesa->CurrentTexObj[1] = 0;
}
- if (ctx->Texture._ReallyEnabled == TEXTURE1_2D) {
+ if (ctx->Texture.Unit[0]._ReallyEnabled == 0 &&
+ ctx->Texture.Unit[1]._ReallyEnabled == TEXTURE_2D_BIT) {
mmesa->tmu_source[0] = 1;
} else {
mmesa->tmu_source[0] = 0;
@@ -744,7 +749,8 @@ void mgaUpdateTextureState( GLcontext *ctx )
mmesa->setup.tdualstage1 = mmesa->setup.tdualstage0;
- if (ctx->Texture._ReallyEnabled == (TEXTURE0_2D|TEXTURE1_2D)) {
+ if (ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT &&
+ ctx->Texture.Unit[1]._ReallyEnabled == TEXTURE_2D_BIT) {
mgaUpdateTextureObject( ctx, 1 );
mgaUpdateTextureEnvG400( ctx, 1 );
mmesa->dirty |= MGA_UPLOAD_TEX1;
@@ -757,7 +763,7 @@ void mgaUpdateTextureState( GLcontext *ctx )
mmesa->dirty |= MGA_UPLOAD_CONTEXT | MGA_UPLOAD_TEX0;
mmesa->setup.dwgctl &= DC_opcod_MASK;
- mmesa->setup.dwgctl |= (ctx->Texture._ReallyEnabled
+ mmesa->setup.dwgctl |= (ctx->Texture._EnabledUnits
? DC_opcod_texture_trap
: DC_opcod_trap);
}
@@ -889,7 +895,7 @@ mgaDDTexParameter( GLcontext *ctx, GLenum target,
case GL_TEXTURE_BORDER_COLOR:
FLUSH_BATCH(mmesa);
- mgaSetTexBorderColor(t,tObj->BorderColor);
+ mgaSetTexBorderColor(t, tObj->_BorderChan);
break;
default: