Open rokcej opened 1 year ago
In case I didn't forget anything while writing the comment, another consideration is how to go about qualifying f32 (unorm or snorm). I've run https://github.com/kainino0x/gpuinfo-vulkan-query by @kainino0x against these features and it probably needs to be an extension since shaderStorageImageReadWithoutFormat loses quite an amount of old devices (or emulated devices), whereas shaderStorageImageWriteWithoutFormat loses just an enumerable amount (shaderStorageImageWriteWithoutFormat after shaderStorageImageReadWithoutFormat does not lose any additional devices):
Requirement "shaderStorageImageWriteWithoutFormat" loses 3 (and partially loses 0) further deviceNames:
In ALL reports (3 deviceNames):
x PowerVR Rogue GE8300: 1 (5712)
x PowerVR Rogue GE8320: 1 (7432)
x PowerVR Rogue GX6250: 1 (3779)
In SOME reports (0 deviceNames):
Requirement "shaderStorageImageReadWithoutFormat" loses 218 (and partially loses 7) further deviceNames: ...
Python snippet:
add_rq('shaderStorageImageWriteWithoutFormat',
lambda info: 'shaderStorageImageWriteWithoutFormat' in info.features)
add_rq('shaderStorageImageReadWithoutFormat',
lambda info: 'shaderStorageImageReadWithoutFormat' in info.features)
Full report as file is in following attachment: result-20230921-012253.txt
It's very interesting that shaderStorageImageWriteWithoutFormat seems to be basically ubiquitous. Last time we checked I don't think we had the analysis script, so we couldn't see that all of the devices that didn't have it would be unsupported anyway. Also it was 3.5 years ago before we dropped support for some old devices: https://github.com/gpuweb/gpuweb/pull/532#issuecomment-577435144
We should consider adding that to core WebGPU.
Nominating that change for milestone 1.
@alan-baker observed it would be annoying/bad to have the feature depend on the access mode. We now have read-only, read-write storage textures too.
The read-side feature, shaderStorageImageReadWithoutFormat
is much much less supported. Per the report, it loses 218 kinds of Vulkan devices cutting across Qualcomm, NVIDIA, Intel, AMD, Arm.
I was in process of pointing out the same thing, that this can only be added to core for write-only storage textures which could be seen as odd by users.
I think it's very worthwhile even if it can't be used with read-only/read-write. It can avoid unnecessary pipeline creation and reduces development friction since it's easier to do things like change the storage texture format. Syntactically it's pretty clean:
texture_storage_2d<rgba8unorm, write>
texture_storage_2d<rgba8unorm, read_write>
texture_storage_2d<f32, write>
texture_storage_2d<f32, read_write> // invalid
Adding my vote to this issue, it is a common source of WepGPU specific errors with Unity compute shaders that other supported platforms we support don't have.
When I'm using
texture_storage_2d
, I'm forced to hard-code the texel format (e.g.rgba8unorm
) in the shader. Here's an example from my compute shader:Hard-coding
rgba8unorm
seems super redundant, sincevec4<f32>
is used when writing to the texture for several different formats. Why can't I just write something liketexture_storage_2d<f32, write>
, similar to normal texture bindings?Here's the comment from @mehmetoguzderin on WebGPU's Matrix chat: