gfx-rs/wgpu · error
Surface should have a native Vulkan swapchain
Error message
Surface should have a native Vulkan swapchain
What it means
Panic in Vulkan Surface::set_next_present_time: the surface is configured with a non-native (e.g. DXGI-provided) swapchain rather than a Vulkan-created one, so Vulkan present-time control does not apply. The faulty input is the foreign swapchain configuration.
Source
Thrown at wgpu-hal/src/vulkan/mod.rs:284
///
/// The exact semantics of the fields are also documented in the [specification](https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkPresentTimeGOOGLE.html) for the extension.
///
/// # Panics
///
/// - If the surface hasn't been configured.
/// - If the surface has been configured for a DXGI swapchain.
/// - If the device doesn't [support present timing](wgt::Features::VULKAN_GOOGLE_DISPLAY_TIMING).
///
/// [VK_GOOGLE_display_timing]: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_GOOGLE_display_timing.html
#[track_caller]
pub fn set_next_present_time(&self, present_timing: vk::PresentTimeGOOGLE) {
let mut swapchain = self.swapchain.write();
swapchain
.as_mut()
.expect("Surface should have been configured")
.as_any_mut()
.downcast_mut::<swapchain::NativeSwapchain>()
.expect("Surface should have a native Vulkan swapchain")
.set_next_present_time(present_timing);
}
/// Set a `pNext` chain of extension structs to be attached to the [`vk::PresentInfoKHR`]
/// of the next [presentation](crate::Queue::present()) of this surface.
///
/// This supports presentation extensions that `wgpu-hal` has no dedicated support
/// for, such as [VK_NV_present_metering]. The corresponding device extension must be
/// enabled at device creation, e.g. with
/// [`Adapter::open_with_callback()`](super::vulkan::Adapter::open_with_callback).
///
/// The chain is consumed by the next presentation: it replaces any chain set by a
/// previous call that hasn't been presented yet, and is discarded unread if the
/// surface is reconfigured first.
///
/// # Safety
///
/// - `chain` must point to a valid `pNext` chain of structs that can extendView on GitHub (pinned to 3e11ff59bf)
Solutions
- Only use present timing on surfaces whose swapchain was created by the Vulkan backend
- Reconfigure the surface to use the native Vulkan swapchain
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at wgpu-hal/src/vulkan/mod.rs:284 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of gfx-rs/wgpu@3e11ff59bf (2026-09-03).
Data as JSON: /api/errors/d33e57df204d7324.
Report an issue: GitHub.