-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debug builds on windows result in "thread 'main' has overflowed its stack" #1633
Comments
@seratonik The commit you referred to is just a readme update. If the issue didn't exist before, it looks more like some "caching" issue or an issue with dependencies or an environment configuration at a first glance. Also it unlikely that any recent changes in vulkano-shaders could lead to crashes. Can you try to find an exact commit from which your project works? Or at least at which Vulkano version. |
I have the same issue in my project. I think the cause is surprisingly large size of GraphicsPipelineBuilder struct. In 0.23 it was 352 bytes, 1072 in 0.24, and 84232 in 0.25. In debug builds, each invocation of builder methods adds another 82kb to the stack. This can quickly overflow even in regular usage. Reproduction: use vulkano::pipeline::GraphicsPipeline;
fn main() {
GraphicsPipeline::start()
.cull_mode_back()
.cull_mode_back()
.cull_mode_back()
.cull_mode_back()
.cull_mode_back()
.cull_mode_back()
.cull_mode_back()
.cull_mode_back()
.cull_mode_back()
.cull_mode_back()
.cull_mode_back()
.cull_mode_back()
.cull_mode_back();
} |
I tracked down some sizes of things and I think the issue is a
pub struct GraphicsEntryPoint<'a> {
module: &'a ShaderModule,
name: &'a CStr,
descriptor_set_layout_descs: SmallVec<[DescriptorSetDesc; 16]>, // <---- !!!
push_constant_range: Option<PipelineLayoutPcRange>,
spec_constants: &'static [SpecializationMapEntry],
input: ShaderInterface,
output: ShaderInterface,
ty: GraphicsShaderType,
} and is 16,776 bytes. But I found this commit: 1771714 /// Object that describes the layout of the descriptors and push constants of a pipeline.
#[derive(Debug, Clone)]
pub struct PipelineLayoutDesc {
descriptor_sets: Vec<Vec<Option<DescriptorDesc>>>,
push_constants: Vec<PipelineLayoutDescPcRange>,
} into the struct we have now, replacing the pure-heap I found some discussion about linting for type sizes in An aside: |
This simple program produces thread 'main' has overflowed its stack: type MyRand = [u32; 10]; fn mix(se: &mut MyRand) { fn seed(se: &mut MyRand, val: u32) { fn random(se: &mut MyRand) -> u32 { } |
Issue
Something that changed after commit 3850a92 seems to be causing a stack overflow error when I attempt to run my game that uses Vulkano, but it only happens in Windows and only when compiling in debug mode. Compiling on OSX or in Release mode on Windows fixes the issue.
I don't have a small reproducible example at the moment, I just wanted to report it when I saw it. I also had issues with this latest version crashing rust-analyzer's macro system in VS Code in both Windows/OSX when using
vulkano_shaders::shader!
The text was updated successfully, but these errors were encountered: