Fix RNG transmutation
CI / cargo test (push) Successful in 14m31s
CI / cargo test (GPU) (push) Successful in 12m49s
CI / cargo fmt (push) Successful in 28s

This commit is contained in:
2026-06-29 20:40:12 -04:00
parent 3c5563c940
commit 86ef0887e3
3 changed files with 42 additions and 8 deletions
+5 -4
View File
@@ -110,7 +110,7 @@ impl<'a, R: Rng> Iterator for ChaosGame<'a, R> {
/// Shader entry point for running the chaos game to produce new IFS coordinates
pub mod entry {
use crate::chaos_game::ChaosGame;
use crate::rng::xoshiro_from_state;
use crate::rng::xoshiro256starstar_from_seed;
use crate::transform::Transform;
use crate::variation::Variation;
use glam::Vec2;
@@ -121,15 +121,16 @@ pub mod entry {
#[spirv(compute(entry_point_name = "main_chaos_game", threads(1)))]
pub fn main_chaos_game(
#[spirv(spec_constant(id = 1, default = 20))] iteration_discard: u32,
#[spirv(storage_buffer, descriptor_set = 0, binding = 0)] _rng_seed: &[u8],
#[spirv(storage_buffer, descriptor_set = 0, binding = 0)] rng_seed: &[u8],
#[spirv(storage_buffer, descriptor_set = 0, binding = 1)] transforms: &[Transform],
#[spirv(storage_buffer, descriptor_set = 0, binding = 2)] weights: &[f32],
#[spirv(storage_buffer, descriptor_set = 0, binding = 3)] variations: &[Variation],
#[spirv(storage_buffer, descriptor_set = 1, binding = 0)] output: &mut [Vec2],
) {
let rng_seed_actual = [0u8; 32];
let mut rng_seed_actual = [0u8; 32];
(0..32).for_each(|i| rng_seed_actual[i] = rng_seed[i]);
let mut rng = xoshiro_from_state(rng_seed_actual);
let mut rng = xoshiro256starstar_from_seed(rng_seed_actual);
let mut chaos_game = ChaosGame::new(&mut rng, transforms, weights, variations);
for _ in 0..iteration_discard {