tried making naming more uniform and implemented most of the opengl managers

This commit is contained in:
ZY4N
2025-03-25 02:22:44 +01:00
parent c609d49f0d
commit 71ea2d9237
155 changed files with 4097 additions and 2434 deletions

View File

@@ -1,36 +0,0 @@
#pragma once
namespace zgl
{
class buffer_manager
{
public:
using store_type = dynamic_texture_store;
using store_id_type = store_type::id_type;
using resource_manager_type = resource_manager<store_id_type>;
using resource_type = resource_manager_type::resource_handle;
using handle_type = texture_handle;
static constexpr std::size_t min_garbage_collection_count = 4;
void process(store_type& store);
std::optional<handle_type> get_handle(store_id_type id);
void collect_garbage(bool force = false);
private:
resource_manager<store_id_type> m_resource_manager;
std::vector<std::pair<dynamic_texture_store::id_type, const dynamic_texture_buffer&>> m_texture_buffer;
std::vector<GLuint> m_texture_id_buffer;
};
}

View File

@@ -0,0 +1,35 @@
#pragma once
#include "../../assets/data_stores"
#include "opengl/resource_management/resource_manager.hpp"
#include "opengl/handles/index_buffer_handle.hpp"
#include "opengl/metadata/index_buffer_metadata.hpp"
namespace zgl
{
class mesh_index_buffer_manager
{
public:
using store_type = dynamic_mesh_store;
using store_id_type = store_type::id_type;
using metadata_type = index_buffer_metadata;
using handle_type = index_buffer_handle;
using resource_manager_type = resource_manager<store_id_type, metadata_type>;
using entry_type = std::pair<handle_type, metadata_type>;
static constexpr std::size_t min_garbage_collection_count = 4;
void process(store_type& store);
std::optional<entry_type> get_handle(store_id_type id);
void collect_garbage(bool force = false);
protected:
resource_manager_type m_resource_manager;
private:
std::vector<store_type::iterator_type::value_type> m_mesh_buffer;
std::vector<GLuint> m_buffer_id_buffer;
};
}

View File

@@ -1,32 +1,38 @@
#pragma once
#include "assets/dynamic_data_stores/dynamic_mesh_store.hpp"
#include "assets/data_stores/mesh_store.hpp"
#include "opengl/resource_management/resource_manager.hpp"
#include "opengl/handles/vertex_buffer_handle.hpp"
#include "opengl/metadata/vertex_buffer_metadata.hpp"
#include "opengl/metadata/mesh_vertex_buffer_metadata.hpp"
namespace zgl
{
class mesh_vertex_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 = vertex_buffer_metadata;
using metadata_type = mesh_vertex_buffer_metadata;
using handle_type = vertex_buffer_handle;
using resource_manager_type = resource_manager<store_id_type, metadata_type>;
using texture_entry_type = std::pair<handle_type, metadata_type>;
using entry_type = std::pair<handle_type, metadata_type>;
static constexpr std::size_t min_garbage_collection_count = 4;
void process(store_type& store);
std::optional<texture_entry_type> get_handle(store_id_type id);
std::optional<entry_type> get_handle(store_id_type id);
void collect_garbage(bool force = false);
private:
protected:
resource_manager_type m_resource_manager;
private:
std::vector<store_type::iterator_type::value_type> m_mesh_buffer;
std::vector<GLuint> m_buffer_id_buffer;
std::vector<ztu::u8> m_byte_buffer;
};
}

View File

