Skip to content

Commit 521c9c3

Browse files
committed
smaller resolution test
1 parent ff48e6a commit 521c9c3

4 files changed

Lines changed: 23 additions & 1204 deletions

File tree

apps/typegpu-docs/src/examples/algorithms/probability/executor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export class Executor {
108108
) {
109109
let distributionMap = this.#pipelineCache.get(distribution);
110110
if (!distributionMap) {
111-
distributionMap = new Map([[generator, pipeline]]);
111+
distributionMap = new Map();
112112
this.#pipelineCache.set(distribution, distributionMap);
113113
}
114114

apps/typegpu-docs/src/examples/algorithms/probability/index.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,25 +119,24 @@ export const controls = {
119119
},
120120
'Test Resolution': import.meta.env.DEV && {
121121
onButtonClick() {
122-
for (const dist of c.distributions) {
123-
for (const gen of c.generators) {
124-
const code = tgpu.resolve({
125-
externals: {
126-
p: executor.pipelineCacheGet(
127-
getPRNG(dist).prng,
128-
getGenerator(gen),
129-
),
130-
},
131-
});
132-
root.device.createShaderModule({ code });
133-
}
122+
for (const [i, j] of [[0, 0], [8, 1], [10, 0]]) {
123+
const code = tgpu.resolve({
124+
externals: {
125+
p: executor.pipelineCacheGet(
126+
getPRNG(c.distributions[i]).prng,
127+
getGenerator(c.generators[j]),
128+
),
129+
},
130+
});
131+
root.device.createShaderModule({ code });
134132
}
135133
},
136134
},
137135
};
138136

139137
export function onCleanup() {
140138
root.destroy();
139+
plotter.destroy();
141140
}
142141

143142
// #endregion

apps/typegpu-docs/src/examples/algorithms/probability/plotter.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export class Plotter {
4646
this.#core.renderer.transitionTime = 1; // it is number from [0, 1] indicating the state of the animation - 1 means current
4747
}
4848

49+
destroy() {
50+
this.#core.stop();
51+
}
52+
4953
async plot(samples: d.v3f[], prng: PRNG, animate = false): Promise<void> {
5054
let needNewBuffer = false;
5155
if (samples.length !== this.#count) {

0 commit comments

Comments
 (0)