29 个版本 (12 个稳定版)

2.3.0 2022年1月26日
2.2.0 2021年12月11日
2.1.0 2021年9月5日
2.0.2 2021年7月28日
0.7.2 2021年3月29日

#257 in 渲染

Download history 1/week @ 2024-03-15 25/week @ 2024-03-29 1/week @ 2024-04-05 1/week @ 2024-04-19 1/week @ 2024-04-26

每月下载量 84
asche 中使用

Zlib OR MIT OR Apache-2.0

58KB
1K SLoC

vk-alloc

Latest version Documentation ZLIB MIT Apache

用 Rust 编写的 Vulkan 分列表内存分配器。

使用 erupt 针对 Vulkan 1.2+。

功能

默认情况下,所有功能都是可选的。

  • tracing 使用 tracing 添加日志功能。
  • profiling 添加对 profiling 的支持。
  • vk-buffer-device-address: 启用 "vkGetBufferDeviceAddress" 的使用。需要启用 Vulkan 1.2 的 "bufferDeviceAddress" 设备功能。

许可证

许可协议为 MIT 或 Apache-2.0 或 ZLIB。


lib.rs:

Vulkan 的分列表内存分配器。

分配器可以将用户定义生命周期的分配池起来,以帮助减少碎片。

示例

#[derive(Debug, Clone, Copy, Hash, Eq, PartialEq)]
enum Lifetime {
    Buffer,
    Image,
}

impl vk_alloc::Lifetime for Lifetime {}

unsafe {
    Allocator::<Lifetime>::new(
        &instance,
        &physical_device,
        &AllocatorDescriptor {
            ..Default::default()
        },
    ).unwrap();

    let allocation = alloc
        .allocate(
            &logical_device,
            &AllocationDescriptor {
                location: MemoryLocation::GpuOnly,
                requirements: vk::MemoryRequirementsBuilder::new()
                    .alignment(512)
                    .size(1024)
                    .memory_type_bits(u32::MAX)
                    .build(),
                lifetime: Lifetime::Buffer,
                is_dedicated: false,
                is_optimal: false,
            },
        )
        .unwrap();
}

依赖项

~7–33MB
~498K SLoC