Skip to content
Merged
Prev Previous commit
Next Next commit
Remove the unnecessary interface
  • Loading branch information
Aleksander Katan committed Sep 18, 2025
commit c9fb2b4d3713a12d73b9f2e09877d00cc9ee7eb6
15 changes: 3 additions & 12 deletions packages/typegpu/src/prepareDispatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,7 @@ type DispatchForArgs<TArgs> = TArgs extends { length: infer TLength }
: never
: never;

interface Dispatch<TArgs> {
with(
bindGroupLayout: TgpuBindGroupLayout,
bindGroup: TgpuBindGroup,
): this;

dispatch: DispatchForArgs<TArgs>;
}

class DispatchImpl<TArgs> implements Dispatch<TArgs> {
class PreparedDispatch<TArgs> {
#pipeline: TgpuComputePipeline;
constructor(
public readonly dispatch: DispatchForArgs<TArgs>,
Expand All @@ -72,7 +63,7 @@ class DispatchImpl<TArgs> implements Dispatch<TArgs> {
export function prepareDispatch<TArgs extends number[]>(
root: TgpuRoot,
callback: (...args: TArgs) => undefined,
): Dispatch<TArgs> {
): PreparedDispatch<TArgs> {
if (callback.length >= 4) {
throw new Error('Dispatch only supports up to three dimensions.');
}
Expand Down Expand Up @@ -110,5 +101,5 @@ export function prepareDispatch<TArgs extends number[]>(
);
root['~unstable'].flush();
}) as DispatchForArgs<TArgs>;
return new DispatchImpl(dispatch, pipeline);
return new PreparedDispatch(dispatch, pipeline);
}