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

vulkan: HDR ASTC formats support #2496

Merged
merged 1 commit into from
Feb 20, 2022
Merged

vulkan: HDR ASTC formats support #2496

merged 1 commit into from
Feb 20, 2022

Conversation

jinleili
Copy link
Contributor

@jinleili jinleili commented Feb 20, 2022

Connections
#2371

Description

  • Add astc_hdr field to PhysicalDeviceFeatures to hold PhysicalDeviceTextureCompressionASTCHDRFeaturesEXT when this feature is supported;
  • Set TEXTURE_COMPRESSION_ASTC_HDR feature if astc_hdr is not none, then use this feature to enable extension;
  • Enable ExtSwapchainColorspaceFn during create Instance to provide wide color gamut support;
  • Choose EXTENDED_SRGB_LINEAR_EXT color space when creating the swapchain;
    • HDR ASTC formarts need linear color space to display, and vulkan swapchain for Android only supports DISPLAY_P3_NONLINEAR_EXT and EXTENDED_SRGB_LINEAR_EXT
    • Maybe better way is using get_physical_device_surface_formats detect color space to choose, but need PhysicalDevice as a parameter that fn create_swapchain cannot provide, that needs to change a lot of code.

Testing
Running on maOS 12.2.1 (M1 Max MacBook Pro, vulkan-portability) can perfectly display HDR ASTC texture via wgpu-on-app demo, but on Ubundu 20.04, currently vulkan driver cannot support WCG color space:

Using llvmpipe (LLVM 13.0.0, 128 bits) (Vulkan)
WARNING: lavapipe is not a conformant vulkan implementation, testing use only.
thread 'main' panicked at 'Error in Surface::configure: requested format Rgba16Float is not in list of supported formats: [Bgra8Unorm, Bgra8UnormSrgb]', /home/parallels/Downloads/forks/wgpu/wgpu/src/backend/direct.rs:231:9

The vk backend on Android has weak support for HDR ASTC formats, I'm tested a lot of Android devices(real devices + cloud devices), all cannot find VK_EXT_texture_compression_astc_hdr extension, screenshots below are of tested cloud Android devices with GL Extensions Viewer installed to detect the vulkan extensions:
cloud android device

vulkan extensions (android 9) vulkan extensions (android 10)

jinleili added a commit to jinleili/wgpu-in-app that referenced this pull request Feb 20, 2022
@kvark
Copy link
Member

kvark commented Feb 20, 2022

Thank you for the PR!
Worth noting that while WebGPU upstream requires Rgba16float, we can't really require it on native. It has to be optional.

wgpu-core/src/instance.rs Show resolved Hide resolved
@kvark kvark merged commit 01628a1 into gfx-rs:master Feb 20, 2022
@jinleili
Copy link
Contributor Author

Supplementing Android test info, I changed to another remote Android devices platform, Snapdragon 865+ CPU devices basically all support HDR ASTC formats.

@teoxoy teoxoy mentioned this pull request Dec 5, 2022
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

Successfully merging this pull request may close these issues.

2 participants