Fixed bugs in lazy shader compilation.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "assets/components/material_components.hpp"
|
||||
#include "assets/components/mesh_vertex_components.hpp"
|
||||
#include "shader_program/features/mesh_features.hpp"
|
||||
#include "util/enum_bitfield_operators.hpp"
|
||||
|
||||
#include <array>
|
||||
|
||||
@@ -11,16 +12,16 @@ namespace rendering::requirements::mesh
|
||||
|
||||
struct type
|
||||
{
|
||||
shader_program::capabilities::mesh::indices::type shader_program_requirement_index{};
|
||||
shader_program::features::mesh::indices::type shader_program_requirement_index{};
|
||||
components::mesh_vertex::flags vertex_requirements{
|
||||
components::mesh_vertex::flags::none
|
||||
};
|
||||
material_component::flags material_requirements{
|
||||
material_component::flags::none
|
||||
components::material::flags material_requirements{
|
||||
components::material::flags::none
|
||||
};
|
||||
};
|
||||
|
||||
enum class flags : int
|
||||
enum class flags : std::uint8_t
|
||||
{
|
||||
none = 0,
|
||||
position = 1 << 0,
|
||||
@@ -32,33 +33,33 @@ enum class flags : int
|
||||
};
|
||||
|
||||
constexpr inline auto position = type{
|
||||
.shader_program_requirement_index = shader_program::capabilities::mesh::indices::position,
|
||||
.shader_program_requirement_index = shader_program::features::mesh::indices::position,
|
||||
.vertex_requirements = components::mesh_vertex::flags::position
|
||||
};
|
||||
|
||||
constexpr inline auto lit = type{
|
||||
.shader_program_requirement_index = shader_program::capabilities::mesh::indices::lit,
|
||||
.shader_program_requirement_index = shader_program::features::mesh::indices::lit,
|
||||
.vertex_requirements = components::mesh_vertex::flags::normal,
|
||||
.material_requirements = material_component::flags::surface_properties
|
||||
.material_requirements = components::material::flags::surface_properties
|
||||
};
|
||||
|
||||
constexpr inline auto point = type{
|
||||
.shader_program_requirement_index = shader_program::capabilities::mesh::indices::point
|
||||
.shader_program_requirement_index = shader_program::features::mesh::indices::point
|
||||
};
|
||||
|
||||
constexpr inline auto textured = type{
|
||||
.shader_program_requirement_index = shader_program::capabilities::mesh::indices::textured,
|
||||
.shader_program_requirement_index = shader_program::features::mesh::indices::textured,
|
||||
.vertex_requirements = components::mesh_vertex::flags::tex_coord,
|
||||
.material_requirements = material_component::flags::texture,
|
||||
.material_requirements = components::material::flags::texture,
|
||||
};
|
||||
|
||||
constexpr inline auto uniform_color = type{
|
||||
.shader_program_requirement_index = shader_program::capabilities::mesh::indices::uniform_color
|
||||
.shader_program_requirement_index = shader_program::features::mesh::indices::uniform_color
|
||||
};
|
||||
|
||||
constexpr inline auto uniform_alpha = type{
|
||||
.shader_program_requirement_index = shader_program::capabilities::mesh::indices::uniform_alpha,
|
||||
.material_requirements = material_component::flags::transparency
|
||||
.shader_program_requirement_index = shader_program::features::mesh::indices::uniform_alpha,
|
||||
.material_requirements = components::material::flags::transparency
|
||||
};
|
||||
|
||||
constexpr inline auto all = std::array{
|
||||
@@ -67,61 +68,4 @@ constexpr inline auto all = std::array{
|
||||
|
||||
}
|
||||
|
||||
|
||||
[[nodiscard]] constexpr rendering::requirements::mesh::flags operator|(
|
||||
const rendering::requirements::mesh::flags& a, const rendering::requirements::mesh::flags& b
|
||||
) {
|
||||
return static_cast<rendering::requirements::mesh::flags>(static_cast<int>(a) | static_cast<int>(b));
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr rendering::requirements::mesh::flags operator&(
|
||||
const rendering::requirements::mesh::flags& a, const rendering::requirements::mesh::flags& b
|
||||
) {
|
||||
return static_cast<rendering::requirements::mesh::flags>(static_cast<int>(a) & static_cast<int>(b));
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr rendering::requirements::mesh::flags operator^(
|
||||
const rendering::requirements::mesh::flags& a, const rendering::requirements::mesh::flags& b
|
||||
) {
|
||||
return static_cast<rendering::requirements::mesh::flags>(static_cast<int>(a) ^ static_cast<int>(b));
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr rendering::requirements::mesh::flags operator~(const rendering::requirements::mesh::flags& a) {
|
||||
return static_cast<rendering::requirements::mesh::flags>(~static_cast<int>(a));
|
||||
}
|
||||
|
||||
constexpr rendering::requirements::mesh::flags& operator|=(rendering::requirements::mesh::flags& a, const rendering::requirements::mesh::flags& b) {
|
||||
return a = a | b;
|
||||
}
|
||||
|
||||
constexpr rendering::requirements::mesh::flags& operator&=(rendering::requirements::mesh::flags& a, const rendering::requirements::mesh::flags& b) {
|
||||
return a = a & b;
|
||||
}
|
||||
|
||||
constexpr rendering::requirements::mesh::flags& operator^=(rendering::requirements::mesh::flags& a, const rendering::requirements::mesh::flags& b) {
|
||||
return a = a ^ b;
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr bool operator<(
|
||||
rendering::requirements::mesh::flags lhs, rendering::requirements::mesh::flags rhs
|
||||
) {
|
||||
return static_cast<int>(lhs) < static_cast<int>(rhs);
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr bool operator<=(
|
||||
rendering::requirements::mesh::flags lhs, rendering::requirements::mesh::flags rhs
|
||||
) {
|
||||
return static_cast<int>(lhs) <= static_cast<int>(rhs);
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr bool operator>(
|
||||
rendering::requirements::mesh::flags lhs, rendering::requirements::mesh::flags rhs
|
||||
) {
|
||||
return static_cast<int>(lhs) > static_cast<int>(rhs);
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr bool operator>=(
|
||||
rendering::requirements::mesh::flags lhs, rendering::requirements::mesh::flags rhs
|
||||
) {
|
||||
return static_cast<int>(lhs) >= static_cast<int>(rhs);
|
||||
}
|
||||
DEFINE_ENUM_BITFIELD_OPERATORS(rendering::requirements::mesh::flags)
|
||||
|
||||
Reference in New Issue
Block a user