create static method
- VulkanDeviceOptions? options,
Creates a Vulkan instance, device, and graphics queue for render sessions.
Attach sessions with the context from VulkanDeviceHandle.getContext(),
in place of a device of your own. Without device_uuid or device_luid,
it prefers a discrete GPU. The device enables the external memory and
semaphore extensions that the GPU offers.
See mln_vulkan_device_create in the
C API reference.
Errors:
Status.unsupportedwhensupportedRenderBackendMask()lacksRenderBackendFlag.vulkan, or whenpresentationis true and the Vulkan loader or the GPU can't present.Status.notFoundwhen no GPU matchesdevice_uuidanddevice_luid.Status.nativeErrorwhen there is no Vulkan loader, no GPU has a graphics queue, or Vulkan can't create the instance or the device.
Implementation
static VulkanDeviceHandle create({VulkanDeviceOptions? options}) =>
withNativeArena((arena) {
ensureAbiVersion();
final outDevice = arena<Uint64>();
_check(
raw.mln_vulkan_device_create(
options == null
? nullptr
: _writeVulkanDeviceOptions(options, arena),
outDevice,
nativeDiagnostic,
),
);
return _adoptOwned(
outDevice.value,
() => VulkanDeviceHandle._(_NativeVulkanDevice(outDevice.value)),
(handle) {
raw.mln_vulkan_device_release(handle);
},
);
});