4#ifndef GREM_GRAPHICS_CONSTANT_DESCRIPTION_HPP
5#define GREM_GRAPHICS_CONSTANT_DESCRIPTION_HPP
59struct is_shader_constant : std::false_type {};
61template <constant_value_type T>
62struct is_shader_constant<
T> : std::true_type {};
64template <
typename TupleType>
65inline constexpr bool is_shader_constant_v = is_shader_constant<TupleType>::value;
67template <
typename TupleType>
68struct is_shader_constants : std::false_type {};
70template <
typename... Ts>
71struct is_shader_constants<
Tuple<Ts...>> : std::bool_constant<(is_shader_constant_v<std::remove_cvref_t<Ts>> && ...)> {};
73template <
typename TupleType>
74inline constexpr bool is_shader_constants_v = is_shader_constants<TupleType>::value;
88 detail::is_shader_constants_v<decltype(meta::getFields(std::declval<T>()))>;
100static_assert(
sizeof(float) ==
sizeof(
float32_t));
101static_assert(
alignof(float) ==
alignof(
float32_t));
102static_assert(
sizeof(
bool32_t) ==
sizeof(
float));
103static_assert(
sizeof(int32_t) ==
sizeof(
float));
104static_assert(
sizeof(uint32_t) ==
sizeof(
float));
105static_assert(
alignof(
bool32_t) ==
alignof(
float));
106static_assert(
alignof(int32_t) ==
alignof(
float));
107static_assert(
alignof(uint32_t) ==
alignof(
float));
109template <
typename ConstantStruct>
110[[nodiscard]]
constexpr auto getConstantDescriptions() {
114 .type = detail::CONSTANT_TYPE<T>,
121template <
typename ConstantStruct>
122inline constexpr auto CONSTANT_DESCRIPTIONS = getConstantDescriptions<ConstantStruct>();
Definition fundamentals.hpp:109
Definition concepts.hpp:100
Concept that checks if a type is a valid value type for a shader constant.
Definition ConstantDescription.hpp:30
Concept that checks if a type is a valid shader constant struct type.
Definition ConstantDescription.hpp:84
Definition concepts.hpp:35
Definition concepts.hpp:109
Definition concepts.hpp:187
@ T
't'
Definition keyboard.hpp:90
Definition buffer_layouts.hpp:20
ConstantType
Specification of the underlying value type of a shader constant.
Definition ConstantDescription.hpp:39
@ UINT
C++: uint32_t, GLSL: uint.
Definition ConstantDescription.hpp:42
@ INT
C++: int32_t, GLSL: int.
Definition ConstantDescription.hpp:41
@ BOOL
C++: bool32_t, GLSL: bool.
Definition ConstantDescription.hpp:40
@ FLOAT
C++: float, GLSL: float.
Definition ConstantDescription.hpp:43
float float32_t
Definition fundamentals.hpp:155
Tuple(Ts...) -> Tuple< Ts... >
CStringViewBase< char, std::char_traits< char > > CStringView
Definition CStringView.hpp:635
Description of a constant in a shader constant struct.
Definition ConstantDescription.hpp:93
ConstantType type
Constant value type.
Definition ConstantDescription.hpp:94
CStringView name
Identifier that the constant is accessed by in the shader source code.
Definition ConstantDescription.hpp:95