Skip to content

Commit 176d6c2

Browse files
authored
Allow windows 0.52 in addition to windows 0.51 (#189)
* Allow `windows 0.52` in addition to `windows 0.51` Extend the version range bound to allow both as there do not appear to be breaking changes that affect this crate, and test compatibility against the minimum and maximum version of all dependencies in CI. Also remove the `check` job from CI which is only running a subset of what `clippy` is already also doing. * Allow `ash 0.34` for examples We no longer have a fixed dependency on `ash-window` that disallows us from using a lower value. * Clean up Vulkan example
1 parent e45e25a commit 176d6c2

File tree

3 files changed

+20
-33
lines changed

3 files changed

+20
-33
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,6 @@ on: [push, pull_request]
33
name: CI
44

55
jobs:
6-
check:
7-
name: Check
8-
strategy:
9-
matrix:
10-
include:
11-
- os: ubuntu-latest
12-
features: vulkan,visualizer
13-
- os: windows-latest
14-
features: vulkan,visualizer,d3d12,public-winapi
15-
runs-on: ${{ matrix.os }}
16-
steps:
17-
- uses: actions/checkout@v4
18-
- name: Cargo check
19-
run: cargo check --workspace --all-targets --features ${{ matrix.features }} --no-default-features
20-
216
check_msrv:
227
name: Check MSRV (1.65.0)
238
strategy:
@@ -73,6 +58,13 @@ jobs:
7358
- name: Cargo clippy
7459
run: cargo clippy --workspace --all-targets --features ${{ matrix.features }} --no-default-features -- -D warnings
7560

61+
- name: Install nightly Rust
62+
uses: dtolnay/rust-toolchain@nightly
63+
- name: Generate lockfile with minimal dependency versions
64+
run: cargo +nightly generate-lockfile -Zminimal-versions
65+
- name: Cargo clippy with minimal-versions
66+
run: cargo +stable clippy --workspace --all-targets --features ${{ matrix.features }} --no-default-features -- -D warnings
67+
7668
doc:
7769
name: Build documentation
7870
# Windows supports the entire feature surface

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ egui_extras = { version = "0.23", optional = true, default-features = false }
3535
winapi = { version = "0.3.9", features = ["d3d12", "winerror", "impl-default", "impl-debug"], optional = true }
3636

3737
[target.'cfg(windows)'.dependencies.windows]
38-
version = "0.51"
38+
version = ">=0.51,<=0.52"
3939
features = [
4040
"Win32_Foundation",
4141
"Win32_Graphics",
@@ -48,14 +48,14 @@ optional = true
4848

4949
[dev-dependencies]
5050
# Enable the "loaded" feature to be able to access the Vulkan entrypoint.
51-
ash = { version = "0.37", default-features = false, features = ["debug", "loaded"] }
51+
ash = { version = ">=0.34,<=0.37", default-features = false, features = ["debug", "loaded"] }
5252
env_logger = "0.10"
5353

5454
[target.'cfg(windows)'.dev-dependencies]
5555
winapi = { version = "0.3.9", features = ["d3d12", "d3d12sdklayers", "dxgi1_6", "winerror", "impl-default", "impl-debug", "winuser", "windowsx", "libloaderapi"] }
5656

5757
[target.'cfg(windows)'.dev-dependencies.windows]
58-
version = "0.51"
58+
version = ">=0.51,<=0.52"
5959
features = [
6060
"Win32_Foundation",
6161
"Win32_Graphics",

examples/vulkan-buffer.rs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
use std::default::Default;
2+
use std::ffi::CStr;
3+
14
use ash::vk;
25
use log::info;
36

4-
use std::default::Default;
5-
use std::ffi::CString;
6-
77
use gpu_allocator::vulkan::{
88
AllocationCreateDesc, AllocationScheme, Allocator, AllocatorCreateDesc,
99
};
@@ -16,27 +16,22 @@ fn main() {
1616

1717
// Create Vulkan instance
1818
let instance = {
19-
let app_name = CString::new("Vulkan gpu-allocator test").unwrap();
19+
let app_name = CStr::from_bytes_with_nul(b"Vulkan gpu-allocator test\0").unwrap();
2020

2121
let appinfo = vk::ApplicationInfo::builder()
22-
.application_name(&app_name)
22+
.application_name(app_name)
2323
.application_version(0)
24-
.engine_name(&app_name)
24+
.engine_name(app_name)
2525
.engine_version(0)
2626
.api_version(vk::make_api_version(0, 1, 0, 0));
2727

28-
let layer_names = [CString::new("VK_LAYER_KHRONOS_validation").unwrap()];
29-
let layers_names_raw: Vec<*const i8> = layer_names
30-
.iter()
31-
.map(|raw_name| raw_name.as_ptr())
32-
.collect();
33-
34-
let extensions_names_raw = vec![];
28+
let layer_names_raw = [CStr::from_bytes_with_nul(b"VK_LAYER_KHRONOS_validation\0")
29+
.unwrap()
30+
.as_ptr()];
3531

3632
let create_info = vk::InstanceCreateInfo::builder()
3733
.application_info(&appinfo)
38-
.enabled_layer_names(&layers_names_raw)
39-
.enabled_extension_names(&extensions_names_raw);
34+
.enabled_layer_names(&layer_names_raw);
4035

4136
unsafe {
4237
entry

0 commit comments

Comments
 (0)