3 ms·
Gotcha. I assumed that was the case, but I was seeing some other stuff that implied otherwise elsewhere in this thread. Yeah, in that case, it'd probably have
by nynx 5y ago
Gotcha. I assumed that was the case, but I was seeing some other stuff that implied otherwise elsewhere in this thread.
Yeah, in that case, it'd probably have to be a transformation on top of static variables or something like that.
- dragontamer 5y agoIn the Lisp world... it is ambiguous if functions or macros are called at compile time or runtime. I'm not sure if this is kosher in the world of Rust, but... static RAY_STACK: [Shared<Ray>; 2000] = [Shared::new(Ray::default()); 2000]; This could still work, if Shared::new(...) were a compile-time function. Or a language-extension that looked like a compile-time function. EDIT: You wouldn't be allowed to have Shared::new inside of a loop or a recursive function though. But as long as you had assurances that any such Shared::new instance ran exactly once throughout the code, it might work? Or maybe that's too ugly. "static" probably captures the idea better
- nynx 5y agoThe best way to do it is probably the way rust-gpu does it: https://github.com/EmbarkStudios/rust-gpu/blob/main/docs/src/attributes.md#workgroup-shared-memory https://github.com/EmbarkStudios/rust-gpu/blob/main/docs/src... The entry point of the kernel would supply any objects that have special properties.