Returns count unchanged if it fits the device's dispatch limit, and throws
otherwise. The counterpart to calcWorkgroups for shaders with no
grid-stride fallback: silently clamping those computes only part of the
result and reports success, so a refusal is the safer failure.
Parameters
device: any
count: number
workgroups this dispatch requires in one dimension
routine: string
routine name, for the error message
Optionaldim: string = "x"
dimension label ("x"/"y"), for the error message
Returns number
count
Throws
when count exceeds maxComputeWorkgroupsPerDimension
Returns
countunchanged if it fits the device's dispatch limit, and throws otherwise. The counterpart to calcWorkgroups for shaders with no grid-stride fallback: silently clamping those computes only part of the result and reports success, so a refusal is the safer failure.