std140 implementation

This commit is contained in:
ZY4N
2025-03-27 19:47:32 +01:00
parent 70893c083b
commit 6f60cc11c8
45 changed files with 789 additions and 234 deletions

View File

@@ -4,9 +4,9 @@
#include "opengl/error.hpp"
#include "opengl/type_utils.hpp"
void zgl::mesh_index_buffer_manager::process(const assets::data_stores& stores)
void zgl::mesh_index_buffer_manager::process(const store_type& meshes)
{
for (const auto& [ id, mesh ] : stores.meshes)
for (const auto& [ id, mesh ] : meshes)
{
if (not m_resource_manager.has_resource(id))
{

View File

@@ -2,12 +2,12 @@
#include "util/logger.hpp"
#include "opengl/error.hpp"
#include "opengl/vertex_buffer_utils.hpp"
#include "opengl/type_utils.hpp"
void zgl::mesh_vertex_buffer_manager::process(const assets::data_stores& stores)
void zgl::mesh_vertex_buffer_manager::process(const store_type& meshes)
{
for (const auto& [ id, mesh ] : stores.meshes)
for (const auto& [ id, mesh ] : meshes)
{
if (not m_resource_manager.has_resource(id))
{
@@ -30,16 +30,10 @@ void zgl::mesh_vertex_buffer_manager::process(const assets::data_stores& stores)
m_byte_buffer.clear();
std::apply(
[&](const auto&... component_buffers)
{
vertex_buffer_utils::interlace(
m_byte_buffer,
mesh.component_flags,
mesh.vertex_count,
component_buffers...
);
},
type_utils::interlace_vertex_buffer(
m_byte_buffer,
mesh.component_flags,
mesh.vertex_count,
mesh.vertex_component_arrays
);

View File

@@ -2,12 +2,12 @@
#include "util/logger.hpp"
#include "opengl/error.hpp"
#include "opengl/vertex_buffer_utils.hpp"
#include "opengl/type_utils.hpp"
void zgl::point_cloud_vertex_buffer_manager::process(const assets::data_stores& stores)
void zgl::point_cloud_vertex_buffer_manager::process(const store_type& point_clouds)
{
for (const auto& [ id, point_cloud ] : stores.point_clouds)
for (const auto& [ id, point_cloud ] : point_clouds)
{
if (not m_resource_manager.has_resource(id))
{
@@ -30,16 +30,10 @@ void zgl::point_cloud_vertex_buffer_manager::process(const assets::data_stores&
m_byte_buffer.clear();
std::apply(
[&](const auto&... component_buffers)
{
vertex_buffer_utils::interlace(
m_byte_buffer,
point_cloud.vertex_component_flags,
point_cloud.point_count,
component_buffers...
);
},
type_utils::interlace_vertex_buffer(
m_byte_buffer,
point_cloud.vertex_component_flags,
point_cloud.point_count,
point_cloud.vertex_component_arrays
);

View File

@@ -79,6 +79,11 @@ std::optional<std::pair<zgl::shader_metadata, zgl::shader_handle>> zgl::shader_m
return std::nullopt;
}
void zgl::shader_manager::process(const store_type& shader_sources)
{
m_preprocessor.process(shader_sources);
}
void zgl::shader_manager::get_handles(
const assets::shader_source_store& shader_sources,
std::span<const shading::shader_set_requirements> requirements,
@@ -256,9 +261,3 @@ bool zgl::shader_manager::compile_shader(
return true;
}
void zgl::shader_manager::process(
const assets::data_stores& stores
) {
m_preprocessor.process(stores);
}

View File

@@ -24,10 +24,9 @@ struct prioritized_metadata_comparator
}
};
void zgl::shader_program_manager::process(
const assets::data_stores& stores
) {
m_shader_manager.preprocess(stores);
void zgl::shader_program_manager::process(const store_type& shader_sources)
{
m_shader_manager.process(shader_sources);
}
void zgl::shader_program_manager::get_handles(

View File

@@ -76,12 +76,11 @@ private:
void zgl::shader_source_manager::process(
const assets::data_stores& stores
) {
void zgl::shader_source_manager::process(const store_type& shader_sources)
{
namespace language = shading::shader_metadata_language;
for (const auto& [ id, shader_source ] : stores.shader_sources)
for (const auto& [ id, shader_source ] : shader_sources)
{
m_value_token_buffer.clear();
m_declaration_token_count_buffer.clear();

View File

@@ -5,12 +5,11 @@
#include "opengl/error.hpp"
void zgl::texture_manager::process(
const assets::data_stores& stores
) {
void zgl::texture_manager::process(const store_type& textures)
{
m_texture_buffer.clear();
for (const auto& [ id, texture ] : stores.textures)
for (const auto& [ id, texture ] : textures)
{
if (not m_resource_manager.has_resource(id))
{