Compute dispatch call

This commit is contained in:
Dzmitry Malyshau 2018-10-02 16:05:22 -04:00
parent 15883ab21c
commit dd681d2c77
3 changed files with 19 additions and 5 deletions

View File

@ -1,11 +1,12 @@
use hal;
use registry::{HUB, Items, Registry}; use registry::{HUB, Items, Registry};
use { use {
Stored, Stored,
CommandBufferId, ComputePassId CommandBufferId, ComputePassId
}; };
use hal;
use hal::command::RawCommandBuffer;
pub struct ComputePass<B: hal::Backend> { pub struct ComputePass<B: hal::Backend> {
raw: B::CommandBuffer, raw: B::CommandBuffer,
@ -35,3 +36,13 @@ pub extern "C" fn wgpu_compute_pass_end_pass(
.raw = Some(pass.raw); .raw = Some(pass.raw);
pass.cmb_id.0 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]);
}

View File

@ -1,12 +1,12 @@
use hal;
use hal::command::RawCommandBuffer;
use registry::{HUB, Items, Registry}; use registry::{HUB, Items, Registry};
use { use {
Stored, Stored,
CommandBufferId, RenderPassId, CommandBufferId, RenderPassId,
}; };
use hal;
use hal::command::RawCommandBuffer;
pub struct RenderPass<B: hal::Backend> { pub struct RenderPass<B: hal::Backend> {
raw: B::CommandBuffer, raw: B::CommandBuffer,

View File

@ -273,6 +273,9 @@ impl<'a> ComputePass<'a> {
wgn::wgpu_compute_pass_end_pass(self.id); wgn::wgpu_compute_pass_end_pass(self.id);
self.parent self.parent
} }
pub fn dispatch(&self, x: u32, y: u32, z: u32) {
wgn::wgpu_compute_pass_dispatch(self.id, x, y, z);
}
} }
impl Queue { impl Queue {