GLSL Struct 1.4.8
glslstruct
Loading...
Searching...
No Matches
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 void update_max_alignment(size_t currentAlignment) noexcept;
31 };
32
33 /**
34 * @brief layout context which contains alignment of last added struct
35 * @ingroup glslstruct
36 */
38 /// @brief contains last added struct alignment
39 size_t structAlignment = 0;
40 };
41} // namespace glslstruct
42
43/**
44 * @brief std::hash specialization for glslstruct::max_alignment_layout_context
45 * @ingroup glslstruct
46 */
47template<>
48struct std::hash<glslstruct::max_alignment_layout_context> {
49 [[nodiscard]] size_t operator()(const glslstruct::max_alignment_layout_context& ctx) const noexcept;
50};
51
52/**
53 * @brief std::hash specialization for glslstruct::struct_added_layout_context
54 * @ingroup glslstruct
55 */
56template<>
57struct std::hash<glslstruct::struct_added_layout_context> {
58 [[nodiscard]] size_t operator()(const glslstruct::struct_added_layout_context& ctx) const noexcept;
59};
60
61 #endif
62#endif
#define _GLSL_STRUCT_HAS_CXX17
check if compiler has c++ version greater or equal to c++17
Definition config.hpp:130
Main namespace of glslstruct library.
Definition contexts.hpp:20
layout context which contains max alignment of all variables
Definition contexts.hpp:25
void update_max_alignment(size_t currentAlignment) noexcept
updates max alignment value
Definition contexts.cpp:21
size_t maxAlignment
contains max alignment value
Definition contexts.hpp:27
layout context which contains alignment of last added struct
Definition contexts.hpp:37
size_t structAlignment
contains last added struct alignment
Definition contexts.hpp:39