mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-29 01:23:57 +01:00
fix buffer inits being delayed by a frame
leading potentially to stomping previous results Fixes #1555
This commit is contained in:
1 parent
b6a6a67534
commit
3cf52de1e1
1 file changed
+5
-3
@@ -601,12 +601,11 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
let device = device_guard
|
||||
.get_mut(queue_id)
|
||||
.map_err(|_| DeviceError::Invalid)?;
|
||||
let pending_write_command_buffer = device.pending_writes.finish();
|
||||
device.temp_suspected.clear();
|
||||
device.active_submission_index += 1;
|
||||
let submit_index = device.active_submission_index;
|
||||
|
||||
let fence = {
|
||||
let (fence, pending_write_command_buffer) = {
|
||||
let mut signal_swapchain_semaphores = SmallVec::<[_; 1]>::new();
|
||||
let (mut swap_chain_guard, mut token) = hub.swap_chains.write(&mut token);
|
||||
let (mut command_buffer_guard, mut token) = hub.command_buffers.write(&mut token);
|
||||
@@ -758,6 +757,9 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
}
|
||||
}
|
||||
|
||||
// Finish pending writes. Don't do this earlier since buffer init may lead to additional writes (see initialize_buffer_memory).
|
||||
let pending_write_command_buffer = device.pending_writes.finish();
|
||||
|
||||
// now prepare the GPU submission
|
||||
let mut fence = device
|
||||
.raw
|
||||
@@ -786,7 +788,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
Some(&mut fence),
|
||||
);
|
||||
}
|
||||
fence
|
||||
(fence, pending_write_command_buffer)
|
||||
};
|
||||
|
||||
if let Some(comb_raw) = pending_write_command_buffer {
|
||||
|
||||
Reference in new issue
Block a user