{"record":{"id":"d33e57df204d7324","repo":"gfx-rs/wgpu","slug":"surface-should-have-a-native-vulkan-swapchain","errorCode":null,"errorMessage":"Surface should have a native Vulkan swapchain","messagePattern":"Surface should have a native Vulkan swapchain","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wgpu-hal/src/vulkan/mod.rs","lineNumber":284,"sourceCode":"    ///\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    ///\n    /// # Safety\n    ///\n    /// - `chain` must point to a valid `pNext` chain of structs that can extend","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/gfx-rs/wgpu/blob/3e11ff59bf3f9795d285ecc045014089640d7248/wgpu-hal/src/vulkan/mod.rs#L266-L302","documentation":"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.","triggerScenarios":"Thrown at wgpu-hal/src/vulkan/mod.rs:284 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Only use present timing on surfaces whose swapchain was created by the Vulkan backend","Reconfigure the surface to use the native Vulkan swapchain"],"exampleFix":null,"handlingStrategy":"type-guard","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"}