Crates.io | mira |
lib.rs | mira |
version | 0.1.26 |
source | src |
created_at | 2021-10-04 17:42:34.415758 |
updated_at | 2024-11-25 15:27:55.209438 |
description | Pure and simple Vulkan bindings generated from Vulkan-Headers! |
homepage | |
repository | https://github.com/onlymaresia/mira |
max_upload_size | |
id | 460224 |
size | 1,500,465 |
Pure and simple Vulkan bindings generated from Vulkan-Headers!
Mira provides a simple and straightforward way to interact with Vulkan. Everything was generated by bindgen and uses the original API names.
This crate provides:
Enumerate all instance extensions (rust 2021 edition).
use mira::error::MiraError;
use mira::loader;
use mira::mem::{from_cstring, zeroed_vec};
use mira::vulkan::*;
fn main() -> Result<(), MiraError> {
let enumerate_instance_extensions: PFN_vkEnumerateInstanceExtensionProperties;
enumerate_instance_extensions = unsafe {
loader::instance(
std::ptr::null_mut(),
c"vkEnumerateInstanceExtensionProperties",
)?
};
let mut count: u32 = 0;
unsafe {
enumerate_instance_extensions(std::ptr::null_mut(), &mut count, std::ptr::null_mut())
};
let mut extensions = unsafe { zeroed_vec::<VkExtensionProperties>(count as usize) };
unsafe {
enumerate_instance_extensions(std::ptr::null_mut(), &mut count, extensions.as_mut_ptr())
};
println!("Instance extensions");
for extension in extensions.iter().enumerate() {
let str = match unsafe { from_cstring(extension.1.extensionName.as_ptr()) } {
Ok(str) => str,
Err(_) => continue,
};
println!("extension #{} - {}", extension.0, str);
}
Ok(())
}
Successfully tested on Linux(Lubuntu 20.04) with Intel(R) HD Graphics 620 (KBL GT2).
Displays a window with a purple background.
cargo run --example color
1.3.302 (with av1, h264 and h265 video extensions)
For a version in sync with the official vulkan headers repository clone this project from github and run the generator.