Add record_commands

This commit is contained in:
Florian RICHER 2025-06-09 21:07:17 +02:00
parent 2300c25603
commit 1f7bfd142c
Signed by: florian.richer
GPG key ID: C73D37CBED7BFC77
2 changed files with 22 additions and 12 deletions

View file

@ -49,6 +49,26 @@ pub trait AsRecordable {
Ok(()) Ok(())
} }
fn record_commands(
builder: &mut AutoCommandBufferBuilder<PrimaryAutoCommandBuffer>,
descriptor_set_allocator: &Arc<StandardDescriptorSetAllocator>,
pipeline: &Arc<GraphicsPipeline>,
mesh: &impl AsRenderableMesh,
instances: &impl AsRenderableMeshInstance,
descriptor_sets: Vec<Arc<dyn AsDescriptorSet>>,
) -> Result<(), Box<dyn Error>> {
Self::record_bind_commands(
builder,
descriptor_set_allocator,
pipeline,
mesh,
instances,
descriptor_sets,
)?;
Self::record_draw_commands(builder, mesh, instances)?;
Ok(())
}
} }
pub trait AsRenderableMesh { pub trait AsRenderableMesh {

View file

@ -263,7 +263,7 @@ impl Scene for MainScene {
state state
.pipeline_loader .pipeline_loader
.with_pipeline::<SimplePipeline, _>(|pipeline| { .with_pipeline::<SimplePipeline, _>(|pipeline| {
SimplePipeline::record_bind_commands( SimplePipeline::record_commands(
&mut builder, &mut builder,
&app_context.descriptor_set_allocator, &app_context.descriptor_set_allocator,
pipeline, pipeline,
@ -278,13 +278,8 @@ impl Scene for MainScene {
.clone(), .clone(),
], ],
)?; )?;
SimplePipeline::record_draw_commands(
&mut builder,
&state.square,
&square_transform_uniform,
)?;
SimplePipeline::record_bind_commands( SimplePipeline::record_commands(
&mut builder, &mut builder,
&app_context.descriptor_set_allocator, &app_context.descriptor_set_allocator,
pipeline, pipeline,
@ -299,11 +294,6 @@ impl Scene for MainScene {
.clone(), .clone(),
], ],
)?; )?;
SimplePipeline::record_draw_commands(
&mut builder,
&state.obj,
&obj_transform_uniform,
)?;
Ok(()) Ok(())
})?; })?;