mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-23 07:51:08 +01:00
Rename dispatch -> dispatch_workgroups
This commit is contained in:
1 parent
ff07716f79
commit
5706263917
11 files changed
+39
-31
No files matched your search
@@ -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,
|
||||
|
||||
@@ -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::<WebGpuComputePass>(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::<WebGpuComputePass>(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,
|
||||
|
||||
@@ -575,8 +575,8 @@ fn declare_webgpu_ops() -> Vec<deno_core::OpDecl> {
|
||||
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(),
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -128,10 +128,10 @@ impl crate::ComputePassInner<Context> 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<web_sys::GpuBuffer>,
|
||||
indirect_offset: wgt::BufferAddress,
|
||||
|
||||
+10
-6
@@ -69,8 +69,8 @@ trait ComputePassInner<Ctx: Context> {
|
||||
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,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)]
|
||||
|
||||
Reference in new issue
Block a user