[opengl-games-utils] Recognize software rendering as such now that it is done with gallium llvmpipe, rather then the clas

Hans de Goede jwrdegoede at fedoraproject.org
Thu Sep 15 17:49:45 UTC 2011


commit 9ad82ef91e96bb7459f446bf266b1c10c5cfb9a3
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Thu Sep 15 19:49:24 2011 +0200

    Recognize software rendering as such now that it is done with gallium
    llvmpipe, rather then the classic software renderer
    Add a new hasDri function to opengl-game-functions.sh

 README                   |   31 ++++++++++++++++++++-----------
 opengl-game-functions.sh |   16 ++++++++++++++--
 opengl-games-utils.spec  |    9 +++++++--
 3 files changed, 41 insertions(+), 15 deletions(-)
---
diff --git a/README b/README
index e378a1f..64691ed 100644
--- a/README
+++ b/README
@@ -4,7 +4,7 @@ is available before launching an OpenGL game. This package is intended for use
 by other packages and is not intended for direct end user use!
 
 
-Currently this package only contains one script:
+Currently this package contains one utility script:
 opengl-game-wrapper.sh
 
 To use this script create a link in /usr/bin gamename-wrapper[.sh] to
@@ -16,19 +16,28 @@ available a userfriendly error dialog will be shown explaining that gamename
 cannot run without hardware accelerated 3d, and that this is probably due to
 missing Free Software support for the users card.
 
+The utility script uses 2 functions defined in
+/usr/share/opengl-games-utils/opengl-game-functions.sh
+You can also use these 2 functions directly from your own scripts by
+including the above file from your own shell script.
 
-In the future I also plan to add an opengl-games-functions.sh file which can
-be included by other wrapper scripts, the idea is to have a function in here
-which will return true or false depending on if the current glx setup is a
-setup which is known to work well. This function will have a list of
-OpenGL renderer strings of known to work well drivers. This can then be used
-by games which can take advantage of OpenGL, but will work without it too,
-to determine wether or not to enable OpenGL support. The idea here is that
-one might not want to enable OpenGL by default on SIS, VIA and other
-low quality chipset / drivers.
+The 2 included functions are:
+
+hasDri:
+This function will return true if hardware accellerated OpenGL is available
+and false if it is not. This does not say anything about the OpenGL
+capabilities (nor the quality of the driver).
+
+checkDriOK:
+This functino calls hasDri, if hardware accellerated OpenGL is available
+it does nothing, if it is not available it will show an error dialog and
+then call exit. This is the function around which opengl-game-wrapper.sh is
+build. It is provided as a "library" function so that if your game needs a
+wrapper script anyways, you don't need to wrap the wrapper but instead can
+call it directly from the wrapper.
 
 
 Last but not least before I forget, to avoid any licensing issues I hereby
 declare that all files in this package are in the Public Domain.
 
-Hans de Goede 22 septemper 2007.
+Hans de Goede 15 September 2011.
diff --git a/opengl-game-functions.sh b/opengl-game-functions.sh
index 2cac720..d188728 100644
--- a/opengl-game-functions.sh
+++ b/opengl-game-functions.sh
@@ -1,8 +1,20 @@
+# check if DRI is available, true if it is, false otherwise
+
+function hasDri ()
+{
+  if [ "`glxinfo | grep "direct rendering: " | head -n 1 | cut -d " " -f 3`" != Yes ] ||
+     glxinfo | grep -qE "OpenGL renderer string: Software Rasterizer|OpenGL renderer string: Gallium .* on llvmpipe"; then
+    return 1
+  else
+    return 0
+  fi 
+}
+
 # check if DRI is available, show an error and exit if it isn't
+
 function checkDriOK ()
 {
-  if [ "`glxinfo | grep "direct rendering: " | head -n 1 | cut -d " " -f 3`" != Yes ] ||
-     glxinfo | grep -q "OpenGL renderer string: Software Rasterizer"; then
+  if ! hasDri; then
     zenity --error --text="Your system currently is not capable of hardware \
 accelerated 3D. Therefore $1 cannot run.
 
diff --git a/opengl-games-utils.spec b/opengl-games-utils.spec
index 2fe0a70..f7ba839 100644
--- a/opengl-games-utils.spec
+++ b/opengl-games-utils.spec
@@ -1,6 +1,6 @@
 Name:           opengl-games-utils
-Version:        0.1
-Release:        10%{?dist}
+Version:        0.2
+Release:        1%{?dist}
 Summary:        Utilities to check proper 3d support before launching 3d games
 Group:          Amusements/Games
 License:        Public Domain
@@ -48,6 +48,11 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Thu Sep 15 2011 Hans de Goede <hdegoede at redhat.com> 0.2-1
+- Recognize software rendering as such now that it is done with gallium
+  llvmpipe, rather then the classic software renderer
+- Add a new hasDri function to opengl-game-functions.sh
+
 * Tue Feb 08 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.1-10
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 


More information about the scm-commits mailing list