GLSL Struct 1.4.8
glslstruct
Loading...
Searching...
No Matches
simple_checks.hpp
1/*
2 * glslstruct - a C++ library designed to easily represent GLSL's Uniform Buffer Objects (UBOs) and Shader Storage Buffer Objects (SSBOs) in C++.
3 *
4 * Licensed under the BSD 3-Clause License with Attribution Requirement.
5 * See the LICENSE file for details: https://github.com/MAIPA01/glslstruct/blob/main/LICENSE
6 *
7 * Copyright (c) 2025, Patryk Antosik (MAIPA01)
8 */
9
10#pragma once
11#ifndef _GLSL_STRUCT_VALUE_CHECKS_HPP_
12 #define _GLSL_STRUCT_VALUE_CHECKS_HPP_
13
14 #include <glslstruct/config.hpp>
15
17_GLSL_STRUCT_ERROR("This is only available for c++17 and greater!");
18 #else
19
20 #include <glslstruct/type/traits/mat_traits.hpp>
21 #include <glslstruct/type/traits/scalar_traits.hpp>
22 #include <glslstruct/type/traits/vec_traits.hpp>
23
24namespace glslstruct {
25 #pragma region IS_SIMPLE
26 /**
27 * @brief check if type is glsl simple (is of scalar or vec or mat type)
28 * @ingroup glslstruct
29 * @tparam T type which is glsl simple type
30 */
31 template<class T>
32 static _GLSL_STRUCT_CONSTEXPR17 bool is_glsl_simple_v = is_glsl_scalar_v<T> || is_glsl_vec_v<T> || is_glsl_mat_v<T>;
33
34 /**
35 * @brief check if type is glsl simple (is of scalar or vec or mat type)
36 * @ingroup glslstruct
37 * @tparam T type which is glsl simple type
38 */
39 template<class T>
40 struct is_glsl_simple : std::bool_constant<is_glsl_simple_v<T>> {};
41
43 /**
44 * @brief check if type is glsl simple (is of scalar or vec or mat type)
45 * @ingroup glslstruct
46 * @tparam T type which is glsl simple type
47 */
48 template<class T> concept glsl_simple = is_glsl_simple_v<T>;
49 #endif
50
51 #pragma endregion
52
53 namespace utils {
54 #pragma region IS_SIMPLE_ARRAY
55 /**
56 * @brief check if type is array of glsl simple (scalar or vec or mat type)
57 * @ingroup utils
58 */
59 template<class T>
60 static _GLSL_STRUCT_CONSTEXPR17 bool is_glsl_simples_array_v =
61 is_glsl_scalars_array_v<T> || is_glsl_vecs_array_v<T> || is_glsl_mats_array_v<T>;
62
63 /**
64 * @brief check if type is static size array of glsl simple (scalar or vec or mat type)
65 * @ingroup utils
66 */
67 template<class T>
68 static _GLSL_STRUCT_CONSTEXPR17 bool is_glsl_simples_static_size_array_v =
69 is_glsl_scalars_static_size_array_v<T> || is_glsl_vecs_static_size_array_v<T> || is_glsl_mats_static_size_array_v<T>;
70
72 /**
73 * @brief check if type is array of glsl simple (scalar or vec or mat type)
74 * @ingroup utils
75 */
76 template<class T> concept glsl_simples_array = is_glsl_simples_array_v<T>;
77
78 /**
79 * @brief check if type is static size array of glsl simple (scalar or vec or mat type)
80 * @ingroup utils
81 */
82 template<class T> concept glsl_simples_static_size_array = is_glsl_simples_static_size_array_v<T>;
83 #endif
84 #pragma endregion
85 } // namespace utils
86} // namespace glslstruct
87
88 #endif
89#endif
#define _GLSL_STRUCT_HAS_CXX20
check if compiler has c++ version greater or equal to c++20 and if user enabled c++20 features using ...
Definition config.hpp:142
#define _GLSL_STRUCT_HAS_CXX17
check if compiler has c++ version greater or equal to c++17
Definition config.hpp:130
#define _GLSL_STRUCT_CONSTEXPR17
constexpr for c++17 and higher
Definition config.hpp:196