Skip to content

Commit 2a9df4e

Browse files
committed
fix: Less hacky vector implementation
1 parent a1f510c commit 2a9df4e

File tree

4 files changed

+124
-109
lines changed

4 files changed

+124
-109
lines changed

packages/typegpu/src/core/root/init.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ function toVec3(arr: readonly (number | undefined)[]): v3u {
112112
}
113113

114114
const workgroupSizeConfigs = [
115-
vec3u(1, 1, 1),
116-
vec3u(256, 1, 1),
117-
vec3u(16, 16, 1),
118-
vec3u(8, 8, 4),
115+
[1, 1, 1],
116+
[256, 1, 1],
117+
[16, 16, 1],
118+
[8, 8, 4],
119119
] as const;
120120

121121
export class TgpuGuardedComputePipelineImpl<
@@ -124,15 +124,15 @@ export class TgpuGuardedComputePipelineImpl<
124124
#root: ExperimentalTgpuRoot;
125125
#pipeline: TgpuComputePipeline;
126126
#sizeUniform: TgpuUniform<Vec3u>;
127-
#workgroupSize: v3u;
127+
#workgroupSize: [number, number, number];
128128

129-
#lastSize: v3u;
129+
#lastSize: [number, number, number];
130130

131131
constructor(
132132
root: ExperimentalTgpuRoot,
133133
pipeline: TgpuComputePipeline,
134134
sizeUniform: TgpuUniform<Vec3u>,
135-
workgroupSize: v3u,
135+
workgroupSize: [number, number, number],
136136
) {
137137
this.#root = root;
138138
this.#pipeline = pipeline;
@@ -228,7 +228,7 @@ class WithBindingImpl implements WithBinding {
228228
throw new Error('Guarded compute callback only supports up to three dimensions.');
229229
}
230230

231-
const workgroupSize = workgroupSizeConfigs[callback.length] as v3u;
231+
const workgroupSize = workgroupSizeConfigs[callback.length] as [number, number, number];
232232
const wrappedCallback = fn([u32, u32, u32])(callback as (...args: number[]) => void);
233233

234234
const sizeUniform = root.createUniform(vec3u);

0 commit comments

Comments
 (0)