这是indexloc提供的服务,不要输入任何密码
Skip to content

The bgra8unorm-storage feature should most likely only enable write-only access #4377

@teoxoy

Description

@teoxoy

#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.

from https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#descriptorsets-storageimage

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiWebGPU APIapi resolvedResolved - waiting for a change to the API specification

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions