bevy
bevy copied to clipboard
Respect DownLevel flag for Cube Array Textures for point_light_shadow_map_array_texture_view.
Objective
This is a follow up on my PR #12052 for fixing missing Cube Array Texture support on iOS simulator. I've since noticed that iPhone 7, iPad 6th and 7th gen also run a Metal family not supporting Cube Array Textures. This PR makes it so that we respect the DownLevel flags from WGPU through the whole chain instead of using features to pick the correct one.
Solution
- Use
render_adapter.get_downlevel_capabilities().flags.contains(DownlevelFlags::CUBE_ARRAY_TEXTURES)to identify which texture format we should use instead of relying on a compile time feature flag.
Changelog
Fixed
- Use correct texture format for point_light_shadow_map_array_texture_view on GPUs which are missing CUBE_ARRAY_TEXTURES support.
iPhone 7, iPad 6th and 7th gen
Just noting that these are all unsupported hardware for webgpu (it's targeting iphone 8/a11 SOC as the min spec), and the 6th gen iPad especially is a massive pain to support (high res screen with only 1.4GB usable ram for both GPU and CPU means constant OOMs).
@Elabajaba we've had some degree of success running in production on iPad 6th and iPad 7th after employing this change and using WgpuSettingsPriority::Compatibility using the Metal backend natively on iPadOS. These iPads are still very widely supported by Apple, they got iPadOS 17 for example, and really common unfortunately. So they are devices we feel like we need support in our application to some degree.
FWIW, Apple provides a separate device type for the simulator, with its capabilities limited to an Apple family 2 GPU (which is the old A8 chip). This means that the simulator often supports fewer features or has more limitations compared to actual iOS devices. Here is the relevant documentation: https://developer.apple.com/documentation/metal/developing_metal_apps_that_run_in_simulator
I think it might not be necessary to modify the render code for compatibility with the A8 chip.
@jinleili this specific PR fixes issues pertaining to physical Apple devices, not the iOS simulator. We've been running this change in production for a few months and are quite stable on those devices post this change.
I can't share exact stats, but active sessions are in the thousands per day on those devices. So we are quite confident that this works. Would be great if we could get this is in, right now we are currently running of a fork with this being the only change employed.
This breaks support for Wasm/WebGL2:
Caused by:
In Device::create_render_pipeline
note: label = `pbr_opaque_mesh_pipeline`
Error matching ShaderStages(FRAGMENT) shader requirements against the pipeline
Shader global ResourceBinding { group: 0, binding: 2 } is not available in the pipeline layout
View dimension Cube (is array: false) doesn't match the binding Texture { sample_type: Depth, view_dimension: CubeArray, multisampled: false }
@mockersf thanks for testing ⭐ this should be resolved now.
works for me! I would prefer the if to be only on the changing field like in my suggested change
There is still interest in this if you want to resolve the merge conflicts. :)