Add record_commands
This commit is contained in:
parent
2300c25603
commit
1f7bfd142c
2 changed files with 22 additions and 12 deletions
|
@ -49,6 +49,26 @@ pub trait AsRecordable {
|
|||
|
||||
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 {
|
||||
|
|
|
@ -263,7 +263,7 @@ impl Scene for MainScene {
|
|||
state
|
||||
.pipeline_loader
|
||||
.with_pipeline::<SimplePipeline, _>(|pipeline| {
|
||||
SimplePipeline::record_bind_commands(
|
||||
SimplePipeline::record_commands(
|
||||
&mut builder,
|
||||
&app_context.descriptor_set_allocator,
|
||||
pipeline,
|
||||
|
@ -278,13 +278,8 @@ impl Scene for MainScene {
|
|||
.clone(),
|
||||
],
|
||||
)?;
|
||||
SimplePipeline::record_draw_commands(
|
||||
&mut builder,
|
||||
&state.square,
|
||||
&square_transform_uniform,
|
||||
)?;
|
||||
|
||||
SimplePipeline::record_bind_commands(
|
||||
SimplePipeline::record_commands(
|
||||
&mut builder,
|
||||
&app_context.descriptor_set_allocator,
|
||||
pipeline,
|
||||
|
@ -299,11 +294,6 @@ impl Scene for MainScene {
|
|||
.clone(),
|
||||
],
|
||||
)?;
|
||||
SimplePipeline::record_draw_commands(
|
||||
&mut builder,
|
||||
&state.obj,
|
||||
&obj_transform_uniform,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
})?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue