mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Don't merge stateless trackers from bind groups
This commit is contained in:
@@ -210,8 +210,10 @@ impl RenderBundleEncoder {
|
||||
state.set_bind_group(index, bind_group_id, bind_group.layout_id, offsets);
|
||||
state
|
||||
.trackers
|
||||
.merge_extend_all(&bind_group.used)
|
||||
.merge_extend_stateful(&bind_group.used)
|
||||
.map_pass_err(scope)?;
|
||||
//Note: stateless trackers are not merged: the lifetime reference
|
||||
// is held to the bind group itself.
|
||||
}
|
||||
RenderCommand::SetPipeline(pipeline_id) => {
|
||||
let scope = PassErrorScope::SetPipelineRender(pipeline_id);
|
||||
|
||||
@@ -219,7 +219,8 @@ impl State {
|
||||
) -> Result<(), UsageConflict> {
|
||||
for id in self.binder.list_active() {
|
||||
self.trackers.merge_extend(&bind_group_guard[id].used)?;
|
||||
base_trackers.merge_extend_stateless(&bind_group_guard[id].used);
|
||||
//Note: stateless trackers are not merged: the lifetime reference
|
||||
// is held to the bind group itself.
|
||||
}
|
||||
|
||||
log::trace!("Encoding dispatch barriers");
|
||||
|
||||
@@ -945,7 +945,8 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
info.trackers
|
||||
.merge_extend(&bind_group.used)
|
||||
.map_pass_err(scope)?;
|
||||
cmd_buf.trackers.merge_extend_stateless(&bind_group.used);
|
||||
//Note: stateless trackers are not merged: the lifetime reference
|
||||
// is held to the bind group itself.
|
||||
|
||||
cmd_buf.buffer_memory_init_actions.extend(
|
||||
bind_group.used_buffer_ranges.iter().filter_map(|action| {
|
||||
|
||||
@@ -738,7 +738,8 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
.map_err(DeviceError::from)?
|
||||
};
|
||||
log::trace!("Stitching command buffer {:?} before submission", cmb_id);
|
||||
trackers.merge_extend_stateless(&baked.trackers);
|
||||
//Note: stateless trackers are not merged:
|
||||
// device already knows these resources exist.
|
||||
CommandBuffer::insert_barriers(
|
||||
&mut baked.encoder,
|
||||
&mut *trackers,
|
||||
|
||||
@@ -620,29 +620,14 @@ impl TrackerSet {
|
||||
self.query_sets.optimize();
|
||||
}
|
||||
|
||||
/// Merge all the trackers of another instance by extending
|
||||
/// the usage. Panics on a stateless conflict, returns a conflict otherwise.
|
||||
pub fn merge_extend_all(&mut self, other: &Self) -> Result<(), UsageConflict> {
|
||||
/// Merge only the stateful trackers of another instance by extending
|
||||
/// the usage. Returns a conflict if any.
|
||||
pub fn merge_extend_stateful(&mut self, other: &Self) -> Result<(), UsageConflict> {
|
||||
self.buffers.merge_extend(&other.buffers)?;
|
||||
self.textures.merge_extend(&other.textures)?;
|
||||
self.merge_extend_stateless(other);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Merge all the stateless trackers of another instance by extending
|
||||
/// the usage. Panics on a conflict.
|
||||
pub fn merge_extend_stateless(&mut self, other: &Self) {
|
||||
self.views.merge_extend(&other.views).unwrap();
|
||||
self.bind_groups.merge_extend(&other.bind_groups).unwrap();
|
||||
self.samplers.merge_extend(&other.samplers).unwrap();
|
||||
self.compute_pipes
|
||||
.merge_extend(&other.compute_pipes)
|
||||
.unwrap();
|
||||
self.render_pipes.merge_extend(&other.render_pipes).unwrap();
|
||||
self.bundles.merge_extend(&other.bundles).unwrap();
|
||||
self.query_sets.merge_extend(&other.query_sets).unwrap();
|
||||
}
|
||||
|
||||
pub fn backend(&self) -> wgt::Backend {
|
||||
self.buffers.backend
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user