Open
Conversation
- need to store transition buffer, change only when counts change ;(
…eGPU into docs/generator-slot
|
pkg.pr.new packages benchmark commit |
📊 Bundle Size Comparison
👀 Notable resultsStatic test results:No major changes. Dynamic test results:No major changes. 📋 All resultsClick to reveal the results table (344 entries).
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu. |
There was a problem hiding this comment.
Pull request overview
Adds a new Linear Congruential Generator (LCG) to @typegpu/noise and wires generator selection into the docs’ probability example, updating resolution/testing snapshots accordingly.
Changes:
- Introduce and export
LCGas aStatefulGeneratorin@typegpu/noise. - Update docs examples to select PRNG generator (BPETER vs LCG) and cache pipelines per (distribution, generator).
- Adjust the probability example’s “Test Resolution” behavior and corresponding snapshot expectations.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/typegpu/tests/examples/individual/probability.test.ts | Updates expected shader-module creation count and inline snapshot to reflect new generator/pipeline resolution behavior. |
| packages/typegpu-noise/src/index.ts | Re-exports LCG from the package entrypoint. |
| packages/typegpu-noise/src/generator.ts | Adds the LCG StatefulGenerator implementation (u32 state + float conversion). |
| apps/typegpu-docs/src/examples/tests/uniformity/prngs.ts | Switches uniformity test PRNG list to import LCG from @typegpu/noise. |
| apps/typegpu-docs/src/examples/tests/uniformity/lcg.ts | Removes now-duplicated local LCG implementation. |
| apps/typegpu-docs/src/examples/algorithms/probability/types.ts | Adds Generator options/type for UI selection. |
| apps/typegpu-docs/src/examples/algorithms/probability/plotter.ts | Adds destroy() to stop the MorphCharts core. |
| apps/typegpu-docs/src/examples/algorithms/probability/index.ts | Adds generator selection control, threads generator into execution, updates “Test Resolution”, and calls plotter.destroy() on cleanup. |
| apps/typegpu-docs/src/examples/algorithms/probability/helpers.ts | Adds generator mapping (getGenerator) and updated imports. |
| apps/typegpu-docs/src/examples/algorithms/probability/executor.ts | Updates pipeline caching to be keyed by (distribution, generator) and binds randomGeneratorSlot per pipeline. |
| apps/typegpu-docs/src/examples/algorithms/probability/constants.ts | Adds initial generator and generator options list. |
Comments suppressed due to low confidence (1)
apps/typegpu-docs/src/examples/algorithms/probability/executor.ts:52
#pipelineCacheis declared as aWeakMap<..., WeakMap<...>>, but it's initialized withnew Map()in the constructor. This is a type mismatch (and changes the GC/retention semantics). Initialize it withnew WeakMap()instead, or change the field type/comment toMapif strong references are intended.
// they can be WeakMaps, because we always have reference to distribution and PRNG
readonly #pipelineCache: WeakMap<
TgpuFn,
WeakMap<StatefulGenerator, TgpuComputePipeline>
>;
constructor(root: TgpuRoot) {
this.#root = root;
this.#bufferCache = new Map();
this.#pipelineCache = new Map();
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
apps/typegpu-docs/src/examples/algorithms/probability/executor.ts
Outdated
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.