Store shader bytecode as a static rather than on the stack. This fixes stack overflow errors for large shaders. (#1476)

Signed-off-by: Arc-blroth <45273859+Arc-blroth@users.noreply.github.com>
This commit is contained in:
Arc'blroth 2021-01-17 17:38:29 -08:00 committed by GitHub
parent 8c6ff4aba9
commit ccb5a1091b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -4,6 +4,7 @@
- Added basic VK_KHR_external_memory, VK_KHR_external_memory_fd, and VK_EXT_external_memory_dma_buf support. - 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 potential segmentation fault in `ComputePipeline` when referencing `PipelineCache` objects.
- Fixed race condition in `StandardCommandPool` when allocating buffers. - 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) # Version 0.20.0 (2020-12-26)

View File

@ -308,11 +308,11 @@ pub(super) fn reflect(
-> Result<#struct_name, ::vulkano::OomError> -> Result<#struct_name, ::vulkano::OomError>
{ {
#( #cap_checks )* #( #cap_checks )*
let words = [ #( #spirv ),* ]; static WORDS: &[u32] = &[ #( #spirv ),* ];
unsafe { unsafe {
Ok(#struct_name { Ok(#struct_name {
shader: ::vulkano::pipeline::shader::ShaderModule::from_words(device, &words)? shader: ::vulkano::pipeline::shader::ShaderModule::from_words(device, WORDS)?
}) })
} }
} }