Further shader compilation development.
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
#pragma once
|
||||
|
||||
#include "model_geometry.hpp"
|
||||
#include "shader_stage.hpp"
|
||||
#include "features/mesh_features.hpp"
|
||||
#include "features/point_cloud_features.hpp"
|
||||
#include "features/generic_features.hpp"
|
||||
|
||||
namespace zgl::shading
|
||||
{
|
||||
|
||||
struct shader_program_requirements
|
||||
{
|
||||
|
||||
static constexpr auto geometry_bits = static_cast<std::size_t>(std::bit_width(model_geometry::names.size()));
|
||||
static constexpr auto feature_bits = sizeof(features::generic::type) * 8 - geometry_bits;
|
||||
|
||||
explicit shader_program_requirements(const features::mesh::flags mesh_features) :
|
||||
shader_program_requirements(model_geometry::types::mesh, static_cast<features::generic::type>(mesh_features)) {}
|
||||
|
||||
explicit shader_program_requirements(const features::point_cloud::flags point_cloud_features) :
|
||||
shader_program_requirements(model_geometry::types::point_cloud, static_cast<features::generic::type>(point_cloud_features)) {}
|
||||
|
||||
shader_program_requirements(const model_geometry::types geometry_type, const features::generic::type generic_features) :
|
||||
geometry_type{ geometry_type }, features{ generic_features } {}
|
||||
|
||||
|
||||
[[nodiscard]] auto operator<=>(const shader_program_requirements& other) const noexcept
|
||||
{
|
||||
return (
|
||||
std::tie(this->geometry_type, std::popcount(this->features)) <=>
|
||||
std::tie(other.geometry_type, std::popcount(other.features))
|
||||
);
|
||||
}
|
||||
|
||||
[[nodiscard]] bool operator==(const shader_program_requirements& other) const noexcept = default;
|
||||
|
||||
model_geometry::types geometry_type : geometry_bits;
|
||||
features::generic::type features : feature_bits;
|
||||
};
|
||||
|
||||
/*
|
||||
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;
|
||||
};*/
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user