initial
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
#include "ShaderManager.hpp"
|
||||
|
||||
namespace tw::io {
|
||||
|
||||
ShaderManager::ShaderManager(const Gpu* gpu, const Files* files) :
|
||||
m_files(files),
|
||||
m_shader_builder(gpu)
|
||||
{
|
||||
}
|
||||
|
||||
Shader ShaderManager::load_shader(const std::string& name) {
|
||||
return m_shader_builder.from_binary(m_files->read_file_binary(path("shaders") / name));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <shaders/Shader.hpp>
|
||||
#include <shaders/SpirvShaderBuilder.hpp>
|
||||
|
||||
#include "io/Files.hpp"
|
||||
|
||||
namespace tw::io {
|
||||
|
||||
/**
|
||||
* Unifies and simplifies shader loading
|
||||
*/
|
||||
class ShaderManager {
|
||||
const Files *m_files;
|
||||
const SpirvShaderBuilder m_shader_builder;
|
||||
|
||||
public:
|
||||
ShaderManager(const Gpu* gpu, const Files *files);
|
||||
|
||||
Shader load_shader(const std::string& name);
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user