[spring] - GCC 4.6 compile fixes.

Gilboa Davara gilboa at fedoraproject.org
Sat Apr 2 11:03:16 UTC 2011


commit 0b499d71c3abd931269f6c2467d7fe4db9724ef9
Author: Gilboa Davara <gilboa at gilboa-home-dev.localdomain>
Date:   Sat Apr 2 14:02:19 2011 +0300

    - GCC 4.6 compile fixes.

 spring-AI-compile-fix.patch                  |   10 --
 spring-gcc46-include-fix.patch               |   31 ++++
 spring-gcc46-tempfloat-compile-fix.patch     |   33 ++++
 spring-gcc46-tempfloat-compile-fix.patch.old |  218 ++++++++++++++++++++++++++
 spring-glcontext-compile-fix.patch           |   11 --
 spring-lua-compile-fix.patch                 |   29 ----
 spring.spec                                  |   16 +--
 7 files changed, 288 insertions(+), 60 deletions(-)
---
diff --git a/spring-gcc46-include-fix.patch b/spring-gcc46-include-fix.patch
new file mode 100644
index 0000000..1e0d61e
--- /dev/null
+++ b/spring-gcc46-include-fix.patch
@@ -0,0 +1,31 @@
+--- AI/Skirmish/E323AI/AAStar.h.old	2011-03-10 05:31:35.558283029 +0200
++++ AI/Skirmish/E323AI/AAStar.h	2011-03-10 05:31:42.333474485 +0200
+@@ -1,6 +1,6 @@
+ #ifndef E323ASTAR_H
+ #define E323ASTAR_H
+-
++#include <cstdio>
+ #include <queue>
+ #include <vector>
+ #include <list>
+--- rts/Rendering/GLContext.cpp.old	2011-03-16 15:36:46.001675256 +0200
++++ rts/Rendering/GLContext.cpp	2011-03-16 15:36:56.443566867 +0200
+@@ -7,7 +7,7 @@
+ #endif
+ 
+ #include "GLContext.h"
+-
++#include <cstdio>
+ #include <list>
+ 
+ 
+--- ./rts/System/MemPool.h.old	2011-03-28 17:27:09.515598615 +0200
++++ ./rts/System/MemPool.h	2011-03-28 17:33:48.916600171 +0200
+@@ -3,6 +3,7 @@
+ #ifndef _MEM_POOL_H_
+ #define _MEM_POOL_H_
+ 
++#include <cstdio>
+ #include <new>
+ 
+ const size_t MAX_MEM_SIZE=200;
diff --git a/spring-gcc46-tempfloat-compile-fix.patch b/spring-gcc46-tempfloat-compile-fix.patch
new file mode 100644
index 0000000..7c73699
--- /dev/null
+++ b/spring-gcc46-tempfloat-compile-fix.patch
@@ -0,0 +1,33 @@
+--- rts/Rendering/ShadowHandler.h.old	2011-04-02 09:52:18.741050648 +0300
++++ rts/Rendering/ShadowHandler.h	2011-04-02 09:53:35.750051447 +0300
+@@ -38,7 +38,7 @@
+ 	CMatrix44f shadowMatrix;
+ 	void CalcMinMaxView(void);
+ 
+-	const float4 GetShadowParams() const { return float4(xmid, ymid, p17, p18); }
++	const float4& GetShadowParams() const { return shadowParams; }
+ 
+ 	enum ShadowGenProgram {
+ 		SHADOWGEN_PROGRAM_MODEL      = 0,
+@@ -76,6 +76,7 @@
+ 	//! to write the (FBO) depth-buffer texture
+ 	std::vector<Shader::IProgramObject*> shadowGenProgs;
+ 
++	float4 shadowParams;
+ 	float x1, x2, y1, y2;
+ 	float xmid, ymid;
+ 	float p17, p18;
+--- rts/Rendering/ShadowHandler.cpp.old	2011-04-02 09:52:29.604050155 +0300
++++ rts/Rendering/ShadowHandler.cpp	2011-04-02 09:54:15.477051021 +0300
+@@ -318,6 +318,11 @@
+ 	xmid = 1.0f - (sqrt(fabs(x2)) / (sqrt(fabs(x2)) + sqrt(fabs(x1))));
+ 	ymid = 1.0f - (sqrt(fabs(y2)) / (sqrt(fabs(y2)) + sqrt(fabs(y1))));
+ 
++	shadowParams.x = xmid;
++	shadowParams.y = ymid;
++	shadowParams.z = p17;
++	shadowParams.w = p18;
++
+ 	shadowMatrix[ 0] =   cross1.x / maxLengthX;
+ 	shadowMatrix[ 4] =   cross1.y / maxLengthX;
+ 	shadowMatrix[ 8] =   cross1.z / maxLengthX;
diff --git a/spring-gcc46-tempfloat-compile-fix.patch.old b/spring-gcc46-tempfloat-compile-fix.patch.old
new file mode 100644
index 0000000..c49d7c4
--- /dev/null
+++ b/spring-gcc46-tempfloat-compile-fix.patch.old
@@ -0,0 +1,218 @@
+--- rts/Map/SMF/BFGroundDrawer.cpp.old	2011-03-28 12:51:56.331599362 +0200
++++ rts/Map/SMF/BFGroundDrawer.cpp	2011-03-28 12:54:43.209600038 +0200
+@@ -1342,7 +1342,28 @@
+ 			smfShaderGLSL->Enable();
+ 			smfShaderGLSL->SetUniform3fv(10, &camera->pos[0]);
+ 			smfShaderGLSL->SetUniformMatrix4fv(12, false, &shadowHandler->shadowMatrix.m[0]);
+-			smfShaderGLSL->SetUniform4fv(13, const_cast<float*>(&(shadowHandler->GetShadowParams().x)));
++
++			{
++				/* 
++				 * GCC 4.6 barfs on having a temporary copy of float4
++				 *   passed as pointer to glUniform4fv.
++				 * Pending a cleaner solution that will include
++				 *   changes to shadowHandler and float4,
++				 *   the only thing remaining is to manually copy
++				 *   the members to temporary stack array and pass
++				 *   it down to glUniform4fv.
++				 */
++				float4 shadowFloat4 =
++						shadowHandler->GetShadowParams();
++				float shadowFloatArr[4];
++	
++				shadowFloatArr[0] = shadowFloat4.x;
++				shadowFloatArr[1] = shadowFloat4.y;
++				shadowFloatArr[2] = shadowFloat4.z;
++				shadowFloatArr[3] = shadowFloat4.w;
++
++				smfShaderGLSL->SetUniform4fv(13, shadowFloatArr);
++			}
+ 
+ 			glActiveTexture(GL_TEXTURE5); glBindTexture(GL_TEXTURE_2D, map->GetNormalsTexture());
+ 			glActiveTexture(GL_TEXTURE6); glBindTexture(GL_TEXTURE_2D, map->GetSpecularTexture());
+--- rts/Rendering/Env/GrassDrawer.cpp.old	2011-03-28 14:29:32.521597516 +0200
++++ rts/Rendering/Env/GrassDrawer.cpp	2011-03-28 14:33:18.881600104 +0200
+@@ -485,7 +485,29 @@
+ 
+ 		if (globalRendering->haveGLSL) {
+ 			grassShader->SetUniformMatrix4fv(6, false, &shadowHandler->shadowMatrix.m[0]);
+-			grassShader->SetUniform4fv(7, const_cast<float*>(&(shadowHandler->GetShadowParams().x)));
++
++			{
++				/* 
++				 * GCC 4.6 barfs on having a temporary copy of float4
++				 *   passed as pointer to glUniform4fv.
++				 * Pending a cleaner solution that will include
++				 *   changes to shadowHandler and float4,
++				 *   the only thing remaining is to manually copy
++				 *   the members to temporary stack array and pass
++				 *   it down to glUniform4fv.
++				 */
++				float4 shadowFloat4 =
++						shadowHandler->GetShadowParams();
++				float shadowFloatArr[4];
++
++				shadowFloatArr[0] = shadowFloat4.x;
++				shadowFloatArr[1] = shadowFloat4.y;
++				shadowFloatArr[2] = shadowFloat4.z;
++				shadowFloatArr[3] = shadowFloat4.w;
++
++				grassShader->SetUniform4fv(7, shadowFloatArr);
++			}
++
+ 			grassShader->SetUniform1f(8, gs->frameNum);
+ 			grassShader->SetUniform3fv(9, const_cast<float*>(&(windSpeed.x)));
+ 		} else {
+@@ -585,7 +607,29 @@
+ 
+ 		if (globalRendering->haveGLSL) {
+ 			grassShader->SetUniformMatrix4fv(6, false, &shadowHandler->shadowMatrix.m[0]);
+-			grassShader->SetUniform4fv(7, const_cast<float*>(&(shadowHandler->GetShadowParams().x)));
++
++			{
++				/* 
++				 * GCC 4.6 barfs on having a temporary copy of float4
++				 *   passed as pointer to glUniform4fv.
++				 * Pending a cleaner solution that will include
++				 *   changes to shadowHandler and float4,
++				 *   the only thing remaining is to manually copy
++				 *   the members to temporary stack array and pass
++				 *   it down to glUniform4fv.
++				 */
++				float4 shadowFloat4 =
++						shadowHandler->GetShadowParams();
++				float shadowFloatArr[4];
++
++				shadowFloatArr[0] = shadowFloat4.x;
++				shadowFloatArr[1] = shadowFloat4.y;
++				shadowFloatArr[2] = shadowFloat4.z;
++				shadowFloatArr[3] = shadowFloat4.w;
++
++				grassShader->SetUniform4fv(7, shadowFloatArr);
++			}
++
+ 			grassShader->SetUniform1f(8, gs->frameNum);
+ 			grassShader->SetUniform3fv(9, const_cast<float*>(&(windSpeed.x)));
+ 		}
+--- rts/Rendering/Env/AdvTreeDrawer.cpp.old	2011-03-28 14:29:47.511601193 +0200
++++ rts/Rendering/Env/AdvTreeDrawer.cpp	2011-03-28 14:35:20.958600022 +0200
+@@ -458,7 +458,27 @@
+ 
+ 		if (globalRendering->haveGLSL) {
+ 			treeShader->SetUniformMatrix4fv(7, false, &shadowHandler->shadowMatrix.m[0]);
+-			treeShader->SetUniform4fv(8, const_cast<float*>(&(shadowHandler->GetShadowParams().x)));
++			{
++				/* 
++				 * GCC 4.6 barfs on having a temporary copy of float4
++				 *   passed as pointer to glUniform4fv.
++				 * Pending a cleaner solution that will include
++				 *   changes to shadowHandler and float4,
++				 *   the only thing remaining is to manually copy
++				 *   the members to temporary stack array and pass
++				 *   it down to glUniform4fv.
++				 */
++				float4 shadowFloat4 =
++						shadowHandler->GetShadowParams();
++				float shadowFloatArr[4];
++
++				shadowFloatArr[0] = shadowFloat4.x;
++				shadowFloatArr[1] = shadowFloat4.y;
++				shadowFloatArr[2] = shadowFloat4.z;
++				shadowFloatArr[3] = shadowFloat4.w;
++
++				treeShader->SetUniform4fv(8, shadowFloatArr);
++			}
+ 		} else {
+ 			treeShader->SetUniformTarget(GL_FRAGMENT_PROGRAM_ARB);
+ 			treeShader->SetUniform4f(10, L.groundAmbientColor.x, L.groundAmbientColor.y, L.groundAmbientColor.z, 1.0f);
+@@ -501,7 +521,28 @@
+ 
+ 			if (globalRendering->haveGLSL) {
+ 				treeShader->SetUniformMatrix4fv(7, false, &shadowHandler->shadowMatrix.m[0]);
+-				treeShader->SetUniform4fv(8, const_cast<float*>(&(shadowHandler->GetShadowParams().x)));
++
++				{
++					/* 
++					 * GCC 4.6 barfs on having a temporary copy of float4
++					 *   passed as pointer to glUniform4fv.
++					 * Pending a cleaner solution that will include
++					 *   changes to shadowHandler and float4,
++					 *   the only thing remaining is to manually copy
++					 *   the members to temporary stack array and pass
++					 *   it down to glUniform4fv.
++					 */
++					float4 shadowFloat4 =
++							shadowHandler->GetShadowParams();
++					float shadowFloatArr[4];
++
++					shadowFloatArr[0] = shadowFloat4.x;
++					shadowFloatArr[1] = shadowFloat4.y;
++					shadowFloatArr[2] = shadowFloat4.z;
++					shadowFloatArr[3] = shadowFloat4.w;
++
++					treeShader->SetUniform4fv(8, shadowFloatArr);
++				}
+ 			}
+ 
+ 			glActiveTexture(GL_TEXTURE1);
+--- rts/Lua/LuaMaterial.cpp.old	2011-03-16 11:34:10.123708670 +0200
++++ rts/Lua/LuaMaterial.cpp	2011-03-16 14:44:23.736824894 +0200
+@@ -379,7 +379,25 @@
+ 	}
+ 
+ 	if (shadowParamsLoc >= 0) {
+-		glUniform4fv(shadowParamsLoc, 1, const_cast<float*>(&(shadowHandler->GetShadowParams().x)));
++		/* 
++		 * GCC 4.6 barfs on having a temporary copy of float4
++		 *   passed as pointer to glUniform4fv.
++		 * Pending a cleaner solution that will include
++		 *   changes to shadowHandler and float4,
++		 *   the only thing remaining is to manually copy
++		 *   the members to temporary stack array and pass
++		 *   it down to glUniform4fv.
++		 */
++		float4 shadowFloat4 =
++				shadowHandler->GetShadowParams();
++		float shadowFloatArr[4];
++
++		shadowFloatArr[0] = shadowFloat4.x;
++		shadowFloatArr[1] = shadowFloat4.y;
++		shadowFloatArr[2] = shadowFloat4.z;
++		shadowFloatArr[3] = shadowFloat4.w;
++
++		glUniform4fv(shadowParamsLoc, 1, shadowFloatArr);
+ 	}
+ 
+ 	const int maxTex = std::max(texCount, prev.texCount);
+--- rts/Rendering/UnitDrawer.cpp.old	2011-03-28 14:11:57.129599851 +0200
++++ rts/Rendering/UnitDrawer.cpp	2011-03-28 14:14:01.937599970 +0200
+@@ -1195,7 +1195,28 @@
+ 			modelShaders[MODEL_SHADER_S3O_ACTIVE]->SetUniformMatrix4dv(7, false, const_cast<double*>(camera->GetViewMat()));
+ 			modelShaders[MODEL_SHADER_S3O_ACTIVE]->SetUniformMatrix4dv(8, false, const_cast<double*>(camera->GetViewMatInv()));
+ 			modelShaders[MODEL_SHADER_S3O_ACTIVE]->SetUniformMatrix4fv(13, false, &shadowHandler->shadowMatrix.m[0]);
+-			modelShaders[MODEL_SHADER_S3O_ACTIVE]->SetUniform4fv(14, const_cast<float*>(&(shadowHandler->GetShadowParams().x)));
++
++			{
++				/* 
++				 * GCC 4.6 barfs on having a temporary copy of float4
++				 *   passed as pointer to glUniform4fv.
++				 * Pending a cleaner solution that will include
++				 *   changes to shadowHandler and float4,
++				 *   the only thing remaining is to manually copy
++				 *   the members to temporary stack array and pass
++				 *   it down to glUniform4fv.
++				 */
++				float4 shadowFloat4 =
++						shadowHandler->GetShadowParams();
++				float shadowFloatArr[4];
++
++				shadowFloatArr[0] = shadowFloat4.x;
++				shadowFloatArr[1] = shadowFloat4.y;
++				shadowFloatArr[2] = shadowFloat4.z;
++				shadowFloatArr[3] = shadowFloat4.w;
++
++				modelShaders[MODEL_SHADER_S3O_ACTIVE]->SetUniform4fv(14, shadowFloatArr);
++			}
+ 		} else {
+ 			modelShaders[MODEL_SHADER_S3O_ACTIVE]->SetUniformTarget(GL_VERTEX_PROGRAM_ARB);
+ 			modelShaders[MODEL_SHADER_S3O_ACTIVE]->SetUniform4f(10, mapInfo->light.sunDir.x, mapInfo->light.sunDir.y ,mapInfo->light.sunDir.z, 0.0f);
diff --git a/spring.spec b/spring.spec
index 4fb3350..e6d56ce 100644
--- a/spring.spec
+++ b/spring.spec
@@ -15,9 +15,8 @@ License:		GPLv2+ and GPLv3+ and LGPLv2 and GFDL and (GFDL or CC-BY)
 URL:			http://springrts.com
 Source0:		http://downloads.sourceforge.net/project/springrts/springrts/spring-%{version}/spring_%{version}_src.tar.lzma
 Source1:		spring-README.Fedora
-Patch0:			spring-AI-compile-fix.patch
-Patch1:			spring-lua-compile-fix.patch
-Patch2:			spring-glcontext-compile-fix.patch
+Patch0:			spring-gcc46-include-fix.patch
+Patch1:			spring-gcc46-tempfloat-compile-fix.patch
 
 BuildRoot:		%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -56,9 +55,8 @@ great resource, read it here: http://spring.clan-sy.com/wiki/Main_Page
 %setup -q -n %{name}_%{version}
 
 # Compile patches.
-%patch0 -p0 -b .spring-AI-compile-fix
-%patch1 -p0 -b .spring-lua-compile-fix
-%patch2 -p0 -b .spring-glcontext-compile-fix
+%patch0 -p0 -b .spring-gcc46-include-compile-fix
+%patch1 -p0 -b .spring-gcc46-tempfloat-compile-fix
 
 cp -p %{SOURCE1} README.Fedora
 touch ./rts/build/cmake/FindAllegro.cmake
@@ -149,11 +147,9 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
-* Thu Mar 10 2011 Gilboa Davara <gilboad [AT] gmail [DOT] com> - 0.82.7.1-3
+* Thu Mar 31 2011 Gilboa Davara <gilboad [AT] gmail [DOT] com> - 0.82.7.1-3
 - Boost fix (F15/rawhide).
-- AI compile fix (GCC 4.6).
-- Lua compile fix (GCC 4.6).
-- GLContext compile fix (GCC 4.6).
+- GCC 4.6 (F15) compilation fixes.
 
 * Wed Feb 09 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.82.7.1-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild


More information about the scm-commits mailing list