diff --git a/examples/shader/custom_render_phase.rs b/examples/shader/custom_render_phase.rs index 56dca9d69f1d71..7f30c1d8f026b8 100644 --- a/examples/shader/custom_render_phase.rs +++ b/examples/shader/custom_render_phase.rs @@ -48,6 +48,9 @@ use bevy::{ }, utils::{nonmax::NonMaxU32, FloatOrd}, }; +use bevy_internal::render::render_resource::{ + BindGroupLayoutEntry, BindingType, BufferBindingType, +}; fn main() { App::new() @@ -233,6 +236,8 @@ impl RenderCommand

for SetMaterialBindGroup bind_group: SystemParamItem<'w, '_, Self::Param>, pass: &mut TrackedRenderPass<'w>, ) -> RenderCommandResult { + println!("!!! set bind group !!!"); + pass.set_bind_group(I, bind_group.into_inner(), &[mesh_index.index()]); RenderCommandResult::Success } @@ -322,10 +327,16 @@ impl FromWorld for CustomPipeline { let bind_group_layout = render_device.create_bind_group_layout( "custom_bind_group_layout", - &BindGroupLayoutEntries::single( - ShaderStages::FRAGMENT, - uniform_buffer::(true), - ), + &[BindGroupLayoutEntry { + binding: 0, + ty: BindingType::Buffer { + ty: BufferBindingType::Uniform, + has_dynamic_offset: true, + min_binding_size: Some(CustomMaterial::min_size()), + }, + visibility: ShaderStages::FRAGMENT, + count: None, + }], ); let shader = world @@ -352,7 +363,7 @@ impl SpecializedMeshPipeline for CustomPipeline { println!("specialize custom"); let mut desc = self.mesh_pipeline.specialize(key, layout)?; - desc.label = Some("mesh_custom_pipeline".into()); + desc.label = Some("custom_mesh_pipeline".into()); // The layout of the pipeline // It's important that it matches the order specified in the `DrawCustom` @@ -400,7 +411,7 @@ fn prepare_custom_bind_group( &custom_pipeline.bind_group_layout, &BindGroupEntries::single(uniform), ); - println!("bind group preprared"); + println!("bind group prepared"); commands.insert_resource(CustomMaterialBindGroup(bind_group)); }