17 lines
410 B
TypeScript
17 lines
410 B
TypeScript
export const getWorkgroupCount = (
|
|
invocationCount: number,
|
|
workgroupSize: number
|
|
): number => {
|
|
if (
|
|
!Number.isFinite(invocationCount) ||
|
|
!Number.isFinite(workgroupSize) ||
|
|
invocationCount <= 0 ||
|
|
workgroupSize <= 0
|
|
) {
|
|
throw new Error(
|
|
'Invocation count and workgroup size must be positive finite numbers'
|
|
);
|
|
}
|
|
|
|
return Math.ceil(invocationCount / workgroupSize);
|
|
};
|