GLSL Struct 1.4.0
glslstruct
Loading...
Searching...
No Matches
layout_traits_contexts.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_LAYOUT_TRAITS_CONTEXTS_HPP_
12 #define _GLSL_STRUCT_LAYOUT_TRAITS_CONTEXTS_HPP_
13
14 #include <glslstruct/config.hpp>
15
17_GLSL_STRUCT_ERROR("This is only available for c++17 and greater!");
18 #else
19
20namespace glslstruct {
21 /**
22 * @brief layout context which contains max alignment of all variables
23 * @ingroup glslstruct
24 */
26 /// @brief contains max alignment value
27 size_t maxAlignment = 0;
28
29 /// @brief updates max alignment value
30 _GLSL_STRUCT_CONSTEXPR17 void update_max_alignment(const size_t currentAlignment) noexcept {
31 maxAlignment = std::max(maxAlignment, currentAlignment);
32 }
33 };
34
35 /**
36 * @brief layout context which contains alignment of last added struct
37 * @ingroup glslstruct
38 */
40 /// @brief contains last added struct alignment
41 size_t structAlignment = 0;
42 };
43} // namespace glslstruct
44
45 #endif
46#endif
#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
Main namespace of glslstruct library.
Definition scalar_layout_traits.hpp:23
layout context which contains max alignment of all variables
Definition layout_traits_contexts.hpp:25
size_t maxAlignment
contains max alignment value
Definition layout_traits_contexts.hpp:27
_GLSL_STRUCT_CONSTEXPR17 void update_max_alignment(const size_t currentAlignment) noexcept
updates max alignment value
Definition layout_traits_contexts.hpp:30
layout context which contains alignment of last added struct
Definition layout_traits_contexts.hpp:39
size_t structAlignment
contains last added struct alignment
Definition layout_traits_contexts.hpp:41