MCPcopy Create free account
hub / github.com/Apress/Ray-Tracing-Gems-II / CreateShaderModule

Function CreateShaderModule

Chapter_16/main.cpp:106–119  ·  view source on GitHub ↗

Creates a shader module from an std::string containing SPIR-V bytecode.

Source from the content-addressed store, hash-verified

104
105// Creates a shader module from an std::string containing SPIR-V bytecode.
106VkShaderModule 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
122bool AreExtensionsIncluded(const std::vector<const char*> requestedExtensions, const std::vector<VkExtensionProperties> deviceExtensionProperties)

Callers 1

mainFunction · 0.85

Calls 2

sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected