MCPcopy Create free account
hub / github.com/Rust-GPU/rust-gpu / insert_shader_module

Method insert_shader_module

examples/runners/ash/src/main.rs:852–865  ·  view source on GitHub ↗

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])

Source from the content-addressed store, hash-verified

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) {

Callers 1

mainFunction · 0.80

Calls 2

expectMethod · 0.80
insertMethod · 0.80

Tested by

no test coverage detected