-
Notifications
You must be signed in to change notification settings - Fork 345
Description
#4326 added read-only access to bgra8unorm (if the bgra8unorm-storage feature is supported) based on the findings in #3838 (comment); but I haven't considered bgra8unorm's additional requirements (on Vulkan) in my investigation.
Vulkan
Storage image loads are supported in all shader stages for image views whose format features contain VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT.
In addition to VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT, bgra8unorm requires VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT for read-only access (KhronosGroup/Vulkan-Docs#2027 (comment)).
The reports at https://vulkan.gpuinfo.org/ don't contain VkFormatFeatureFlagBits2 info (SaschaWillems/VulkanCapsViewer#194), so we can't analyze the hardware/driver landscape for STORAGE_WRITE_WITHOUT_FORMAT vs STORAGE_WRITE_WITHOUT_FORMAT. But at least based on intel's open-source mesa driver code we can see that the write access is a lot more common than the read access. More context can be found here: gfx-rs/wgpu#4655.
For completeness, here are the current requirements for bgra8unorm with STORAGE_BINDING usage on underlying APIs:
| Vulkan | D3D12 FL11_0 | Metal | |
|---|---|---|---|
| write-only | STORAGE_WRITE_WITHOUT_FORMAT |
"UAV Typed Store" | ✅ |
| read-only | STORAGE_READ_WITHOUT_FORMAT |
✅ (via SRV) | ✅ |
| read-write | STORAGE_WRITE_WITHOUT_FORMAT & STORAGE_READ_WITHOUT_FORMAT |
"UAV Typed Store" & "UAV Typed Load" | ❌ |
I think the bgra8unorm-storage feature should only allow write-only access (as it originally did).