[iortcw] 48/497: All: Rend2: Fix rendering when r_hdr = 0 and r_floatLightmap = 1

Simon McVittie smcv at debian.org
Fri Sep 8 10:36:15 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 bffea3ef4c85bf252d856fc8c86fe25df65c524c
Author: M4N4T4RMS at gmail.com <M4N4T4RMS at gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a>
Date:   Sat Feb 15 10:44:07 2014 +0000

    All: Rend2: Fix rendering when r_hdr = 0 and r_floatLightmap = 1
---
 MP/code/rend2/tr_bsp.c        | 15 ++++++---------
 MP/code/rend2/tr_extensions.c |  3 +++
 MP/code/rend2/tr_glsl.c       |  4 ++--
 MP/code/rend2/tr_local.h      |  2 ++
 SP/code/rend2/tr_bsp.c        | 15 ++++++---------
 SP/code/rend2/tr_extensions.c |  3 +++
 SP/code/rend2/tr_glsl.c       |  4 ++--
 SP/code/rend2/tr_local.h      |  2 ++
 8 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/MP/code/rend2/tr_bsp.c b/MP/code/rend2/tr_bsp.c
index 0d5dad8..fb17c08 100644
--- a/MP/code/rend2/tr_bsp.c
+++ b/MP/code/rend2/tr_bsp.c
@@ -292,13 +292,10 @@ static	void R_LoadLightmaps( lump_t *l, lump_t *surfs ) {
 		tr.deluxemaps = ri.Hunk_Alloc( tr.numLightmaps * sizeof(image_t *), h_low );
 	}
 
-	if (r_hdr->integer)
-	{
-		if (glRefConfig.textureFloat && glRefConfig.halfFloatPixel && r_floatLightmap->integer)
-			textureInternalFormat = GL_RGBA16F_ARB;
-		else
-			textureInternalFormat = GL_RGBA8;
-	}
+	if (glRefConfig.floatLightmap)
+		textureInternalFormat = GL_RGBA16F_ARB;
+	else
+		textureInternalFormat = GL_RGBA8;
 
 	if (r_mergeLightmaps->integer)
 	{
@@ -410,12 +407,12 @@ static	void R_LoadLightmaps( lump_t *l, lump_t *surfs ) {
 
 					R_ColorShiftLightingFloats(color, color, 1.0f/255.0f);
 
-					if (glRefConfig.textureFloat && glRefConfig.halfFloatPixel && r_floatLightmap->integer)
+					if (glRefConfig.floatLightmap)
 						ColorToRGBA16F(color, (unsigned short *)(&image[j*8]));
 					else
 						ColorToRGBM(color, &image[j*4]);
 				}
-				else if (glRefConfig.textureFloat && glRefConfig.halfFloatPixel && r_floatLightmap->integer) 
+				else if (glRefConfig.floatLightmap)
 				{
 					vec4_t color;
 
diff --git a/MP/code/rend2/tr_extensions.c b/MP/code/rend2/tr_extensions.c
index d7e5f1b..3d65369 100644
--- a/MP/code/rend2/tr_extensions.c
+++ b/MP/code/rend2/tr_extensions.c
@@ -725,4 +725,7 @@ void GLimp_InitExtraExtensions()
 	{
 		ri.Printf(PRINT_ALL, result[2], extension);
 	}
+
+	// use float lightmaps?
+	glRefConfig.floatLightmap = (glRefConfig.textureFloat && glRefConfig.halfFloatPixel && r_floatLightmap->integer && r_hdr->integer);
 }
diff --git a/MP/code/rend2/tr_glsl.c b/MP/code/rend2/tr_glsl.c
index db55c15..3dc95b5 100644
--- a/MP/code/rend2/tr_glsl.c
+++ b/MP/code/rend2/tr_glsl.c
@@ -903,7 +903,7 @@ void GLSL_InitGPUShaders(void)
 		if (i & GENERICDEF_USE_LIGHTMAP)
 			Q_strcat(extradefines, 1024, "#define USE_LIGHTMAP\n");
 
-		if (r_hdr->integer && !(glRefConfig.textureFloat && glRefConfig.halfFloatPixel && r_floatLightmap->integer))
+		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))
@@ -1028,7 +1028,7 @@ void GLSL_InitGPUShaders(void)
 		if (1)
 			Q_strcat(extradefines, 1024, "#define SWIZZLE_NORMALMAP\n");
 
-		if (r_hdr->integer && !(glRefConfig.textureFloat && glRefConfig.halfFloatPixel && r_floatLightmap->integer))
+		if (r_hdr->integer && !glRefConfig.floatLightmap)
 			Q_strcat(extradefines, 1024, "#define RGBM_LIGHTMAP\n");
 
 		if (lightType)
