1121: Implement render bundle freeing r=straightforward a=kvark

**Connections**
Fixes #1120

**Description**
Since render bundles were added the relevant bits of logic to free them were just missing.

**Testing**
Untested

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
This commit is contained in:
bors[bot]
2021-01-04 14:32:45 +00:00
committed by GitHub
3 changed files with 11 additions and 1 deletions

View File

@@ -65,6 +65,8 @@ pub enum DrawError {
pub enum RenderCommandError {
#[error("bind group {0:?} is invalid")]
InvalidBindGroup(id::BindGroupId),
#[error("render bundle {0:?} is invalid")]
InvalidRenderBundle(id::RenderBundleId),
#[error("bind group index {index} is greater than the device's requested `max_bind_group` limit {max}")]
BindGroupIndexOutOfRange { index: u8, max: u32 },
#[error("dynamic buffer offset {0} does not respect `BIND_BUFFER_ALIGNMENT`")]

View File

@@ -1778,7 +1778,8 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
.trackers
.bundles
.use_extend(&*bundle_guard, bundle_id, (), ())
.unwrap();
.map_err(|_| RenderCommandError::InvalidRenderBundle(bundle_id))
.map_pass_err(scope)?;
info.context
.check_compatible(&bundle.context)

View File

@@ -484,6 +484,8 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
let (mut command_buffer_guard, mut token) = hub.command_buffers.write(&mut token);
if !command_buffer_ids.is_empty() {
let (render_bundle_guard, mut token) = hub.render_bundles.read(&mut token);
let (_, mut token) = hub.pipeline_layouts.read(&mut token);
let (bind_group_guard, mut token) = hub.bind_groups.read(&mut token);
let (compute_pipe_guard, mut token) = hub.compute_pipelines.read(&mut token);
let (render_pipe_guard, mut token) = hub.render_pipelines.read(&mut token);
@@ -583,6 +585,11 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
device.temp_suspected.render_pipelines.push(id);
}
}
for id in cmdbuf.trackers.bundles.used() {
if !render_bundle_guard[id].life_guard.use_at(submit_index) {
device.temp_suspected.render_bundles.push(id);
}
}
// execute resource transitions
let mut transit = device.cmd_allocator.extend(cmdbuf);