MCPcopy Create free account
hub / github.com/a2flo/floor / create_vulkan_program_internal

Method create_vulkan_program_internal

compute/vulkan/vulkan_compute.cpp:2766–2799  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2764}
2765
2766vulkan_program::vulkan_program_entry
2767vulkan_compute::create_vulkan_program_internal(const vulkan_device& device,
2768 const spirv_handler::container& container,
2769 const vector<llvm_toolchain::function_info>& functions,
2770 const string& identifier) {
2771 vulkan_program::vulkan_program_entry ret;
2772 ret.functions = functions;
2773
2774 // create modules
2775 ret.programs.reserve(container.entries.size());
2776 for(const auto& entry : container.entries) {
2777 // map functions (names) to the module index
2778 const auto mod_idx = (uint32_t)ret.programs.size();
2779 for(const auto& func_name : entry.function_names) {
2780 ret.func_to_mod_map.emplace(func_name, mod_idx);
2781 }
2782
2783 const VkShaderModuleCreateInfo module_info {
2784 .sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
2785 .pNext = nullptr,
2786 .flags = 0,
2787 .codeSize = entry.data_word_count * 4,
2788 .pCode = &container.spirv_data[entry.data_offset],
2789 };
2790 VkShaderModule module { nullptr };
2791 VK_CALL_RET(vkCreateShaderModule(device.device, &module_info, nullptr, &module),
2792 "failed to create shader module (\"" + identifier + "\") for device \"" + device.name + "\"", ret)
2793 set_vulkan_debug_label(device, VK_OBJECT_TYPE_SHADER_MODULE, uint64_t(module), identifier);
2794 ret.programs.emplace_back(module);
2795 }
2796
2797 ret.valid = true;
2798 return ret;
2799}
2800
2801shared_ptr<compute_program> vulkan_compute::add_precompiled_program_file(const string& file_name,
2802 const vector<llvm_toolchain::function_info>& functions) {

Callers

nothing calls this directly

Calls 3

reserveMethod · 0.80
emplaceMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected