diff --git a/deno_webgpu/01_webgpu.js b/deno_webgpu/01_webgpu.js index ebb3182a8..ffa6d6a8e 100644 --- a/deno_webgpu/01_webgpu.js +++ b/deno_webgpu/01_webgpu.js @@ -4213,9 +4213,9 @@ * @param {number} workgroupCountY * @param {number} workgroupCountZ */ - dispatch(workgroupCountX, workgroupCountY = 1, workgroupCountZ = 1) { + dispatchWorkgroups(workgroupCountX, workgroupCountY = 1, workgroupCountZ = 1) { webidl.assertBranded(this, GPUComputePassEncoderPrototype); - const prefix = "Failed to execute 'dispatch' on 'GPUComputePassEncoder'"; + const prefix = "Failed to execute 'dispatchWorkgroups' on 'GPUComputePassEncoder'"; webidl.requiredArguments(arguments.length, 1, { prefix }); workgroupCountX = webidl.converters.GPUSize32(workgroupCountX, { prefix, @@ -4239,7 +4239,7 @@ }); const computePassRid = assertResource(this, { prefix, context: "this" }); core.opSync( - "op_webgpu_compute_pass_dispatch", + "op_webgpu_compute_pass_dispatch_workgroups", computePassRid, workgroupCountX, workgroupCountY, @@ -4251,10 +4251,10 @@ * @param {GPUBuffer} indirectBuffer * @param {number} indirectOffset */ - dispatchIndirect(indirectBuffer, indirectOffset) { + dispatchWorkgroupsIndirect(indirectBuffer, indirectOffset) { webidl.assertBranded(this, GPUComputePassEncoderPrototype); const prefix = - "Failed to execute 'dispatchIndirect' on 'GPUComputePassEncoder'"; + "Failed to execute 'dispatchWorkgroupsIndirect' on 'GPUComputePassEncoder'"; webidl.requiredArguments(arguments.length, 2, { prefix }); indirectBuffer = webidl.converters.GPUBuffer(indirectBuffer, { prefix, @@ -4283,7 +4283,7 @@ selfContext: "this", }); core.opSync( - "op_webgpu_compute_pass_dispatch_indirect", + "op_webgpu_compute_pass_dispatch_workgroups_indirect", computePassRid, indirectBufferRid, indirectOffset, diff --git a/deno_webgpu/src/compute_pass.rs b/deno_webgpu/src/compute_pass.rs index 6ecae3505..cc9a81e89 100644 --- a/deno_webgpu/src/compute_pass.rs +++ b/deno_webgpu/src/compute_pass.rs @@ -40,7 +40,7 @@ pub fn op_webgpu_compute_pass_set_pipeline( } #[op] -pub fn op_webgpu_compute_pass_dispatch( +pub fn op_webgpu_compute_pass_dispatch_workgroups( state: &mut OpState, compute_pass_rid: ResourceId, x: u32, @@ -51,7 +51,7 @@ pub fn op_webgpu_compute_pass_dispatch( .resource_table .get::(compute_pass_rid)?; - wgpu_core::command::compute_ffi::wgpu_compute_pass_dispatch( + wgpu_core::command::compute_ffi::wgpu_compute_pass_dispatch_workgroups( &mut compute_pass_resource.0.borrow_mut(), x, y, @@ -62,7 +62,7 @@ pub fn op_webgpu_compute_pass_dispatch( } #[op] -pub fn op_webgpu_compute_pass_dispatch_indirect( +pub fn op_webgpu_compute_pass_dispatch_workgroups_indirect( state: &mut OpState, compute_pass_rid: ResourceId, indirect_buffer: ResourceId, @@ -75,7 +75,7 @@ pub fn op_webgpu_compute_pass_dispatch_indirect( .resource_table .get::(compute_pass_rid)?; - wgpu_core::command::compute_ffi::wgpu_compute_pass_dispatch_indirect( + wgpu_core::command::compute_ffi::wgpu_compute_pass_dispatch_workgroups_indirect( &mut compute_pass_resource.0.borrow_mut(), buffer_resource.0, indirect_offset, diff --git a/deno_webgpu/src/lib.rs b/deno_webgpu/src/lib.rs index 63bd720eb..c0e89266a 100644 --- a/deno_webgpu/src/lib.rs +++ b/deno_webgpu/src/lib.rs @@ -575,8 +575,8 @@ fn declare_webgpu_ops() -> Vec { render_pass::op_webgpu_render_pass_draw_indexed_indirect::decl(), // compute_pass compute_pass::op_webgpu_compute_pass_set_pipeline::decl(), - compute_pass::op_webgpu_compute_pass_dispatch::decl(), - compute_pass::op_webgpu_compute_pass_dispatch_indirect::decl(), + compute_pass::op_webgpu_compute_pass_dispatch_workgroups::decl(), + compute_pass::op_webgpu_compute_pass_dispatch_workgroups_indirect::decl(), compute_pass::op_webgpu_compute_pass_begin_pipeline_statistics_query::decl(), compute_pass::op_webgpu_compute_pass_end_pipeline_statistics_query::decl(), compute_pass::op_webgpu_compute_pass_write_timestamp::decl(), diff --git a/deno_webgpu/webgpu.idl b/deno_webgpu/webgpu.idl index 6938a1248..53f48ca99 100644 --- a/deno_webgpu/webgpu.idl +++ b/deno_webgpu/webgpu.idl @@ -846,8 +846,8 @@ interface mixin GPUDebugCommandsMixin { [Exposed=(Window, DedicatedWorker), SecureContext] interface GPUComputePassEncoder { undefined setPipeline(GPUComputePipeline pipeline); - undefined dispatch(GPUSize32 workgroupCountX, optional GPUSize32 workgroupCountY = 1, optional GPUSize32 workgroupCountZ = 1); - undefined dispatchIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); + undefined dispatchWorkgroups(GPUSize32 workgroupCountX, optional GPUSize32 workgroupCountY = 1, optional GPUSize32 workgroupCountZ = 1); + undefined dispatchWorkgroupsIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); undefined beginPipelineStatisticsQuery(GPUQuerySet querySet, GPUSize32 queryIndex); undefined endPipelineStatisticsQuery(); diff --git a/wgpu-core/src/command/compute.rs b/wgpu-core/src/command/compute.rs index 8ffff41aa..38629543f 100644 --- a/wgpu-core/src/command/compute.rs +++ b/wgpu-core/src/command/compute.rs @@ -812,7 +812,7 @@ pub mod compute_ffi { } #[no_mangle] - pub extern "C" fn wgpu_compute_pass_dispatch( + pub extern "C" fn wgpu_compute_pass_dispatch_workgroups( pass: &mut ComputePass, groups_x: u32, groups_y: u32, @@ -824,7 +824,7 @@ pub mod compute_ffi { } #[no_mangle] - pub extern "C" fn wgpu_compute_pass_dispatch_indirect( + pub extern "C" fn wgpu_compute_pass_dispatch_workgroups_indirect( pass: &mut ComputePass, buffer_id: id::BufferId, offset: BufferAddress, diff --git a/wgpu/examples/boids/main.rs b/wgpu/examples/boids/main.rs index 61cbb3449..444a37561 100644 --- a/wgpu/examples/boids/main.rs +++ b/wgpu/examples/boids/main.rs @@ -302,7 +302,7 @@ impl framework::Example for Example { command_encoder.begin_compute_pass(&wgpu::ComputePassDescriptor { label: None }); cpass.set_pipeline(&self.compute_pipeline); cpass.set_bind_group(0, &self.particle_bind_groups[self.frame_num % 2], &[]); - cpass.dispatch(self.work_group_count, 1, 1); + cpass.dispatch_workgroups(self.work_group_count, 1, 1); } command_encoder.pop_debug_group(); diff --git a/wgpu/examples/hello-compute/main.rs b/wgpu/examples/hello-compute/main.rs index fb45db79e..bbff9130f 100644 --- a/wgpu/examples/hello-compute/main.rs +++ b/wgpu/examples/hello-compute/main.rs @@ -136,7 +136,7 @@ async fn execute_gpu_inner( cpass.set_pipeline(&compute_pipeline); cpass.set_bind_group(0, &bind_group, &[]); cpass.insert_debug_marker("compute collatz iterations"); - cpass.dispatch(numbers.len() as u32, 1, 1); // Number of cells to run, the (x,y,z) size of item being processed + cpass.dispatch_workgroups(numbers.len() as u32, 1, 1); // Number of cells to run, the (x,y,z) size of item being processed } // Sets adds copy operation to command encoder. // Will copy data from storage buffer on GPU to staging buffer on CPU. diff --git a/wgpu/src/backend/direct.rs b/wgpu/src/backend/direct.rs index d6478044b..d93616862 100644 --- a/wgpu/src/backend/direct.rs +++ b/wgpu/src/backend/direct.rs @@ -321,15 +321,19 @@ mod pass_impl { wgpu_compute_pass_end_pipeline_statistics_query(self) } - fn dispatch(&mut self, x: u32, y: u32, z: u32) { - wgpu_compute_pass_dispatch(self, x, y, z) + fn dispatch_workgroups(&mut self, x: u32, y: u32, z: u32) { + wgpu_compute_pass_dispatch_workgroups(self, x, y, z) } - fn dispatch_indirect( + fn dispatch_workgroups_indirect( &mut self, indirect_buffer: &super::Buffer, indirect_offset: wgt::BufferAddress, ) { - wgpu_compute_pass_dispatch_indirect(self, indirect_buffer.id, indirect_offset) + wgpu_compute_pass_dispatch_workgroups_indirect( + self, + indirect_buffer.id, + indirect_offset, + ) } } diff --git a/wgpu/src/backend/web.rs b/wgpu/src/backend/web.rs index dd5800d8b..d45d491f4 100644 --- a/wgpu/src/backend/web.rs +++ b/wgpu/src/backend/web.rs @@ -128,10 +128,10 @@ impl crate::ComputePassInner for ComputePass { // self.0.pop_debug_group(); } - fn dispatch(&mut self, x: u32, y: u32, z: u32) { + fn dispatch_workgroups(&mut self, x: u32, y: u32, z: u32) { self.0.dispatch_with_y_and_z(x, y, z); } - fn dispatch_indirect( + fn dispatch_workgroups_indirect( &mut self, indirect_buffer: &Sendable, indirect_offset: wgt::BufferAddress, diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 8e23f43ef..b39e412fc 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -69,8 +69,8 @@ trait ComputePassInner { fn write_timestamp(&mut self, query_set: &Ctx::QuerySetId, query_index: u32); fn begin_pipeline_statistics_query(&mut self, query_set: &Ctx::QuerySetId, query_index: u32); fn end_pipeline_statistics_query(&mut self); - fn dispatch(&mut self, x: u32, y: u32, z: u32); - fn dispatch_indirect( + fn dispatch_workgroups(&mut self, x: u32, y: u32, z: u32); + fn dispatch_workgroups_indirect( &mut self, indirect_buffer: &Ctx::BufferId, indirect_offset: BufferAddress, @@ -2881,19 +2881,23 @@ impl<'a> ComputePass<'a> { /// Dispatches compute work operations. /// /// `x`, `y` and `z` denote the number of work groups to dispatch in each dimension. - pub fn dispatch(&mut self, x: u32, y: u32, z: u32) { - ComputePassInner::dispatch(&mut self.id, x, y, z); + pub fn dispatch_workgroups(&mut self, x: u32, y: u32, z: u32) { + ComputePassInner::dispatch_workgroups(&mut self.id, x, y, z); } /// Dispatches compute work operations, based on the contents of the `indirect_buffer`. /// /// The structure expected in `indirect_buffer` must conform to [`DispatchIndirect`](crate::util::DispatchIndirect). - pub fn dispatch_indirect( + pub fn dispatch_workgroups_indirect( &mut self, indirect_buffer: &'a Buffer, indirect_offset: BufferAddress, ) { - ComputePassInner::dispatch_indirect(&mut self.id, &indirect_buffer.id, indirect_offset); + ComputePassInner::dispatch_workgroups_indirect( + &mut self.id, + &indirect_buffer.id, + indirect_offset, + ); } } diff --git a/wgpu/src/util/indirect.rs b/wgpu/src/util/indirect.rs index 49013adcb..36e6e7063 100644 --- a/wgpu/src/util/indirect.rs +++ b/wgpu/src/util/indirect.rs @@ -54,7 +54,7 @@ impl DrawIndexedIndirect { } } -/// The structure expected in `indirect_buffer` for [`ComputePass::dispatch_indirect`](crate::ComputePass::dispatch_indirect). +/// The structure expected in `indirect_buffer` for [`ComputePass::dispatch_workgroups_indirect`](crate::ComputePass::dispatch_workgroups_indirect). /// /// x, y and z denote the number of work groups to dispatch in each dimension. #[repr(C)]