From e8fc2797055b6d029b1c17170eb4d9a95f82c574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Mockers?= Date: Thu, 26 Dec 2024 19:00:21 +0100 Subject: [PATCH 1/9] Fix non-meshlet shaders for non-bindless mode (#16966) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Objective - Running example `load_gltf` when not using bindless gives this error ``` ERROR bevy_render::render_resource::pipeline_cache: failed to process shader: error: no definition in scope for identifier: 'slot' ┌─ crates/bevy_pbr/src/render/pbr_fragment.wgsl:153:13 │ 153 │ slot, │ ^^^^ unknown identifier │ = no definition in scope for identifier: 'slot' ``` - since https://github.com/bevyengine/bevy/pull/16825 ## Solution - Set `slot` to the expected value when not mindless - Also use it for `uv_b` ## Testing - Run example `load_gltf` on a Mac or in wasm --- crates/bevy_pbr/src/render/pbr_fragment.wgsl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/bevy_pbr/src/render/pbr_fragment.wgsl b/crates/bevy_pbr/src/render/pbr_fragment.wgsl index 1df7ef404f7b8..a8a02b3f71a4e 100644 --- a/crates/bevy_pbr/src/render/pbr_fragment.wgsl +++ b/crates/bevy_pbr/src/render/pbr_fragment.wgsl @@ -80,6 +80,7 @@ fn pbr_input_from_standard_material( let base_color = pbr_bindings::material[slot].base_color; let deferred_lighting_pass_id = pbr_bindings::material[slot].deferred_lighting_pass_id; #else // BINDLESS + let slot = mesh[in.instance_index].material_and_lightmap_bind_group_slot & 0xffffu; let flags = pbr_bindings::material.flags; let base_color = pbr_bindings::material.base_color; let deferred_lighting_pass_id = pbr_bindings::material.deferred_lighting_pass_id; @@ -171,7 +172,7 @@ fn pbr_input_from_standard_material( // parallax mapping algorithm easier to understand and reason // about. -Vt, - in.instance_index, + slot, ); #else uv_b = uv; From 78d2149503e109af193fd8e57ef428073f434f30 Mon Sep 17 00:00:00 2001 From: Rob Parrett Date: Thu, 26 Dec 2024 14:10:34 -0800 Subject: [PATCH 2/9] Fix panics in `scene_viewer` and `audio_control` (#16983) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Objective Fixes #16978 While testing, discovered that the morph weight interface in `scene_viewer` has been broken for a while (panics when loaded model has morph weights), probably since #15591. Fixed that too. While testing, saw example text in morph interface with [wrong padding](https://bevyengine.org/learn/contribute/helping-out/creating-examples/#visual-guidelines). Fixed that too. Left the small font size because there may be a lot of morphs to display, so that seems intentional. ## Solution Use normal queries and bail early ## Testing Morph interface can be tested with ``` cargo run --example scene_viewer assets/models/animated/MorphStressTest.gltf ``` ## Discussion I noticed that this fix is different than what is happening in #16976. Feel free to discard this for an alternative fix. I opened this anyway to document the issue with morph weight display. This is on top of #16966 which is required to test. --------- Co-authored-by: François Mockers Co-authored-by: François Mockers --- examples/audio/audio_control.rs | 27 +++++++++++++--- examples/helpers/camera_controller.rs | 6 ++-- .../tools/scene_viewer/morph_viewer_plugin.rs | 31 ++++++++++++------- 3 files changed, 47 insertions(+), 17 deletions(-) diff --git a/examples/audio/audio_control.rs b/examples/audio/audio_control.rs index 2091ac8011966..89600c69deadf 100644 --- a/examples/audio/audio_control.rs +++ b/examples/audio/audio_control.rs @@ -34,11 +34,22 @@ fn setup(mut commands: Commands, asset_server: Res) { #[derive(Component)] struct MyMusic; -fn update_speed(sink: Single<&AudioSink, With>, time: Res