This commit is contained in:
ZY4N
2025-03-25 15:57:32 +01:00
parent a78be71e34
commit 70893c083b
24 changed files with 78 additions and 64 deletions

View File

@@ -10,7 +10,7 @@
#include "assets/components/texture_components.hpp"
#include "assets/data/texture_data.hpp"
#include "assets/data_stores/texture_store.hpp"
#include "assets/dynamic_data_store.hpp"
#include "assets/data_stores.hpp"
#include "assets/prefetch_queue.hpp"
#include "assets/prefetch_lookups/texture_prefetch_lookup.hpp"
#include "util/string_list.hpp"

View File

@@ -11,7 +11,7 @@
namespace assets
{
struct dynamic_data_store
struct data_stores
{
material_library_store material_libraries;
material_store materials;

View File

@@ -4,7 +4,7 @@
#include <vector>
#include <string>
#include "assets/dynamic_data_store.hpp"
#include "assets/data_stores.hpp"
#include "assets/prefetch_lookup.hpp"
#include "assets/prefetch_queue.hpp"
#include "assets/prefetch_lookups/mesh_prefetch_lookup.hpp"

View File

@@ -4,7 +4,7 @@
#include <vector>
#include <span>
#include "assets/dynamic_data_store.hpp"
#include "assets/data_stores.hpp"
#include "assets/components/point_cloud_vertex_components.hpp"
#include "assets/data/point_cloud_data.hpp"
#include "assets/data_stores/point_cloud_store.hpp"

View File

@@ -2,7 +2,7 @@
#include <filesystem>
#include "assets/dynamic_data_store.hpp"
#include "assets/data_stores.hpp"
#include "assets/prefetch_lookup.hpp"
#include "assets/prefetch_queue.hpp"
#include "util/string_list.hpp"

View File

@@ -3,7 +3,7 @@
#include <filesystem>
#include <system_error>
#include "assets/dynamic_data_store.hpp"
#include "assets/data_stores.hpp"
#include "assets/prefetch_lookup.hpp"
#include "assets/prefetch_queue.hpp"
#include "assets/data"

View File

@@ -4,7 +4,7 @@
#include <system_error>
#include <string_view>
#include "assets/dynamic_data_store.hpp"
#include "assets/data_stores.hpp"
#include "assets/data"
#include "../data_stores"
#include "assets/prefetch_lookup.hpp"

View File

@@ -2,7 +2,7 @@
#include <filesystem>
#include "assets/dynamic_data_store.hpp"
#include "assets/data_stores.hpp"
#include "assets/prefetch_lookup.hpp"
#include "assets/prefetch_queue.hpp"
#include "assets/data"

View File

@@ -1,6 +1,7 @@
#pragma once
#include "../../assets/data_stores"
#include "assets/data_stores.hpp"
#include "assets/data_stores/mesh_store.hpp"
#include "opengl/resource_management/resource_manager.hpp"
#include "opengl/handles/index_buffer_handle.hpp"
#include "opengl/metadata/index_buffer_metadata.hpp"
@@ -10,7 +11,7 @@ namespace zgl
class mesh_index_buffer_manager
{
public:
using store_type = dynamic_mesh_store;
using store_type = assets::mesh_store;
using store_id_type = store_type::id_type;
using metadata_type = index_buffer_metadata;
using handle_type = index_buffer_handle;
@@ -19,7 +20,7 @@ public:
static constexpr std::size_t min_garbage_collection_count = 4;
void process(store_type& store);
void process(const assets::data_stores& stores);
std::optional<entry_type> get_handle(store_id_type id);

View File

@@ -1,6 +1,7 @@
#pragma once
#include "assets/data_stores.hpp"
#include "assets/data_stores/mesh_store.hpp"
#include "opengl/resource_management/resource_manager.hpp"
#include "opengl/handles/vertex_buffer_handle.hpp"
@@ -20,7 +21,7 @@ public:
static constexpr std::size_t min_garbage_collection_count = 4;
void process(store_type& store);
void process(const assets::data_stores& stores);
std::optional<entry_type> get_handle(store_id_type id);

View File

@@ -1,5 +1,6 @@
#pragma once
#include "assets/data_stores.hpp"
#include "assets/data_stores/point_cloud_store.hpp"
#include "opengl/resource_management/resource_manager.hpp"
#include "opengl/handles/vertex_buffer_handle.hpp"
@@ -20,7 +21,7 @@ public:
static constexpr std::size_t min_garbage_collection_count = 4;
void process(store_type& store);
void process(const assets::data_stores& stores);
std::optional<entry_type> get_handle(store_id_type id);

View File

@@ -11,6 +11,7 @@
#include "opengl/handles/shader_handle.hpp"
#include "util/string_lookup.hpp"
#include "shader_source_manager.hpp"
#include "assets/data_stores.hpp"
#include "opengl/metadata/shader_metadata.hpp"
#include "opengl/data/shader_data.hpp"
#include "opengl/handles/shader_handle_set.hpp"
@@ -22,12 +23,15 @@ namespace zgl
{
class shader_manager
{
using shader_lookup_entry_type = std::pair<shader_metadata, shader_data>;
using metadata_type = shader_metadata;
using data_type = shader_data;
using handle_type = shader_handle;
using entry_type = std::pair<metadata_type, data_type>;
using entry_view_type = std::pair<metadata_type, handle_type>;
public:
void process(
const assets::shader_source_store& shader_sources
);
void process(const assets::data_stores& stores);
void get_handles(
const assets::shader_source_store& shader_sources,
@@ -37,7 +41,7 @@ public:
);
protected:
std::optional<std::pair<shader_metadata, shader_handle>> find_shader(
std::optional<entry_view_type> find_shader(
const shading::shader_requirements& requirements
);
@@ -47,12 +51,13 @@ protected:
shader_data& shader
);
private:
shader_source_manager m_preprocessor{};
shader_source_manager m_preprocessor{};
std::vector<entry_type> m_shader_lookup{};
private:
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{};
};
}

View File

@@ -11,15 +11,14 @@ namespace zgl
class shader_program_manager
{
using shader_program_lookup_entry_type = std::pair<
shader_program_metadata,
shader_program_data
>;
public:
void process(
const assets::shader_source_store& shader_sources
);
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 assets::data_stores& stores);
void get_handles(
const assets::shader_source_store& shader_sources,
@@ -29,7 +28,7 @@ public:
);
protected:
std::optional<std::pair<shader_program_metadata, shader_program_handle>> find_shader_program(
std::optional<entry_view_type> find_shader_program(
const shading::shader_program_requirements& requirements
);
@@ -38,10 +37,9 @@ protected:
);
shader_manager m_shader_manager;
std::vector<shader_program_lookup_entry_type> m_shader_program_lookup;
std::vector<entry_type> m_shader_program_lookup;
private:
std::vector<shading::shader_set_requirements> m_shader_requirements_buffer;
std::vector<shader_set_metadata> m_shader_metadata_buffer;
std::vector<shader_handle_set> shader_set_buffer;

View File

@@ -4,6 +4,8 @@
#include <vector>
#include <optional>
#include <span>
#include "assets/data_stores.hpp"
#include "util/string_lookup.hpp"
#include "opengl/metadata/shader_source_metadata.hpp"
@@ -18,9 +20,15 @@ namespace zgl {
class shader_source_manager {
public:
void process(
const assets::shader_source_store& shader_sources
);
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 assets::data_stores& stores);
void get_shader_sources(
const assets::shader_source_store& shader_sources,
@@ -74,14 +82,12 @@ protected:
std::vector<const char*>& defines
);
std::vector<entry_type> m_shader_source_lookup;
private:
std::vector<std::string_view> m_value_token_buffer;
std::vector<std::size_t> m_declaration_token_count_buffer;
std::array<std::size_t, 4> m_declaration_type_index_buffer;
using source_lookup_entry_type = std::pair<shader_source_metadata, assets::shader_source_store::id_type>;
using source_lookup_type = std::vector<source_lookup_entry_type>;
source_lookup_type m_shader_source_lookup;
};
}

View File

@@ -2,11 +2,12 @@
#include <unordered_map>
#include "../../assets/read_buffers"
#include "../../assets/data_stores"
#include "assets/data/texture_data.hpp"
#include "assets/data_stores/texture_store.hpp"
#include "opengl/handles/texture_handle.hpp"
#include <vector>
#include "assets/data_stores.hpp"
#include "opengl/metadata/texture_metadata.hpp"
#include "opengl/resource_management/resource_manager.hpp"
@@ -15,7 +16,7 @@ namespace zgl
class texture_manager
{
public:
using store_type = dynamic_texture_store;
using store_type = assets::texture_store;
using store_id_type = store_type::id_type;
using metadata_type = texture_metadata;
using handle_type = texture_handle;
@@ -24,7 +25,7 @@ public:
static constexpr std::size_t min_garbage_collection_count = 4;
void process(store_type& store);
void process(const assets::data_stores& stores);
std::optional<entry_type> get_handle(store_id_type id);
@@ -34,7 +35,7 @@ protected:
resource_manager_type m_resource_manager;
private:
std::vector<std::pair<dynamic_texture_store::id_type, const dynamic_texture_buffer&>> m_texture_buffer;
std::vector<std::pair<store_id_type, const assets::texture_data&>> m_texture_buffer;
std::vector<GLuint> m_texture_id_buffer;
};

View File

@@ -2,6 +2,7 @@
#include "assets/components/mesh_vertex_components.hpp"
#include "assets/data_stores/material_store.hpp"
#include "opengl/handles/material_handle.hpp"
namespace zgl
{
@@ -9,7 +10,7 @@ namespace zgl
struct mesh_vertex_buffer_metadata
{
assets::mesh_vertex_components::flags component_flags;
assets::material_store::id_type material_id{};
material_handle material{};
};
}