2
3
4
5
6
7
8
11#ifndef _GLSL_STRUCT_GLSL_WRITER_HPP_
12 #define _GLSL_STRUCT_GLSL_WRITER_HPP_
14 #include <glslstruct/config.hpp>
18 "This is only available for c++17 and greater and when types are not disabled with defined GLSL_STRUCT_DISABLE_TYPES!"
22 #include <glslstruct/type/containers/struct_type.hpp>
23 #include <glslstruct/utils/assert.hpp>
27
28
29
58
59
60
61
62
64 const mstd::ordered_map<struct_type, std::string>& structsNames);
67
68
69
98
99
100
101
102
106
107
108
109
110
111
112
114 bool canBeVariableSize,
const mstd::ordered_map<struct_type, std::string>& structsNames);
117
118
119
141 const mstd::ordered_map<std::string, var_data>& variables);
144 void _append_buffer_body(std::string_view layoutData, std::string_view name, std::string_view bufferType,
145 bool canHaveVariableSizeArray,
const mstd::ordered_map<std::string, var_data>& variables,
146 std::string_view varName =
"");
150 const mstd::ordered_map<std::string, var_data>& variables, std::string_view varName =
"",
151 std::string_view qualifiers =
"");
172 void append_struct(std::string_view name,
const struct_type& structType);
179 const mstd::ordered_map<std::string, var_data>& variables, std::string_view varName =
"");
183 const mstd::ordered_map<std::string, var_data>& variables, std::string_view varName =
"",
184 std::string_view qualifiers =
"");
191 #include <glslstruct/writer/glsl/opengl/writer.hpp>
192 #include <glslstruct/writer/glsl/vulkan/writer.hpp>
type visitor which gets array and sub arrays counts in format [0][1]...
Definition writer.hpp:70
bool _canBeVariableSize
check for variable size arrays
Definition writer.hpp:73
glsl_array_count_getter(bool canBeVariableSize) noexcept
Definition writer.cpp:35
const std::string & get_result() const noexcept
returns result
Definition writer.cpp:37
std::string _result
result
Definition writer.hpp:75
void visit(Type &&varType)
visitor function
Definition writer.hpp:82
type visitor which returns variable type
Definition writer.hpp:30
void visit(Type &&varType)
type visitor
Definition writer.hpp:43
glsl_var_type_getter(const mstd::ordered_map< struct_type, std::string > &structsNames)
constructor with defined structs names
Definition writer.cpp:23
std::string _result
result
Definition writer.hpp:33
const std::string & get_result() const noexcept
returns result
Definition writer.cpp:26
mstd::ordered_map< struct_type, std::string > _structsNames
defined structs names
Definition writer.hpp:35
general glsl writer
Definition writer.hpp:120
std::unordered_set< std::string > _uniqueNames
unique names of all strucs, UBOs and SSBOs
Definition writer.hpp:131
mstd::ordered_map< struct_type, std::string > _uniqueStructs
struct name generator idx
Definition writer.hpp:128
static std::string _get_layout(std::string_view layoutData)
returns layout string
Definition writer.cpp:51
void visit(Type &&varType)
type visitor
Definition writer.hpp:162
void append_struct(std::string_view name, const struct_type &structType)
appends struct with given name
Definition writer.cpp:110
glsl_writer()
default constructor
void _append_shader_storage_buffer_body(std::string_view layoutData, std::string_view name, const mstd::ordered_map< std::string, var_data > &variables, std::string_view varName="", std::string_view qualifiers="")
appends shader storage buffer body (SSBO)
Definition writer.cpp:92
size_t _structIdx
struct name generator idx
Definition writer.hpp:126
void _append_struct_body(std::string_view structBody)
appends struct body to result
Definition writer.cpp:53
const std::string & to_string() const noexcept
returns result string
Definition writer.cpp:149
void append_struct(const struct_type &structType)
appends struct with generated name
Definition writer.cpp:128
std::string _get_struct_body(std::string_view type, std::string_view name, bool canHaveVariableSizeArray, const mstd::ordered_map< std::string, var_data > &variables)
returns struct body string
Definition writer.cpp:58
void append_shader_storage_buffer(std::string_view layoutData, std::string_view name, const mstd::ordered_map< std::string, var_data > &variables, std::string_view varName="", std::string_view qualifiers="")
appends shader storage buffer
Definition writer.cpp:144
std::string _result
result
Definition writer.hpp:123
void _append_buffer_body(std::string_view layoutData, std::string_view name, std::string_view bufferType, bool canHaveVariableSizeArray, const mstd::ordered_map< std::string, var_data > &variables, std::string_view varName="")
appends buffer body to result
Definition writer.cpp:76
bool _contains_name(std::string_view name)
returns true if struct, UBO or SSBO with given name already was appended
Definition writer.cpp:100
void append_uniform_buffer(std::string_view layoutData, std::string_view name, const mstd::ordered_map< std::string, var_data > &variables, std::string_view varName="")
appends uniform buffer
Definition writer.cpp:139
std::string get_glsl_variable_string(std::string_view name, const base_type_handle &varType, bool canBeVariableSize, const mstd::ordered_map< struct_type, std::string > &structsNames)
returns variable line type name[0][1]...
Definition writer.cpp:45
#define glsl_struct_assert(expression,...)
glslstruct assert
Definition assert.hpp:33
std::string get_glsl_array_count_string(const base_type_handle &varType, bool canBeVariableSize)
returns array counts string
Definition writer.cpp:39
#define _GLSL_STRUCT_HAS_TYPES
check if user not disabled type containers using GLSL_STRUCT_DISABLE_TYPES
Definition config.hpp:162
std::string get_glsl_var_type_string(const base_type_handle &varType, const mstd::ordered_map< struct_type, std::string > &structsNames)
returns variable type
Definition writer.cpp:28
#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