Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access Delta concept. New algorithm of resource synchronization inside one command buffer #1916

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 39 additions & 27 deletions vulkano/src/command_buffer/commands/bind_push.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ impl SyncCommandBufferBuilder {
}

self.current_state.index_buffer = Some((buffer.clone(), index_ty));
self.commands.push(Box::new(Cmd { buffer, index_ty }));
self.append_command(Box::new(Cmd { buffer, index_ty }), &[]);
}

/// Calls `vkCmdBindPipeline` on the builder with a compute pipeline.
Expand All @@ -505,7 +505,7 @@ impl SyncCommandBufferBuilder {
}

self.current_state.pipeline_compute = Some(pipeline.clone());
self.commands.push(Box::new(Cmd { pipeline }));
self.append_command(Box::new(Cmd { pipeline }), &[]);
}

/// Calls `vkCmdBindPipeline` on the builder with a graphics pipeline.
Expand Down Expand Up @@ -534,7 +534,7 @@ impl SyncCommandBufferBuilder {
.map(|(s, _)| s),
);
self.current_state.pipeline_graphics = Some(pipeline.clone());
self.commands.push(Box::new(Cmd { pipeline }));
self.append_command(Box::new(Cmd { pipeline }), &[]);
}

/// Starts the process of binding vertex buffers. Returns an intermediate struct which can be
Expand Down Expand Up @@ -594,13 +594,16 @@ impl SyncCommandBufferBuilder {
);
out.set_len(size as usize);

self.commands.push(Box::new(Cmd {
pipeline_layout: pipeline_layout.clone(),
stages,
offset,
size,
data: out.into(),
}));
self.append_command(
Box::new(Cmd {
pipeline_layout: pipeline_layout.clone(),
stages,
offset,
size,
data: out.into(),
}),
&[],
);

// TODO: Push constant invalidations.
// The Vulkan spec currently is unclear about this, so Vulkano currently just marks
Expand Down Expand Up @@ -668,12 +671,15 @@ impl SyncCommandBufferBuilder {
set_resources.update(write);
}

self.commands.push(Box::new(Cmd {
pipeline_bind_point,
pipeline_layout,
set_num,
descriptor_writes,
}));
self.append_command(
Box::new(Cmd {
pipeline_bind_point,
pipeline_layout,
set_num,
descriptor_writes,
}),
&[],
);
}
}

Expand Down Expand Up @@ -746,12 +752,15 @@ impl<'b> SyncCommandBufferBuilderBindDescriptorSets<'b> {
.insert(first_set + set_num as u32, SetOrPush::Set(set.clone()));
}

self.builder.commands.push(Box::new(Cmd {
descriptor_sets: self.descriptor_sets,
pipeline_bind_point,
pipeline_layout,
first_set,
}));
self.builder.append_command(
Box::new(Cmd {
descriptor_sets: self.descriptor_sets,
pipeline_bind_point,
pipeline_layout,
first_set,
}),
&[],
);
}
}

Expand Down Expand Up @@ -795,11 +804,14 @@ impl<'a> SyncCommandBufferBuilderBindVertexBuffer<'a> {
.insert(first_set + i as u32, buffer.clone());
}

self.builder.commands.push(Box::new(Cmd {
first_set,
inner: Mutex::new(Some(self.inner)),
buffers: self.buffers,
}));
self.builder.append_command(
Box::new(Cmd {
first_set,
inner: Mutex::new(Some(self.inner)),
buffers: self.buffers,
}),
&[],
);
}
}

Expand Down
6 changes: 3 additions & 3 deletions vulkano/src/command_buffer/commands/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ impl SyncCommandBufferBuilder {
}
}

self.commands.push(Box::new(Cmd { label_info }));
self.append_command(Box::new(Cmd { label_info }), &[]);
}

/// Calls `vkCmdEndDebugUtilsLabelEXT` on the builder.
Expand All @@ -192,7 +192,7 @@ impl SyncCommandBufferBuilder {
}
}

self.commands.push(Box::new(Cmd {}));
self.append_command(Box::new(Cmd {}), &[]);
}

/// Calls `vkCmdInsertDebugUtilsLabelEXT` on the builder.
Expand All @@ -216,7 +216,7 @@ impl SyncCommandBufferBuilder {
}
}

self.commands.push(Box::new(Cmd { label_info }));
self.append_command(Box::new(Cmd { label_info }), &[]);
}
}

Expand Down
Loading