Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDR swapchains on Vulkan + Windows #158

Open
ArthurBrussee opened this issue Aug 14, 2024 · 1 comment
Open

HDR swapchains on Vulkan + Windows #158

ArthurBrussee opened this issue Aug 14, 2024 · 1 comment

Comments

@ArthurBrussee
Copy link

ArthurBrussee commented Aug 14, 2024

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.

@ArthurBrussee ArthurBrussee changed the title HDR swapchain on Vulkan is wrong HDR swapchains on Vulkan Aug 14, 2024
@ArthurBrussee ArthurBrussee changed the title HDR swapchains on Vulkan HDR swapchains on Vulkan + Windows Aug 14, 2024
@jansol
Copy link

jansol commented Aug 16, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants