Skip to content

Commit f0317e5

Browse files
authored
fix: Only release functionalities in resolution-time app (#2370)
1 parent 16f8188 commit f0317e5

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

apps/resolution-time/procedural.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ const popDepth = tgpu.comptime(() => {
5959
state.$.stackDepth--;
6060
});
6161

62+
const range = tgpu.comptime((count: number) => {
63+
return Array.from({ length: count }, (_, i) => i);
64+
});
65+
6266
const timeAccessor = tgpu.accessor(d.f32, 0);
6367
const colorAccessor = tgpu.accessor(d.vec3f, d.vec3f(1, 0.5, 0.2));
6468

@@ -152,7 +156,7 @@ const waveFn = tgpu.comptime(() => {
152156
v = d.vec2f(std.sin(v.x * Math.PI), std.cos(v.y * Math.PI));
153157
const _energy = std.dot(v, v);
154158

155-
for (const _i of tgpu.unroll(std.range(config.branching))) {
159+
for (const _i of tgpu.unroll(range(config.branching))) {
156160
// @ts-expect-error trust me
157161
instructions[choice()]()();
158162
}
@@ -172,7 +176,7 @@ const accFn = tgpu.comptime(() => {
172176
let acc = d.vec2f();
173177
acc = d.vec2f(acc.x + offset.x * scale, acc.y + offset.y * scale);
174178

175-
for (const _i of tgpu.unroll(std.range(config.branching))) {
179+
for (const _i of tgpu.unroll(range(config.branching))) {
176180
// @ts-expect-error trust me
177181
instructions[choice()]()();
178182
}
@@ -194,7 +198,7 @@ const rotateFn = tgpu.comptime(() => {
194198
const s = std.sin(angle);
195199
v = d.vec2f(v.x * c - v.y * s, v.x * s + v.y * c);
196200

197-
for (const _i of tgpu.unroll(std.range(config.branching))) {
201+
for (const _i of tgpu.unroll(range(config.branching))) {
198202
// @ts-expect-error trust me
199203
instructions[choice()]()();
200204
}
@@ -216,7 +220,7 @@ const spiralFn = tgpu.comptime(() => {
216220
const pos = d.vec2f(center.x + radius * std.cos(angle), center.y + radius * std.sin(angle));
217221
const _dist = std.length(pos);
218222

219-
for (const _i of tgpu.unroll(std.range(config.branching))) {
223+
for (const _i of tgpu.unroll(range(config.branching))) {
220224
// @ts-expect-error trust me
221225
instructions[choice()]()();
222226
}
@@ -232,7 +236,7 @@ instructions.push(baseFn, blendFn, thresholdFn, filterFn, waveFn, accFn, rotateF
232236
const main = () => {
233237
'use gpu';
234238

235-
for (const _i of tgpu.unroll(std.range(config.mainBranching))) {
239+
for (const _i of tgpu.unroll(range(config.mainBranching))) {
236240
// @ts-expect-error trust me
237241
instructions[choice()]()();
238242
}

0 commit comments

Comments
 (0)