Vulkan Shader Module initialization
This commit is contained in:
@@ -63,3 +63,20 @@ KRDataBlock *KRShader::getData()
|
|||||||
{
|
{
|
||||||
return m_pData;
|
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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ public:
|
|||||||
|
|
||||||
virtual std::string getExtension();
|
virtual std::string getExtension();
|
||||||
|
|
||||||
|
bool createShaderModule(VkDevice& device, VkShaderModule& module);
|
||||||
|
|
||||||
virtual bool save(KRDataBlock &data);
|
virtual bool save(KRDataBlock &data);
|
||||||
|
|
||||||
KRDataBlock *getData();
|
KRDataBlock *getData();
|
||||||
|
|||||||
Reference in New Issue
Block a user