[iortcw] 245/497: All: Rend2: Remove lightmap support from generic glsl shader

Simon McVittie smcv at debian.org
Fri Sep 8 10:37:00 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to annotated tag 1.42d
in repository iortcw.

commit 6b79c3b5dbbdda902c64ac679f52eb7ee463df1a
Author: M4N4T4RMS at gmail.com <M4N4T4RMS at gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a>
Date:   Thu Nov 13 23:48:16 2014 +0000

    All: Rend2: Remove lightmap support from generic glsl shader
---
 MP/code/rend2/glsl/generic_fp.glsl |  33 --------
 MP/code/rend2/glsl/generic_vp.glsl |   9 +--
 MP/code/rend2/tr_glsl.c            |  12 ---
 MP/code/rend2/tr_local.h           |  12 +--
 MP/code/rend2/tr_shade.c           |  11 ---
 MP/code/rend2/tr_shader.c          | 161 -------------------------------------
 SP/code/rend2/glsl/generic_fp.glsl |  33 --------
 SP/code/rend2/glsl/generic_vp.glsl |   9 +--
 SP/code/rend2/tr_glsl.c            |  12 ---
 SP/code/rend2/tr_local.h           |  12 +--
 SP/code/rend2/tr_shade.c           |  11 ---
 SP/code/rend2/tr_shader.c          | 161 -------------------------------------
 12 files changed, 10 insertions(+), 466 deletions(-)

diff --git a/MP/code/rend2/glsl/generic_fp.glsl b/MP/code/rend2/glsl/generic_fp.glsl
index aefa33c..50db078 100644
--- a/MP/code/rend2/glsl/generic_fp.glsl
+++ b/MP/code/rend2/glsl/generic_fp.glsl
@@ -1,45 +1,12 @@
 uniform sampler2D u_DiffuseMap;
 
-#if defined(USE_LIGHTMAP)
-uniform sampler2D u_LightMap;
-
-uniform int       u_Texture1Env;
-#endif
-
 varying vec2      var_DiffuseTex;
 
-#if defined(USE_LIGHTMAP)
-varying vec2      var_LightTex;
-#endif
-
 varying vec4      var_Color;
 
 
 void main()
 {
 	vec4 color  = texture2D(u_DiffuseMap, var_DiffuseTex);
-#if defined(USE_LIGHTMAP)
-	vec4 color2 = texture2D(u_LightMap, var_LightTex);
-  #if defined(RGBM_LIGHTMAP)
-	color2.rgb *= color2.a;
-	color2.a = 1.0;
-  #endif
-
-	if (u_Texture1Env == TEXENV_MODULATE)
-	{
-		color *= color2;
-	}
-	else if (u_Texture1Env == TEXENV_ADD)
-	{
-		color += color2;
-	}
-	else if (u_Texture1Env == TEXENV_REPLACE)
-	{
-		color = color2;
-	}
-	
-	//color = color * (u_Texture1Env.xxxx + color2 * u_Texture1Env.z) + color2 * u_Texture1Env.y;
-#endif
-
 	gl_FragColor = color * var_Color;
 }
diff --git a/MP/code/rend2/glsl/generic_vp.glsl b/MP/code/rend2/glsl/generic_vp.glsl
index 8dc86d7..e04b201 100644
--- a/MP/code/rend2/glsl/generic_vp.glsl
+++ b/MP/code/rend2/glsl/generic_vp.glsl
@@ -9,7 +9,7 @@ attribute vec3 attr_Normal2;
 attribute vec4 attr_Color;
 attribute vec4 attr_TexCoord0;
 
-#if defined(USE_LIGHTMAP) || defined(USE_TCGEN)
+#if defined(USE_TCGEN)
 attribute vec4 attr_TexCoord1;
 #endif
 
@@ -57,9 +57,6 @@ uniform float  u_VertexLerp;
 #endif
 
 varying vec2   var_DiffuseTex;
-#if defined(USE_LIGHTMAP)
-varying vec2   var_LightTex;
-#endif
 varying vec4   var_Color;
 
 #if defined(USE_DEFORM_VERTEXES)
@@ -236,10 +233,6 @@ void main()
     var_DiffuseTex = tex;
 #endif
 
-#if defined(USE_LIGHTMAP)
-	var_LightTex = attr_TexCoord1.st;
-#endif
-
 #if defined(USE_RGBAGEN)
 	var_Color = CalcColor(position, normal);
 #else
