Add DeviceDescriptor::default_queue: QueueDescriptor to support setting label to queue (#10109)

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
Sam authored and GitHub committed 2026-08-19 10:06:10 +00:00
1 parent b4ced71d93
commit feab2f79ef
24 files changed
+108 -13

No files matched your search

+8 -10
View File
@@ -1,6 +1,6 @@
#[cfg(feature = "trace")]
use alloc::string::ToString as _;
use alloc::{boxed::Box, sync::Arc, vec, vec::Vec};
use alloc::{boxed::Box, string::String, sync::Arc, vec, vec::Vec};
use core::{
iter,
mem::{self, ManuallyDrop},
@@ -26,7 +26,7 @@ use crate::{
CommandAllocator, CommandBuffer, CommandEncoder, CommandEncoderError, CopySide,
TransferError,
},
device::{DeviceError, WaitIdleError},
device::{DeviceError, QueueDescriptor, WaitIdleError},
get_lowest_common_denom, hal_label,
init_tracker::{has_copy_partial_init_tracker_coverage, TextureInitRange},
lock::{rank, Mutex, MutexGuard, RwLock, RwLockWriteGuard},
@@ -42,7 +42,7 @@ use crate::{
scratch::ScratchBuffer,
snatch::{SnatchGuard, Snatchable},
track::{self, Tracker, TrackerIndex},
FastHashMap, SubmissionIndex,
FastHashMap, LabelHelpers, SubmissionIndex,
};
use crate::{device::resource::CommandIndices, resource::RawResourceAccess};
@@ -50,6 +50,7 @@ pub struct Queue {
raw: Box<dyn hal::DynQueue>,
pub(crate) pending_writes: Mutex<PendingWrites>,
life_tracker: Mutex<LifetimeTracker>,
label: String,
// The device needs to be dropped last (`Device.zero_buffer` might be referenced by the encoder in pending writes).
pub(crate) device: Arc<Device>,
}
@@ -58,6 +59,7 @@ impl Queue {
pub(crate) fn new(
device: Arc<Device>,
raw: Box<dyn hal::DynQueue>,
desc: QueueDescriptor,
instance_flags: wgt::InstanceFlags,
) -> Result<Self, DeviceError> {
let pending_encoder = device
@@ -103,6 +105,7 @@ impl Queue {
Ok(Queue {
raw,
device,
label: desc.label.to_string(),
pending_writes: Mutex::new(rank::QUEUE_PENDING_WRITES, pending_writes),
life_tracker: Mutex::new(rank::QUEUE_LIFE_TRACKER, LifetimeTracker::new()),
})
@@ -262,12 +265,7 @@ impl Queue {
}
crate::impl_resource_type!(Queue);
// TODO: https://github.com/gfx-rs/wgpu/issues/4014
impl Labeled for Queue {
fn label(&self) -> &str {
""
}
}
crate::impl_labeled!(Queue);
crate::impl_parent_device!(Queue);
crate::impl_storage_item!(Queue);
@@ -1468,7 +1466,7 @@ impl Queue {
&self,
submit_index: SubmissionIndex,
commands: Option<Vec<crate::command::Command<crate::command::PointerReferences>>>,
error: alloc::string::String,
error: String,
) {
if let Some(ref mut trace) = *self.device.trace.lock() {
trace.add(Action::FailedCommands {