Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swapchain performance/correctness #92

Merged
merged 6 commits into from
Feb 17, 2025
Merged

Swapchain performance/correctness #92

merged 6 commits into from
Feb 17, 2025

Conversation

attackgoat
Copy link
Owner

@attackgoat attackgoat commented Feb 15, 2025

Modifies the Display struct to own a Swapchain, instead of operating in conjunction with it. Fixes the incorrect "image ready" fence which was waited upon before submitting new frames.

The previous behavior was unsound and only worked on certain hardware.

The new pattern greatly simplifies swapchain handling:

  • A list of command buffers available to execute frame submissions is kept in Display
  • The list of command buffers may have 1 or more items, up to and beyond the number of swapchain images

Process:

  • vkAcquireNextImageKHR signals an "acquire" semaphore when the image is available
  • Rendering commands wait for "acquire" and signal a "rendered" semaphore
  • vkQueuePresentKHR waits for "rendered" before presenting the image

Additionally, recreating the swapchain no longer uses vkDeviceWaitIdle. This improves window resizing performance.

@attackgoat attackgoat changed the title Various fixes Swapchain performance/correctness Feb 17, 2025
@attackgoat
Copy link
Owner Author

Tested platforms:

  • Windows Nvidia
  • Windows Intel Iris Xe
  • X11 Nvidia
  • Wayland Nvidia
  • Apple M3

Notes:

  • Found unrelated issues in multithread.rs and egui.rs which cause segfaults on Windows and Wayland
  • Resizing the window on Apple causes a segfault - this will be solved later

Platform support:

  • Windows and X11: All bugs should be solved ASAP
  • Apple: Some bugs will exist and be solved as time permits
  • Wayland: Best effort, but it doesn't run Chrome properly so
  • Android: Should work, I welcome someone to help verify this

@attackgoat attackgoat merged commit 7cde64b into master Feb 17, 2025
3 checks passed
@attackgoat attackgoat deleted the misc-fixes branch February 17, 2025 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Running triangle example with DeviceInfo debug enabled crashes.
1 participant