Add ShaderRegistry

This commit is contained in:
2023-09-02 16:57:23 +02:00
parent 74823ad636
commit b328db0075
3 changed files with 86 additions and 12 deletions

View File

@@ -6,9 +6,7 @@
#include "Device.hpp"
#include "Base/Utils.hpp"
extern "C" {
#include "Shader/Shaders.h"
}
#include "Shader/ShaderRegistry.hpp"
namespace openVulkanoCpp::Vulkan
{
@@ -92,18 +90,13 @@ namespace openVulkanoCpp::Vulkan
vk::ShaderModule Device::CreateShaderModule(const std::string& filename) const
{
Array<char> buffer;
void* data = nullptr;
const void* data = nullptr;
size_t size = 0;
if (Utils::StartsWith(filename, "Shader/"))
{
for(uint32_t i = 0; i < fileTableSize; i++)
{
if (Utils::EndsWith(filename, fileTable[i].entryName))
{
data = const_cast<unsigned char*>(fileTable[i].data);
size = fileTable[i].size;
}
}
auto shader = ShaderRegistry::GetInstance().GetShader(filename.substr(7));
data = shader.first;
size = shader.second;
}
if (!data)
{