...
This commit is contained in:
58
include/opengl/data_managers/shader_manager.hpp
Normal file
58
include/opengl/data_managers/shader_manager.hpp
Normal file
@@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
#include <bit>
|
||||
#include <format>
|
||||
#include <ranges>
|
||||
#include <bits/ranges_algo.h>
|
||||
|
||||
#include "assets/dynamic_data_stores/dynamic_shader_source_store.hpp"
|
||||
#include "opengl/shader_program_lookup.hpp"
|
||||
#include "opengl/handles/shader_handle.hpp"
|
||||
#include "util/string_lookup.hpp"
|
||||
#include "shader_source_manager.hpp"
|
||||
#include "opengl/metadata/shader_metadata.hpp"
|
||||
#include "opengl/data/shader_data.hpp"
|
||||
#include "opengl/handles/shader_handle_set.hpp"
|
||||
#include "opengl/shading/requirements/shader_requirements.hpp"
|
||||
#include "opengl/metadata/shader_set_metadata.hpp"
|
||||
#include "opengl/shading/requirements/shader_set_requirements.hpp"
|
||||
|
||||
namespace zgl
|
||||
{
|
||||
class shader_manager
|
||||
{
|
||||
using shader_lookup_entry_type = std::pair<shader_metadata, shader_data>;
|
||||
public:
|
||||
|
||||
void process(
|
||||
const dynamic_shader_source_store& shader_sources
|
||||
);
|
||||
|
||||
void get_handles(
|
||||
const dynamic_shader_source_store& shader_sources,
|
||||
std::span<const shading::shader_set_requirements> requirements,
|
||||
std::span<shader_set_metadata> metadata,
|
||||
std::span<shader_handle_set> shader_sets
|
||||
);
|
||||
|
||||
protected:
|
||||
std::optional<std::pair<shader_metadata, shader_handle>> find_shader(
|
||||
const shading::shader_requirements& requirements
|
||||
);
|
||||
|
||||
static bool compile_shader(
|
||||
GLenum shader_type,
|
||||
std::span<const char*> source_strings,
|
||||
shader_data& shader
|
||||
);
|
||||
|
||||
private:
|
||||
shader_source_manager m_preprocessor{};
|
||||
|
||||
std::vector<shading::shader_source_requirements> m_source_requirement_buffer{};
|
||||
std::vector<preprocessed_shader_source_metadata> m_preprocessed_shader_source_metadata_buffer{};
|
||||
std::vector<const char*> m_source_strings_buffer{};
|
||||
std::vector<shader_lookup_entry_type> m_shader_lookup{};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user