50 lines
1.4 KiB
C++
50 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include "shader_manager.hpp"
|
|
#include "assets/data_stores/shader_source_store.hpp"
|
|
#include "opengl/data/shader_program_data.hpp"
|
|
#include "opengl/shading/requirements/shader_program_requirements.hpp"
|
|
#include "opengl/metadata/shader_program_metadata.hpp"
|
|
|
|
namespace zgl
|
|
{
|
|
|
|
class shader_program_manager
|
|
{
|
|
public:
|
|
using store_type = shader_manager::store_type;
|
|
using metadata_type = shader_program_metadata;
|
|
using data_type = shader_program_data;
|
|
using handle_type = shader_program_handle;
|
|
using entry_type = std::pair<metadata_type, data_type>;
|
|
using entry_view_type = std::pair<metadata_type, handle_type>;
|
|
|
|
void process(const store_type& shader_sources);
|
|
|
|
void fetch(
|
|
const assets::shader_source_store& shader_sources,
|
|
std::span<const shading::shader_program_requirements> requirements,
|
|
std::span<shader_program_metadata> metadata,
|
|
std::span<shader_program_handle> shader_programs
|
|
);
|
|
|
|
protected:
|
|
std::optional<entry_view_type> find_shader_program(
|
|
const shading::shader_program_requirements& requirements
|
|
);
|
|
|
|
bool link_shader_program(
|
|
const shader_handle_set& shaders
|
|
);
|
|
|
|
shader_manager m_shader_manager;
|
|
std::vector<entry_type> m_shader_program_lookup;
|
|
|
|
private:
|
|
std::vector<shading::shader_program_requirements> m_shader_requirements_buffer;
|
|
std::vector<shader_set_metadata> m_shader_metadata_buffer;
|
|
std::vector<shader_handle_set> shader_set_buffer;
|
|
};
|
|
|
|
}
|