diff --git a/MP/code/rend2/tr_glsl.c b/MP/code/rend2/tr_glsl.c
index ef2820a..074218d 100644
--- a/MP/code/rend2/tr_glsl.c
+++ b/MP/code/rend2/tr_glsl.c
@@ -90,7 +90,6 @@ static uniformInfo_t uniformsInfo[] =
 
 	{ "u_DiffuseTexMatrix",  GLSL_VEC4 },
 	{ "u_DiffuseTexOffTurb", GLSL_VEC4 },
-	{ "u_Texture1Env",       GLSL_INT },
 
 	{ "u_TCGen0",        GLSL_INT },
 	{ "u_TCGen0Vector0", GLSL_VEC3 },
@@ -919,18 +918,12 @@ void GLSL_InitGPUShaders(void)
 		if (i & GENERICDEF_USE_RGBAGEN)
 			Q_strcat(extradefines, 1024, "#define USE_RGBAGEN\n");
 
-		if (i & GENERICDEF_USE_LIGHTMAP)
-			Q_strcat(extradefines, 1024, "#define USE_LIGHTMAP\n");
-
 		if (i & GENERICDEF_USE_WOLF_FOG_LINEAR)
 			Q_strcat(extradefines, 1024, "#define USE_WOLF_FOG_LINEAR\n");
 		
 		if (i & GENERICDEF_USE_WOLF_FOG_EXPONENTIAL)
 			Q_strcat(extradefines, 1024, "#define USE_WOLF_FOG_EXPONENTIAL\n");
 
-		if (r_hdr->integer && !glRefConfig.floatLightmap)
-			Q_strcat(extradefines, 1024, "#define RGBM_LIGHTMAP\n");
-
 		if (!GLSL_InitGPUShader(&tr.genericShader[i], "generic", attribs, qtrue, extradefines, qtrue, fallbackShader_generic_vp, fallbackShader_generic_fp))
 		{
 			ri.Error(ERR_FATAL, "Could not load generic shader!");
@@ -1518,11 +1511,6 @@ shaderProgram_t *GLSL_GetGenericShaderProgram(int stage, glfog_t *glFog)
 			shaderAttribs |= GENERICDEF_USE_WOLF_FOG_EXPONENTIAL;
 	}
 
-	if (pStage->bundle[1].image[0] && tess.shader->multitextureEnv)
-	{
-		shaderAttribs |= GENERICDEF_USE_LIGHTMAP;
-	}
-
 	switch (pStage->rgbGen)
 	{
 		case CGEN_LIGHTING_DIFFUSE:
diff --git a/MP/code/rend2/tr_local.h b/MP/code/rend2/tr_local.h
index 96c70a1..5994c64 100644
--- a/MP/code/rend2/tr_local.h
+++ b/MP/code/rend2/tr_local.h
@@ -505,8 +505,6 @@ typedef struct shader_s {
 	float portalRange;                  // distance to fog out at
 	qboolean	isPortal;
 
-	int multitextureEnv;                // 0, GL_MODULATE, GL_ADD (FIXME: put in stage)
-
 	cullType_t cullType;                // CT_FRONT_SIDED, CT_BACK_SIDED, or CT_TWO_SIDED
 	qboolean polygonOffset;             // set for decals and other items that must be offset
 	qboolean noMipMaps;                 // for console fonts, 2D elements, etc.
@@ -647,11 +645,10 @@ enum
 	GENERICDEF_USE_VERTEX_ANIMATION = 0x0004,
 	GENERICDEF_USE_FOG              = 0x0008,
 	GENERICDEF_USE_RGBAGEN          = 0x0010,
-	GENERICDEF_USE_LIGHTMAP         = 0x0020,
-	GENERICDEF_USE_WOLF_FOG_LINEAR      = 0x0040,
-	GENERICDEF_USE_WOLF_FOG_EXPONENTIAL = 0x0080,
-	GENERICDEF_ALL                  = 0x00FF,
-	GENERICDEF_COUNT                = 0x0100,
+	GENERICDEF_USE_WOLF_FOG_LINEAR      = 0x0020,
+	GENERICDEF_USE_WOLF_FOG_EXPONENTIAL = 0x0040,
+	GENERICDEF_ALL                  = 0x007F,
+	GENERICDEF_COUNT                = 0x0080,
 };
 
 enum
@@ -725,7 +722,6 @@ typedef enum
 
 	UNIFORM_DIFFUSETEXMATRIX,
 	UNIFORM_DIFFUSETEXOFFTURB,
-	UNIFORM_TEXTURE1ENV,
 
 	UNIFORM_TCGEN0,
 	UNIFORM_TCGEN0VECTOR0,
diff --git a/MP/code/rend2/tr_shade.c b/MP/code/rend2/tr_shade.c
index 07d2884..bd64b84 100644
--- a/MP/code/rend2/tr_shade.c
+++ b/MP/code/rend2/tr_shade.c
@@ -1480,15 +1480,6 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
 		{
 			R_BindAnimatedImageToTMU( &pStage->bundle[0], 0 );
 
-			//
-			// lightmap/secondary pass
-			//
-			if ( r_lightmap->integer ) {
-				GLSL_SetUniformInt(sp, UNIFORM_TEXTURE1ENV, GL_REPLACE);
-			} else {
-				GLSL_SetUniformInt(sp, UNIFORM_TEXTURE1ENV, tess.shader->multitextureEnv);
-			}
-
 			R_BindAnimatedImageToTMU( &pStage->bundle[1], 1 );
 		}
 		else 
@@ -1497,8 +1488,6 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
 			// set state
 			//
 			R_BindAnimatedImageToTMU( &pStage->bundle[0], 0 );
-
-			GLSL_SetUniformInt(sp, UNIFORM_TEXTURE1ENV, 0);
 		}
 
 		//
