Skip to content

Crashes on startup due to too many bindings #16988

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
BenjaminBrienen opened this issue Dec 26, 2024 · 5 comments · Fixed by #17155
Closed

Crashes on startup due to too many bindings #16988

BenjaminBrienen opened this issue Dec 26, 2024 · 5 comments · Fixed by #17155
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior C-Startup A crash that occurs when first attempting to run a Bevy app P-Crash A sudden unexpected crash S-Needs-Investigation This issue requires detective work to figure out what's going wrong
Milestone

Comments

@BenjaminBrienen
Copy link
Contributor

BenjaminBrienen commented Dec 26, 2024

Bevy version

c03e494: Migrate reflection benchmarks to new naming system (#16986) …

[Optional] Relevant system information

PS C:\Users\BenjaminBrienen\source\bevy> cargo version                                                                                                                                                                              
cargo 1.83.0 (5ffbef321 2024-10-29)
SystemInfo { os: "Windows 11 Pro", kernel: "26100", cpu: "12th Gen Intel(R) Core(TM) i7-12700H", core_count: "14", memory: "31.7 GiB" }
AdapterInfo { name: "Intel(R) Iris(R) Xe Graphics", vendor: 32902, device: 18086, device_type: IntegratedGpu, driver: "Intel Corporation", driver_info: "101.6325", backend: Vulkan }

My drivers are very up-to-date.

What you did

PS C:\Users\BenjaminBrienen\source\bevy> cargo run --example testbed_ui --no-default-features --features "android-game-activity android-game-activity android_shared_stdcxx animation bevy_asset bevy_audio bevy_color bevy_core_pipeline bevy_gilrs bevy_gizmos bevy_gltf bevy_mesh_picking_backend bevy_pbr bevy_picking bevy_remote bevy_render bevy_scene bevy_sprite bevy_sprite_picking_backend bevy_state bevy_ui bevy_ui_picking_backend bevy_window bevy_winit custom_cursor default_font hdr multi_threaded png smaa_luts sysinfo_plugin tonemapping_luts vorbis webgl2 x11"

What went wrong

warning: error finalizing incremental compilation session directory `\\?\C:\Users\BenjaminBrienen\source\bevy\target\debug\incremental\bevy_gltf-3d0vzuikmb2aw\s-h33e87o7fs-12utzwx-working`: Access is denied. (os error 5)

warning: `bevy_gltf` (lib) generated 1 warning
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.84s
     Running `target\debug\examples\testbed_ui.exe`
2024-12-26T21:32:35.430861Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Windows 11 Pro", kernel: "26100", cpu: "12th Gen Intel(R) Core(TM) i7-12700H", core_count: "14", memory: "31.7 GiB" }
2024-12-26T21:32:35.592957Z  INFO bevy_render::renderer: AdapterInfo { name: "Intel(R) Iris(R) Xe Graphics", vendor: 32902, device: 18086, device_type: IntegratedGpu, driver: "Intel Corporation", driver_info: "101.6325", backend: Vulkan }
2024-12-26T21:32:36.498821Z ERROR wgpu::backend::wgpu_core: Handling wgpu errors as fatal by default    
thread 'main' panicked at C:\Users\BenjaminBrienen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-23.0.1\src\backend\wgpu_core.rs:891:18:
wgpu error: Validation Error

Caused by:
  In Device::create_bind_group_layout, label = 'StandardMaterial'
    Too many bindings of type Samplers in Stage ShaderStages(VERTEX | FRAGMENT), limit is 64, count was 96. Check the limit `max_samplers_per_shader_stage` passed to `Adapter::request_device`


note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\examples\testbed_ui.exe` (exit code: 101)

Additional information

Encountered in #16322

@BenjaminBrienen BenjaminBrienen added A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior P-Crash A sudden unexpected crash S-Needs-Investigation This issue requires detective work to figure out what's going wrong labels Dec 26, 2024
@BenjaminBrienen BenjaminBrienen changed the title testbed_ui crashes on startup Crashes on startup due to too many bindings Dec 27, 2024
@BenjaminBrienen BenjaminBrienen added the C-Startup A crash that occurs when first attempting to run a Bevy app label Dec 27, 2024
@BenjaminBrienen
Copy link
Contributor Author

This also happens with trying to run loading_screen

@mockersf
Copy link
Member

Can't reproductible on a Mac.

Could you try to git bisect?

@alice-i-cecile alice-i-cecile added this to the 0.16 milestone Dec 27, 2024
@BenjaminBrienen
Copy link
Contributor Author

BenjaminBrienen commented Dec 28, 2024

#16644

7ed1f327d91a73b3c96f306ae15e53bcc39192f3 is the first bad commit
commit 7ed1f327d91a73b3c96f306ae15e53bcc39192f3 (HEAD)
Author: Patrick Walton <[email protected]>
Date:   Tue Dec 10 09:48:56 2024 -0800

    Make `StandardMaterial` bindless. (#16644)

@BenjaminBrienen
Copy link
Contributor Author

@pcwalton Do you think you could continue the investigation from here? It has to do with the bindless StandardMaterial.

@pcwalton
Copy link
Contributor

Well, the error is quite clear, unfortunately: we have too many samplers. I suppose what we should probably do is to check the max sampler count and if it’s too high for the material, disable bindless for that material. Varying the chunk size isn’t really an option right now because wgpu presently requires all binding arrays to have fixed size specified in the shader.

github-merge-queue bot pushed a commit that referenced this issue Dec 31, 2024
# Objective

Fix #16792

## Solution

Fix the logic to retain loaded ones

## Testing

Unable to test due to #16988
pcwalton added a commit to pcwalton/bevy that referenced this issue Jan 5, 2025
more samplers than are available on the device.

Some hardware and driver combos, such as Intel Iris Xe, have low limits
on the numbers of samplers per shader, causing an overflow. With
first-class bindless arrays, `wgpu` should be able to work around this
limitation eventually, but for now we need to disable bindless materials
on those platforms.

This is an alternative to PR bevyengine#17107 that calculates the precise number
of samplers needed and compares to the hardware sampler limit,
transparently falling back to non-bindless if the limit is exceeded.

Fixes bevyengine#16988.
github-merge-queue bot pushed a commit that referenced this issue Jan 5, 2025
…s more samplers than are available on the device. (#17155)

Some hardware and driver combos, such as Intel Iris Xe, have low limits
on the numbers of samplers per shader, causing an overflow. With
first-class bindless arrays, `wgpu` should be able to work around this
limitation eventually, but for now we need to disable bindless materials
on those platforms.

This is an alternative to PR #17107 that calculates the precise number
of samplers needed and compares to the hardware sampler limit,
transparently falling back to non-bindless if the limit is exceeded.

Fixes #16988.
ecoskey pushed a commit to ecoskey/bevy that referenced this issue Jan 6, 2025
# Objective

Fix bevyengine#16792

## Solution

Fix the logic to retain loaded ones

## Testing

Unable to test due to bevyengine#16988
mrchantey pushed a commit to mrchantey/bevy that referenced this issue Feb 4, 2025
# Objective

Fix bevyengine#16792

## Solution

Fix the logic to retain loaded ones

## Testing

Unable to test due to bevyengine#16988
mrchantey pushed a commit to mrchantey/bevy that referenced this issue Feb 4, 2025
…s more samplers than are available on the device. (bevyengine#17155)

Some hardware and driver combos, such as Intel Iris Xe, have low limits
on the numbers of samplers per shader, causing an overflow. With
first-class bindless arrays, `wgpu` should be able to work around this
limitation eventually, but for now we need to disable bindless materials
on those platforms.

This is an alternative to PR bevyengine#17107 that calculates the precise number
of samplers needed and compares to the hardware sampler limit,
transparently falling back to non-bindless if the limit is exceeded.

Fixes bevyengine#16988.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior C-Startup A crash that occurs when first attempting to run a Bevy app P-Crash A sudden unexpected crash S-Needs-Investigation This issue requires detective work to figure out what's going wrong
Projects
None yet
4 participants