File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change 1
- const _functional = Ref {Bool} (false )
2
- functional () = _functional[]
1
+ # Starts at `nothing`. Only false when it's determined
2
+ const _functional = Ref {Union{Nothing,Bool}} (false )
3
+
4
+ function functional ()
5
+ if isnothing (_functional[])
6
+ dev = device ()
7
+
8
+ _functional[] =
9
+ supports_family (dev, MTL. MTLGPUFamilyApple7) &&
10
+ supports_family (dev, MTL. MTLGPUFamilyMetal3)
11
+ end
12
+ _functional[]
13
+ end
3
14
4
15
function __init__ ()
5
16
precompiling = ccall (:jl_generating_output , Cint, ()) != 0
@@ -39,7 +50,10 @@ function __init__()
39
50
load_framework (" CoreGraphics" )
40
51
ver = MTL. MTLCompileOptions (). languageVersion
41
52
@debug " Successfully loaded Metal; targeting v$ver ."
42
- _functional[] = true
53
+
54
+ # Successful loading of CoreGraphics means there's a
55
+ # chance the graphics device is supported
56
+ _functional[] = nothing
43
57
catch err
44
58
@error " Failed to load Metal" exception= (err,catch_backtrace ())
45
59
return
You can’t perform that action at this time.
0 commit comments