mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 16:24:24 +00:00
Fix compute pass barriers
This commit is contained in:
parent
17e555b257
commit
4446b81f3e
@ -686,7 +686,7 @@ void wgpu_compute_pass_push_debug_group(WGPUComputePassId _pass_id, WGPURawStrin
|
||||
void wgpu_compute_pass_set_bind_group(WGPUComputePassId pass_id,
|
||||
uint32_t index,
|
||||
WGPUBindGroupId bind_group_id,
|
||||
const uint32_t *offsets_ptr,
|
||||
const WGPUBufferAddress *offsets_ptr,
|
||||
uintptr_t offsets_count);
|
||||
|
||||
void wgpu_compute_pass_set_pipeline(WGPUComputePassId pass_id, WGPUComputePipelineId pipeline_id);
|
||||
@ -810,7 +810,7 @@ void wgpu_render_pass_push_debug_group(WGPURenderPassId _pass_id, WGPURawString
|
||||
void wgpu_render_pass_set_bind_group(WGPURenderPassId pass_id,
|
||||
uint32_t index,
|
||||
WGPUBindGroupId bind_group_id,
|
||||
const uint32_t *offsets_ptr,
|
||||
const WGPUBufferAddress *offsets_ptr,
|
||||
uintptr_t offsets_count);
|
||||
|
||||
void wgpu_render_pass_set_blend_color(WGPURenderPassId pass_id, const WGPUColor *color);
|
||||
@ -831,7 +831,7 @@ void wgpu_render_pass_set_stencil_reference(WGPURenderPassId pass_id, uint32_t v
|
||||
|
||||
void wgpu_render_pass_set_vertex_buffers(WGPURenderPassId pass_id,
|
||||
const WGPUBufferId *buffer_ptr,
|
||||
const uint32_t *offset_ptr,
|
||||
const WGPUBufferAddress *offset_ptr,
|
||||
uintptr_t count);
|
||||
|
||||
void wgpu_render_pass_set_viewport(WGPURenderPassId pass_id,
|
||||
|
@ -24,12 +24,16 @@ pub struct ComputePass<B: hal::Backend> {
|
||||
}
|
||||
|
||||
impl<B: hal::Backend> ComputePass<B> {
|
||||
pub(crate) fn new(raw: B::CommandBuffer, cmb_id: Stored<CommandBufferId>) -> Self {
|
||||
pub(crate) fn new(
|
||||
raw: B::CommandBuffer,
|
||||
cmb_id: Stored<CommandBufferId>,
|
||||
trackers: TrackerSet,
|
||||
) -> Self {
|
||||
ComputePass {
|
||||
raw,
|
||||
cmb_id,
|
||||
binder: Binder::default(),
|
||||
trackers: TrackerSet::new(),
|
||||
trackers,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -38,14 +42,14 @@ impl<B: hal::Backend> ComputePass<B> {
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_compute_pass_end_pass(pass_id: ComputePassId) -> CommandBufferId {
|
||||
let mut command_buffer_guard = HUB.command_buffers.write();
|
||||
let mut cmb_guard = HUB.command_buffers.write();
|
||||
let pass = HUB.compute_passes.unregister(pass_id);
|
||||
let cmb = &mut cmb_guard[pass.cmb_id.value];
|
||||
|
||||
//TODO: transitions?
|
||||
|
||||
command_buffer_guard[pass.cmb_id.value]
|
||||
.raw
|
||||
.push(pass.raw);
|
||||
// There are no transitions to be made: we've already been inserting barriers
|
||||
// into the parent command buffer while recording this compute pass.
|
||||
cmb.trackers = pass.trackers;
|
||||
cmb.raw.push(pass.raw);
|
||||
pass.cmb_id.value
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ use back::Backend;
|
||||
use hal::{command::RawCommandBuffer, Device as _};
|
||||
use log::trace;
|
||||
|
||||
use std::{collections::hash_map::Entry, iter, slice, thread::ThreadId};
|
||||
use std::{collections::hash_map::Entry, iter, mem, slice, thread::ThreadId};
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
|
||||
@ -426,12 +426,13 @@ pub fn command_encoder_begin_compute_pass(
|
||||
let cmb = &mut cmb_guard[command_encoder_id];
|
||||
|
||||
let raw = cmb.raw.pop().unwrap();
|
||||
let trackers = mem::replace(&mut cmb.trackers, TrackerSet::new());
|
||||
let stored = Stored {
|
||||
value: command_encoder_id,
|
||||
ref_count: cmb.life_guard.ref_count.clone(),
|
||||
};
|
||||
|
||||
ComputePass::new(raw, stored)
|
||||
ComputePass::new(raw, stored, trackers)
|
||||
}
|
||||
|
||||
#[cfg(feature = "local")]
|
||||
|
Loading…
Reference in New Issue
Block a user