mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-21 22:33:49 +00:00
remove Tracker.add_from_render_bundle
The render bundle resources are already kept alive by the render bundle itself, there is no need to add them.
This commit is contained in:
parent
a4e7a293d7
commit
f19217479d
@ -2716,9 +2716,7 @@ fn execute_bundle<A: HalApi>(
|
||||
) -> Result<(), RenderPassErrorInner> {
|
||||
api_log!("RenderPass::execute_bundle {}", bundle.error_ident());
|
||||
|
||||
// Have to clone the bundle arc, otherwise we keep a mutable reference to the bundle
|
||||
// while later trying to add the bundle's resources to the tracker.
|
||||
let bundle = state.tracker.bundles.insert_single(bundle).clone();
|
||||
let bundle = state.tracker.bundles.insert_single(bundle);
|
||||
|
||||
bundle.same_device_as(cmd_buf.as_ref())?;
|
||||
|
||||
@ -2769,7 +2767,6 @@ fn execute_bundle<A: HalApi>(
|
||||
|
||||
unsafe {
|
||||
state.info.usage_scope.merge_render_bundle(&bundle.used)?;
|
||||
state.tracker.add_from_render_bundle(&bundle.used)?;
|
||||
};
|
||||
state.reset_bundle();
|
||||
Ok(())
|
||||
|
@ -681,25 +681,4 @@ impl<A: HalApi> Tracker<A> {
|
||||
.set_and_remove_from_usage_scope_sparse(&mut scope.textures, &bind_group.textures)
|
||||
};
|
||||
}
|
||||
|
||||
/// Tracks the stateless resources from the given renderbundle. It is expected
|
||||
/// that the stateful resources will get merged into a usage scope first.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// The maximum ID given by each bind group resource must be less than the
|
||||
/// value given to `set_size`
|
||||
pub unsafe fn add_from_render_bundle(
|
||||
&mut self,
|
||||
render_bundle: &RenderBundleScope<A>,
|
||||
) -> Result<(), ResourceUsageCompatibilityError> {
|
||||
self.bind_groups
|
||||
.add_from_tracker(&*render_bundle.bind_groups.read());
|
||||
self.render_pipelines
|
||||
.add_from_tracker(&*render_bundle.render_pipelines.read());
|
||||
self.query_sets
|
||||
.add_from_tracker(&*render_bundle.query_sets.read());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -90,28 +90,4 @@ impl<T: Trackable> StatelessTracker<T> {
|
||||
|
||||
unsafe { self.metadata.insert(index, resource) }
|
||||
}
|
||||
|
||||
/// Adds the given resources from the given tracker.
|
||||
///
|
||||
/// If the ID is higher than the length of internal vectors,
|
||||
/// the vectors will be extended. A call to set_size is not needed.
|
||||
pub fn add_from_tracker(&mut self, other: &Self) {
|
||||
let incoming_size = other.metadata.size();
|
||||
if incoming_size > self.metadata.size() {
|
||||
self.set_size(incoming_size);
|
||||
}
|
||||
|
||||
for index in other.metadata.owned_indices() {
|
||||
self.tracker_assert_in_bounds(index);
|
||||
other.tracker_assert_in_bounds(index);
|
||||
unsafe {
|
||||
let previously_owned = self.metadata.contains_unchecked(index);
|
||||
|
||||
if !previously_owned {
|
||||
let other_resource = other.metadata.get_resource_unchecked(index);
|
||||
self.metadata.insert(index, other_resource.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user