Added SSAO support on WebGPU, with R32Float fallback.#20960
Added SSAO support on WebGPU, with R32Float fallback.#20960alice-i-cecile merged 8 commits intobevyengine:mainfrom
Conversation
| // ----------------- | ||
|
|
||
| /// Convert a world space position to clip space | ||
| /// DEPRECATED: use bevy_render::view::position_world_to_clip instead |
|
Oh whoops just read the rest of the PR description. |
|
Also I'm not 100% sure that we'd need this workaround once #8888 (comment) is resolved. But not sure, haven't checked what GPUs don't support |
no updates in #8888 for a while, what's the plan? |
# Objective - Fix chrome rendering bug: <img width="1755" height="985" alt="image" src="https://github.com/user-attachments/assets/6293a960-b8fa-460e-9d71-e7f2a9fb2d20" /> ## Solution - Revert part of #20313 - I don't know why this fixes it, but #20960 also ran into it ## Testing -
# Objective - Fix chrome rendering bug: <img width="1755" height="985" alt="image" src="https://github.com/user-attachments/assets/6293a960-b8fa-460e-9d71-e7f2a9fb2d20" /> ## Solution - Revert part of #20313 - I don't know why this fixes it, but #20960 also ran into it ## Testing -
|
OK, I reverted the fix for Chrome, as I think it's been addressed by #21202 |
|
Hello guys, please let me know what I should do for this MR? Thanks. cc @alice-i-cecile |
| @group(0) @binding(1) var preprocessed_depth_mip0: texture_storage_2d<r#{SSAO_DEPTH_FORMAT}float, write>; | ||
| @group(0) @binding(2) var preprocessed_depth_mip1: texture_storage_2d<r#{SSAO_DEPTH_FORMAT}float, write>; | ||
| @group(0) @binding(3) var preprocessed_depth_mip2: texture_storage_2d<r#{SSAO_DEPTH_FORMAT}float, write>; | ||
| @group(0) @binding(4) var preprocessed_depth_mip3: texture_storage_2d<r#{SSAO_DEPTH_FORMAT}float, write>; | ||
| @group(0) @binding(5) var preprocessed_depth_mip4: texture_storage_2d<r#{SSAO_DEPTH_FORMAT}float, write>; |
There was a problem hiding this comment.
This style of shader val formatting is going away with the incoming wesl migration, would you mind changing this to be a boolean style SSAO_USE_R32FLOAT_FALLBACK and duplicating the bindings instead? CC @tychedelia
There was a problem hiding this comment.
Thank you @atlv24. In that case, I think I can just revert one of the commit and make it the original way of #idfef.
This reverts commit e53c622.
Objective
This PR is to add SSAO support on WebGPU.
Solution
Add r16float detect and fallback to r32float if not supported. FYI the initial ssao PR here.
Testing
Did you test these changes? If so, how?
Yes, here is the command to test the ssao example
RUSTFLAGS="--cfg getrandom_backend=\"wasm_js\"" cargo run --example ssao --target wasm32-unknown-unknown --features webgpuand then http://localhost:1334, make sure it supports WebGPU
Are there any parts that need more testing?
N/A
How can other people (reviewers) test your changes? Is there anything specific they need to know?
Here is the flickering on Mac Chrome(140.0.7339.133 (Official Build) (arm64))
Tested on native(mac) and WebGPU. To test on native, set "detect_r16float_support" to false to force R32Float.
I couldn't make the WebGPU ssao example running on Windows 11 Chrome or Firefox, there is some error in 'taa_pipeline' .