Module: Engine::Metal::MetalFramework
- Extended by:
- Fiddle::Importer
- Defined in:
- lib/engine/metal/metal_bindings.rb
Class Method Summary collapse
-
.create_system_default_device ⇒ Object
Get default device via Objective-C runtime instead of C function.
Class Method Details
.create_system_default_device ⇒ Object
Get default device via Objective-C runtime instead of C function
70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/engine/metal/metal_bindings.rb', line 70 def self.create_system_default_device # MTLCopyAllDevices returns an NSArray of devices, first one is default devices = ObjC.msg(ObjC.cls('MTLCopyAllDevicesWithObserver'), 'alloc') # Simpler: use the class method on MTLDevice protocol # Actually, let's just call the C function through a different approach = Fiddle.dlopen('/System/Library/Frameworks/Metal.framework/Metal') create_device = Fiddle::Function.new( ['MTLCreateSystemDefaultDevice'], [], Fiddle::TYPE_VOIDP ) create_device.call end |