Skip to content
Snippets Groups Projects
Commit 71826cc2 authored by Paul McCarthy's avatar Paul McCarthy
Browse files

fsl.utils.platform has new property which tells (or tries to tell) if

using a software or hardware GL renderer.
parent a96f44d2
No related branches found
No related tags found
No related merge requests found
...@@ -92,6 +92,7 @@ class Platform(notifier.Notifier): ...@@ -92,6 +92,7 @@ class Platform(notifier.Notifier):
wxFlavour wxFlavour
glVersion glVersion
glRenderer glRenderer
glIsSoftwareRenderer
""" """
...@@ -111,6 +112,7 @@ class Platform(notifier.Notifier): ...@@ -111,6 +112,7 @@ class Platform(notifier.Notifier):
self.__inSSHSession = False self.__inSSHSession = False
self.__glVersion = None self.__glVersion = None
self.__glRenderer = None self.__glRenderer = None
self.__glIsSoftware = None
# Determine if a display is available. We do # Determine if a display is available. We do
# this once at init (instead of on-demand in # this once at init (instead of on-demand in
...@@ -273,6 +275,31 @@ class Platform(notifier.Notifier): ...@@ -273,6 +275,31 @@ class Platform(notifier.Notifier):
"""Set the available OpenGL renderer. """ """Set the available OpenGL renderer. """
self.__glRenderer = value 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() platform = Platform()
"""An instance of the :class:`Platform` class. Feel free to create your own """An instance of the :class:`Platform` class. Feel free to create your own
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment