-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Factor out swapchain to abstracted interface #8356
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
base: trunk
Are you sure you want to change the base?
Conversation
ffab8f0
to
27f1286
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR factors Vulkan swapchain handling into an abstracted, dynamically-dispatchable interface to enable multiple swapchain implementations and prepares synchronization to support both binary and timeline semaphores.
- Introduces swapchain::Surface/Swapchain traits with a native Vulkan implementation.
- Refactors semaphore handling (SemaphoreList) to support both wait and signal paths, including timeline values and stage masks.
- Adapts Instance/Adapter/Queue/Surface integration to the new interfaces.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 11 comments.
Show a summary per file
File | Description |
---|---|
wgpu-hal/src/vulkan/swapchain/native.rs | New native swapchain/surface implementation and related metadata/guards; moved logic from prior monolithic code. |
wgpu-hal/src/vulkan/swapchain/mod.rs | Defines swapchain interfaces (Surface, Swapchain, SurfaceTextureMetadata, guards). |
wgpu-hal/src/vulkan/semaphore_list.rs | Reworks SemaphoreList to handle wait/signal modes, timeline values, and stage masks. |
wgpu-hal/src/vulkan/mod.rs | Wires Surface to trait object, updates Queue submission to use new SemaphoreList, adjusts SurfaceTexture metadata. |
wgpu-hal/src/vulkan/instance.rs | Creates/destroys surfaces via the new trait; config/unconfigure path updated to call into trait objects. |
wgpu-hal/src/vulkan/device.rs | Removes old swapchain construction now handled by swapchain/native. |
wgpu-hal/src/vulkan/adapter.rs | Delegates surface capability queries to the new Surface impl and initializes Queue signal semaphores list. |
Comments suppressed due to low confidence (1)
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
27f1286
to
13feef5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
wgpu-hal/src/vulkan/adapter.rs:1
- Corrected spelling of 'trunkating' to 'truncating'.
use alloc::{borrow::ToOwned as _, boxed::Box, collections::BTreeMap, sync::Arc, vec::Vec};
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Connections
Part of #8354.
Description
In preparation for having multiple swapchain implementations inside the vulkan backend, this pulls out all of the swapchain code into a dynamically dispatchable interface. The code inside the swapchain was merely moved to the new interface, so bulk additions and removals are just moves.
Notably this new interface supports both Binary and Timeline semaphores in all positions, as DXGI interop will be handing timeline semaphores for submit to deal with. In preparation of this, I have updated SemaphoreList to deal with both wait and signal semaphores, with ample sanity checking and validation in debug.
Testing
Manually ran the examples, resized, and closed the window, all without validation layers.
Squash or Rebase?
Izzacommit