gfx-rs/wgpu · error
`ExtendedDisplayP3` is never reported in the Vulkan surface
Error message
`ExtendedDisplayP3` is never reported in the Vulkan surface capabilities
What it means
`map_surface_color_space` panics on `SurfaceColorSpace::ExtendedDisplayP3` because that color space is never reported in Vulkan surface capabilities, meaning the Vulkan backend cannot honor it. Selecting it for a Vulkan-configured surface is an unsupported configuration and trips an unreachable!.
Source
Thrown at wgpu-hal/src/vulkan/conv.rs:207
vk::ColorSpaceKHR::DISPLAY_P3_NONLINEAR_EXT => Scs::DisplayP3,
vk::ColorSpaceKHR::HDR10_ST2084_EXT => Scs::Bt2100Pq,
vk::ColorSpaceKHR::HDR10_HLG_EXT => Scs::Bt2100Hlg,
_ => return None,
})
}
pub fn map_surface_color_space(color_space: wgt::SurfaceColorSpace) -> vk::ColorSpaceKHR {
use wgt::SurfaceColorSpace as Scs;
match color_space {
Scs::Auto => unreachable!("wgpu-core resolves `Auto` before configuring the surface"),
Scs::Srgb => vk::ColorSpaceKHR::SRGB_NONLINEAR,
Scs::ExtendedSrgbLinear => vk::ColorSpaceKHR::EXTENDED_SRGB_LINEAR_EXT,
Scs::ExtendedSrgb => vk::ColorSpaceKHR::EXTENDED_SRGB_NONLINEAR_EXT,
Scs::DisplayP3 => vk::ColorSpaceKHR::DISPLAY_P3_NONLINEAR_EXT,
Scs::Bt2100Pq => vk::ColorSpaceKHR::HDR10_ST2084_EXT,
Scs::Bt2100Hlg => vk::ColorSpaceKHR::HDR10_HLG_EXT,
Scs::ExtendedDisplayP3 => {
unreachable!("`ExtendedDisplayP3` is never reported in the Vulkan surface capabilities")
}
}
}
impl crate::Attachment<'_, super::TextureView> {
pub(super) fn make_attachment_key(&self, ops: crate::AttachmentOps) -> super::AttachmentKey {
super::AttachmentKey {
format: self.view.raw_format,
layout: derive_image_layout(self.usage, self.view.format),
ops,
}
}
}
impl crate::ColorAttachment<'_, super::TextureView> {
pub(super) unsafe fn make_vk_clear_color(&self) -> vk::ClearColorValue {
let cv = &self.clear_value;
match self.target.view.format.sample_type(None, None).unwrap() {View on GitHub (pinned to 3e11ff59bf)
Solutions
- Choose a supported Vulkan color space such as `ExtendedSrgb`, `ExtendedSrgbLinear`, `Bt2100Pq`, `Bt2100Hlg`, or `DisplayP3`
- Query the surface/adapter capabilities first and only request color spaces the backend reports
- Guard with a runtime check: if the adapter backend is Vulkan, avoid ExtendedDisplayP3
Example fix
// before config.color_space = wgpu::SurfaceColorSpace::ExtendedDisplayP3; // after config.color_space = wgpu::SurfaceColorSpace::ExtendedSrgbLinear; // supported on Vulkan
Defensive patterns
Strategy: validation
Validate before calling
let supported = match adapter.get_info().backend {
wgpu::Backend::Vulkan => config.color_space != wgpu::SurfaceColorSpace::ExtendedDisplayP3,
_ => true,
};
assert!(supported, "ExtendedDisplayP3 unsupported on Vulkan"); Prevention
- Check surface capabilities before picking exotic color spaces
- Avoid hardcoding color spaces across platforms; query per adapter backend
- Use ExtendedSrgbLinear as the HDR fallback on Vulkan
When it happens
Trigger: Requesting `SurfaceConfiguration { color_space: SurfaceColorSpace::ExtendedDisplayP3, .. }` on a surface whose adapter is backed by Vulkan (directly or by constructing configuration through internal APIs).
Common situations: Porting an app from Metal (where Display P3 extended variants may exist) to Vulkan/Windows/Linux and keeping the same color space setting; picking a color space from a hardcoded constant without checking what the surface capabilities report.
Related errors
- wgpu-core resolves `Auto` before configuring the surface
- Cannot create swapchain with Auto PresentationMode
- Buffers are required to build acceleration structures
- This vulkan device is affected by [#8333](https://github.com
- vkFreeDescriptorSets error: {err}, please report this error
AI-assisted analysis of gfx-rs/wgpu@3e11ff59bf (2026-09-03).
Data as JSON: /api/errors/7430415080eea52f.
Report an issue: GitHub.