Skip to content

Commit a35343f

Browse files
🪟 Update to windows 0.58 (#236)
* 🪟 Update to `windows 0.58` * Address `0.58` API-breaks in example code * Remove release version bump * Don't lint all targets (i.e. examples) in `minimal-versions` test Since the `windows 0.58` upgrade our crate still supports `windows` all the way back to `0.53`, but the examples use some breaking API changes that require `0.58`. This means, also because of using `windows` in the public API, that it must only be paired with `gpu-allocator` on `0.58`. --------- Co-authored-by: Marijn Suijten <[email protected]>
1 parent db51810 commit a35343f

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
# allowing the 0.0.6 release to be used (but not the 1.0.0 release).
8080
cargo update -p malloc_buf --precise 0.0.6
8181
- name: Cargo clippy with minimal-versions
82-
run: cargo +stable clippy --workspace --all-targets --features ${{ matrix.features }} --no-default-features -- -D warnings
82+
run: cargo +stable clippy --workspace --features ${{ matrix.features }} --no-default-features -- -D warnings
8383

8484
doc:
8585
name: Build documentation

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ metal = { version = "0.29.0", default-features = false, features = ["link", "dis
4141
winapi = { version = "0.3.9", features = ["d3d12", "winerror", "impl-default", "impl-debug"], optional = true }
4242

4343
[target.'cfg(windows)'.dependencies.windows]
44-
version = ">=0.53,<=0.57"
44+
version = ">=0.53,<=0.58"
4545
features = [
4646
"Win32_Graphics_Direct3D12",
4747
"Win32_Graphics_Dxgi_Common",
@@ -57,7 +57,8 @@ env_logger = "0.10"
5757
winapi = { version = "0.3.9", features = ["d3d12", "d3d12sdklayers", "dxgi1_6", "winerror", "impl-default", "impl-debug", "winuser", "windowsx", "libloaderapi"] }
5858

5959
[target.'cfg(windows)'.dev-dependencies.windows]
60-
version = ">=0.53,<=0.57"
60+
# API-breaks since Windows 0.58 only affect our examples
61+
version = "0.58"
6162
features = [
6263
"Win32_Graphics_Direct3D",
6364
"Win32_Graphics_Direct3D12",

examples/d3d12-buffer-winrs.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ fn create_d3d12_device(dxgi_factory: &IDXGIFactory6) -> Option<ID3D12Device> {
3737
};
3838
let adapter4: IDXGIAdapter4 = adapter1.cast().unwrap();
3939

40-
let mut desc = Default::default();
41-
unsafe { adapter4.GetDesc3(&mut desc) }.unwrap();
40+
let desc = unsafe { adapter4.GetDesc3() }.unwrap();
4241
// Skip software adapters
4342
// Vote for https://github.com/microsoft/windows-rs/issues/793!
4443
if (desc.Flags & DXGI_ADAPTER_FLAG3_SOFTWARE) == DXGI_ADAPTER_FLAG3_SOFTWARE {
@@ -86,7 +85,9 @@ fn create_d3d12_device(dxgi_factory: &IDXGIFactory6) -> Option<ID3D12Device> {
8685
fn main() -> Result<()> {
8786
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("trace")).init();
8887

89-
let dxgi_factory = unsafe { CreateDXGIFactory2(0) }?;
88+
let dxgi_factory = unsafe {
89+
CreateDXGIFactory2(windows::Win32::Graphics::Dxgi::DXGI_CREATE_FACTORY_FLAGS::default())
90+
}?;
9091

9192
let device = create_d3d12_device(&dxgi_factory).expect("Failed to create D3D12 device.");
9293

0 commit comments

Comments
 (0)