3 ms·
I can't guarantee that it'd be implemented like this, but I could see it working like this in Rust. struct Ray { origin: Vec3, dir: Vec3, r
by nynx 5y ago
I can't guarantee that it'd be implemented like this, but I could see it working like this in Rust.
struct Ray {
origin: Vec3,
dir: Vec3,
remaining_bounces: u32,
}
and then using it like this:
static RAY_STACK: [Shared<Ray>; 2000] = [Shared::new(Ray::default()); 2000];
or
static RAY_STACK: Shared<[Ray; 2000]> = Shared::default();
I guess it could also be done like this:
#[shared]
static RAY_STACK: [Ray; 2000] = ...;
but that's not really the rust way.
- wizzwizz4 5y agoThis seems more likely than my proposals, but it does mean you won't be able to use a particular part of the `__shared__` region for more than one thing. (Mine are broken by function calls, so yours is still better.)