diff --git a/wgpu-native/src/command/compute.rs b/wgpu-native/src/command/compute.rs index 2ab7d29263..c96df546b1 100644 --- a/wgpu-native/src/command/compute.rs +++ b/wgpu-native/src/command/compute.rs @@ -1,11 +1,12 @@ -use hal; - use registry::{HUB, Items, Registry}; use { Stored, CommandBufferId, ComputePassId }; +use hal; +use hal::command::RawCommandBuffer; + pub struct ComputePass { raw: B::CommandBuffer, @@ -35,3 +36,13 @@ pub extern "C" fn wgpu_compute_pass_end_pass( .raw = Some(pass.raw); pass.cmb_id.0 } + +pub extern "C" fn wgpu_compute_pass_dispatch( + pass_id: ComputePassId, x: u32, y: u32, z: u32, +) { + HUB.compute_passes + .lock() + .get_mut(pass_id) + .raw + .dispatch([x, y, z]); +} diff --git a/wgpu-native/src/command/render.rs b/wgpu-native/src/command/render.rs index d382bbf8d3..79dcd91daa 100644 --- a/wgpu-native/src/command/render.rs +++ b/wgpu-native/src/command/render.rs @@ -1,12 +1,12 @@ -use hal; -use hal::command::RawCommandBuffer; - use registry::{HUB, Items, Registry}; use { Stored, CommandBufferId, RenderPassId, }; +use hal; +use hal::command::RawCommandBuffer; + pub struct RenderPass { raw: B::CommandBuffer, diff --git a/wgpu-rs/src/lib.rs b/wgpu-rs/src/lib.rs index 3b859990c1..f288d1e726 100644 --- a/wgpu-rs/src/lib.rs +++ b/wgpu-rs/src/lib.rs @@ -273,6 +273,9 @@ impl<'a> ComputePass<'a> { wgn::wgpu_compute_pass_end_pass(self.id); self.parent } + pub fn dispatch(&self, x: u32, y: u32, z: u32) { + wgn::wgpu_compute_pass_dispatch(self.id, x, y, z); + } } impl Queue {