gfx-rs/wgpu · error
Surface should have been configured
Error message
Surface should have been configured
What it means
Panic in Vulkan Surface::set_next_present_time: the surface has not been configured yet (no swapchain exists), so there is nothing to attach the present-time info to. The faulty input is calling set_next_present_time before configure.
Source
Thrown at wgpu-hal/src/vulkan/mod.rs:281
/// Note that `wgpu-hal` does *not* provide a way to use that API - you should manually access this through [`ash`].
///
/// This can also be used to add a "not before" timestamp to the presentation.
///
/// 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.
///View on GitHub (pinned to 3e11ff59bf)
Solutions
- Call Surface::configure before setting a next-present timestamp
- Check the surface configuration state before using presentation timing
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at wgpu-hal/src/vulkan/mod.rs:281 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/bcb69cdd3574d87d.
Report an issue: GitHub.