GLSL Struct 1.4.0
glslstruct
Loading...
Searching...
No Matches
scalar_layout_traits.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_SCALAR_LAYOUT_TRAITS_HPP_
12 #define _GLSL_STRUCT_SCALAR_LAYOUT_TRAITS_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/layout/traits/contexts/layout_traits_contexts.hpp>
21 #include <glslstruct/utils/ValueType.hpp>
22
23namespace glslstruct {
24 /**
25 * @brief Scalar Layout additional context
26 * @ingroup layout_traits
27 */
29
30 /**
31 * @brief Scalar Layout traits
32 * @ingroup layout_traits
33 */
35 /// @brief scalar layout context type
37
38 /// @brief scalar layout scalar alignment
39 static size_t get_scalar_alignment(ValueType valueType, context_type& ctx) noexcept;
40
41 /// @brief scalar layout vec alignment
42 static size_t get_vec_alignment(ValueType valueType, size_t length, context_type& ctx) noexcept;
43
44 /// @brief scalar layout array alignment
45 static size_t get_array_alignment(size_t elemBaseAlignment, context_type& ctx) noexcept;
46
47 /// @brief scalar layout struct alignment
48 static size_t get_struct_alignment(const context_type& ctx) noexcept;
49
50 /// @brief scalar layout after_add action
51 static void after_add(size_t& currentOffset, size_t size, size_t alignment, context_type& ctx) noexcept;
52 };
53} // namespace glslstruct
54
55 #endif
56#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 scalar_layout_traits.hpp:23
layout context which contains max alignment of all variables
Definition layout_traits_contexts.hpp:25
Scalar Layout additional context.
Definition scalar_layout_traits.hpp:28
Scalar Layout traits.
Definition scalar_layout_traits.hpp:34
static size_t get_scalar_alignment(ValueType valueType, context_type &ctx) noexcept
scalar layout scalar alignment
Definition scalar_layout_traits.cpp:21
scalar_layout_context context_type
scalar layout context type
Definition scalar_layout_traits.hpp:36
static size_t get_vec_alignment(ValueType valueType, size_t length, context_type &ctx) noexcept
scalar layout vec alignment
Definition scalar_layout_traits.cpp:25
static size_t get_struct_alignment(const context_type &ctx) noexcept
scalar layout struct alignment
Definition scalar_layout_traits.cpp:33
static size_t get_array_alignment(size_t elemBaseAlignment, context_type &ctx) noexcept
scalar layout array alignment
Definition scalar_layout_traits.cpp:29
static void after_add(size_t &currentOffset, size_t size, size_t alignment, context_type &ctx) noexcept
scalar layout after_add action
Definition scalar_layout_traits.cpp:35