Files
Z3D/include/opengl/data_managers/shader_source_manager.hpp
2025-03-30 22:38:06 +02:00

51 lines
1.4 KiB
C++

#pragma once
#include <string_view>
#include <vector>
#include <optional>
#include <span>
#include "assets/data_stores.hpp"
#include "util/string_lookup.hpp"
#include "opengl/metadata/shader_source_metadata.hpp"
#include "opengl/shading/requirements/shader_requirements.hpp"
#include "opengl/metadata/preprocessed_shader_source_metadata.hpp"
#include "assets/data_stores/shader_source_store.hpp"
#include "opengl/shading/shader_source_set.hpp"
namespace zgl {
class shader_source_manager {
public:
using store_type = assets::shader_source_store;
using store_id_type = store_type::id_type;
using metadata_type = shader_source_metadata;
using data_type = char*;
using handle_type = const char*;
using entry_type = std::pair<metadata_type, store_id_type>;
using entry_view_type = std::pair<preprocessed_shader_source_metadata, handle_type>;
void process(const store_type& shader_sources);
void fetch(
const assets::shader_source_store& shader_sources,
std::span<const shading::shader_requirements> requirements,
std::span<preprocessed_shader_source_metadata> metadata,
std::vector<const char*>& shader_strings
);
protected:
static void get_define_strings(
assets::model_geometry::types geometry_type,
assets::shader_components::flags components,
assets::shader_components::flags& component_count,
std::vector<const char*>& defines
);
std::vector<entry_type> m_shader_source_lookup;
};
}