Skip to content

Commit a902a77

Browse files
refactor!: subvert-rename dispatch* to dispatchWorkgroups
1 parent 013ed87 commit a902a77

22 files changed

Lines changed: 75 additions & 45 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ Bottom level categories:
7373
- Added more granular limits for mesh shaders. By @inner-daemons in [#8739](https://github.com/gfx-rs/wgpu/pull/8739).
7474
- Added new `InvalidWorkgroupSizeError`, which is now used by `DrawError::InvalidGroupSize` and `StageError::InvalidWorkgroupSize`. By @andyleiserson in [#9357](https://github.com/gfx-rs/wgpu/pull/9357).
7575
- Zero-size `Queue::write_buffer` now returns an error if the offset is invalid or the buffer lacks `COPY_DST`. By @39ali in [#9374](https://github.com/gfx-rs/wgpu/pull/9374).
76+
- BREAKING: The `dispatch` and `dispatch_indirect` methods on pass and bundle encoders have been renamed to `dispatch_workgroups` and `dispatch_workgroups_indirect`, respectively, to match the WebGPU spec. By @ErichDonGubler in [#9362](https://github.com/gfx-rs/wgpu/pull/9362).
7677

7778
#### Validation
7879

player/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,8 +1050,8 @@ impl Player {
10501050
size_bytes,
10511051
values_offset,
10521052
},
1053-
C::Dispatch(groups) => C::Dispatch(groups),
1054-
C::DispatchIndirect { buffer, offset } => C::DispatchIndirect {
1053+
C::DispatchWorkgroups(groups) => C::DispatchWorkgroups(groups),
1054+
C::DispatchWorkgroupsIndirect { buffer, offset } => C::DispatchWorkgroupsIndirect {
10551055
buffer: self.resolve_buffer_id(buffer),
10561056
offset,
10571057
},

player/tests/player/data/pipeline-statistics-query.ron

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
query_set: PointerId(0x10),
6363
query_index: 0,
6464
),
65-
Dispatch((2, 3, 7,)),
65+
DispatchWorkgroups((2, 3, 7,)),
6666
EndPipelineStatisticsQuery,
6767
],
6868
dynamic_offsets: [],

player/tests/player/data/zero-init-buffer.ron

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
num_dynamic_offsets: 0,
150150
bind_group: Some(PointerId(0x10)),
151151
),
152-
Dispatch((4, 1, 1)),
152+
DispatchWorkgroups((4, 1, 1)),
153153
],
154154
dynamic_offsets: [],
155155
string_data: [],

player/tests/player/data/zero-init-texture-binding.ron

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
num_dynamic_offsets: 0,
153153
bind_group: Some(PointerId(0x10)),
154154
),
155-
Dispatch((4, 1, 1)),
155+
DispatchWorkgroups((4, 1, 1)),
156156
],
157157
dynamic_offsets: [],
158158
string_data: [],

