Skip to content

Commit 27a694f

Browse files
committed
Fix tracking of the set_sub_data service command buffer
1 parent ac1b755 commit 27a694f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/command/render.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ pub extern "C" fn wgpu_render_pass_set_pipeline(
212212

213213
let pipeline_layout_guard = HUB.pipeline_layouts.read();
214214
let pipeline_layout = &pipeline_layout_guard[pipeline.layout_id];
215-
let bing_group_guard = HUB.bind_groups.read();
215+
let bind_group_guard = HUB.bind_groups.read();
216216

217217
pass.binder.pipeline_layout_id = Some(pipeline.layout_id.clone());
218218
pass.binder.ensure_length(pipeline_layout.bind_group_layout_ids.len());
@@ -223,7 +223,7 @@ pub extern "C" fn wgpu_render_pass_set_pipeline(
223223
.enumerate()
224224
{
225225
if let Some(bg_id) = entry.expect_layout(bgl_id) {
226-
let desc_set = &bing_group_guard[bg_id].raw;
226+
let desc_set = &bind_group_guard[bg_id].raw;
227227
unsafe {
228228
pass.raw.bind_graphics_descriptor_sets(
229229
&pipeline_layout.raw,

src/device.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,7 +1659,12 @@ pub extern "C" fn wgpu_buffer_set_sub_data(
16591659
range: None .. None, //TODO: could be partial
16601660
});
16611661

1662+
// Note: this is not pretty. If we need one-time service command buffers,
1663+
// we'll need to have some internal abstractions for them to be safe.
16621664
let mut comb = device.com_allocator.allocate(buffer.device_id.clone(), &device.raw);
1665+
// mark as used by the next submission, conservatively
1666+
let last_submit_index = device.life_guard.submission_index.load(Ordering::Acquire);
1667+
comb.life_guard.submission_index.store(last_submit_index + 1, Ordering::Release);
16631668
unsafe {
16641669
let raw = comb.raw.last_mut().unwrap();
16651670
raw.begin(

0 commit comments

Comments
 (0)