Respect DownLevel flag for Cube Array Textures for point_light_shadow_map_array_texture_view.#12849
Conversation
# Conflicts: # crates/bevy_pbr/Cargo.toml # crates/bevy_pbr/src/render/light.rs # crates/bevy_pbr/src/render/mesh.rs # crates/bevy_pbr/src/render/mesh_view_bindings.rs # crates/bevy_render/src/render_resource/pipeline_cache.rs
# Conflicts: # crates/bevy_pbr/Cargo.toml
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 |
…lag-cube-array-texture # Conflicts: # crates/bevy_pbr/src/render/light.rs # crates/bevy_pbr/src/render/mesh.rs # crates/bevy_pbr/src/render/mesh_view_bindings.rs
| point_light_shadow_map: Res<PointLightShadowMap>, | ||
| directional_light_shadow_map: Res<DirectionalLightShadowMap>, | ||
| mut shadow_render_phases: ResMut<ViewBinnedRenderPhases<Shadow>>, | ||
| mut max_directional_lights_warning_emitted: Local<bool>, |
There was a problem hiding this comment.
Started to fail compilation after merging in main, I think it was due to many arguments tripping the compiler out:
error[E0599]: the method `in_set` exists for fn item `fn(Commands<'a, 'b>, ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ...) {prepare_lights}`, but its trait bounds were not satisfied
--> crates/bevy_pbr/src/lib.rs:401:26
Easiest way around it I could find was to merge these two locals into a container struct.
|
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: |
|
@mockersf thanks for testing ⭐ this should be resolved now. |
|
works for me! I would prefer the |
kristoff3r
left a comment
There was a problem hiding this comment.
I haven't tested it, but the changes seem correct to me.
Is the ios_simulator feature still used after this? If not this PR should also remove it + docs and other references.
| not(target_arch = "wasm32"), | ||
| feature = "webgpu" | ||
| ))] | ||
| let supports_cube_array_textures = render_adapter |
There was a problem hiding this comment.
Is there any reason that this would not work in all cases? I feel like it should and then the cfg stuff isn’t needed which simplifies this quite a bit.
There was a problem hiding this comment.
that's how the PR was before #12849 (comment), but that crashed on WebGL2
| not(target_arch = "wasm32"), | ||
| feature = "webgpu" | ||
| ))] | ||
| let supports_cube_array_textures = render_adapter |
There was a problem hiding this comment.
Same here. Why can’t this code be used in all cases?
|
There is still interest in this if you want to resolve the merge conflicts. :) |
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
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