GLSL Struct 1.4.0
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::utils {
25 #pragma region IS_SIMPLE
26 /**
27 * @brief check if type is glsl simple (is of scalar or vec or mat type)
28 * @ingroup utils
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 array of glsl simple (scalar or vec or mat type)
36 * @ingroup utils
37 */
38 template<class T>
39 static _GLSL_STRUCT_CONSTEXPR17 bool is_glsl_simples_array_v =
40 is_glsl_scalars_array_v<T> || is_glsl_vecs_array_v<T> || is_glsl_mats_array_v<T>;
41
42 /**
43 * @brief check if type is static size array of glsl simple (scalar or vec or mat type)
44 * @ingroup utils
45 */
46 template<class T>
47 static _GLSL_STRUCT_CONSTEXPR17 bool is_glsl_simples_static_size_array_v =
48 is_glsl_scalars_static_size_array_v<T> || is_glsl_vecs_static_size_array_v<T> || is_glsl_mats_static_size_array_v<T>;
49
51 /**
52 * @brief check if type is glsl simple (is of scalar or vec or mat type)
53 * @ingroup utils
54 * @tparam T type which is glsl simple type
55 */
56 template<class T> concept glsl_simple = is_glsl_simple_v<T>;
57
58 /**
59 * @brief check if type is array of glsl simple (scalar or vec or mat type)
60 * @ingroup utils
61 */
62 template<class T> concept glsl_simples_array = is_glsl_simples_array_v<T>;
63
64 /**
65 * @brief check if type is static size array of glsl simple (scalar or vec or mat type)
66 * @ingroup utils
67 */
68 template<class T> concept glsl_simples_static_size_array = is_glsl_simples_static_size_array_v<T>;
69 #endif
70 #pragma endregion
71} // namespace glslstruct::utils
72
73 #endif
74#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