mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-30 18:14:18 +01:00
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:
24 files changed
+108
-13
No files matched your search
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user