diff --git a/MP/code/rend2/tr_shader.c b/MP/code/rend2/tr_shader.c
index a422f28..f579a2d 100644
--- a/MP/code/rend2/tr_shader.c
+++ b/MP/code/rend2/tr_shader.c
@@ -2190,155 +2190,6 @@ static void ComputeVertexAttribs(void)
 	}
 }
 
-typedef struct {
-	int blendA;
-	int blendB;
-
-	int multitextureEnv;
-	int multitextureBlend;
-} collapse_t;
-
-static collapse_t collapse[] = {
-	{ 0, GLS_DSTBLEND_SRC_COLOR | GLS_SRCBLEND_ZERO,
-	  GL_MODULATE, 0 },
-
-	{ 0, GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR,
-	  GL_MODULATE, 0 },
-
-	{ GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR, GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR,
-	  GL_MODULATE, GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR },
-
-	{ GLS_DSTBLEND_SRC_COLOR | GLS_SRCBLEND_ZERO, GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR,
-	  GL_MODULATE, GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR },
-
-	{ GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR, GLS_DSTBLEND_SRC_COLOR | GLS_SRCBLEND_ZERO,
-	  GL_MODULATE, GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR },
-
-	{ GLS_DSTBLEND_SRC_COLOR | GLS_SRCBLEND_ZERO, GLS_DSTBLEND_SRC_COLOR | GLS_SRCBLEND_ZERO,
-	  GL_MODULATE, GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR },
-
-	{ 0, GLS_DSTBLEND_ONE | GLS_SRCBLEND_ONE,
-	  GL_ADD, 0 },
-
-	{ GLS_DSTBLEND_ONE | GLS_SRCBLEND_ONE, GLS_DSTBLEND_ONE | GLS_SRCBLEND_ONE,
-	  GL_ADD, GLS_DSTBLEND_ONE | GLS_SRCBLEND_ONE },
-#if 0
-	{ 0, GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA | GLS_SRCBLEND_SRC_ALPHA,
-	  GL_DECAL, 0 },
-#endif
-	{ -1 }
-};
-
-/*
-================
-CollapseMultitexture
-
-Attempt to combine two stages into a single multitexture stage
-FIXME: I think modulated add + modulated add collapses incorrectly
-=================
-*/
-static qboolean CollapseMultitexture( void ) {
-	int abits, bbits;
-	int i;
-	textureBundle_t tmpBundle;
-
-	if ( !qglActiveTextureARB ) {
-		return qfalse;
-	}
-
-	// make sure both stages are active
-	if ( !stages[0].active || !stages[1].active ) {
-		return qfalse;
-	}
-
-	// on voodoo2, don't combine different tmus
-	if ( glConfig.driverType == GLDRV_VOODOO ) {
-		if ( stages[0].bundle[0].image[0]->TMU ==
-			 stages[1].bundle[0].image[0]->TMU ) {
-			return qfalse;
-		}
-	}
-
-	abits = stages[0].stateBits;
-	bbits = stages[1].stateBits;
-
-	// make sure that both stages have identical state other than blend modes
-	if ( ( abits & ~( GLS_DSTBLEND_BITS | GLS_SRCBLEND_BITS | GLS_DEPTHMASK_TRUE ) ) !=
-		 ( bbits & ~( GLS_DSTBLEND_BITS | GLS_SRCBLEND_BITS | GLS_DEPTHMASK_TRUE ) ) ) {
-		return qfalse;
-	}
-
-	abits &= ( GLS_DSTBLEND_BITS | GLS_SRCBLEND_BITS );
-	bbits &= ( GLS_DSTBLEND_BITS | GLS_SRCBLEND_BITS );
-
-	// search for a valid multitexture blend function
-	for ( i = 0; collapse[i].blendA != -1 ; i++ ) {
-		if ( abits == collapse[i].blendA
-			 && bbits == collapse[i].blendB ) {
-			break;
-		}
-	}
-
-	// nothing found
-	if ( collapse[i].blendA == -1 ) {
-		return qfalse;
-	}
-
-	// GL_ADD is a separate extension
-	if ( collapse[i].multitextureEnv == GL_ADD && !glConfig.textureEnvAddAvailable ) {
-		return qfalse;
-	}
-
-	// make sure waveforms have identical parameters
-	if ( ( stages[0].rgbGen != stages[1].rgbGen ) ||
-		 ( stages[0].alphaGen != stages[1].alphaGen ) ) {
-		return qfalse;
-	}
-
-	// an add collapse can only have identity colors
-	if ( collapse[i].multitextureEnv == GL_ADD && stages[0].rgbGen != CGEN_IDENTITY ) {
-		return qfalse;
-	}
-
-	if ( stages[0].rgbGen == CGEN_WAVEFORM ) {
-		if ( memcmp( &stages[0].rgbWave,
-					 &stages[1].rgbWave,
-					 sizeof( stages[0].rgbWave ) ) ) {
-			return qfalse;
-		}
-	}
-	if ( stages[0].alphaGen == AGEN_WAVEFORM ) {
-		if ( memcmp( &stages[0].alphaWave,
-					 &stages[1].alphaWave,
-					 sizeof( stages[0].alphaWave ) ) ) {
-			return qfalse;
-		}
-	}
-
-
-	// make sure that lightmaps are in bundle 1 for 3dfx
-	if ( stages[0].bundle[0].isLightmap ) {
-		tmpBundle = stages[0].bundle[0];
-		stages[0].bundle[0] = stages[1].bundle[0];
-		stages[0].bundle[1] = tmpBundle;
-	} else
-	{
-		stages[0].bundle[1] = stages[1].bundle[0];
-	}
-
-	// set the new blend state bits
-	shader.multitextureEnv = collapse[i].multitextureEnv;
-	stages[0].stateBits &= ~( GLS_DSTBLEND_BITS | GLS_SRCBLEND_BITS );
-	stages[0].stateBits |= collapse[i].multitextureBlend;
-
-	//
-	// move down subsequent shaders
-	//
-	memmove( &stages[1], &stages[2], sizeof( stages[0] ) * ( MAX_SHADER_STAGES - 2 ) );
-	memset( &stages[MAX_SHADER_STAGES - 1], 0, sizeof( stages[0] ) );
-
-	return qtrue;
-}
 
 static void CollapseStagesToLightall(shaderStage_t *diffuse, 
 	shaderStage_t *normal, shaderStage_t *specular, shaderStage_t *lightmap, 
@@ -2669,9 +2520,6 @@ static int CollapseStagesToGLSL(void)
 		numStages++;
 	}
 
