Skip to content

Commit

Permalink
Update comment why it's important to destroy textures after submit, n…
Browse files Browse the repository at this point in the history
…ot before
  • Loading branch information
Wumpf authored Oct 6, 2024
1 parent 2efa244 commit 7f81524
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/egui-wgpu/src/winit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,9 @@ impl Painter {
vsync_sec += start.elapsed().as_secs_f32();
};

// Free textures marked for destruction **after** queue submit since they might still be used in the current frame.
// Calling `wgpu::Texture::destroy` on a texture that is still in use would invalidate the command buffer(s) it is used in.
// However, once we called `wgpu::Queue::submit`, it is up for wgpu to determine how long the underlying gpu resource has to live.
{
let mut renderer = render_state.renderer.write();
for id in &textures_delta.free {
Expand Down

0 comments on commit 7f81524

Please sign in to comment.