summaryrefslogtreecommitdiff
path: root/xc
diff options
context:
space:
mode:
authordaryll <daryll>1999-12-16 04:13:24 +0000
committerdaryll <daryll>1999-12-16 04:13:24 +0000
commita364d379a925a1af6fc840fa1531984fa335eac7 (patch)
tree3b9f700c861827ca456acc97991dafb90550d151 /xc
parenta3d4a4aa4a0e2ff8fb9a9b92fba50c2eb560e0c7 (diff)
Fix for the lightmap problems in Q3A. We can't use DST_ALPHA, because
the current hardware doesn't support it. Instead we assume DST_ALPHA is one and return that instead.
Diffstat (limited to 'xc')
-rw-r--r--xc/extras/Mesa/src/FX/fxdrv.h8
-rw-r--r--xc/extras/Mesa/src/FX/fxsetup.c110
2 files changed, 111 insertions, 7 deletions
diff --git a/xc/extras/Mesa/src/FX/fxdrv.h b/xc/extras/Mesa/src/FX/fxdrv.h
index e26f07ae2..5bf7c03f1 100644
--- a/xc/extras/Mesa/src/FX/fxdrv.h
+++ b/xc/extras/Mesa/src/FX/fxdrv.h
@@ -255,10 +255,10 @@ typedef struct {
#define FX_UM_E_IFMT 0x00fff000
-#define FX_UM_COLOR_ITERATED 0x00100000
-#define FX_UM_COLOR_CONSTANT 0x00200000
-#define FX_UM_ALPHA_ITERATED 0x00400000
-#define FX_UM_ALPHA_CONSTANT 0x00800000
+#define FX_UM_COLOR_ITERATED 0x01000000
+#define FX_UM_COLOR_CONSTANT 0x02000000
+#define FX_UM_ALPHA_ITERATED 0x04000000
+#define FX_UM_ALPHA_CONSTANT 0x08000000
typedef void (*tfxRenderVBFunc)(GLcontext *);
diff --git a/xc/extras/Mesa/src/FX/fxsetup.c b/xc/extras/Mesa/src/FX/fxsetup.c
index 8cf833926..5cd894103 100644
--- a/xc/extras/Mesa/src/FX/fxsetup.c
+++ b/xc/extras/Mesa/src/FX/fxsetup.c
@@ -194,6 +194,11 @@ static GLuint fxGetTexSetConfiguration(GLcontext *ctx,
else
unitsmode|=FX_UM_COLOR_CONSTANT;
+ /*
+ OpenGL Feeds Texture 0 into Texture 1
+ Glide Feeds Texture 1 into Texture 0
+ */
+#if 0
if(tObj0) {
tfxTexInfo *ti0=fxTMGetTexInfo(tObj0);
@@ -288,10 +293,105 @@ static GLuint fxGetTexSetConfiguration(GLcontext *ctx,
break;
}
}
+#else
+ if(tObj0) {
+ tfxTexInfo *ti0=fxTMGetTexInfo(tObj0);
+
+ switch(ti0->baseLevelInternalFormat) {
+ case GL_ALPHA:
+ ifmt|=FX_UM_E1_ALPHA;
+ break;
+ case GL_LUMINANCE:
+ ifmt|=FX_UM_E1_LUMINANCE;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ ifmt|=FX_UM_E1_LUMINANCE_ALPHA;
+ break;
+ case GL_INTENSITY:
+ ifmt|=FX_UM_E1_INTENSITY;
+ break;
+ case GL_RGB:
+ ifmt|=FX_UM_E1_RGB;
+ break;
+ case GL_RGBA:
+ ifmt|=FX_UM_E1_RGBA;
+ break;
+ }
+
+ switch(ctx->Texture.Unit[0].EnvMode) {
+ case GL_DECAL:
+ envmode|=FX_UM_E1_DECAL;
+ break;
+ case GL_MODULATE:
+ envmode|=FX_UM_E1_MODULATE;
+ break;
+ case GL_REPLACE:
+ envmode|=FX_UM_E1_REPLACE;
+ break;
+ case GL_BLEND:
+ envmode|=FX_UM_E1_BLEND;
+ break;
+ case GL_ADD:
+ envmode|=FX_UM_E1_ADD;
+ break;
+ default:
+ /* do nothing */
+ break;
+ }
+ }
+
+ if(tObj1) {
+ tfxTexInfo *ti1=fxTMGetTexInfo(tObj1);
+ switch(ti1->baseLevelInternalFormat) {
+ case GL_ALPHA:
+ ifmt|=FX_UM_E0_ALPHA;
+ break;
+ case GL_LUMINANCE:
+ ifmt|=FX_UM_E0_LUMINANCE;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ ifmt|=FX_UM_E0_LUMINANCE_ALPHA;
+ break;
+ case GL_INTENSITY:
+ ifmt|=FX_UM_E0_INTENSITY;
+ break;
+ case GL_RGB:
+ ifmt|=FX_UM_E0_RGB;
+ break;
+ case GL_RGBA:
+ ifmt|=FX_UM_E0_RGBA;
+ break;
+ default:
+ /* do nothing */
+ break;
+ }
+
+ switch(ctx->Texture.Unit[1].EnvMode) {
+ case GL_DECAL:
+ envmode|=FX_UM_E0_DECAL;
+ break;
+ case GL_MODULATE:
+ envmode|=FX_UM_E0_MODULATE;
+ break;
+ case GL_REPLACE:
+ envmode|=FX_UM_E0_REPLACE;
+ break;
+ case GL_BLEND:
+ envmode|=FX_UM_E0_BLEND;
+ break;
+ case GL_ADD:
+ envmode|=FX_UM_E0_ADD;
+ break;
+ default:
+ /* do nothing */
+ break;
+ }
+ }
+#endif
unitsmode|=(ifmt | envmode);
- if (MESA_VERBOSE & (VERBOSE_DRIVER|VERBOSE_TEXTURE))
+ if (MESA_VERBOSE & (VERBOSE_DRIVER|VERBOSE_TEXTURE))
fxPrintUnitsMode("unitsmode", unitsmode);
return unitsmode;
@@ -1179,11 +1279,15 @@ void fxDDBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor)
adfact=GR_BLEND_ZERO;
break;
case GL_DST_ALPHA:
- dfact=GR_BLEND_DST_ALPHA;
+ /* dfact=GR_BLEND_DST_ALPHA; */
+ /* We can't do DST_ALPHA */
+ dfact=GR_BLEND_ONE;
adfact=GR_BLEND_ZERO;
break;
case GL_ONE_MINUS_DST_ALPHA:
- dfact=GR_BLEND_ONE_MINUS_DST_ALPHA;
+ /* dfact=GR_BLEND_ONE_MINUS_DST_ALPHA; */
+ /* We can't do DST_ALPHA */
+ dfact=GR_BLEND_ZERO;
adfact=GR_BLEND_ZERO;
break;
case GL_SRC_ALPHA_SATURATE: