You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue automatically imported from old repo: EmbarkStudios/rust-gpu#1132 Old labels: t: bug Originally creatd by pyranota on 2024-02-11T13:28:58Z
EDIT(@eddyb): while there are reasons to avoid such arrays, the slowdown is the immediate Rust-GPU bug - I've left unchanged the original text, but used strikethrough for parts that don't apply, IMO.
User should not be able to create large sized arrays in rust-gpu shaders. Stack is limited, and large sized data-structures should be moved in buffers.
Plus it makes compilation incredibly slow (I assume this syntax [0; SIZE] translates to spirv's [0, 0, 0, 0, 0, ... SIZE])
Expected Behaviour
spirv-builder should throw an error, when user creates large array in stack
Comment from eddyb (CONTRIBUTOR) on 2024-02-20T12:14:25Z
I suspect let mut array = [0; 32 * 1024]; is worse than something like:
letmut array = MaybeUninit::<[_;32*1024]>::zeroed().assume_init();// or `core::mem::zeroed`?
I think we have an optimization for e.g. memset(0), but not [expr; N].
(haven't checked the code though, but it could be as simple as using the better approach in more places)
Issue automatically imported from old repo: EmbarkStudios/rust-gpu#1132
Old labels: t: bug
Originally creatd by pyranota on 2024-02-11T13:28:58Z
EDIT(@eddyb): while there are reasons to avoid such arrays, the slowdown is the immediate Rust-GPU bug - I've left unchanged the original text, but used
strikethroughfor parts that don't apply, IMO.User should not be able to create large sized arrays in rust-gpu shaders.Stack is limited, and large sized data-structures should be moved in buffers.Plus it makes compilation incredibly slow (I assume this syntax [0; SIZE] translates to spirv's [0, 0, 0, 0, 0, ... SIZE])
Expected Behaviour
spirv-builder should throw an error, when user creates large array in stackExample & Steps To Reproduce
let arr = [0; 32 * 1024];
cargo build
System Info
The text was updated successfully, but these errors were encountered: