Skip to content

Commit

Permalink
Allow windows 0.52 in addition to windows 0.51 (#189)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
MarijnS95 authored Nov 16, 2023
1 parent e45e25a commit 176d6c2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 33 deletions.
22 changes: 7 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,6 @@ on: [push, pull_request]
name: CI

jobs:
check:
name: Check
strategy:
matrix:
include:
- os: ubuntu-latest
features: vulkan,visualizer
- os: windows-latest
features: vulkan,visualizer,d3d12,public-winapi
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Cargo check
run: cargo check --workspace --all-targets --features ${{ matrix.features }} --no-default-features

check_msrv:
name: Check MSRV (1.65.0)
strategy:
Expand Down Expand Up @@ -73,6 +58,13 @@ jobs:
- name: Cargo clippy
run: cargo clippy --workspace --all-targets --features ${{ matrix.features }} --no-default-features -- -D warnings

- name: Install nightly Rust
uses: dtolnay/rust-toolchain@nightly
- name: Generate lockfile with minimal dependency versions
run: cargo +nightly generate-lockfile -Zminimal-versions
- name: Cargo clippy with minimal-versions
run: cargo +stable clippy --workspace --all-targets --features ${{ matrix.features }} --no-default-features -- -D warnings

doc:
name: Build documentation
# Windows supports the entire feature surface
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ egui_extras = { version = "0.23", optional = true, default-features = false }
winapi = { version = "0.3.9", features = ["d3d12", "winerror", "impl-default", "impl-debug"], optional = true }

[target.'cfg(windows)'.dependencies.windows]
version = "0.51"
version = ">=0.51,<=0.52"
features = [
"Win32_Foundation",
"Win32_Graphics",
Expand All @@ -48,14 +48,14 @@ optional = true

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

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

[target.'cfg(windows)'.dev-dependencies.windows]
version = "0.51"
version = ">=0.51,<=0.52"
features = [
"Win32_Foundation",
"Win32_Graphics",
Expand Down
25 changes: 10 additions & 15 deletions examples/vulkan-buffer.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::default::Default;
use std::ffi::CStr;

use ash::vk;
use log::info;

use std::default::Default;
use std::ffi::CString;

use gpu_allocator::vulkan::{
AllocationCreateDesc, AllocationScheme, Allocator, AllocatorCreateDesc,
};
Expand All @@ -16,27 +16,22 @@ fn main() {

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

let appinfo = vk::ApplicationInfo::builder()
.application_name(&app_name)
.application_name(app_name)
.application_version(0)
.engine_name(&app_name)
.engine_name(app_name)
.engine_version(0)
.api_version(vk::make_api_version(0, 1, 0, 0));

let layer_names = [CString::new("VK_LAYER_KHRONOS_validation").unwrap()];
let layers_names_raw: Vec<*const i8> = layer_names
.iter()
.map(|raw_name| raw_name.as_ptr())
.collect();

let extensions_names_raw = vec![];
let layer_names_raw = [CStr::from_bytes_with_nul(b"VK_LAYER_KHRONOS_validation\0")
.unwrap()
.as_ptr()];

let create_info = vk::InstanceCreateInfo::builder()
.application_info(&appinfo)
.enabled_layer_names(&layers_names_raw)
.enabled_extension_names(&extensions_names_raw);
.enabled_layer_names(&layer_names_raw);

unsafe {
entry
Expand Down

0 comments on commit 176d6c2

Please sign in to comment.