bevy
bevy copied to clipboard
Bevy 0.8.1 3d_shapes example crashes on startup - macOS
Bevy
0.8.1
Relevant system information
- Rust version:
1.67.0-nightly (7e484fc1a 2022-10-27) - macOS Mojave 10.14.6
If your bug is rendering-related, copy the adapter info that appears when you run Bevy.
`AdapterInfo { name: "Intel(R) Iris(TM) Plus Graphics 645", vendor: 0, device: 0, device_type: IntegratedGpu, backend: Metal }`
You should also consider testing the examples of our upstream dependencies to help isolate any setup-specific issue:
- Tested wgpu cube example and it works as expected.
What you did
cargo run --example 3d_shapes
What went wrong
The app starts up then instantly crashes
Additional information
3D works with Bevy 0.7, but not 0.8 and after.
Logs
2022-11-06T13:10:00.760272Z WARN metal::device: Shader warnings: Compilation succeeded with:
program_source:197:25: warning: unused variable 'in'
const FragmentInput in = { is_front, varyings_1.world_position, varyings_1.world_normal, varyings_1.uv };
^
program_source:19:29: warning: unused variable 'POINT_LIGHT_FLAGS_SHADOWS_ENABLED_BIT'
constexpr constant unsigned POINT_LIGHT_FLAGS_SHADOWS_ENABLED_BIT = 1u;
^
program_source:20:29: warning: unused variable 'POINT_LIGHT_FLAGS_SPOT_LIGHT_Y_NEGATIVE'
constexpr constant unsigned POINT_LIGHT_FLAGS_SPOT_LIGHT_Y_NEGATIVE = 2u;
^
program_source:21:29: warning: unused variable 'DIRECTIONAL_LIGHT_FLAGS_SHADOWS_ENABLED_BIT'
constexpr constant unsigned DIRECTIONAL_LIGHT_FLAGS_SHADOWS_ENABLED_BIT = 1u;
^
program_source:22:29: warning: unused variable 'MESH_FLAGS_SHADOW_RECEIVER_BIT'
constexpr constant unsigned MESH_FLAGS_SHADOW_RECEIVER_BIT = 1u;
^
2022-11-06T13:10:00.842787Z ERROR wgpu::backend::direct: Shader translation error for stage FRAGMENT: Metal: Compilation failed:
program_source:687:32: error: no matching function for call to 'dot'
float NdotV_3 = metal::max(metal::dot(in_1.N, in_1.V), 0.00009999999747378752);
^~~~~~~~~~
/System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/3902/Libraries/lib/clang/902.3/include/metal/metal_geometric:171:30: note: candidate template ignored: requirement '_geometric_binary_func_enable<float __attribute__((ext_vector_type(3))), float __attribute__((packed_vector_type(3)))>::value' was not satisfied [with T = float __attribute__((ext_vector_type(3))), U = float __attribute__((packed_vector_type(3)))]
METAL_FUNC make_scalar_t<_O> dot(T x, U y)
^
program_source:693:25: error: no matching function for call to 'reflect'
metal::float3 R_3 = metal::reflect(-in_1.V, in_1.N);
^~~~~~~~~~~~~~
/System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/3902/Libraries/lib/clang/902.3/include/metal/metal_geometric:354:15: note: candidate template ignored: requirement '_geometric_binary_func_enable<float __attribute__((packed_vector_type(3))), float __attribute__((ext_vector_type(3)))>::value' was not satisfied [with T = float __attribute__((packed_vector_type(3))), U = float __attribute__((ext_vector_type(3)))]
METAL_FUNC _O reflect(T i, U n)
^
2022-11-06T13:10:00.842862Z ERROR wgpu::backend::direct: Please report it to https://github.com/gfx-rs/naga
2022-11-06T13:10:00.842931Z ERROR wgpu::backend::direct: Handling wgpu errors as fatal by default
thread 'main' panicked at 'wgpu error: Validation Error
Caused by:
In Device::create_render_pipeline
note: label = `pbr_opaque_mesh_pipeline`
Internal error in FRAGMENT shader: Metal: Compilation failed:
program_source:687:32: error: no matching function for call to 'dot'
float NdotV_3 = metal::max(metal::dot(in_1.N, in_1.V), 0.00009999999747378752);
^~~~~~~~~~
/System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/3902/Libraries/lib/clang/902.3/include/metal/metal_geometric:171:30: note: candidate template ignored: requirement '_geometric_binary_func_enable<float __attribute__((ext_vector_type(3))), float __attribute__((packed_vector_type(3)))>::value' was not satisfied [with T = float __attribute__((ext_vector_type(3))), U = float __attribute__((packed_vector_type(3)))]
METAL_FUNC make_scalar_t<_O> dot(T x, U y)
^
program_source:693:25: error: no matching function for call to 'reflect'
metal::float3 R_3 = metal::reflect(-in_1.V, in_1.N);
^~~~~~~~~~~~~~
/System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/3902/Libraries/lib/clang/902.3/include/metal/metal_geometric:354:15: note: candidate template ignored: requirement '_geometric_binary_func_enable<float __attribute__((packed_vector_type(3))), float __attribute__((ext_vector_type(3)))>::value' was not satisfied [with T = float __attribute__((packed_vector_type(3))), U = float __attribute__((ext_vector_type(3)))]
METAL_FUNC _O reflect(T i, U n)
Useful to know. Does this fail on main as well for you?
It fails on main as well.
works for me on macOS 12.5
AdapterInfo { name: "Apple M1 Max", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }
Could be due to the old macOS version, or the intel graphics. Given the error messages, it seems the shaders are trying to use functions not available, so I would say it's the macOS version
To isolate this further, I'd suggest testing this upstream, on the wgpu examples.
The user noted on Discord that they did test wgpu examples. However, looking at the error message, it looks like a dot product has to be used and the examples may not do that.
@cwfitzgerald ping for wgpu support on old macOS.
I just tested the remaining wgpu examples (had only tested cube).
They all work fine, except conservative-raster, which gives this error:
`thread 'main' panicked at 'Adapter does not support required features for this example: CONSERVATIVE_RASTERIZATION', wgpu/examples/conservative-raster/../framework.rs:195:5`
That has to with my Adapter, and not my macOS version. Please let me know if I should try some other things.
EDIT: Looking at bevy_render dependencies,bevy-0.8.1 uses wgpu version 0.13.1 . bevy-0.7 uses version 0.12 .