HDR swapchains on Vulkan + Windows
ArthurBrussee opened this issue · 1 comments
Hiya,
Zed on Windows is looking rather washed out when using HDR: zed-industries/zed#16182
I think this is due to how blade creates the swapchain. In vulkan/init.rs, it checks supported_formats.rs for
let surface_format = vk::SurfaceFormatKHR {
format: vk::Format::B8G8R8A8_UNORM,
color_space: vk::ColorSpaceKHR::EXTENDED_SRGB_LINEAR_EXT,
};
This is not reported as a supproted format in HDR (even though it is?), so it falls back to
vk::SurfaceFormatKHR {
format: vk::Format::B8G8R8A8_SRGB,
color_space: vk::ColorSpaceKHR::default(),
}
Closest I have gotten Zed to look good is using the whole hog 16 bit float textures, still looks a bit dark though:
let (format, surface_format) = (
crate::TextureFormat::Rgba16Float,
vk::SurfaceFormatKHR {
format: vk::Format::R16G16B16A16_SFLOAT,
color_space: vk::ColorSpaceKHR::EXTENDED_SRGB_LINEAR_EXT,
},
);
I've also tried some of the 'native' HDR swapchain formats like HDR10_ST2084
with A2R10G10B10_UNORM_PACKED
but that looked all kinds of wrong. This seems to happen on both 8 and 10 bit output formats.
I'm not quite deep enough on swapchains to say what is correct here. It's odd that using B8G8R8A8_SRGB doesn't have the WMD do some kind of SDR conversion. wgpu might have issues with this as well gfx-rs/wgpu#4842, not sure. Maybe sRGB + Vulkan + Windows + HDR is just broken, it's strange that a non HDR format is affected at all.
I wonder if this is related to it being a Vulkan application, which in HDR mode should specify HDR metadata. Would be interesting to know if it affects SDR Vulkan games too.