Replies: 3 comments 1 reply
-
POC of changing all the references from R16Float to R32Float and it working on webgpu main...DarkZek:bevy:poc-webgpu-ssao |
Beta Was this translation helpful? Give feedback.
-
Relates to #16089 |
Beta Was this translation helpful? Give feedback.
-
So my proposed implementation for this would be a some type exposed by bevy_render that switches between R16Float and R32Float depending on device compatibility, similar to usize being transparently different depending on platform. It'd probably be made harder having to be exposed both in shaders and in rust. |
Beta Was this translation helpful? Give feedback.
-
An investigation I did into what we need to do to get SSAO on WebGPU, which does increase support on native too.
The reason SSAO is not functional on WebGPU & WebGL is because SSAO requires a single texture of type R16Float with the texture usage of STORAGE_BINDING.
This texture format & usage combination isn’t supported on all platforms:
WebGPU (Source https://gpuweb.github.io/gpuweb/#plain-color-formats)
WebGL (It doesn’t work on my machine but can’t find specifics about support)
Native Vulkan has only 72% support (Source https://vulkan.gpuinfo.org/listlineartilingformats.php)
I assume we went with a R16Float because it provides less ram usage than R32Float while still providing enough precision for the usecase.
One solution to this would be to modify the SSAO compute shader to not require STORAGE_BINDING. The SSAO shader requires STORAGE_BINDING because it writes to the ambient occlusion texture via textureStore. I’m not aware of a way to not require the storage binding texture usage so I don't think this is feesable.
The remaining option is to provide fallback texture format R32Float for targets that don’t support R16Float. This has the benefit of not increasing ram usage unnecessarily for targets that do support R16Float with STORAGE_BINDING, while still allowing these clients to enjoy SSAO albeit with double the ram usage for the feature.
This option gets SSAO working on an extra ~8% of native platforms, and WebGPU. WebGL still has problems with max_storage_textures_per_shader_stage and potentially more.
Beta Was this translation helpful? Give feedback.
All reactions