-	if (numStages == i && i >= 2 && CollapseMultitexture())
-		numStages--;
-
 	// convert any remaining lightmap stages to a lighting pass with a white texture
 	// only do this with r_sunlightMode non-zero, as it's only for correct shadows.
 	if (r_sunlightMode->integer && shader.numDeforms == 0)
@@ -3706,15 +3554,6 @@ void    R_ShaderList_f( void ) {
 		} else {
 			ri.Printf( PRINT_ALL, "  " );
 		}
-		if ( shader->multitextureEnv == GL_ADD ) {
-			ri.Printf( PRINT_ALL, "MT(a) " );
-		} else if ( shader->multitextureEnv == GL_MODULATE ) {
-			ri.Printf( PRINT_ALL, "MT(m) " );
-		} else if ( shader->multitextureEnv == GL_DECAL ) {
-			ri.Printf( PRINT_ALL, "MT(d) " );
-		} else {
-			ri.Printf( PRINT_ALL, "      " );
-		}
 		if ( shader->explicitlyDefined ) {
 			ri.Printf( PRINT_ALL, "E " );
 		} else {
diff --git a/SP/code/rend2/glsl/generic_fp.glsl b/SP/code/rend2/glsl/generic_fp.glsl
index aefa33c..50db078 100644
--- a/SP/code/rend2/glsl/generic_fp.glsl
+++ b/SP/code/rend2/glsl/generic_fp.glsl
@@ -1,45 +1,12 @@
 uniform sampler2D u_DiffuseMap;
 
-#if defined(USE_LIGHTMAP)
-uniform sampler2D u_LightMap;
-
-uniform int       u_Texture1Env;
-#endif
-
 varying vec2      var_DiffuseTex;
 
-#if defined(USE_LIGHTMAP)
-varying vec2      var_LightTex;
-#endif
-
 varying vec4      var_Color;
 
 
 void main()
 {
 	vec4 color  = texture2D(u_DiffuseMap, var_DiffuseTex);
-#if defined(USE_LIGHTMAP)
-	vec4 color2 = texture2D(u_LightMap, var_LightTex);
-  #if defined(RGBM_LIGHTMAP)
-	color2.rgb *= color2.a;
-	color2.a = 1.0;
-  #endif
-
-	if (u_Texture1Env == TEXENV_MODULATE)
-	{
-		color *= color2;
-	}
-	else if (u_Texture1Env == TEXENV_ADD)
-	{
-		color += color2;
-	}
-	else if (u_Texture1Env == TEXENV_REPLACE)
-	{
-		color = color2;
-	}
-	
-	//color = color * (u_Texture1Env.xxxx + color2 * u_Texture1Env.z) + color2 * u_Texture1Env.y;
-#endif
-
 	gl_FragColor = color * var_Color;
 }
diff --git a/SP/code/rend2/glsl/generic_vp.glsl b/SP/code/rend2/glsl/generic_vp.glsl
index 8dc86d7..e04b201 100644
--- a/SP/code/rend2/glsl/generic_vp.glsl
+++ b/SP/code/rend2/glsl/generic_vp.glsl
@@ -9,7 +9,7 @@ attribute vec3 attr_Normal2;
 attribute vec4 attr_Color;
 attribute vec4 attr_TexCoord0;
 
-#if defined(USE_LIGHTMAP) || defined(USE_TCGEN)
+#if defined(USE_TCGEN)
 attribute vec4 attr_TexCoord1;
 #endif
 
@@ -57,9 +57,6 @@ uniform float  u_VertexLerp;
 #endif
 
 varying vec2   var_DiffuseTex;
-#if defined(USE_LIGHTMAP)
-varying vec2   var_LightTex;
-#endif
 varying vec4   var_Color;
 
 #if defined(USE_DEFORM_VERTEXES)
@@ -236,10 +233,6 @@ void main()
     var_DiffuseTex = tex;
 #endif
 
-#if defined(USE_LIGHTMAP)
-	var_LightTex = attr_TexCoord1.st;
-#endif
-
 #if defined(USE_RGBAGEN)
 	var_Color = CalcColor(position, normal);
 #else
diff --git a/SP/code/rend2/tr_glsl.c b/SP/code/rend2/tr_glsl.c
index ef2820a..074218d 100644
--- a/SP/code/rend2/tr_glsl.c
+++ b/SP/code/rend2/tr_glsl.c
@@ -90,7 +90,6 @@ static uniformInfo_t uniformsInfo[] =
 
 	{ "u_DiffuseTexMatrix",  GLSL_VEC4 },
 	{ "u_DiffuseTexOffTurb", GLSL_VEC4 },
-	{ "u_Texture1Env",       GLSL_INT },
 
 	{ "u_TCGen0",        GLSL_INT },
 	{ "u_TCGen0Vector0", GLSL_VEC3 },
@@ -919,18 +918,12 @@ void GLSL_InitGPUShaders(void)
 		if (i & GENERICDEF_USE_RGBAGEN)
 			Q_strcat(extradefines, 1024, "#define USE_RGBAGEN\n");
 
-		if (i & GENERICDEF_USE_LIGHTMAP)
-			Q_strcat(extradefines, 1024, "#define USE_LIGHTMAP\n");
-
 		if (i & GENERICDEF_USE_WOLF_FOG_LINEAR)
 			Q_strcat(extradefines, 1024, "#define USE_WOLF_FOG_LINEAR\n");
 		
 		if (i & GENERICDEF_USE_WOLF_FOG_EXPONENTIAL)
 			Q_strcat(extradefines, 1024, "#define USE_WOLF_FOG_EXPONENTIAL\n");
 
-		if (r_hdr->integer && !glRefConfig.floatLightmap)
-			Q_strcat(extradefines, 1024, "#define RGBM_LIGHTMAP\n");
-
 		if (!GLSL_InitGPUShader(&tr.genericShader[i], "generic", attribs, qtrue, extradefines, qtrue, fallbackShader_generic_vp, fallbackShader_generic_fp))
 		{
 			ri.Error(ERR_FATAL, "Could not load generic shader!");
@@ -1518,11 +1511,6 @@ shaderProgram_t *GLSL_GetGenericShaderProgram(int stage, glfog_t *glFog)
 			shaderAttribs |= GENERICDEF_USE_WOLF_FOG_EXPONENTIAL;
 	}
 
-	if (pStage->bundle[1].image[0] && tess.shader->multitextureEnv)
-	{
-		shaderAttribs |= GENERICDEF_USE_LIGHTMAP;
-	}
-
 	switch (pStage->rgbGen)
 	{
 		case CGEN_LIGHTING_DIFFUSE:
diff --git a/SP/code/rend2/tr_local.h b/SP/code/rend2/tr_local.h
index 567e40a..6c6e2ab 100644
--- a/SP/code/rend2/tr_local.h
+++ b/SP/code/rend2/tr_local.h
@@ -507,8 +507,6 @@ typedef struct shader_s {
 	float portalRange;                  // distance to fog out at
 	qboolean	isPortal;
 
-	int multitextureEnv;                // 0, GL_MODULATE, GL_ADD (FIXME: put in stage)
-
 	cullType_t cullType;                // CT_FRONT_SIDED, CT_BACK_SIDED, or CT_TWO_SIDED
 	qboolean polygonOffset;             // set for decals and other items that must be offset
 	qboolean noMipMaps;                 // for console fonts, 2D elements, etc.
@@ -652,11 +650,10 @@ enum
 	GENERICDEF_USE_VERTEX_ANIMATION = 0x0004,
 	GENERICDEF_USE_FOG              = 0x0008,
 	GENERICDEF_USE_RGBAGEN          = 0x0010,
-	GENERICDEF_USE_LIGHTMAP         = 0x0020,
-	GENERICDEF_USE_WOLF_FOG_LINEAR      = 0x0040,
-	GENERICDEF_USE_WOLF_FOG_EXPONENTIAL = 0x0080,
-	GENERICDEF_ALL                  = 0x00FF,
-	GENERICDEF_COUNT                = 0x0100,
+	GENERICDEF_USE_WOLF_FOG_LINEAR      = 0x0020,
+	GENERICDEF_USE_WOLF_FOG_EXPONENTIAL = 0x0040,
+	GENERICDEF_ALL                  = 0x007F,
+	GENERICDEF_COUNT                = 0x0080,
 };
 
 enum
@@ -730,7 +727,6 @@ typedef enum
 
 	UNIFORM_DIFFUSETEXMATRIX,
 	UNIFORM_DIFFUSETEXOFFTURB,
-	UNIFORM_TEXTURE1ENV,
 
 	UNIFORM_TCGEN0,
 	UNIFORM_TCGEN0VECTOR0,
diff --git a/SP/code/rend2/tr_shade.c b/SP/code/rend2/tr_shade.c
index bb0f78b..cd4cafb 100644
--- a/SP/code/rend2/tr_shade.c
+++ b/SP/code/rend2/tr_shade.c
@@ -1475,15 +1475,6 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
 		{
 			R_BindAnimatedImageToTMU( &pStage->bundle[0], 0 );
 
-			//
-			// lightmap/secondary pass
-			//
-			if ( r_lightmap->integer ) {
-				GLSL_SetUniformInt(sp, UNIFORM_TEXTURE1ENV, GL_REPLACE);
-			} else {
-				GLSL_SetUniformInt(sp, UNIFORM_TEXTURE1ENV, tess.shader->multitextureEnv);
-			}
-
 			R_BindAnimatedImageToTMU( &pStage->bundle[1], 1 );
 		}
 		else 
@@ -1492,8 +1483,6 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
 			// set state
 			//
 			R_BindAnimatedImageToTMU( &pStage->bundle[0], 0 );
-
-			GLSL_SetUniformInt(sp, UNIFORM_TEXTURE1ENV, 0);
 		}
 
 		//
diff --git a/SP/code/rend2/tr_shader.c b/SP/code/rend2/tr_shader.c
index 4520f4e..1d73743 100644
--- a/SP/code/rend2/tr_shader.c
+++ b/SP/code/rend2/tr_shader.c
@@ -2211,155 +2211,6 @@ static void ComputeVertexAttribs(void)
 	}
 }
 
