MCPcopy Create free account
hub / github.com/KhronosGroup/glTF-IBL-Sampler / loadShaderModule

Method loadShaderModule

lib/source/vkHelper.cpp:606–632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

604}
605
606VkResult IBLLib::vkHelper::loadShaderModule(VkShaderModule& _outShader, const uint32_t* _spvBlob, size_t _spvBlobByteSize)
607{
608 if (_spvBlobByteSize % sizeof(uint32_t) != 0u)
609 {
610 printf("Invalid SPIR-V blob size\n");
611 return VK_RESULT_MAX_ENUM;
612 }
613
614 VkResult res = VK_RESULT_MAX_ENUM;
615
616 // create shader module from spv blob
617 VkShaderModuleCreateInfo createInfo = {};
618 createInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
619 createInfo.codeSize = _spvBlobByteSize;
620 createInfo.pCode = _spvBlob;
621
622 if ((res = vkCreateShaderModule(m_logicalDevice, &createInfo, nullptr, &_outShader)) != VK_SUCCESS)
623 {
624 _outShader = VK_NULL_HANDLE;
625 printf("Failed to create shader module [%u]\n", res);
626 return res;
627 }
628
629 m_shaderModules.emplace_back(_outShader);
630
631 return res;
632}
633
634VkResult IBLLib::vkHelper::loadShaderModule(VkShaderModule& _outShader, const char* _path)
635{

Callers 1

compileShaderFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected