Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 88 additions & 45 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ pp-rs = "0.2.1"
profiling = { version = "1.0.1", default-features = false }
quote = "1.0.38"
raw-window-handle = { version = "0.6.2", default-features = false }
rwh_05 = { version = "0.5.2", package = "raw-window-handle" } # temporary compatibility for glutin-winit
rayon = "1.3"
regex-lite = "0.1"
renderdoc-sys = "1"
Expand Down Expand Up @@ -225,9 +224,8 @@ gpu-allocator = { version = "0.28", default-features = false, features = [
# Gles dependencies
khronos-egl = "6"
glow = "0.16"
glutin = { version = "0.31", default-features = false }
glutin-winit = { version = "0.4", default-features = false }
glutin_wgl_sys = "0.6"
glutin = { version = "0.32.3", default-features = false }
glutin-winit = { version = "0.5", default-features = false }

# DX12 and GLES dependencies
windows = { version = "0.62", default-features = false }
Expand Down
1 change: 1 addition & 0 deletions tests/src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ pub fn initialize_instance(backends: wgpu::Backends, params: &TestParameters) ->
},
},
display: None,
window: None,
})
}

Expand Down
1 change: 1 addition & 0 deletions tests/tests/wgpu-validation/api/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ mod request_adapter_error {
memory_budget_thresholds: wgpu::MemoryBudgetThresholds::default(),
backend_options: wgpu::BackendOptions::default(),
display: None,
window: None,
}
}

Expand Down
13 changes: 13 additions & 0 deletions wgpu-core/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ pub struct Instance {
/// When used with `winit`, callers are expected to pass its `OwnedDisplayHandle` (created from
/// the `EventLoop`) here.
display: Option<Box<dyn wgt::WgpuHasDisplayHandle>>,

/// Non-lifetimed [`raw_window_handle::WindowHandle`], for keepalive and validation purposes in
/// [`Self::create_surface()`].
///
/// When used with `winit`, callers are expected to pass its `OwnedDisplayHandle` (created from
/// the `EventLoop`) here.
window: Option<Box<dyn wgt::WgpuHasWindowHandle>>,
}

impl Instance {
Expand All @@ -114,6 +121,7 @@ impl Instance {
// try_add_hal(). Remove it from the mutable descriptor instead, while try_add_hal()
// borrows the handle from `this.display` instead.
display: instance_desc.display.take(),
window: instance_desc.window.take(),
};

#[cfg(vulkan)]
Expand Down Expand Up @@ -161,6 +169,10 @@ impl Instance {
hdh.display_handle()
.expect("Implementation did not provide a DisplayHandle")
}),
window: self.window.as_ref().map(|hdw| {
hdw.window_handle()
.expect("Implementation did not provide a WindowHandle")
}),
};

use hal::Instance as _;
Expand Down Expand Up @@ -192,6 +204,7 @@ impl Instance {
supported_backends: A::VARIANT.into(),
flags: wgt::InstanceFlags::default(),
display: None, // TODO: Extract display from HAL instance if available?
window: None, // TODO: Extract window from HAL instance if available?
}
}

Expand Down
Loading
Loading