diff --git a/MP/code/rend2/tr_local.h b/MP/code/rend2/tr_local.h
index 119b8fa..f1b87ce 100644
--- a/MP/code/rend2/tr_local.h
+++ b/MP/code/rend2/tr_local.h
@@ -1551,6 +1551,8 @@ typedef struct {
 	qboolean seamlessCubeMap;
 
 	GLenum packedNormalDataType;
+
+	qboolean floatLightmap;
 } glRefConfig_t;
 
 typedef struct {
diff --git a/SP/code/rend2/tr_bsp.c b/SP/code/rend2/tr_bsp.c
index e85c0e3..c1c0d6d 100644
--- a/SP/code/rend2/tr_bsp.c
+++ b/SP/code/rend2/tr_bsp.c
@@ -291,13 +291,10 @@ static	void R_LoadLightmaps( lump_t *l, lump_t *surfs ) {
 		tr.deluxemaps = ri.Hunk_Alloc( tr.numLightmaps * sizeof(image_t *), h_low );
 	}
 
-	if (r_hdr->integer)
-	{
-		if (glRefConfig.textureFloat && glRefConfig.halfFloatPixel && r_floatLightmap->integer)
-			textureInternalFormat = GL_RGBA16F_ARB;
-		else
-			textureInternalFormat = GL_RGBA8;
-	}
+	if (glRefConfig.floatLightmap)
+		textureInternalFormat = GL_RGBA16F_ARB;
+	else
+		textureInternalFormat = GL_RGBA8;
 
 	if (r_mergeLightmaps->integer)
 	{
@@ -408,12 +405,12 @@ static	void R_LoadLightmaps( lump_t *l, lump_t *surfs ) {
 
 					R_ColorShiftLightingFloats(color, color, 1.0f/255.0f);
 
-					if (glRefConfig.textureFloat && glRefConfig.halfFloatPixel && r_floatLightmap->integer)
+					if (glRefConfig.floatLightmap)
 						ColorToRGBA16F(color, (unsigned short *)(&image[j*8]));
 					else
 						ColorToRGBM(color, &image[j*4]);
 				}
-				else if (glRefConfig.textureFloat && glRefConfig.halfFloatPixel && r_floatLightmap->integer) 
+				else if (glRefConfig.floatLightmap)
 				{
 					vec4_t color;
 
diff --git a/SP/code/rend2/tr_extensions.c b/SP/code/rend2/tr_extensions.c
index d7e5f1b..3d65369 100644
--- a/SP/code/rend2/tr_extensions.c
+++ b/SP/code/rend2/tr_extensions.c
@@ -725,4 +725,7 @@ void GLimp_InitExtraExtensions()
 	{
 		ri.Printf(PRINT_ALL, result[2], extension);
 	}
+
+	// use float lightmaps?
+	glRefConfig.floatLightmap = (glRefConfig.textureFloat && glRefConfig.halfFloatPixel && r_floatLightmap->integer && r_hdr->integer);
 }
diff --git a/SP/code/rend2/tr_glsl.c b/SP/code/rend2/tr_glsl.c
index db55c15..3dc95b5 100644
--- a/SP/code/rend2/tr_glsl.c
+++ b/SP/code/rend2/tr_glsl.c
@@ -903,7 +903,7 @@ void GLSL_InitGPUShaders(void)
 		if (i & GENERICDEF_USE_LIGHTMAP)
 			Q_strcat(extradefines, 1024, "#define USE_LIGHTMAP\n");
 
-		if (r_hdr->integer && !(glRefConfig.textureFloat && glRefConfig.halfFloatPixel && r_floatLightmap->integer))
+		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))
@@ -1028,7 +1028,7 @@ void GLSL_InitGPUShaders(void)
 		if (1)
 			Q_strcat(extradefines, 1024, "#define SWIZZLE_NORMALMAP\n");
 
-		if (r_hdr->integer && !(glRefConfig.textureFloat && glRefConfig.halfFloatPixel && r_floatLightmap->integer))
+		if (r_hdr->integer && !glRefConfig.floatLightmap)
 			Q_strcat(extradefines, 1024, "#define RGBM_LIGHTMAP\n");
 
 		if (lightType)
diff --git a/SP/code/rend2/tr_local.h b/SP/code/rend2/tr_local.h
index 943c2ff..f378f00 100644
--- a/SP/code/rend2/tr_local.h
+++ b/SP/code/rend2/tr_local.h
@@ -1564,6 +1564,8 @@ typedef struct {
 	qboolean seamlessCubeMap;
 
 	GLenum packedNormalDataType;
+
+	qboolean floatLightmap;
 } glRefConfig_t;
 
 typedef struct {

-- 
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