In the middle of multithreading parsers.

This commit is contained in:
zy4n
2025-03-30 22:38:06 +02:00
parent d18b40a7fc
commit 144126ee7a
80 changed files with 2904 additions and 1450 deletions

View File

@@ -21,16 +21,18 @@ struct type
namespace indices
{
using type = ztu::u8;
constexpr inline type face = 0;
constexpr inline type line = 1;
constexpr inline type point = 2;
constexpr inline type luminance = 3;
constexpr inline type color = 4;
constexpr inline type alpha = 5;
constexpr inline type lighting = 6;
constexpr inline type texture = 7;
constexpr inline type uniform_color = 8;
enum : z3d::size
{
face,
line,
point,
luminance,
color,
alpha,
lighting,
texture,
uniform_color
};
}
enum class flags : std::uint16_t

View File

@@ -23,14 +23,16 @@ struct type
namespace indices
{
using type = ztu::u8;
constexpr inline type square = 0;
constexpr inline type lighting = 1;
constexpr inline type luminance = 2;
constexpr inline type color = 3;
constexpr inline type alpha = 4;
constexpr inline type uniform_color = 5;
constexpr inline type rainbow = 6;
enum : z3d::size
{
square,
lighting,
luminance,
color,
alpha,
uniform_color,
rainbow
};
}
enum class flags : std::uint8_t

View File

@@ -1,57 +1,14 @@
#pragma once
#include "opengl/shading/model_geometry.hpp"
#include "opengl/shading/features/generic_features.hpp"
#include "assets/model_geometry.hpp"
#include "assets/components/shader_components.hpp"
namespace zgl::shading
{
struct shader_program_requirements
{
model_geometry::types geometry;
features::generic::type features;
assets::model_geometry::types geometry_type;
assets::shader_components::flags components{};
};
}
/*
struct shader_program_metadata
{
using generic_feature_type = std::common_type_t<
std::underlying_type_t<features::mesh::flags>,
std::underlying_type_t<features::point_cloud::flags>
>;
static constexpr auto geometry_bits = static_cast<std::size_t>(std::bit_width(geometry::names.size()));
static constexpr auto feature_bits = sizeof(generic_feature_type) * 8 - geometry_bits;
explicit shader_program_metadata(const features::mesh::flags static_enabled, const features::mesh::flags dynamic_enable) :
shader_program_metadata(
geometry::types::mesh,
static_cast<generic_feature_type>(static_enabled),
static_cast<generic_feature_type>(dynamic_enable)
) {}
explicit shader_program_metadata(const features::point_cloud::flags static_enabled, const features::point_cloud::flags dynamic_enable) :
shader_program_metadata(
geometry::types::point_cloud,
static_cast<generic_feature_type>(static_enabled),
static_cast<generic_feature_type>(dynamic_enable)
) {}
shader_program_metadata(const geometry::types geometry_type, const generic_feature_type static_enabled, generic_feature_type dynamic_enable) :
m_geometry_type{ geometry_type }, m_static_enabled{ static_enabled }, m_dynamic_enable{ dynamic_enable } {}
[[nodiscard]] auto operator<=>(const shader_program_metadata& other) const noexcept
{
return (
std::tie(this->m_geometry_type, std::popcount(this->m_static_enabled), std::popcount(this->m_dynamic_enable)) <=>
std::tie(other.m_geometry_type, std::popcount(other.m_static_enabled), std::popcount(other.m_dynamic_enable))
);
}
[[nodiscard]] bool operator==(const shader_program_metadata& other) const noexcept = default;
geometry::types m_geometry_type : geometry_bits;
generic_feature_type m_static_enabled : feature_bits;
generic_feature_type m_dynamic_enable;
};*/

View File

@@ -1,8 +1,16 @@
#pragma once
#include "shader_source_requirements.hpp"
#include "assets/model_geometry.hpp"
#include "assets/components/shader_components.hpp"
namespace zgl::shading
{
using shader_requirements = shader_source_requirements;
struct shader_requirements
{
assets::model_geometry::types geometry_type;
assets::shader_components::stage stage;
assets::shader_components::flags components{};
};
}

View File

@@ -1,13 +0,0 @@
#pragma once
#include "opengl/shading/features/generic_features.hpp"
namespace zgl::shading
{
struct shader_set_requirements
{
model_geometry::types geometry;
features::generic::type features;
};
}

View File

@@ -1,16 +0,0 @@
#pragma once
#include "opengl/shading/model_geometry.hpp"
#include "opengl/shading/shader_stage.hpp"
#include "opengl/shading/features/generic_features.hpp"
namespace zgl::shading
{
struct shader_source_requirements
{
model_geometry::types geometry;
stage::types stage;
features::generic::type features;
};
}

View File

@@ -11,34 +11,34 @@ namespace zgl::shading::mesh_sampler_uniforms
enum class flags : std::uint16_t
{
none = 0,
ambient_color_texture = 1 << 0,
diffuse_color_texture = 1 << 1,
specular_color_texture = 1 << 2,
specular_filter_texture = 1 << 0,
diffuse_filter_texture = 1 << 1,
specular_filter_texture = 1 << 2,
shininess_texture = 1 << 3,
alpha_texture = 1 << 4,
bump_texture = 1 << 5
};
constexpr inline auto ambient_color_texture = sampler_uniform{ 0 };
constexpr inline auto diffuse_color_texture = sampler_uniform{ 1 };
constexpr inline auto specular_color_texture = sampler_uniform{ 2 };
constexpr inline auto specular_filter_texture = sampler_uniform{ 0 };
constexpr inline auto diffuse_filter_texture = sampler_uniform{ 1 };
constexpr inline auto specular_filter_texture = sampler_uniform{ 2 };
constexpr inline auto shininess_texture = sampler_uniform{ 3 };
constexpr inline auto alpha_texture = sampler_uniform{ 4 };
constexpr inline auto bump_texture = sampler_uniform{ 5 };
constexpr inline auto all = std::array{
ambient_color_texture,
diffuse_color_texture,
specular_color_texture,
specular_filter_texture,
diffuse_filter_texture,
specular_filter_texture,
shininess_texture,
alpha_texture,
bump_texture
};
constexpr inline auto names = std::array{
"ambient_color_texture",
"diffuse_color_texture",
"specular_color_texture",
"specular_filter_texture",
"diffuse_filter_texture",
"specular_filter_texture",
"shininess_texture",
"alpha_texture",
"bump_texture"