Vulkan Shader Module initialization

This commit is contained in:
2021-05-02 21:08:14 -07:00
parent 2385a19926
commit f1fb41a29c
2 changed files with 19 additions and 0 deletions

View File

@@ -63,3 +63,20 @@ KRDataBlock *KRShader::getData()
{
return m_pData;
}
bool KRShader::createShaderModule(VkDevice& device, VkShaderModule& module)
{
bool success = true;
VkShaderModuleCreateInfo createInfo{};
m_pData->lock();
createInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
createInfo.codeSize = m_pData->getSize();
createInfo.pCode = reinterpret_cast<const uint32_t*>(m_pData->getStart());
VkShaderModule shaderModule;
if (vkCreateShaderModule(device, &createInfo, nullptr, &module) != VK_SUCCESS) {
success = false;
}
m_pData->unlock();
return success;
}

View File

@@ -45,6 +45,8 @@ public:
virtual ~KRShader();
virtual std::string getExtension();
bool createShaderModule(VkDevice& device, VkShaderModule& module);
virtual bool save(KRDataBlock &data);