diff --git a/fsl/utils/platform.py b/fsl/utils/platform.py index 9be0265a6b632ae35c9d2c3ba81bcd3229655c41..382d7bb921c705e6b6e8b7472f3a22aeff20c9a3 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