{"record":{"id":"bcb69cdd3574d87d","repo":"gfx-rs/wgpu","slug":"surface-should-have-been-configured","errorCode":null,"errorMessage":"Surface should have been configured","messagePattern":"Surface should have been configured","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wgpu-hal/src/vulkan/mod.rs","lineNumber":281,"sourceCode":"    /// Note that `wgpu-hal` does *not* provide a way to use that API - you should manually access this through [`ash`].\n    ///\n    /// This can also be used to add a \"not before\" timestamp to the presentation.\n    ///\n    /// 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.\n    ///\n    /// # Panics\n    ///\n    /// - If the surface hasn't been configured.\n    /// - If the surface has been configured for a DXGI swapchain.\n    /// - If the device doesn't [support present timing](wgt::Features::VULKAN_GOOGLE_DISPLAY_TIMING).\n    ///\n    /// [VK_GOOGLE_display_timing]: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_GOOGLE_display_timing.html\n    #[track_caller]\n    pub fn set_next_present_time(&self, present_timing: vk::PresentTimeGOOGLE) {\n        let mut swapchain = self.swapchain.write();\n        swapchain\n            .as_mut()\n            .expect(\"Surface should have been configured\")\n            .as_any_mut()\n            .downcast_mut::<swapchain::NativeSwapchain>()\n            .expect(\"Surface should have a native Vulkan swapchain\")\n            .set_next_present_time(present_timing);\n    }\n\n    /// Set a `pNext` chain of extension structs to be attached to the [`vk::PresentInfoKHR`]\n    /// of the next [presentation](crate::Queue::present()) of this surface.\n    ///\n    /// This supports presentation extensions that `wgpu-hal` has no dedicated support\n    /// for, such as [VK_NV_present_metering]. The corresponding device extension must be\n    /// enabled at device creation, e.g. with\n    /// [`Adapter::open_with_callback()`](super::vulkan::Adapter::open_with_callback).\n    ///\n    /// The chain is consumed by the next presentation: it replaces any chain set by a\n    /// previous call that hasn't been presented yet, and is discarded unread if the\n    /// surface is reconfigured first.\n    ///","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/gfx-rs/wgpu/blob/3e11ff59bf3f9795d285ecc045014089640d7248/wgpu-hal/src/vulkan/mod.rs#L263-L299","documentation":"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.","triggerScenarios":"Thrown at wgpu-hal/src/vulkan/mod.rs:281 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call Surface::configure before setting a next-present timestamp","Check the surface configuration state before using presentation timing"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3e11ff59bf3f9795d285ecc045014089640d7248","analyzedAt":"2026-09-03T01:43:21.459Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}