rpms/ClanLib/FC-6 ClanLib-0.8.0-tex-format.patch, NONE, 1.1 ClanLib.spec, 1.8, 1.9

Hans de Goede (jwrdegoede) fedora-extras-commits at redhat.com
Sat Mar 31 20:49:46 UTC 2007


Author: jwrdegoede

Update of /cvs/extras/rpms/ClanLib/FC-6
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv1654

Modified Files:
	ClanLib.spec 
Added Files:
	ClanLib-0.8.0-tex-format.patch 
Log Message:
* Sat Mar 31 2007 Hans de Goede <j.w.r.degoede at hhs.nl> 0.8.0-4
- Fix some stupidness in the OpenGL surface code, which triggers an obscure 
  bug in mesa-6.5.2, as a bonus the OpenGL surface's should be somewhat faster
  now. Details: https://bugs.freedesktop.org/show_bug.cgi?id=10491


ClanLib-0.8.0-tex-format.patch:

--- NEW FILE ClanLib-0.8.0-tex-format.patch ---
diff -ur ClanLib-0.8.0/Sources/GL/surface_target_opengl.cpp ClanLib-0.8.0.new/Sources/GL/surface_target_opengl.cpp
--- ClanLib-0.8.0/Sources/GL/surface_target_opengl.cpp	2006-06-08 10:20:06.000000000 +0200
+++ ClanLib-0.8.0.new/Sources/GL/surface_target_opengl.cpp	2007-03-31 21:33:11.000000000 +0200
@@ -73,8 +73,44 @@
 	// check out if the original texture needs or doesn't need an alpha channel
 	bool needs_alpha = provider.get_format().get_alpha_mask() || provider.get_format().has_colorkey();
 
-	CLint internal_format = needs_alpha ? CL_RGBA : CL_RGB;
-	CLenum format = needs_alpha ? CL_RGBA : CL_RGB;
+	CLint internal_format;
+	CLenum format;
+	CLenum type;
+
+	// we must get the format and type correct here, since they must match
+	// the ones passed to clTexSubImage2D() when the actual upload happens!
+	bool conv_needed = !CL_OpenGL::to_opengl_pixelformat(provider.get_format(), format, type);
+
+	// also check for the pitch (OpenGL can only skip pixels, not bytes)
+	if (!conv_needed)
+	{
+		const int bytesPerPixel = (provider.get_format().get_depth() + 7) / 8;
+		if (provider.get_pitch() % bytesPerPixel != 0)
+			conv_needed = true;
+	}
+
+	// and determine the actual formats and type
+	if (!conv_needed)
+	{
+		// type and format have been set by to_opengl_pixelformat()
+		switch (format)
+		{
+			CL_RED:
+			CL_GREEN:
+			CL_BLUE:
+			CL_ALPHA:
+				internal_format = 1;
+				break;
+			default:
+				internal_format = needs_alpha ? CL_RGBA : CL_RGB;
+		}
+	}
+	else
+	{
+		internal_format = needs_alpha ? CL_RGBA : CL_RGB;
+		format = needs_alpha ? CL_RGBA : CL_RGB;
+		type = CL_UNSIGNED_BYTE;
+	}
 
 	// Upload to OpenGL:
 	clGenTextures(1, &handle);
@@ -88,8 +124,8 @@
 		texture_size.width,       // width
 		texture_size.height,      // height
 		0,                        // border
-		format,                   // format (it really doesn't matter since nothing is uploaded)
-		CL_UNSIGNED_BYTE,         // type (it really doesn't matter since nothing is uploaded)
+		format,                   // format
+		type,                     // type
 		0);                       // texels (0 to avoid uploading)
 
 	set_pixeldata(CL_Point(0, 0), CL_Rect(0, 0, provider.get_width(), provider.get_height()), provider);
@@ -122,8 +158,36 @@
 	// check out if the original texture needs or doesn't need an alpha channel
 	bool needs_alpha = pf.get_alpha_mask() || pf.has_colorkey();
 
