Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Evan Edmond
fslpy
Commits
71826cc2
Commit
71826cc2
authored
8 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/utils/platform.py
+27
-0
27 additions, 0 deletions
fsl/utils/platform.py
with
27 additions
and
0 deletions
fsl/utils/platform.py
+
27
−
0
View file @
71826cc2
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment