Skip to content

Commit 95ba6d0

Browse files
authored
🥳 Upgrade to ash 0.38 (#218)
* 🥳 Upgrade to `ash 0.38` * Bump MSRV to 1.69
1 parent 52b88cd commit 95ba6d0

7 files changed

Lines changed: 27 additions & 29 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: CI
44

55
jobs:
66
check_msrv:
7-
name: Check MSRV (1.65.0)
7+
name: Check MSRV (1.69.0)
88
strategy:
99
matrix:
1010
include:
@@ -17,8 +17,9 @@ jobs:
1717
runs-on: ${{ matrix.os }}
1818
steps:
1919
- uses: actions/checkout@v4
20-
- uses: dtolnay/rust-toolchain@1.65.0
21-
- run: cargo check --workspace --all-targets --features ${{ matrix.features }} --no-default-features
20+
- uses: dtolnay/rust-toolchain@1.69.0
21+
# Note that examples are extempt from the MSRV check, so that they can use newer Rust features
22+
- run: cargo check --workspace --features ${{ matrix.features }} --no-default-features
2223

2324
test:
2425
name: Test Suite

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ homepage = "https://github.com/Traverse-Research/gpu-allocator"
1010
repository = "https://github.com/Traverse-Research/gpu-allocator"
1111
keywords = ["vulkan", "memory", "allocator"]
1212
documentation = "https://docs.rs/gpu-allocator/"
13-
rust-version = "1.65"
13+
rust-version = "1.69"
1414

1515
include = [
1616
"/README.md",
@@ -28,7 +28,7 @@ thiserror = "1.0"
2828
presser = { version = "0.3" }
2929
# Only needed for Vulkan. Disable all default features as good practice,
3030
# such as the ability to link/load a Vulkan library.
31-
ash = { version = ">=0.34, <=0.37", optional = true, default-features = false, features = ["debug"] }
31+
ash = { version = "0.38", optional = true, default-features = false, features = ["debug"] }
3232
# Only needed for visualizer.
3333
egui = { version = ">=0.24, <=0.27", optional = true, default-features = false }
3434
egui_extras = { version = ">=0.24, <=0.27", optional = true, default-features = false }
@@ -54,7 +54,7 @@ optional = true
5454

5555
[dev-dependencies]
5656
# Enable the "loaded" feature to be able to access the Vulkan entrypoint.
57-
ash = { version = ">=0.34,<=0.37", default-features = false, features = ["debug", "loaded"] }
57+
ash = { version = "0.38", default-features = false, features = ["debug", "loaded"] }
5858
env_logger = "0.10"
5959

6060
[target.'cfg(windows)'.dev-dependencies]

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE-MIT)
77
[![LICENSE](https://img.shields.io/badge/license-apache-blue.svg?logo=apache)](LICENSE-APACHE)
88
[![Contributor Covenant](https://img.shields.io/badge/contributor%20covenant-v1.4%20adopted-ff69b4.svg)](../main/CODE_OF_CONDUCT.md)
9-
[![MSRV](https://img.shields.io/badge/rustc-1.65.0+-ab6000.svg)](https://blog.rust-lang.org/2022/11/03/Rust-1.65.0.html)
9+
[![MSRV](https://img.shields.io/badge/rustc-1.69.0+-ab6000.svg)](https://blog.rust-lang.org/2023/04/20/Rust-1.69.0.html)
1010

1111
[![Banner](banner.png)](https://traverseresearch.nl)
1212

@@ -48,7 +48,7 @@ use gpu_allocator::vulkan::*;
4848
use gpu_allocator::MemoryLocation;
4949

5050
// Setup vulkan info
51-
let vk_info = vk::BufferCreateInfo::builder()
51+
let vk_info = vk::BufferCreateInfo::default()
5252
.size(512)
5353
.usage(vk::BufferUsageFlags::STORAGE_BUFFER);
5454

@@ -163,7 +163,7 @@ allocator.free(&allocation).unwrap();
163163

164164
## Minimum Supported Rust Version
165165

166-
The MSRV for this crate and the `vulkan`, `d3d12` and `metal` features is Rust 1.65. Any other features such as the `visualizer` (with all the `egui` dependencies) may have a higher requirement and are not tested in our CI.
166+
The MSRV for this crate and the `vulkan`, `d3d12` and `metal` features is Rust 1.69. Any other features such as the `visualizer` (with all the `egui` dependencies) may have a higher requirement and are not tested in our CI.
167167

168168
## License
169169

README.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE-MIT)
77
[![LICENSE](https://img.shields.io/badge/license-apache-blue.svg?logo=apache)](LICENSE-APACHE)
88
[![Contributor Covenant](https://img.shields.io/badge/contributor%20covenant-v1.4%20adopted-ff69b4.svg)](../main/CODE_OF_CONDUCT.md)
9-
[![MSRV](https://img.shields.io/badge/rustc-1.65.0+-ab6000.svg)](https://blog.rust-lang.org/2022/11/03/Rust-1.65.0.html)
9+
[![MSRV](https://img.shields.io/badge/rustc-1.69.0+-ab6000.svg)](https://blog.rust-lang.org/2023/04/20/Rust-1.69.0.html)
1010

1111
[![Banner](banner.png)](https://traverseresearch.nl)
1212

@@ -21,7 +21,7 @@ gpu-allocator = "0.26.0"
2121

2222
## Minimum Supported Rust Version
2323

24-
The MSRV for this crate and the `vulkan`, `d3d12` and `metal` features is Rust 1.65. Any other features such as the `visualizer` (with all the `egui` dependencies) may have a higher requirement and are not tested in our CI.
24+
The MSRV for this crate and the `vulkan`, `d3d12` and `metal` features is Rust 1.69. Any other features such as the `visualizer` (with all the `egui` dependencies) may have a higher requirement and are not tested in our CI.
2525

2626
## License
2727

examples/vulkan-buffer.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::default::Default;
2-
use std::ffi::CStr;
32

43
use ash::vk;
54
use log::info;
@@ -16,20 +15,18 @@ fn main() {
1615

1716
// Create Vulkan instance
1817
let instance = {
19-
let app_name = CStr::from_bytes_with_nul(b"Vulkan gpu-allocator test\0").unwrap();
18+
let app_name = c"Vulkan gpu-allocator test";
2019

21-
let appinfo = vk::ApplicationInfo::builder()
20+
let appinfo = vk::ApplicationInfo::default()
2221
.application_name(app_name)
2322
.application_version(0)
2423
.engine_name(app_name)
2524
.engine_version(0)
2625
.api_version(vk::make_api_version(0, 1, 0, 0));
2726

28-
let layer_names_raw = [CStr::from_bytes_with_nul(b"VK_LAYER_KHRONOS_validation\0")
29-
.unwrap()
30-
.as_ptr()];
27+
let layer_names_raw = [c"VK_LAYER_KHRONOS_validation".as_ptr()];
3128

32-
let create_info = vk::InstanceCreateInfo::builder()
29+
let create_info = vk::InstanceCreateInfo::default()
3330
.application_info(&appinfo)
3431
.enabled_layer_names(&layer_names_raw);
3532

@@ -74,11 +71,11 @@ fn main() {
7471
};
7572
let priorities = [1.0];
7673

77-
let queue_info = vk::DeviceQueueCreateInfo::builder()
74+
let queue_info = vk::DeviceQueueCreateInfo::default()
7875
.queue_family_index(queue_family_index as u32)
7976
.queue_priorities(&priorities);
8077

81-
let create_info = vk::DeviceCreateInfo::builder()
78+
let create_info = vk::DeviceCreateInfo::default()
8279
.queue_create_infos(std::slice::from_ref(&queue_info))
8380
.enabled_extension_names(&device_extension_names_raw)
8481
.enabled_features(&features);
@@ -99,7 +96,7 @@ fn main() {
9996

10097
// Test allocating Gpu Only memory
10198
{
102-
let test_buffer_info = vk::BufferCreateInfo::builder()
99+
let test_buffer_info = vk::BufferCreateInfo::default()
103100
.size(512)
104101
.usage(vk::BufferUsageFlags::STORAGE_BUFFER)
105102
.sharing_mode(vk::SharingMode::EXCLUSIVE);
@@ -132,7 +129,7 @@ fn main() {
132129

133130
// Test allocating Cpu to Gpu memory
134131
{
135-
let test_buffer_info = vk::BufferCreateInfo::builder()
132+
let test_buffer_info = vk::BufferCreateInfo::default()
136133
.size(512)
137134
.usage(vk::BufferUsageFlags::STORAGE_BUFFER)
138135
.sharing_mode(vk::SharingMode::EXCLUSIVE);
@@ -165,7 +162,7 @@ fn main() {
165162

166163
// Test allocating Gpu to Cpu memory
167164
{
168-
let test_buffer_info = vk::BufferCreateInfo::builder()
165+
let test_buffer_info = vk::BufferCreateInfo::default()
169166
.size(512)
170167
.usage(vk::BufferUsageFlags::STORAGE_BUFFER)
171168
.sharing_mode(vk::SharingMode::EXCLUSIVE);

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
//! # }).unwrap();
5353
//!
5454
//! // Setup vulkan info
55-
//! let vk_info = vk::BufferCreateInfo::builder()
55+
//! let vk_info = vk::BufferCreateInfo::default()
5656
//! .size(512)
5757
//! .usage(vk::BufferUsageFlags::STORAGE_BUFFER);
5858
//!

src/vulkan/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,12 @@ impl MemoryBlock {
352352
requires_personal_block: bool,
353353
) -> Result<Self> {
354354
let device_memory = {
355-
let alloc_info = vk::MemoryAllocateInfo::builder()
355+
let alloc_info = vk::MemoryAllocateInfo::default()
356356
.allocation_size(size)
357357
.memory_type_index(mem_type_index as u32);
358358

359359
let allocation_flags = vk::MemoryAllocateFlags::DEVICE_ADDRESS;
360-
let mut flags_info = vk::MemoryAllocateFlagsInfo::builder().flags(allocation_flags);
360+
let mut flags_info = vk::MemoryAllocateFlagsInfo::default().flags(allocation_flags);
361361
// TODO(manon): Test this based on if the device has this feature enabled or not
362362
let alloc_info = if buffer_device_address {
363363
alloc_info.push_next(&mut flags_info)
@@ -366,7 +366,7 @@ impl MemoryBlock {
366366
};
367367

368368
// Flag the memory as dedicated if required.
369-
let mut dedicated_memory_info = vk::MemoryDedicatedAllocateInfo::builder();
369+
let mut dedicated_memory_info = vk::MemoryDedicatedAllocateInfo::default();
370370
let alloc_info = match allocation_scheme {
371371
AllocationScheme::DedicatedBuffer(buffer) => {
372372
dedicated_memory_info = dedicated_memory_info.buffer(buffer);
@@ -748,8 +748,8 @@ impl Allocator {
748748
.get_physical_device_memory_properties(desc.physical_device)
749749
};
750750

751-
let memory_types = &mem_props.memory_types[..mem_props.memory_type_count as _];
752-
let memory_heaps = mem_props.memory_heaps[..mem_props.memory_heap_count as _].to_vec();
751+
let memory_types = &mem_props.memory_types_as_slice();
752+
let memory_heaps = mem_props.memory_heaps_as_slice().to_vec();
753753

754754
if desc.debug_settings.log_memory_information {
755755
debug!("memory type count: {}", mem_props.memory_type_count);

0 commit comments

Comments
 (0)