wgpu-core/src/command/compute.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -675,13 +675,14 @@ pub(super) fn encode_compute_pass(
675675
)
676676
.map_pass_err(scope)?;
677677
}
678-
ArcComputeCommand::Dispatch(groups) => {
678+
ArcComputeCommand::DispatchWorkgroups(groups) => {
679679
let scope = PassErrorScope::Dispatch { indirect: false };
680-
dispatch(&mut state, groups).map_pass_err(scope)?;
680+
dispatch_workgroups(&mut state, groups).map_pass_err(scope)?;
681681
}
682-
ArcComputeCommand::DispatchIndirect { buffer, offset } => {
682+
ArcComputeCommand::DispatchWorkgroupsIndirect { buffer, offset } => {
683683
let scope = PassErrorScope::Dispatch { indirect: true };
684-
dispatch_indirect(&mut state, device, buffer, offset).map_pass_err(scope)?;
684+
dispatch_workgroups_indirect(&mut state, device, buffer, offset)
685+
.map_pass_err(scope)?;
685686
}
686687
ArcComputeCommand::PushDebugGroup { color: _, len } => {
687688
pass::push_debug_group(&mut state.pass, &base.string_data, len);
@@ -832,7 +833,7 @@ fn set_pipeline(
832833
)
833834
}
834835

835-
fn dispatch(state: &mut State, groups: [u32; 3]) -> Result<(), ComputePassErrorInner> {
836+
fn dispatch_workgroups(state: &mut State, groups: [u32; 3]) -> Result<(), ComputePassErrorInner> {
836837
api_log!("ComputePass::dispatch {groups:?}");
837838

838839
state.is_ready()?;
@@ -856,12 +857,12 @@ fn dispatch(state: &mut State, groups: [u32; 3]) -> Result<(), ComputePassErrorI
856857
}
857858

858859
unsafe {
859-
state.pass.base.raw_encoder.dispatch(groups);
860+
state.pass.base.raw_encoder.dispatch_workgroups(groups);
860861
}
861862
Ok(())
862863
}
863864

864-
fn dispatch_indirect(
865+
fn dispatch_workgroups_indirect(
865866
state: &mut State,
866867
device: &Arc<Device>,
867868
buffer: Arc<Buffer>,
@@ -979,7 +980,7 @@ fn dispatch_indirect(
979980
}
980981

981982
unsafe {
982-
state.pass.base.raw_encoder.dispatch([1, 1, 1]);
983+
state.pass.base.raw_encoder.dispatch_workgroups([1, 1, 1]);
983984
}
984985

985986
// reset state
@@ -1037,7 +1038,7 @@ fn dispatch_indirect(
10371038
.pass
10381039
.base
10391040
.raw_encoder
1040-
.dispatch_indirect(params.dst_buffer, 0);
1041+
.dispatch_workgroups_indirect(params.dst_buffer, 0);
10411042
}
10421043
} else {
10431044
state.flush_bindings(Some(&buffer), true)?;
@@ -1048,7 +1049,7 @@ fn dispatch_indirect(
10481049
.pass
10491050
.base
10501051
.raw_encoder
1051-
.dispatch_indirect(buf_raw, offset);
1052+
.dispatch_workgroups_indirect(buf_raw, offset);
10521053
}
10531054
}
10541055

@@ -1193,7 +1194,9 @@ impl Global {
11931194

11941195
pass_base!(pass, scope)
11951196
.commands
1196-
.push(ArcComputeCommand::Dispatch([groups_x, groups_y, groups_z]));
1197+
.push(ArcComputeCommand::DispatchWorkgroups([
1198+
groups_x, groups_y, groups_z,
1199+
]));
11971200

11981201
Ok(())
11991202
}
@@ -1211,7 +1214,7 @@ impl Global {
12111214
let buffer = pass_try!(base, scope, hub.buffers.get(buffer_id).get());
12121215

12131216
base.commands
1214-
.push(ArcComputeCommand::DispatchIndirect { buffer, offset });
1217+
.push(ArcComputeCommand::DispatchWorkgroupsIndirect { buffer, offset });
12151218

12161219
Ok(())
12171220
}

wgpu-core/src/command/compute_command.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ pub enum ComputeCommand<R: ReferenceType> {
3434
values_offset: u32,
3535
},
3636

37-
Dispatch([u32; 3]),
37+
DispatchWorkgroups([u32; 3]),
3838

39-
DispatchIndirect {
39+
DispatchWorkgroupsIndirect {
4040
buffer: R::Buffer,
4141
offset: wgt::BufferAddress,
4242
},

wgpu-core/src/device/trace/record.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,8 +469,8 @@ impl IntoTrace for ArcComputeCommand {
469469
size_bytes,
470470
values_offset,
471471
},
472-
C::Dispatch(groups) => C::Dispatch(groups),
473-
C::DispatchIndirect { buffer, offset } => C::DispatchIndirect {
472+
C::DispatchWorkgroups(groups) => C::DispatchWorkgroups(groups),
473+
C::DispatchWorkgroupsIndirect { buffer, offset } => C::DispatchWorkgroupsIndirect {
474474
buffer: buffer.into_trace(),
475475
offset,
476476
},

wgpu-core/src/indirect_validation/draw.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ impl Draw {
447447
}
448448

449449
unsafe {
450-
encoder.dispatch([(batch.entries.len() as u32).div_ceil(64), 1, 1]);
450+
encoder.dispatch_workgroups([(batch.entries.len() as u32).div_ceil(64), 1, 1]);
451451
}
452452
}
453453

wgpu-core/src/timestamp_normalization/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ impl TimestampNormalizer {
353353
0,
354354
&[buffer_offset_timestamps, total_timestamps],
355355
);
356-
encoder.dispatch([needed_workgroups, 1, 1]);
356+
encoder.dispatch_workgroups([needed_workgroups, 1, 1]);
357357
encoder.end_compute_pass();
358358
}
359359
}

0 commit comments

Comments
 (0)