Skip to content

Commit

Permalink
zzre: Fix three Vulkan validations related to cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Helco committed Mar 8, 2024
1 parent 7575080 commit 5b46802
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions zzre.core/imgui/WindowContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ protected override void DisposeManaged()
base.DisposeManaged();
foreach (var window in this.ToArray())
window.Dispose();
onceBeforeUpdate.Invoke();
onceAfterUpdate.Invoke(); // Window Tags like FramebufferArea will defer disposal

ImGuiRenderer.Dispose();
commandList.Dispose();
if (!fence.Signaled)
Expand Down
3 changes: 3 additions & 0 deletions zzre/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ private static void CommonCleanup(ITagContainer diContainer)
diContainer.TryGetTag(out GraphicsDevice graphicsDevice);
diContainer.TryGetTag(out Sdl sdl);
diContainer.TryGetTag(out OpenALDevice openALDevice);

graphicsDevice.WaitForIdle(); // otherwise Vulkan Validation is not happy about us destroying textures

diContainer.RemoveTag<GraphicsDevice>(dispose: false);
diContainer.RemoveTag<Sdl>(dispose: false);
diContainer.RemoveTag<OpenALDevice>(dispose: false);
Expand Down
1 change: 1 addition & 0 deletions zzre/game/UI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ protected override void DisposeManaged()
renderSystems.Dispose();
tagContainer.Dispose();
assetRegistry.Dispose();
ProjectionBuffer.Dispose();
zzContainer.OnResize -= HandleResize;
}

Expand Down

0 comments on commit 5b46802

Please sign in to comment.