#vulkan #graphics #gamedev

erupt-bootstrap

vk-bootstrap for Rust

6 releases

0.3.0 Nov 14, 2022
0.2.3 Feb 1, 2022
0.2.2 Jan 30, 2022
0.1.0 Jan 25, 2022
0.0.0 Jan 13, 2022

#476 in Game dev

Zlib license

96KB
1.5K SLoC

erupt-bootstrap

docs.rs crates.io

Vulkan Bootstrapping library for Rust, inspired by vk-bootstrap.

  • ✅ Instance creation
  • ✅ Physical Device selection
  • ✅ Device creation
  • ✅ Getting queues
  • ✅ Swapchain handling (courtesy of Ralith - thanks!)

MAINTENANCE MODE NOTICE

It is not recommended to use this for new projects, as erupt is in maintenance mode. There is work underway to rewrite ash using ideas from the erupt project, for updates see https://github.com/ash-rs/ash/issues/344. The functionality of erupt-bootstrap will be made available in some form or another again once this work is completed. Simple patches to erupt-bootstrap will still be merged, but no large changes are to be expected.

Cargo Features

Example

let entry = erupt::EntryLoader::new().unwrap();
let instance_builder = InstanceBuilder::new()
    .validation_layers(ValidationLayers::Request)
    .request_debug_messenger(DebugMessenger::Default)
    .require_surface_extensions(&window)
    .unwrap();
let (instance, debug_messenger, instance_metadata) =
    unsafe { instance_builder.build(&entry) }.unwrap();

let surface =
    unsafe { erupt::utils::surface::create_surface(&instance, &window, None) }.unwrap();

let graphics_present = QueueFamilyCriteria::graphics_present();
let transfer = QueueFamilyCriteria::preferably_separate_transfer();

let device_features = vk::PhysicalDeviceFeatures2Builder::new()
    .features(vk::PhysicalDeviceFeaturesBuilder::new().build());

let device_builder = DeviceBuilder::new()
    .queue_family(graphics_present)
    .queue_family(transfer)
    .require_features(&device_features)
    .for_surface(surface);
let (device, device_metadata) =
    unsafe { device_builder.build(&instance, &instance_metadata) }.unwrap();
let graphics_present = device_metadata
    .device_queue(&instance, &device, graphics_present, 0)
    .unwrap()
    .unwrap();
let transfer = device_metadata
    .device_queue(&instance, &device, transfer, 0)
    .unwrap()
    .unwrap();

For more examples, visit the git repo.

Licensing

The logo contains the Volcano Emoji of Twemoji (License). The name "erupt" was added on top of the volcano. The boot is the "Hiking Boot" from Openclipart, released into the Public Domain.

This project is licensed under the zlib License.

vk-bootstrap, the inspiration of this project, is licensed under the MIT license.

Dependencies

~7MB
~168K SLoC