Add a shader module to the hash map of shader modules. returns a handle to the module, and the old shader module if there was one with the same name already. Does not rebuild pipelines that may be using the shader module, nor does it invalidate them.
(&mut self, name: String, spirv: &[u32])
| 850 | /// old shader module if there was one with the same name already. Does not rebuild pipelines |
| 851 | /// that may be using the shader module, nor does it invalidate them. |
| 852 | pub fn insert_shader_module(&mut self, name: String, spirv: &[u32]) { |
| 853 | let shader_info = vk::ShaderModuleCreateInfo::builder().code(spirv); |
| 854 | let shader_module = unsafe { |
| 855 | self.base |
| 856 | .device |
| 857 | .create_shader_module(&shader_info, None) |
| 858 | .expect("Shader module error") |
| 859 | }; |
| 860 | if let Some(old_module) = self.shader_modules.insert(name, shader_module) { |
| 861 | unsafe { |
| 862 | self.base.device.destroy_shader_module(old_module, None); |
| 863 | } |
| 864 | }; |
| 865 | } |
| 866 | |
| 867 | /// Destroys the swapchain, as well as the renderpass and frame and command buffers |
| 868 | pub fn cleanup_swapchain(&mut self) { |