feat (@typegpu/noise): LCG32 and xoroshiro PRNGs, utilities #8955
Annotations
2 errors and 1 warning
|
build-and-test
Process completed with exit code 1.
|
|
[typegpu-docs] tests/individual-example-tests/uniformity.test.ts > uniformity test example > should produce valid code:
apps/typegpu-docs/tests/individual-example-tests/uniformity.test.ts#L25
Error: Snapshot `uniformity test example > should produce valid code 1` mismatched
- Expected
+ Received
@@ -79,22 +79,29 @@
x *= 830770091u;
x ^= (x >> 14u);
return x;
}
+ fn rotl(x: u32, k: u32) -> u32 {
+ return ((x << k) | (x >> (32u - k)));
+ }
+
var<private> seed: u32;
- fn seed_1(value: f32) {
- seed = hash(u32(value));
+ fn seed2(value: vec2f) {
+ var u32Value = bitcast<vec2u>(value);
+ let hx = hash((u32Value.x ^ 1253408251u));
+ let hy = hash((u32Value.y ^ 2900286023u));
+ seed = hash((hx ^ rotl(hy, 16u)));
}
- fn randSeed(seed: f32) {
+ fn randSeed2(seed: vec2f) {
- seed_1(seed);
+ seed2(seed);
}
fn u32To01F32(value: u32) -> f32 {
- let mantissa = (value >> 9u);
+ let mantissa = (value & 8388607u);
let bits = (1065353216u | mantissa);
let f = bitcast<f32>(bits);
return (f - 1f);
}
@@ -110,11 +117,11 @@
@group(1) @binding(0) var texture: texture_storage_2d<r32float, write>;
fn computeFn(x: u32, y: u32, _arg_2: u32) {
let gridSize = configUniform.gridSize;
{
- randSeed(((f32((x + 1u)) * gridSize) + f32((y + 1u))));
+ randSeed2((vec2f(f32(x), f32(y)) + 1f));
}
var i = 0u;
let samplesPerThread = configUniform.samplesPerThread;
var samples = 0f;
while ((i < (samplesPerThread - 1u))) {
@@ -162,12 +169,13 @@
}
var<private> seed: vec2u;
fn seed2(value: vec2f) {
- let hx = hash((u32(value.x) ^ 2135587861u));
+ var u32Value = bitcast<vec2u>(value);
+ let hx = hash((u32Value.x ^ 1253408251u));
- let hy = hash((u32(value.y) ^ 2654435769u));
+ let hy = hash((u32Value.y ^ 2900286023u));
seed = vec2u(hash((hx ^ hy)), hash((rotl(hx, 16u) ^ hy)));
}
fn randSeed2(seed: vec2f) {
seed2(seed);
@@ -181,11 +189,11 @@
seed[1i] = rotl(s1, 13u);
return (rotl((seed[0i] * 2654435771u), 5u) * 5u);
}
fn u32To01F32(value: u32) -> f32 {
- let mantissa = (value >> 9u);
+ let mantissa = (value & 8388607u);
let bits = (1065353216u | mantissa);
let f = bitcast<f32>(bits);
return (f - 1f);
}
❯ tests/individual-example-tests/uniformity.test.ts:25:25
|
|
build-and-test
Node.js 20 actions are deprecated. The following actions are running on Node.js 20 and may not work as expected: actions/checkout@v4, actions/setup-node@v4, pnpm/action-setup@v4. Actions will be forced to run with Node.js 24 by default starting June 2nd, 2026. Node.js 20 will be removed from the runner on September 16th, 2026. Please check if updated versions of these actions are available that support Node.js 24. To opt into Node.js 24 now, set the FORCE_JAVASCRIPT_ACTIONS_TO_NODE24=true environment variable on the runner or in your workflow file. Once Node.js 24 becomes the default, you can temporarily opt out by setting ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true. For more information see: https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/
|