-	CLint internal_format = needs_alpha ? CL_RGBA : CL_RGB;
-	CLenum format = needs_alpha ? CL_RGBA : CL_RGB;
+	CLint internal_format;
+	CLenum format;
+	CLenum type;
+
+	// we must get the format and type correct here, since they must match
+	// the ones passed to clTexSubImage2D() when the actual upload happens!
+	bool conv_needed = !CL_OpenGL::to_opengl_pixelformat(pf, format, type);
+
+	// and determine the actual formats and type
+	if (!conv_needed)
+	{
+		// type and format have been set by to_opengl_pixelformat()
+		switch (format)
+		{
+			CL_RED:
+			CL_GREEN:
+			CL_BLUE:
+			CL_ALPHA:
+				internal_format = 1;
+				break;
+			default:
+				internal_format = needs_alpha ? CL_RGBA : CL_RGB;
+		}
+	}
+	else
+	{
+		internal_format = needs_alpha ? CL_RGBA : CL_RGB;
+		format = needs_alpha ? CL_RGBA : CL_RGB;
+		type = CL_UNSIGNED_BYTE;
+	}
 
 	// Upload to OpenGL:
 	clGenTextures(1, &handle);
@@ -137,8 +201,8 @@
 		texture_size.width,       // width
 		texture_size.height,      // height
 		0,                        // border
-		format,                   // format (it really doesn't matter since nothing is uploaded)
-		CL_UNSIGNED_BYTE,         // type (it really doesn't matter since nothing is uploaded)
+		format,                   // format
+		type,                     // type
 		0);                       // texels (0 to avoid uploading)
 
 	clTexParameteri(CL_TEXTURE_2D, CL_TEXTURE_MIN_FILTER, CL_LINEAR);


Index: ClanLib.spec
===================================================================
RCS file: /cvs/extras/rpms/ClanLib/FC-6/ClanLib.spec,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ClanLib.spec	9 Oct 2006 11:21:51 -0000	1.8
+++ ClanLib.spec	31 Mar 2007 20:49:13 -0000	1.9
@@ -1,12 +1,13 @@
 Summary:        Cross platform C++ game library
 Name:           ClanLib
 Version:        0.8.0
-Release:        3%{?dist}
+Release:        4%{?dist}
 Group:          System Environment/Libraries
 License:        zlib License
 URL:            http://www.clanlib.org/
 Source0:        http://www.clanlib.org/download/releases-0.8/%{name}-%{version}.tgz
 Patch0:         ClanLib-0.8.0-fullscreen.patch
+Patch1:         ClanLib-0.8.0-tex-format.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:  libX11-devel libXi-devel libXmu-devel libGLU-devel libICE-devel
 BuildRequires:  libXext-devel libXxf86vm-devel libXt-devel xorg-x11-proto-devel
@@ -32,6 +33,7 @@
 %prep
 %setup -q
 %patch0 -p1 -z .fs 
+%patch1 -p1 -z .texfmt
 # fixup pc files
 sed -i 's|libdir=${exec_prefix}/lib|libdir=@libdir@|' pkgconfig/clan*.pc.in
 sed -i 's|Libs:   -L${libdir}|Libs:   -L${libdir}/%{name}-0.8|' \
@@ -82,6 +84,11 @@
 
 
 %changelog
+* Sat Mar 31 2007 Hans de Goede <j.w.r.degoede at hhs.nl> 0.8.0-4
+- Fix some stupidness in the OpenGL surface code, which triggers an obscure 
+  bug in mesa-6.5.2, as a bonus the OpenGL surface's should be somewhat faster
+  now. Details: https://bugs.freedesktop.org/show_bug.cgi?id=10491
+
 * Sun Oct  8 2006 Hans de Goede <j.w.r.degoede at hhs.nl> 0.8.0-3
 - Rewrote ClanLib fullscreen handling to fix an issue where a part of the
   window decoration show in fullscreen mode on certain videocards




More information about the fedora-extras-commits mailing list