@@ -0,0 +1,38 @@
#pragma once
#include "assets/data_stores/point_cloud_store.hpp"
#include "opengl/resource_management/resource_manager.hpp"
#include "opengl/handles/vertex_buffer_handle.hpp"
#include "opengl/metadata/point_cloud_vertex_buffer_metadata.hpp"
namespace zgl
{
class point_cloud_vertex_buffer_manager
{
public:
using store_type = assets::point_cloud_store;
using store_id_type = store_type::id_type;
using metadata_type = point_cloud_vertex_buffer_metadata;
using handle_type = vertex_buffer_handle;
using resource_manager_type = resource_manager<store_id_type, metadata_type>;
using entry_type = std::pair<handle_type, metadata_type>;
static constexpr std::size_t min_garbage_collection_count = 4;
void process(store_type& store);
std::optional<entry_type> get_handle(store_id_type id);
void collect_garbage(bool force = false);
protected:
resource_manager_type m_resource_manager;
private:
std::vector<store_type::iterator_type::value_type> m_point_cloud_buffer;
std::vector<GLuint> m_buffer_id_buffer;
std::vector<ztu::u8> m_byte_buffer;
};
}

View File

@@ -6,7 +6,7 @@
#include <ranges>
#include <bits/ranges_algo.h>
#include "assets/dynamic_data_stores/dynamic_shader_source_store.hpp"
#include "assets/data_stores/shader_source_store.hpp"
#include "opengl/shader_program_lookup.hpp"
#include "opengl/handles/shader_handle.hpp"
#include "util/string_lookup.hpp"
@@ -26,11 +26,11 @@ class shader_manager
public:
void process(
const dynamic_shader_source_store& shader_sources
const assets::shader_source_store& shader_sources
);
void get_handles(
const dynamic_shader_source_store& shader_sources,
const assets::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

View File

@@ -1,7 +1,7 @@
#pragma once
#include "shader_manager.hpp"
#include "assets/dynamic_data_stores/dynamic_shader_source_store.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"
@@ -18,11 +18,11 @@ class shader_program_manager
public:
void process(
const dynamic_shader_source_store& shader_sources
const assets::shader_source_store& shader_sources
);
void get_handles(
const dynamic_shader_source_store& shader_sources,
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

View File

@@ -6,11 +6,11 @@
#include <span>
#include "util/string_lookup.hpp"
#include "../metadata/shader_source_metadata.hpp"
#include "opengl/metadata/shader_source_metadata.hpp"
#include "opengl/shading/requirements/shader_source_requirements.hpp"
#include "opengl/metadata/preprocessed_shader_source_metadata.hpp"
#include "assets/dynamic_data_stores/dynamic_shader_source_store.hpp"
#include "assets/data_stores/shader_source_store.hpp"
#include "opengl/shading/shader_source_set.hpp"
namespace zgl {
@@ -19,11 +19,11 @@ class shader_source_manager {
public:
void process(
const dynamic_shader_source_store& shader_sources
const assets::shader_source_store& shader_sources
);
void get_shader_sources(
const dynamic_shader_source_store& shader_sources,
const assets::shader_source_store& shader_sources,
std::span<const shading::shader_source_requirements> requirements,
std::span<preprocessed_shader_source_metadata> metadata,
std::vector<const char*>& shader_strings
@@ -79,7 +79,7 @@ private:
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, dynamic_shader_source_store::id_type>;
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,8 +2,8 @@
#include <unordered_map>
#include "assets/dynamic_read_buffers/dynamic_texture_buffer.hpp"
#include "assets/dynamic_data_stores/dynamic_texture_store.hpp"
#include "../../assets/read_buffers"
#include "../../assets/data_stores"
#include "opengl/handles/texture_handle.hpp"
#include <vector>
@@ -20,20 +20,20 @@ public:
using metadata_type = texture_metadata;
using handle_type = texture_handle;
using resource_manager_type = resource_manager<store_id_type, metadata_type>;
using texture_entry_type = std::pair<handle_type, metadata_type>;
using entry_type = std::pair<handle_type, metadata_type>;
static constexpr std::size_t min_garbage_collection_count = 4;
void process(store_type& store);
std::optional<texture_entry_type> get_handle(store_id_type id);
std::optional<entry_type> get_handle(store_id_type id);
void collect_garbage(bool force = false);
private:
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<GLuint> m_texture_id_buffer;
};