mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
extract dispatch
from compute_pass_end_impl
This commit is contained in:
parent
5fdb663f45
commit
fefb9c2453
@ -627,29 +627,7 @@ impl Global {
|
||||
indirect: false,
|
||||
pipeline: state.pipeline,
|
||||
};
|
||||
state.is_ready().map_pass_err(scope)?;
|
||||
|
||||
state.flush_states(raw, None).map_pass_err(scope)?;
|
||||
|
||||
let groups_size_limit =
|
||||
state.device.limits.max_compute_workgroups_per_dimension;
|
||||
|
||||
if groups[0] > groups_size_limit
|
||||
|| groups[1] > groups_size_limit
|
||||
|| groups[2] > groups_size_limit
|
||||
{
|
||||
return Err(ComputePassErrorInner::Dispatch(
|
||||
DispatchError::InvalidGroupSize {
|
||||
current: groups,
|
||||
limit: groups_size_limit,
|
||||
},
|
||||
))
|
||||
.map_pass_err(scope);
|
||||
}
|
||||
|
||||
unsafe {
|
||||
raw.dispatch(groups);
|
||||
}
|
||||
dispatch(&mut state, raw, groups).map_pass_err(scope)?;
|
||||
}
|
||||
ArcComputeCommand::DispatchIndirect { buffer, offset } => {
|
||||
let scope = PassErrorScope::Dispatch {
|
||||
@ -1003,6 +981,35 @@ fn set_push_constant<A: HalApi>(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn dispatch<A: HalApi>(
|
||||
state: &mut State<A>,
|
||||
raw: &mut A::CommandEncoder,
|
||||
groups: [u32; 3],
|
||||
) -> Result<(), ComputePassErrorInner> {
|
||||
state.is_ready()?;
|
||||
|
||||
state.flush_states(raw, None)?;
|
||||
|
||||
let groups_size_limit = state.device.limits.max_compute_workgroups_per_dimension;
|
||||
|
||||
if groups[0] > groups_size_limit
|
||||
|| groups[1] > groups_size_limit
|
||||
|| groups[2] > groups_size_limit
|
||||
{
|
||||
return Err(ComputePassErrorInner::Dispatch(
|
||||
DispatchError::InvalidGroupSize {
|
||||
current: groups,
|
||||
limit: groups_size_limit,
|
||||
},
|
||||
));
|
||||
}
|
||||
|
||||
unsafe {
|
||||
raw.dispatch(groups);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Recording a compute pass.
|
||||
impl Global {
|
||||
pub fn compute_pass_set_bind_group<A: HalApi>(
|
||||
|
Loading…
Reference in New Issue
Block a user