mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
hal/vulkan: add debug names to all swapchain semaphores
This commit is contained in:
parent
f5d8a0a06a
commit
c5efc89b08
@ -577,8 +577,8 @@ impl super::Device {
|
||||
// semaphores, since we prospectively need to provide the call to
|
||||
// acquire the next image with an unsignaled semaphore.
|
||||
let surface_semaphores = (0..=images.len())
|
||||
.map(|_| {
|
||||
super::SwapchainImageSemaphores::new(&self.shared)
|
||||
.map(|i| {
|
||||
super::SwapchainImageSemaphores::new(&self.shared, i)
|
||||
.map(Mutex::new)
|
||||
.map(Arc::new)
|
||||
})
|
||||
@ -3018,11 +3018,19 @@ impl crate::Device for super::Device {
|
||||
}
|
||||
|
||||
impl super::DeviceShared {
|
||||
pub(super) fn new_binary_semaphore(&self) -> Result<vk::Semaphore, crate::DeviceError> {
|
||||
pub(super) fn new_binary_semaphore(
|
||||
&self,
|
||||
name: &str,
|
||||
) -> Result<vk::Semaphore, crate::DeviceError> {
|
||||
unsafe {
|
||||
self.raw
|
||||
let semaphore = self
|
||||
.raw
|
||||
.create_semaphore(&vk::SemaphoreCreateInfo::default(), None)
|
||||
.map_err(super::map_host_device_oom_err)
|
||||
.map_err(super::map_host_device_oom_err)?;
|
||||
|
||||
self.set_object_name(semaphore, name);
|
||||
|
||||
Ok(semaphore)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1129,6 +1129,8 @@ impl crate::Surface for super::Surface {
|
||||
}
|
||||
};
|
||||
|
||||
log::error!("Got swapchain image {index}");
|
||||
|
||||
drop(locked_swapchain_semaphores);
|
||||
// We only advance the surface semaphores if we successfully acquired an image, otherwise
|
||||
// we should try to re-acquire using the same semaphores.
|
||||
|
||||
@ -262,16 +262,22 @@ struct SwapchainImageSemaphores {
|
||||
///
|
||||
/// [`acquire`]: SwapchainImageSemaphores::acquire
|
||||
previously_used_submission_index: crate::FenceValue,
|
||||
|
||||
/// Which image this semaphore set is used for.
|
||||
frame_index: usize,
|
||||
}
|
||||
|
||||
impl SwapchainImageSemaphores {
|
||||
fn new(device: &DeviceShared) -> Result<Self, crate::DeviceError> {
|
||||
fn new(device: &DeviceShared, frame_index: usize) -> Result<Self, crate::DeviceError> {
|
||||
Ok(Self {
|
||||
acquire: device.new_binary_semaphore()?,
|
||||
acquire: device.new_binary_semaphore(&format!(
|
||||
"SwapchainImageSemaphore: Image {frame_index} acquire"
|
||||
))?,
|
||||
should_wait_for_acquire: true,
|
||||
present: Vec::new(),
|
||||
present_index: 0,
|
||||
previously_used_submission_index: 0,
|
||||
frame_index,
|
||||
})
|
||||
}
|
||||
|
||||
@ -304,7 +310,10 @@ impl SwapchainImageSemaphores {
|
||||
let sem = match self.present.get(self.present_index) {
|
||||
Some(sem) => *sem,
|
||||
None => {
|
||||
let sem = device.new_binary_semaphore()?;
|
||||
let sem = device.new_binary_semaphore(&format!(
|
||||
"SwapchainImageSemaphore: Image {} present semaphore {}",
|
||||
self.frame_index, self.present_index
|
||||
))?;
|
||||
self.present.push(sem);
|
||||
sem
|
||||
}
|
||||
@ -729,7 +738,7 @@ impl RelaySemaphores {
|
||||
fn new(device: &DeviceShared) -> Result<Self, crate::DeviceError> {
|
||||
Ok(Self {
|
||||
wait: None,
|
||||
signal: device.new_binary_semaphore()?,
|
||||
signal: device.new_binary_semaphore("RelaySemaphores: 1")?,
|
||||
})
|
||||
}
|
||||
|
||||
@ -744,7 +753,7 @@ impl RelaySemaphores {
|
||||
// The second submission should wait on `old.signal`, and then
|
||||
// signal a new semaphore which we'll create now.
|
||||
self.wait = Some(old.signal);
|
||||
self.signal = device.new_binary_semaphore()?;
|
||||
self.signal = device.new_binary_semaphore("RelaySemaphores: 2")?;
|
||||
}
|
||||
Some(ref mut wait) => {
|
||||
// What this submission signals, the next should wait.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user