From dd681d2c773a81f2bf9b96b46793bd232a2d4787 Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Tue, 2 Oct 2018 16:05:22 -0400 Subject: [PATCH] Compute dispatch call --- wgpu-native/src/command/compute.rs | 15 +++++++++++++-- wgpu-native/src/command/render.rs | 6 +++--- wgpu-rs/src/lib.rs | 3 +++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/wgpu-native/src/command/compute.rs b/wgpu-native/src/command/compute.rs index 2ab7d2926..c96df546b 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 d382bbf8d..79dcd91da 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 3b859990c..f288d1e72 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 {