MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / seed_for

Function seed_for

tools/bloom-reference/src/main.rs:1057–1063  ·  view source on GitHub ↗

Seed derived from pixel coords + sample index + global seed so each (pixel, sample) pair gets an independent RNG stream without needing to allocate or synchronize anything. The 0x9E3779B97F4A7C15 golden- ratio constant decorrelates nearby pixels.

(pixel: UVec2, sample: u32, global_seed: u64)

Source from the content-addressed store, hash-verified

1055/// to allocate or synchronize anything. The 0x9E3779B97F4A7C15 golden-
1056/// ratio constant decorrelates nearby pixels.
1057fn seed_for(pixel: UVec2, sample: u32, global_seed: u64) -> u64 {
1058 let mut x = global_seed;
1059 x ^= (pixel.x as u64).wrapping_mul(0x9E3779B97F4A7C15);
1060 x ^= (pixel.y as u64).wrapping_mul(0xBF58476D1CE4E5B9);
1061 x ^= (sample as u64).wrapping_mul(0x94D049BB133111EB);
1062 x
1063}
1064
1065// ============================================================
1066// BRDF (GGX + Burley diffuse, metalness-aware)

Callers 1

renderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected