ashpan

Crates.ioashpan
lib.rsashpan
version0.7.0
sourcesrc
created_at2021-08-01 11:07:43.566896
updated_at2022-03-30 15:16:32.208968
descriptionRAII helpers for ash
homepage
repositoryhttps://github.com/swooster/ashpan
max_upload_size
id429989
size52,979
Steve Wooster (swooster)

documentation

README

Ashpan

Crates.io Version Documentation License: MIT License: Apache 2.0

RAII helpers for ash

ashpan makes it easier to properly clean up ash resources when failures occur. It's essentially a scopeguard that has been tailored to Vulkan.

Example

use ashpan::{DeviceExt, Guarded};

struct Resources { ... }

unsafe fn create_resources(device: &ash::Device) -> VkResult<Resources> {
    let render_pass = create_render_pass(device)?;
    let pipeline_layout = create_pipeline_layout(device)?;
    let pipeline = create_pipeline(device, *render_pass, *pipeline_layout)?;
    Ok(Resources {
        render_pass: render_pass.take(),
        pipeline_layout: pipeline_layout.take(),
        pipeline: pipeline.take(),
    })
}

unsafe fn create_render_pass(device: &ash::Device) -> VkResult<Guarded<vk::RenderPass>> {
    let create_info = unimplemented!();
    device.create_guarded_render_pass(create_info, None)
}

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Commit count: 34

cargo fmt