From a256d3398a05224c26ebc9da834b67167214c5e2 Mon Sep 17 00:00:00 2001 From: atlv Date: Fri, 27 Jun 2025 02:59:02 -0400 Subject: [PATCH] use sequential bindings in bevy_sprite (#19830) # Objective - Use the terser api ## Solution - Use the terser api ## Testing - run sprite example it works --- crates/bevy_sprite/src/mesh2d/mesh.rs | 26 ++++++++++---------------- crates/bevy_sprite/src/render/mod.rs | 20 +++++--------------- 2 files changed, 15 insertions(+), 31 deletions(-) diff --git a/crates/bevy_sprite/src/mesh2d/mesh.rs b/crates/bevy_sprite/src/mesh2d/mesh.rs index 204dd85e24..26125c698c 100644 --- a/crates/bevy_sprite/src/mesh2d/mesh.rs +++ b/crates/bevy_sprite/src/mesh2d/mesh.rs @@ -293,19 +293,13 @@ impl FromWorld for Mesh2dPipeline { let tonemapping_lut_entries = get_lut_bind_group_layout_entries(); let view_layout = render_device.create_bind_group_layout( "mesh2d_view_layout", - &BindGroupLayoutEntries::with_indices( + &BindGroupLayoutEntries::sequential( ShaderStages::VERTEX_FRAGMENT, ( - (0, uniform_buffer::(true)), - (1, uniform_buffer::(false)), - ( - 2, - tonemapping_lut_entries[0].visibility(ShaderStages::FRAGMENT), - ), - ( - 3, - tonemapping_lut_entries[1].visibility(ShaderStages::FRAGMENT), - ), + uniform_buffer::(true), + uniform_buffer::(false), + tonemapping_lut_entries[0].visibility(ShaderStages::FRAGMENT), + tonemapping_lut_entries[1].visibility(ShaderStages::FRAGMENT), ), ), ); @@ -755,11 +749,11 @@ pub fn prepare_mesh2d_view_bind_groups( let view_bind_group = render_device.create_bind_group( "mesh2d_view_bind_group", &mesh2d_pipeline.view_layout, - &BindGroupEntries::with_indices(( - (0, view_binding.clone()), - (1, globals.clone()), - (2, lut_bindings.0), - (3, lut_bindings.1), + &BindGroupEntries::sequential(( + view_binding.clone(), + globals.clone(), + lut_bindings.0, + lut_bindings.1, )), ); diff --git a/crates/bevy_sprite/src/render/mod.rs b/crates/bevy_sprite/src/render/mod.rs index 761e2c628a..6c3554e696 100644 --- a/crates/bevy_sprite/src/render/mod.rs +++ b/crates/bevy_sprite/src/render/mod.rs @@ -63,18 +63,12 @@ impl FromWorld for SpritePipeline { let tonemapping_lut_entries = get_lut_bind_group_layout_entries(); let view_layout = render_device.create_bind_group_layout( "sprite_view_layout", - &BindGroupLayoutEntries::with_indices( + &BindGroupLayoutEntries::sequential( ShaderStages::VERTEX_FRAGMENT, ( - (0, uniform_buffer::(true)), - ( - 1, - tonemapping_lut_entries[0].visibility(ShaderStages::FRAGMENT), - ), - ( - 2, - tonemapping_lut_entries[1].visibility(ShaderStages::FRAGMENT), - ), + uniform_buffer::(true), + tonemapping_lut_entries[0].visibility(ShaderStages::FRAGMENT), + tonemapping_lut_entries[1].visibility(ShaderStages::FRAGMENT), ), ), ); @@ -636,11 +630,7 @@ pub fn prepare_sprite_view_bind_groups( let view_bind_group = render_device.create_bind_group( "mesh2d_view_bind_group", &sprite_pipeline.view_layout, - &BindGroupEntries::with_indices(( - (0, view_binding.clone()), - (1, lut_bindings.0), - (2, lut_bindings.1), - )), + &BindGroupEntries::sequential((view_binding.clone(), lut_bindings.0, lut_bindings.1)), ); commands.entity(entity).insert(SpriteViewBindGroup {