mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-20 06:21:13 +01:00
Make sure submissions are tracked
This commit is contained in:
1 parent
ed8503ed6c
commit
758bb16d01
4 files changed
+21
-2
No files matched your search
@@ -160,6 +160,7 @@ impl<B: GfxBackend> CommandBuffer<B> {
|
||||
});
|
||||
base.views.merge_extend(&head.views).unwrap();
|
||||
base.bind_groups.merge_extend(&head.bind_groups).unwrap();
|
||||
base.samplers.merge_extend(&head.samplers).unwrap();
|
||||
|
||||
let stages = all_buffer_stages() | all_image_stages();
|
||||
unsafe {
|
||||
|
||||
@@ -1273,7 +1273,9 @@ pub fn device_create_bind_group<B: GfxBackend>(
|
||||
}
|
||||
binding_model::BindingResource::Sampler(id) => {
|
||||
assert_eq!(decl.ty, binding_model::BindingType::Sampler);
|
||||
let sampler = &sampler_guard[id];
|
||||
let sampler = used.samplers
|
||||
.use_extend(&*sampler_guard, id, (), ())
|
||||
.unwrap();
|
||||
hal::pso::Descriptor::Sampler(&sampler.raw)
|
||||
}
|
||||
binding_model::BindingResource::TextureView(id) => {
|
||||
@@ -1471,7 +1473,8 @@ pub fn queue_submit<B: GfxBackend>(queue_id: QueueId, command_buffer_ids: &[Comm
|
||||
let (bind_group_guard, mut token) = hub.bind_groups.read(&mut token);
|
||||
let (buffer_guard, mut token) = hub.buffers.read(&mut token);
|
||||
let (texture_guard, mut token) = hub.textures.read(&mut token);
|
||||
let (mut texture_view_guard, _) = hub.texture_views.write(&mut token);
|
||||
let (mut texture_view_guard, mut token) = hub.texture_views.write(&mut token);
|
||||
let (sampler_guard, _) = hub.samplers.read(&mut token);
|
||||
|
||||
//TODO: if multiple command buffers are submitted, we can re-use the last
|
||||
// native command buffer of the previous chain instead of always creating
|
||||
@@ -1524,6 +1527,12 @@ pub fn queue_submit<B: GfxBackend>(queue_id: QueueId, command_buffer_ids: &[Comm
|
||||
.submission_index
|
||||
.store(submit_index, Ordering::Release);
|
||||
}
|
||||
for id in comb.trackers.samplers.used() {
|
||||
sampler_guard[id]
|
||||
.life_guard
|
||||
.submission_index
|
||||
.store(submit_index, Ordering::Release);
|
||||
}
|
||||
|
||||
// execute resource transitions
|
||||
let mut transit = device.com_allocator.extend(comb);
|
||||
|
||||
@@ -363,3 +363,9 @@ pub struct Sampler<B: hal::Backend> {
|
||||
pub(crate) device_id: Stored<DeviceId>,
|
||||
pub(crate) life_guard: LifeGuard,
|
||||
}
|
||||
|
||||
impl<B: hal::Backend> Borrow<RefCount> for Sampler<B> {
|
||||
fn borrow(&self) -> &RefCount {
|
||||
&self.life_guard.ref_count
|
||||
}
|
||||
}
|
||||
@@ -441,6 +441,7 @@ impl TrackerSet {
|
||||
self.textures.clear();
|
||||
self.views.clear();
|
||||
self.bind_groups.clear();
|
||||
self.samplers.clear();
|
||||
}
|
||||
|
||||
/// Try to optimize the tracking representation.
|
||||
@@ -449,6 +450,7 @@ impl TrackerSet {
|
||||
self.textures.optimize();
|
||||
self.views.optimize();
|
||||
self.bind_groups.optimize();
|
||||
self.samplers.optimize();
|
||||
}
|
||||
|
||||
/// Merge all the trackers of another instance by extending
|
||||
@@ -458,6 +460,7 @@ impl TrackerSet {
|
||||
self.textures.merge_extend(&other.textures).unwrap();
|
||||
self.views.merge_extend(&other.views).unwrap();
|
||||
self.bind_groups.merge_extend(&other.bind_groups).unwrap();
|
||||
self.samplers.merge_extend(&other.samplers).unwrap();
|
||||
}
|
||||
|
||||
pub fn backend(&self) -> Backend {
|
||||
|
||||
Reference in new issue
Block a user