From 71826cc21e4484238a848f1a31b42698dc03d609 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauld.mccarthy@gmail.com>
Date: Thu, 29 Sep 2016 16:08:07 +0100
Subject: [PATCH] fsl.utils.platform has new property which tells (or tries to
 tell) if using a software or hardware GL renderer.

---
 fsl/utils/platform.py | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/fsl/utils/platform.py b/fsl/utils/platform.py
index 9be0265a6..382d7bb92 100644
--- a/fsl/utils/platform.py
+++ b/fsl/utils/platform.py
@@ -92,6 +92,7 @@ class Platform(notifier.Notifier):
        wxFlavour
        glVersion
        glRenderer
+       glIsSoftwareRenderer
     """
 
     
@@ -111,6 +112,7 @@ class Platform(notifier.Notifier):
         self.__inSSHSession = False
         self.__glVersion    = None
         self.__glRenderer   = None
+        self.__glIsSoftware = None
 
         # Determine if a display is available. We do
         # this once at init (instead of on-demand in
@@ -273,6 +275,31 @@ class Platform(notifier.Notifier):
         """Set the available OpenGL renderer. """
         self.__glRenderer = value
 
+        value = value.lower()
+
+        # There doesn't seem to be any quantitative
+        # method for determining whether we are using
+        # software-based rendering, so a hack is
+        # necessary.
+        self.__glIsSoftware = any((
+            'software' in value,
+            'mesa'     in value,
+            'gallium'  in value,
+            'llvmpipe' in value,
+            'chromium' in value,
+        ))
+
+
+    @property
+    def glIsSoftwareRenderer(self):
+        """Returns ``True`` if the OpenGL renderer is software based,
+        ``False`` otherwise, or ``None`` if the renderer has not yet been set.
+
+        .. note:: This check is based on heuristics, ans is not guaranteed to
+                  be correct.
+        """
+        return self.__glIsSoftware
+
 
 platform = Platform()
 """An instance of the :class:`Platform` class. Feel free to create your own
-- 
GitLab