-typedef struct {
-	int blendA;
-	int blendB;
-
-	int multitextureEnv;
-	int multitextureBlend;
-} collapse_t;
-
-static collapse_t collapse[] = {
-	{ 0, GLS_DSTBLEND_SRC_COLOR | GLS_SRCBLEND_ZERO,
-	  GL_MODULATE, 0 },
-
-	{ 0, GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR,
-	  GL_MODULATE, 0 },
-
-	{ GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR, GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR,
-	  GL_MODULATE, GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR },
-
-	{ GLS_DSTBLEND_SRC_COLOR | GLS_SRCBLEND_ZERO, GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR,
-	  GL_MODULATE, GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR },
-
-	{ GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR, GLS_DSTBLEND_SRC_COLOR | GLS_SRCBLEND_ZERO,
-	  GL_MODULATE, GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR },
-
-	{ GLS_DSTBLEND_SRC_COLOR | GLS_SRCBLEND_ZERO, GLS_DSTBLEND_SRC_COLOR | GLS_SRCBLEND_ZERO,
-	  GL_MODULATE, GLS_DSTBLEND_ZERO | GLS_SRCBLEND_DST_COLOR },
-
-	{ 0, GLS_DSTBLEND_ONE | GLS_SRCBLEND_ONE,
-	  GL_ADD, 0 },
-
-	{ GLS_DSTBLEND_ONE | GLS_SRCBLEND_ONE, GLS_DSTBLEND_ONE | GLS_SRCBLEND_ONE,
-	  GL_ADD, GLS_DSTBLEND_ONE | GLS_SRCBLEND_ONE },
-#if 0
-	{ 0, GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA | GLS_SRCBLEND_SRC_ALPHA,
-	  GL_DECAL, 0 },
-#endif
-	{ -1 }
-};
-
-/*
-================
-CollapseMultitexture
-
-Attempt to combine two stages into a single multitexture stage
-FIXME: I think modulated add + modulated add collapses incorrectly
-=================
-*/
-static qboolean CollapseMultitexture( void ) {
-	int abits, bbits;
-	int i;
-	textureBundle_t tmpBundle;
-
-	if ( !qglActiveTextureARB ) {
-		return qfalse;
-	}
-
-	// make sure both stages are active
-	if ( !stages[0].active || !stages[1].active ) {
-		return qfalse;
-	}
-
-	// on voodoo2, don't combine different tmus
-	if ( glConfig.driverType == GLDRV_VOODOO ) {
-		if ( stages[0].bundle[0].image[0]->TMU ==
-			 stages[1].bundle[0].image[0]->TMU ) {
-			return qfalse;
-		}
-	}
-
-	abits = stages[0].stateBits;
-	bbits = stages[1].stateBits;
-
-	// make sure that both stages have identical state other than blend modes
-	if ( ( abits & ~( GLS_DSTBLEND_BITS | GLS_SRCBLEND_BITS | GLS_DEPTHMASK_TRUE ) ) !=
-		 ( bbits & ~( GLS_DSTBLEND_BITS | GLS_SRCBLEND_BITS | GLS_DEPTHMASK_TRUE ) ) ) {
-		return qfalse;
-	}
-
-	abits &= ( GLS_DSTBLEND_BITS | GLS_SRCBLEND_BITS );
-	bbits &= ( GLS_DSTBLEND_BITS | GLS_SRCBLEND_BITS );
-
-	// search for a valid multitexture blend function
-	for ( i = 0; collapse[i].blendA != -1 ; i++ ) {
-		if ( abits == collapse[i].blendA
-			 && bbits == collapse[i].blendB ) {
-			break;
-		}
-	}
-
-	// nothing found
-	if ( collapse[i].blendA == -1 ) {
-		return qfalse;
-	}
-
-	// GL_ADD is a separate extension
-	if ( collapse[i].multitextureEnv == GL_ADD && !glConfig.textureEnvAddAvailable ) {
-		return qfalse;
-	}
-
-	// make sure waveforms have identical parameters
-	if ( ( stages[0].rgbGen != stages[1].rgbGen ) ||
-		 ( stages[0].alphaGen != stages[1].alphaGen ) ) {
-		return qfalse;
-	}
-
-	// an add collapse can only have identity colors
-	if ( collapse[i].multitextureEnv == GL_ADD && stages[0].rgbGen != CGEN_IDENTITY ) {
-		return qfalse;
-	}
-
-	if ( stages[0].rgbGen == CGEN_WAVEFORM ) {
-		if ( memcmp( &stages[0].rgbWave,
-					 &stages[1].rgbWave,
-					 sizeof( stages[0].rgbWave ) ) ) {
-			return qfalse;
-		}
-	}
-	if ( stages[0].alphaGen == AGEN_WAVEFORM ) {
-		if ( memcmp( &stages[0].alphaWave,
-					 &stages[1].alphaWave,
-					 sizeof( stages[0].alphaWave ) ) ) {
-			return qfalse;
-		}
-	}
-
-
-	// make sure that lightmaps are in bundle 1 for 3dfx
-	if ( stages[0].bundle[0].isLightmap ) {
-		tmpBundle = stages[0].bundle[0];
-		stages[0].bundle[0] = stages[1].bundle[0];
-		stages[0].bundle[1] = tmpBundle;
-	} else
-	{
-		stages[0].bundle[1] = stages[1].bundle[0];
-	}
-
-	// set the new blend state bits
-	shader.multitextureEnv = collapse[i].multitextureEnv;
-	stages[0].stateBits &= ~( GLS_DSTBLEND_BITS | GLS_SRCBLEND_BITS );
-	stages[0].stateBits |= collapse[i].multitextureBlend;
-
-	//
-	// move down subsequent shaders
-	//
-	memmove( &stages[1], &stages[2], sizeof( stages[0] ) * ( MAX_SHADER_STAGES - 2 ) );
-	memset( &stages[MAX_SHADER_STAGES - 1], 0, sizeof( stages[0] ) );
-
-	return qtrue;
-}
 
 static void CollapseStagesToLightall(shaderStage_t *diffuse, 
 	shaderStage_t *normal, shaderStage_t *specular, shaderStage_t *lightmap, 
@@ -2690,9 +2541,6 @@ static int CollapseStagesToGLSL(void)
 		numStages++;
 	}
 
-	if (numStages == i && i >= 2 && CollapseMultitexture())
-		numStages--;
-
 	// convert any remaining lightmap stages to a lighting pass with a white texture
 	// only do this with r_sunlightMode non-zero, as it's only for correct shadows.
 	if (r_sunlightMode->integer && shader.numDeforms == 0)
@@ -3757,15 +3605,6 @@ void    R_ShaderList_f( void ) {
 		} else {
 			ri.Printf( PRINT_ALL, "  " );
 		}
-		if ( shader->multitextureEnv == GL_ADD ) {
-			ri.Printf( PRINT_ALL, "MT(a) " );
-		} else if ( shader->multitextureEnv == GL_MODULATE ) {
-			ri.Printf( PRINT_ALL, "MT(m) " );
-		} else if ( shader->multitextureEnv == GL_DECAL ) {
-			ri.Printf( PRINT_ALL, "MT(d) " );
-		} else {
-			ri.Printf( PRINT_ALL, "      " );
-		}
 		if ( shader->explicitlyDefined ) {
 			ri.Printf( PRINT_ALL, "E " );
 		} else {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git



More information about the Pkg-games-commits mailing list