diff --git a/CHANGELOG_VULKANO.md b/CHANGELOG_VULKANO.md index fbfad34f..8cf039ab 100644 --- a/CHANGELOG_VULKANO.md +++ b/CHANGELOG_VULKANO.md @@ -4,6 +4,7 @@ - Added basic VK_KHR_external_memory, VK_KHR_external_memory_fd, and VK_EXT_external_memory_dma_buf support. - Fixed potential segmentation fault in `ComputePipeline` when referencing `PipelineCache` objects. - Fixed race condition in `StandardCommandPool` when allocating buffers. +- Fixed potential stack overflow error in loading large shaders by storing the bytecode as static. # Version 0.20.0 (2020-12-26) diff --git a/vulkano-shaders/src/codegen.rs b/vulkano-shaders/src/codegen.rs index b0844624..24bc7c22 100644 --- a/vulkano-shaders/src/codegen.rs +++ b/vulkano-shaders/src/codegen.rs @@ -308,11 +308,11 @@ pub(super) fn reflect( -> Result<#struct_name, ::vulkano::OomError> { #( #cap_checks )* - let words = [ #( #spirv ),* ]; + static WORDS: &[u32] = &[ #( #spirv ),* ]; unsafe { Ok(#struct_name { - shader: ::vulkano::pipeline::shader::ShaderModule::from_words(device, &words)? + shader: ::vulkano::pipeline::shader::ShaderModule::from_words(device, WORDS)? }) } }