Calculates the number of workgroups to dispatch, clamped to the device's
maxComputeWorkgroupsPerDimension limit (default 65535 across most devices).
ONLY for shaders whose kernel is a grid-stride loop driven by
num_workgroups — those re-walk the whole domain regardless of how many
workgroups actually launch, so clamping costs a little parallelism and
nothing else. A shader that indexes straight off workgroup_id or
global_invocation_id silently drops every row past the clamp; those must
use requireWorkgroups / requireWorkgroupCount instead.
1D (pass only rows): returns a single count for dispatchWorkgroups(n).
2D (pass both rows and cols): returns { x, y } for dispatchWorkgroups(x, y).
rows maps to the y dimension and cols maps to the x dimension.
Calculates the number of workgroups to dispatch, clamped to the device's
maxComputeWorkgroupsPerDimensionlimit (default 65535 across most devices).ONLY for shaders whose kernel is a grid-stride loop driven by
num_workgroups— those re-walk the whole domain regardless of how many workgroups actually launch, so clamping costs a little parallelism and nothing else. A shader that indexes straight offworkgroup_idorglobal_invocation_idsilently drops every row past the clamp; those must use requireWorkgroups / requireWorkgroupCount instead.rows): returns a single count fordispatchWorkgroups(n).rowsandcols): returns{ x, y }fordispatchWorkgroups(x, y).rowsmaps to the y dimension andcolsmaps to the x dimension.