Clean up render pass labels

This commit is contained in:
Dzmitry Malyshau 2020-12-15 17:28:19 -05:00
parent 03d2c57dc5
commit cb67ef6542
3 changed files with 6 additions and 1 deletions

View File

@ -118,12 +118,14 @@ impl<B: GfxBackend> CommandAllocator<B> {
used_swap_chain: None,
limits,
private_features,
has_labels: label.is_some(),
#[cfg(feature = "trace")]
commands: if enable_tracing {
Some(Vec::new())
} else {
None
},
#[cfg(debug_assertions)]
label: label.to_string_or_default(),
})
}
@ -209,7 +211,7 @@ impl<B: hal::Backend> CommandAllocator<B> {
) {
// Record this command buffer as pending
let mut inner = self.inner.lock();
let clear_label = !cmd_buf.label.is_empty();
let clear_label = cmd_buf.has_labels;
inner
.pools
.get_mut(&cmd_buf.recorded_thread_id)

View File

@ -45,8 +45,10 @@ pub struct CommandBuffer<B: hal::Backend> {
pub(crate) used_swap_chain: Option<(Stored<id::SwapChainId>, B::Framebuffer)>,
limits: wgt::Limits,
private_features: PrivateFeatures,
has_labels: bool,
#[cfg(feature = "trace")]
pub(crate) commands: Option<Vec<crate::device::trace::Command>>,
#[cfg(debug_assertions)]
pub(crate) label: String,
}

View File

@ -499,6 +499,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
unsafe {
if let Some(ref label) = base.label {
cmd_buf.has_labels = true;
device.raw.set_command_buffer_name(&mut raw, label);
}
raw.begin_primary(hal::command::CommandBufferFlags::ONE_TIME_SUBMIT);