[MacOs] 0.15 panic: wgpu error: Validation Error
Bevy version
Bevy 0.15
[Optional] Relevant system information
MacOs 15.1.1 (24B91) Rust 1.83.0 (90b35a623 2024-11-26)
If your bug is rendering-related, copy the adapter info that appears when you run Bevy.
Adapter AdapterInfo { name: "Apple M1 Max", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }
What you did
In my project (closed source) once i drop my crate bevy_debug_log my app crashes on start.
What went wrong
thread '<unnamed>' panicked at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-23.0.1/src/backend/wgpu_core.rs:2976:18:
wgpu error: Validation Error
Caused by:
In RenderPass::end
In a pass parameter
Attachments have differing sample counts: the depth attachment's texture view has count 1 but is followed by the color attachment at index 0's texture view which has count 4
stack backtrace:
0: rust_begin_unwind
at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/panicking.rs:665:5
1: core::panicking::panic_fmt
at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/core/src/panicking.rs:74:14
2: wgpu::backend::wgpu_core::default_error_handler
at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-23.0.1/src/backend/wgpu_core.rs:3050:5
3: wgpu::backend::wgpu_core::ErrorSinkRaw::handle_error
at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-23.0.1/src/backend/wgpu_core.rs:3034:21
4: wgpu::backend::wgpu_core::ContextWgpuCore::handle_error_inner
at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-23.0.1/src/backend/wgpu_core.rs:299:9
5: wgpu::backend::wgpu_core::ContextWgpuCore::handle_error
at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-23.0.1/src/backend/wgpu_core.rs:311:9
6: <wgpu::backend::wgpu_core::ContextWgpuCore as wgpu::context::Context>::render_pass_end
at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-23.0.1/src/backend/wgpu_core.rs:2976:18
7: core::ptr::drop_in_place<wgpu::api::render_pass::RenderPassInner>
at /Users/stephan/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:574:1
8: core::ptr::drop_in_place<wgpu::api::render_pass::RenderPass>
at /Users/stephan/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:574:1
9: core::ptr::drop_in_place<bevy_render::render_phase::draw_state::TrackedRenderPass>
at /Users/stephan/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:574:1
10: <bevy_core_pipeline::core_2d::main_transparent_pass_2d_node::MainTransparentPass2dNode as bevy_render::render_graph::node::ViewNode>::run
at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_core_pipeline-0.15.0/src/core_2d/main_transparent_pass_2d_node.rs:81:9
11: <bevy_render::render_graph::node::ViewNodeRunner<T> as bevy_render::render_graph::node::Node>::run
at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_render-0.15.0/src/render_graph/node.rs:414:9
12: bevy_render::renderer::graph_runner::RenderGraphRunner::run_graph
at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_render-0.15.0/src/renderer/graph_runner.rs:225:21
13: bevy_render::renderer::graph_runner::RenderGraphRunner::run_graph
at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_render-0.15.0/src/renderer/graph_runner.rs:232:21
14: bevy_render::renderer::graph_runner::RenderGraphRunner::run
at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_render-0.15.0/src/renderer/graph_runner.rs:80:9
15: bevy_render::renderer::render_system
at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_render-0.15.0/src/renderer/mod.rs:40:15
16: core::ops::function::FnMut::call_mut
at /Users/stephan/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:166:5
17: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
at /Users/stephan/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:294:13
18: <Func as bevy_ecs::system::exclusive_function_system::ExclusiveSystemParamFunction<fn(F0) .> Out>>::run::call_inner
at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.15.0/src/system/exclusive_function_system.rs:245:21
19: <Func as bevy_ecs::system::exclusive_function_system::ExclusiveSystemParamFunction<fn(F0) .> Out>>::run
at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.15.0/src/system/exclusive_function_system.rs:248:17
20: <bevy_ecs::system::exclusive_function_system::ExclusiveFunctionSystem<Marker,F> as bevy_ecs::system::system::System>::run::{{closure}}
at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.15.0/src/system/exclusive_function_system.rs:129:23
21: bevy_ecs::world::World::last_change_tick_scope
at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.15.0/src/world/mod.rs:3187:9
22: <bevy_ecs::system::exclusive_function_system::ExclusiveFunctionSystem<Marker,F> as bevy_ecs::system::system::System>::run
at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.15.0/src/system/exclusive_function_system.rs:121:9
Additional information
maybe related to #16588 though different panic location. and i am not doing any custom shader, material or vertexbuffer shenigans.
my bevy features:
bevy = { version = "0.15", default-features = false, features = [
"bevy_audio",
"bevy_gizmos",
"bevy_text",
"bevy_winit",
"bevy_window",
"bevy_ui",
"multi_threaded",
"vorbis",
"webgl2",
"x11",
] }
running the same code on ios simulator gives slightly more output:
Missing downlevel flags: DownlevelFlags(INDIRECT_EXECUTION | BASE_VERTEX | CUBE_ARRAY_TEXTURES | COMPARISON_SAMPLERS)
The underlying API or device in use does not support enough features to be a fully compliant implementation of WebGPU. A subset of the features can still be used. If you are running this program on native and not in a browser and wish to limit the features you use to the supported subset, call Adapter::downlevel_properties or Device::downlevel_properties to get a listing of the features the current platform supports. log.file="/Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-core-23.0.1/src/instance.rs" log.line=609 log.module_path="wgpu_core::instance" log.target="wgpu_core::instance"
DownlevelCapabilities {
flags: DownlevelFlags(
COMPUTE_SHADERS | FRAGMENT_WRITABLE_STORAGE | READ_ONLY_DEPTH_STENCIL | NON_POWER_OF_TWO_MIPMAPPED_TEXTURES | INDEPENDENT_BLEND | VERTEX_STORAGE | ANISOTROPIC_FILTERING | FRAGMENT_STORAGE | MULTISAMPLED_SHADING | DEPTH_TEXTURE_AND_BUFFER_COPIES | WEBGPU_TEXTURE_FORMAT_SUPPORT | BUFFER_BINDINGS_NOT_16_BYTE_ALIGNED | UNRESTRICTED_INDEX_BUFFER | FULL_DRAW_INDEX_UINT32 | DEPTH_BIAS_CLAMP | VIEW_FORMATS | UNRESTRICTED_EXTERNAL_TEXTURE_COPIES | SURFACE_VIEW_FORMATS | NONBLOCKING_QUERY_RESOLVE | VERTEX_AND_INSTANCE_INDEX_RESPECTS_RESPECTIVE_FIRST_VALUE_IN_INDIRECT_DRAW,
),
limits: DownlevelLimits,
shader_model: Sm5,
} log.file="/Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-core-23.0.1/src/instance.rs" log.line=614 log.module_path="wgpu_core::instance" log.target="wgpu_core::instance"
nw_connection_copy_connected_local_endpoint_block_invoke [C1] Connection has no local endpoint
Failed to send CA Event for app launch measurements for ca_event_type: 0 event_name: com.apple.app_launch_measurement.FirstFramePresentationMetric
Creating new window "App" (0v1#4294967296)
Handling wgpu errors as fatal by default log.file="/Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-23.0.1/src/backend/wgpu_core.rs" log.line=2976 log.module_path="wgpu::backend::wgpu_core" log.target="wgpu::backend::wgpu_core"
thread '<unnamed>' panicked at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-23.0.1/src/backend/wgpu_core.rs:2976:18:
wgpu error: Validation Error
Caused by:
In RenderPass::end
In a pass parameter
Attachments have differing sample counts: the depth attachment's texture view has count 1 but is followed by the color attachment at index 0's texture view which has count 4
ok i found the tinyest reproducer:
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.spawn(Camera2d);
// only difference to example `sprite.rs`
commands.spawn((
Camera2d,
Msaa::Off,
Camera {
order: 1,
..default()
},
));
commands.spawn(Sprite::from_image(
asset_server.load("branding/bevy_bird_dark.png"),
));
}
Its when having two cameras with different Msaa settings. Which kind of sucks, because in this case my crate bevy_debug_log needs to attach its own camera and somehow now needs to know if other cameras have Msaa::Off to mirror that to not trigger this panic