Skip to content

Commit e3dd7b3

Browse files
WIP: add DeviceDescriptor::default_queue of new type QueueDescriptor
1 parent 06e2c7d commit e3dd7b3

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ Bottom level categories:
4242

4343
## Unreleased
4444

45+
### Added/New Features
46+
47+
#### General
48+
49+
- Added `DeviceDescriptor::default_queue` of new type `QueueDescriptor`. By @ErichDonGubler in [#????](https://github.com/gfx-rs/wgpu/pull/????).
50+
- `DeviceDescriptor::map_label` now takes a `FnMut`, instead of a `FnOnce`.
51+
4552
## v29.0.0 (2026-03-18)
4653

4754
### Major Changes

wgpu-types/src/device.rs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ pub struct DeviceDescriptor<L> {
2424
/// Exactly the specified limits, and no better or worse,
2525
/// will be allowed in validation of API calls on the resulting device.
2626
pub required_limits: crate::Limits,
27+
/// A descriptor for the default queue created with this device.
28+
pub default_queue: QueueDescriptor<L>,
2729
/// Specifies whether `self.required_features` is allowed to contain experimental features.
2830
#[cfg_attr(feature = "serde", serde(skip))]
2931
pub experimental_features: crate::ExperimentalFeatures,
@@ -37,11 +39,13 @@ pub struct DeviceDescriptor<L> {
3739
impl<L> DeviceDescriptor<L> {
3840
/// Takes a closure and maps the label of the device descriptor into another.
3941
#[must_use]
40-
pub fn map_label<K>(&self, fun: impl FnOnce(&L) -> K) -> DeviceDescriptor<K> {
42+
pub fn map_label<K>(&self, fun: impl FnMut(&L) -> K) -> DeviceDescriptor<K> {
43+
let mut fun = fun;
4144
DeviceDescriptor {
4245
label: fun(&self.label),
4346
required_features: self.required_features,
4447
required_limits: self.required_limits.clone(),
48+
default_queue: self.default_queue.map_label(fun),
4549
experimental_features: self.experimental_features,
4650
memory_hints: self.memory_hints.clone(),
4751
trace: self.trace.clone(),
@@ -102,3 +106,24 @@ pub enum Trace {
102106
#[cfg(feature = "trace")]
103107
Memory,
104108
}
109+
110+
/// Describes a [`Queue`](../wgpu/struct.Queue.html).
111+
///
112+
/// Corresponds to [WebGPU `GPUDeviceDescriptor`](
113+
/// https://gpuweb.github.io/gpuweb/#gpuqueuedescriptor).
114+
#[derive(Clone, Debug, Default)]
115+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
116+
pub struct QueueDescriptor<L> {
117+
/// Debug label for the queue.
118+
pub label: L,
119+
}
120+
121+
impl<L> QueueDescriptor<L> {
122+
/// Takes a closure and maps the label of the device descriptor into another.
123+
#[must_use]
124+
pub fn map_label<K>(&self, fun: impl FnOnce(&L) -> K) -> QueueDescriptor<K> {
125+
QueueDescriptor {
126+
label: fun(&self.label),
127+
}
128+
}
129+
}

0 commit comments

Comments
 (0)