28 #ifndef BERSERK_GLSLUTILS_HPP
29 #define BERSERK_GLSLUTILS_HPP
50 stream <<
"//<-- inserted generated options -->//\n";
51 for (
const auto &option : options.
Get())
52 stream <<
"#define " << option <<
"\n";
53 stream <<
"//<-- inserted generated options -->//\n";
57 stream <<
"//<-- inserted generated params code -->//\n";
58 stream <<
"layout (" << layout <<
") uniform " << name <<
" {\n";
60 for (
const auto &p : params.
GetParams()) {
62 auto array = p.arraySize > 1;
63 auto type = p.typeData;
68 stream <<
"[" << p.arraySize <<
"];\n";
75 stream <<
"//<-- inserted generated params code -->//\n";
79 stream <<
"//<-- inserted generated uniform params -->//\n";
81 for (
const auto &p : params.
GetParams()) {
83 auto array = p.arraySize > 1;
84 auto type = p.typeParam;
89 stream <<
"[" << p.arraySize <<
"];\n";
95 stream <<
"//<-- inserted generated uniform params -->//\n";
99 stream <<
"//<-- inserted user code -->//\n";
100 stream << code <<
"\n";
101 stream <<
"//<-- inserted user code -->//\n";
#define BRK_NS_END
Definition: Config.hpp:48
Options passed to compile shader.
Definition: Shader.hpp:67
BRK_API const std::unordered_set< StringName > & Get() const
Definition: Shader.hpp:76
Describes layout of shader params for packing by material.
Definition: ShaderParams.hpp:88
Utf-8 encoded std based default string class.
GLSL source code processing utils.
Definition: UtilsGLSL.hpp:47
static void GenerateUserCode(const String &code, std::stringstream &stream)
Definition: UtilsGLSL.hpp:98
static void GenerateDefines(const ShaderCompileOptions &options, std::stringstream &stream)
Definition: UtilsGLSL.hpp:49
static void GenerateStruct(const char *name, const char *layout, const ShaderParams ¶ms, std::stringstream &stream)
Definition: UtilsGLSL.hpp:56
static void GenerateUniformParams(const ShaderParams ¶ms, std::stringstream &stream)
Definition: UtilsGLSL.hpp:78
BRK_API const std::vector< ShaderParam > & GetParams() const
Definition: ShaderParams.hpp:128
const char * RHIGetShaderParamIdGLSL(RHIShaderParamType type)
Definition: RHIDefs.hpp:456
const char * RHIGetShaderDataIdGLSL(RHIShaderDataType type)
Definition: RHIDefs.hpp:411
Definition: GLDevice.cpp:46