Creates a shader module from an std::string containing SPIR-V bytecode.
| 104 | |
| 105 | // Creates a shader module from an std::string containing SPIR-V bytecode. |
| 106 | VkShaderModule CreateShaderModule(VkDevice device, const std::string& binaryCode) |
| 107 | { |
| 108 | const size_t spirvSize = binaryCode.size(); |
| 109 | const uint32_t* spirvData = reinterpret_cast<const uint32_t*>(binaryCode.data()); |
| 110 | |
| 111 | VkShaderModuleCreateInfo createInfo{VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO}; |
| 112 | createInfo.codeSize = spirvSize; |
| 113 | createInfo.pCode = spirvData; |
| 114 | |
| 115 | VkShaderModule shaderModule = VK_NULL_HANDLE; |
| 116 | NVVK_CHECK(vkCreateShaderModule(device, &createInfo, nullptr, &shaderModule)); |
| 117 | |
| 118 | return shaderModule; |
| 119 | } |
| 120 | |
| 121 | |
| 122 | bool AreExtensionsIncluded(const std::vector<const char*> requestedExtensions, const std::vector<VkExtensionProperties> deviceExtensionProperties) |