aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/10-common/Utils.cpp24
-rw-r--r--source/10-common/Utils.hpp4
-rw-r--r--source/20-codegen-compiler/CodegenMacros.hpp10
-rw-r--r--source/20-codegen-compiler/CodegenUtils.inl48
-rw-r--r--source/20-codegen-compiler/main.cpp58
-rw-r--r--source/30-game/GraphicsTags.cpp41
-rw-r--r--source/30-game/GraphicsTags.hpp23
-rw-r--r--source/30-game/Shader.cpp32
8 files changed, 103 insertions, 137 deletions
diff --git a/source/10-common/Utils.cpp b/source/10-common/Utils.cpp
index 53b3863..dc76b0a 100644
--- a/source/10-common/Utils.cpp
+++ b/source/10-common/Utils.cpp
@@ -1,9 +1,14 @@
#include "Utils.hpp"
+#include "Macros.hpp"
+#include "ScopeGuard.hpp"
+
#ifdef _WIN32
# include <Windows.h>
#endif
+namespace fs = std::filesystem;
+
#ifdef _WIN32
# define BRUSSEL_MODE_STRING(string) L##string
#else
@@ -34,9 +39,9 @@ static FopenModeString GetModeString(Utils::IoMode mode, bool binary) {
return nullptr;
}
-FILE* Utils::OpenCstdioFile(const std::filesystem::path& path, IoMode mode, bool binary) {
+FILE* Utils::OpenCstdioFile(const fs::path& path, IoMode mode, bool binary) {
#ifdef _WIN32
- // std::filesystem::path::c_str() returns `const wchar_t*` under Windows, because NT uses UTF-16 natively
+ // fs::path::c_str() returns `const wchar_t*` under Windows, because NT uses UTF-16 natively
// NOTE: _wfopen() only affects the type of path parameter, otherwise the file stream created is identical to the one by fopen()
return _wfopen(path.c_str(), ::GetModeString(mode, binary));
#else
@@ -57,6 +62,21 @@ FILE* Utils::OpenCstdioFile(const char* path, IoMode mode, bool binary) {
#endif
}
+std::string Utils::ReadFileAsString(const fs::path& path) {
+ auto file = Utils::OpenCstdioFile(path, Utils::Read);
+ if (!file) throw std::runtime_error("Failed to open source file.");
+ DEFER { fclose(file); };
+
+ fseek(file, 0, SEEK_END);
+ auto fileSize = ftell(file);
+ rewind(file);
+
+ std::string result(fileSize, '\0');
+ fread(result.data(), fileSize, 1, file);
+
+ return result;
+}
+
bool Utils::InRangeInclusive(int n, int lower, int upper) {
if (lower > upper) {
std::swap(lower, upper);
diff --git a/source/10-common/Utils.hpp b/source/10-common/Utils.hpp
index 9f28aad..9560b57 100644
--- a/source/10-common/Utils.hpp
+++ b/source/10-common/Utils.hpp
@@ -5,6 +5,8 @@
#include <cstring>
#include <filesystem>
#include <glm/glm.hpp>
+#include <string>
+#include <string_view>
namespace Utils {
@@ -17,6 +19,8 @@ enum IoMode {
FILE* OpenCstdioFile(const std::filesystem::path& path, IoMode mode, bool binary = false);
FILE* OpenCstdioFile(const char* path, IoMode mode, bool binary = false);
+std::string ReadFileAsString(const std::filesystem::path& path);
+
constexpr float Abs(float v) noexcept {
return v < 0.0f ? -v : v;
}
diff --git a/source/20-codegen-compiler/CodegenMacros.hpp b/source/20-codegen-compiler/CodegenMacros.hpp
index 84c9d09..e56aed0 100644
--- a/source/20-codegen-compiler/CodegenMacros.hpp
+++ b/source/20-codegen-compiler/CodegenMacros.hpp
@@ -5,7 +5,12 @@
// I give up, hopefully nothing overflows this buffer
// TODO handle buffer sizing properly
-#define APPEND_LIT(out, str) out += str
+#define INPLACE_FMT(varName, format, ...) \
+ char varName[2048]; \
+ snprintf(varName, sizeof(varName), format, __VA_ARGS__);
+
+#define APPEND_LIT(out, str) \
+ out += str
#define APPEND_FMT(out, format, ...) \
{ \
@@ -14,7 +19,8 @@
out += buffer; \
}
-#define WRITE_LIT(file, str) fwrite(str, sizeof(char), sizeof(str) - 1, file)
+#define WRITE_LIT(file, str) \
+ fwrite(str, sizeof(char), sizeof(str) - 1, file)
// NOTE: snprintf() returns the size written (given an infinite buffer) not including \0
#define WRITE_FMT(file, format, ...) \
diff --git a/source/20-codegen-compiler/CodegenUtils.inl b/source/20-codegen-compiler/CodegenUtils.inl
index 6feb654..dddfe61 100644
--- a/source/20-codegen-compiler/CodegenUtils.inl
+++ b/source/20-codegen-compiler/CodegenUtils.inl
@@ -14,25 +14,7 @@
namespace Utils {
-std::string ReadFileAsString(const std::filesystem::path& path) {
- auto file = Utils::OpenCstdioFile(path, Utils::Read);
- if (!file) throw std::runtime_error("Failed to open source file.");
- DEFER { fclose(file); };
-
- fseek(file, 0, SEEK_END);
- auto fileSize = ftell(file);
- rewind(file);
-
- std::string result(fileSize, '\0');
- fread(result.data(), fileSize, 1, file);
-
- return result;
-}
-
-bool WriteOutputFile(const CodegenOutput& output, std::string_view dir, std::string_view filename, std::string_view additionalSuffix = {}) {
- char path[2048];
- snprintf(path, sizeof(path), "%.*s/%.*s%.*s", PRINTF_STRING_VIEW(dir), PRINTF_STRING_VIEW(filename), PRINTF_STRING_VIEW(additionalSuffix));
-
+bool WriteOutputFile(const CodegenOutput& output, const char* path) {
auto outputFile = Utils::OpenCstdioFile(path, Utils::WriteTruncate);
if (!outputFile) {
printf("[ERROR] unable to open output file %s\n", path);
@@ -74,9 +56,9 @@ std::string MakeFullName(std::string_view name, DeclNamespace* ns = nullptr) {
return fullname;
}
-void ProduceGeneratedHeaderFileHeader(CodegenOutput& output) {
- output.AddOutputThing(CodegenOutputThing{
- .text = &R"""(
+void ProduceGeneratedHeader(const char* headerFilename, CodegenOutput& header, const char* sourceFilename, CodegenOutput& source) {
+ CodegenOutputThing headerOut;
+ headerOut.text += &R"""(
// This file is generated. Any changes will be overidden when building.
#pragma once
@@ -84,23 +66,19 @@ void ProduceGeneratedHeaderFileHeader(CodegenOutput& output) {
#include <cstddef>
#include <cstdint>
-)"""[1],
- });
-}
-
-void ProduceGeneratedSourceFileHeader(CodegenOutput& output) {
- output.AddOutputThing(CodegenOutputThing{
- // TODO we need to get the header name
- .text = &R"""(
-// This file is generated. Any changes will be overidden when building.
+)"""[1];
-#include <cstddef>
-#include <cstdint>
+ CodegenOutputThing sourceOut;
+ APPEND_LIT_LN(sourceOut.text, "// This file is generated. Any changes will be overidden when building.");
+ APPEND_FMT_LN(sourceOut.text, "#include \"%s\"", headerFilename);
+ sourceOut.text += &R"""(
#include <frozen/string.h>
#include <frozen/unordered_map.h>
using namespace std::literals;
- )"""[1],
- });
+)"""[1];
+
+ header.AddOutputThing(std::move(headerOut));
+ source.AddOutputThing(std::move(sourceOut));
}
} // namespace Utils
diff --git a/source/20-codegen-compiler/main.cpp b/source/20-codegen-compiler/main.cpp
index b139515..874cacb 100644
--- a/source/20-codegen-compiler/main.cpp
+++ b/source/20-codegen-compiler/main.cpp
@@ -27,13 +27,10 @@
using namespace std::literals;
namespace fs = std::filesystem;
-// TODO handle namespace
// TODO support codegen target in .cpp files
struct AppState {
std::string_view outputDir;
- CodegenOutput mainHeaderOutput;
- CodegenOutput mainSourceOutput;
};
enum {
@@ -252,30 +249,28 @@ BSTR_LUT_DECL(EnumMetaGenOptions, 0, EMGO_COUNT) {
BSTR_LUT_MAP(EMGO_ExcludeUseHeuristics, "ExcludeHeuristics");
}
-std::string GenerateEnumStringArray(CodegenOutput& out, const DeclEnum& decl, bool useHeruistics) {
- std::string arrayName;
- APPEND_FMT(arrayName, "gCG_%s_Val2Str", decl.name.c_str());
+std::string GenerateEnumStringArray(CodegenOutput& out, const DeclEnum& decl, const std::vector<DeclEnumElement>& filteredElements, bool useHeruistics) {
+ INPLACE_FMT(arrayName, "gCG_%s_Val2Str", decl.name.c_str());
CodegenOutputThing thing;
- APPEND_FMT_LN(thing.text, "const char* %s[] = {", arrayName.c_str());
- for (auto& elm : decl.elements) {
- if (useHeruistics && elm.name.ends_with("COUNT")) {
- continue;
- }
-
+ APPEND_FMT_LN(thing.text, "const char* %s[] = {", arrayName);
+ for (auto& elm : filteredElements) {
APPEND_FMT_LN(thing.text, "\"%s\",", elm.name.c_str());
}
APPEND_LIT_LN(thing.text, "};");
out.AddOutputThing(std::move(thing));
- return arrayName;
+ return std::string(arrayName);
}
std::string GenerateEnumStringMap(CodegenOutput& out, const DeclEnum& decl, bool useHeruistics) {
- std::string mapName;
+ INPLACE_FMT(mapName, "gCG_%s_Val2Str", decl.name.c_str());
+
+ CodegenOutputThing thing;
// TODO
+ out.AddOutputThing(std::move(thing));
- return mapName;
+ return std::string(mapName);
}
void GenerateForEnum(CodegenOutput& headerOut, CodegenOutput& sourceOut, const DeclEnum& decl, EnumFlags<EnumMetaGenOptions> options) {
@@ -306,7 +301,7 @@ void GenerateForEnum(CodegenOutput& headerOut, CodegenOutput& sourceOut, const D
switch (decl.GetPattern()) {
case EVP_Continuous: {
- auto arrayName = GenerateEnumStringArray(sourceOut, decl, useExcludeHeuristics);
+ auto arrayName = GenerateEnumStringArray(sourceOut, decl, filteredElements, useExcludeHeuristics);
int minVal = filteredElements.empty() ? 0 : filteredElements.front().value;
int maxVal = filteredElements.empty() ? 0 : filteredElements.back().value;
@@ -324,7 +319,7 @@ void GenerateForEnum(CodegenOutput& headerOut, CodegenOutput& sourceOut, const D
} break;
case EVP_Bits: {
- auto arrayName = GenerateEnumStringArray(sourceOut, decl, useExcludeHeuristics);
+ auto arrayName = GenerateEnumStringArray(sourceOut, decl, filteredElements, useExcludeHeuristics);
// TODO
} break;
@@ -339,9 +334,8 @@ void GenerateForEnum(CodegenOutput& headerOut, CodegenOutput& sourceOut, const D
if (options.IsSet(EMGO_FromString)) {
// Generate string -> value lookup table
- char mapName[1024];
// TODO mangle to prevent name conflicts of enum in different namespaces
- snprintf(mapName, sizeof(mapName), "gCG_%s_Str2Val", decl.name.c_str());
+ INPLACE_FMT(mapName, "gCG_%s_Str2Val", decl.name.c_str());
CodegenOutputThing lookupTable;
{
@@ -388,9 +382,13 @@ void HandleInputFile(AppState& state, std::string_view filenameStem, std::string
CodegenInput cgInput;
CodegenOutput cgHeaderOutput;
- Utils::ProduceGeneratedHeaderFileHeader(cgHeaderOutput);
CodegenOutput cgSourceOutput;
- Utils::ProduceGeneratedSourceFileHeader(cgSourceOutput);
+ {
+ INPLACE_FMT(hpp, "%.*s.gh.inl", PRINTF_STRING_VIEW(filenameStem));
+ INPLACE_FMT(cpp, "%.*s.gs.inl", PRINTF_STRING_VIEW(filenameStem));
+ Utils::ProduceGeneratedHeader(hpp, cgHeaderOutput, cpp, cgSourceOutput);
+ }
+ CodegenOutput cgStandaloneSourceOutput;
int currentBraceDepth = 0;
// The current effective namespace, see example
@@ -640,11 +638,12 @@ void HandleInputFile(AppState& state, std::string_view filenameStem, std::string
printf("[WARNING] unbalanced brace at end of file.");
}
- Utils::WriteOutputFile(cgHeaderOutput, state.outputDir, filenameStem, ".gh.inl"sv);
- Utils::WriteOutputFile(cgSourceOutput, state.outputDir, filenameStem, ".gs.inl"sv);
-
- // TODO see CMakeLists.txt for rationale, clean this up to be a proper citizen
- Utils::WriteOutputFile(CodegenOutput{}, state.outputDir, filenameStem, ".gs.cpp"sv);
+ INPLACE_FMT(generatedHeaderInlName, "%.*s/%.*s.gh.inl", PRINTF_STRING_VIEW(state.outputDir), PRINTF_STRING_VIEW(filenameStem));
+ Utils::WriteOutputFile(cgHeaderOutput, generatedHeaderInlName);
+ INPLACE_FMT(generatedSourceInlName, "%.*s/%.*s.gs.inl", PRINTF_STRING_VIEW(state.outputDir), PRINTF_STRING_VIEW(filenameStem));
+ Utils::WriteOutputFile(cgSourceOutput, generatedSourceInlName);
+ INPLACE_FMT(generatedCppName, "%.*s/%.*s.g.cpp", PRINTF_STRING_VIEW(state.outputDir), PRINTF_STRING_VIEW(filenameStem));
+ Utils::WriteOutputFile(cgStandaloneSourceOutput, generatedCppName);
}
enum InputOpcode {
@@ -718,9 +717,6 @@ int main(int argc, char* argv[]) {
AppState state;
- Utils::ProduceGeneratedHeaderFileHeader(state.mainHeaderOutput);
- Utils::ProduceGeneratedSourceFileHeader(state.mainSourceOutput);
-
// If no cli is provided (argv[0] conventionally but not mandatorily the cli), this will do thing
// Otherwise, start with the 2nd element in the array, which is the 1st actual argument
if (argc < 2) {
@@ -753,9 +749,5 @@ where <output path>: the directory to write generated contents to. This will N
}
}
- // TODO do we even need these?
- // Utils::WriteOutputFile(state.mainHeaderOutput, state.outputDir, "GeneratedCode.hpp"sv);
- // Utils::WriteOutputFile(state.mainSourceOutput, state.outputDir, "GeneratedCode.cpp"sv);
-
return 0;
}
diff --git a/source/30-game/GraphicsTags.cpp b/source/30-game/GraphicsTags.cpp
index 522a58f..eb9a079 100644
--- a/source/30-game/GraphicsTags.cpp
+++ b/source/30-game/GraphicsTags.cpp
@@ -6,43 +6,6 @@
using namespace std::literals;
-std::string_view Tags::NameOf(VertexElementSemantic semantic) {
- switch (semantic) {
- case VES_Position: return "Position"sv;
- case VES_BlendWeights: return "BlendWeights"sv;
- case VES_BlendIndices: return "BlendIndices"sv;
- case VES_Normal: return "Normal"sv;
- case VES_Color1: return "Color1"sv;
- case VES_Color2: return "Color2"sv;
- case VES_Color3: return "Color3"sv;
- case VES_TexCoords1: return "TexCoords1"sv;
- case VES_TexCoords2: return "TexCoords2"sv;
- case VES_TexCoords3: return "TexCoords3"sv;
- case VES_Binormal: return "Binormal"sv;
- case VES_Tangent: return "Tangent"sv;
- case VES_Generic: return "Generic"sv;
- case VES_COUNT: break;
- }
- return std::string_view();
-}
-
-Tags::VertexElementSemantic Tags::FindVertexElementSemantic(std::string_view name) {
- if (name == "Position"sv) return VES_Position;
- if (name == "BlendWeights"sv) return VES_BlendWeights;
- if (name == "BlendIndices"sv) return VES_BlendIndices;
- if (name == "Normal"sv) return VES_Normal;
- if (name == "Color1"sv) return VES_Color1;
- if (name == "Color2"sv) return VES_Color2;
- if (name == "Color3"sv) return VES_Color3;
- if (name == "TexCoords1"sv) return VES_TexCoords1;
- if (name == "TexCoords2"sv) return VES_TexCoords2;
- if (name == "TexCoords3"sv) return VES_TexCoords3;
- if (name == "Binormal"sv) return VES_Binormal;
- if (name == "Tangent"sv) return VES_Tangent;
- if (name == "Generic"sv) return VES_Generic;
- return VES_COUNT;
-}
-
int Tags::SizeOf(VertexElementType type) {
switch (type) {
case VET_Float1:
@@ -287,7 +250,7 @@ struct GLTypeInfo {
} const kGLTypeInfo;
} // namespace ProjectBrussel_UNITY_ID
-std::string_view Tags::NameOfGLType(GLenum value) {
+std::string_view Tags::GLTypeToString(GLenum value) {
using namespace ProjectBrussel_UNITY_ID;
auto iter = kGLTypeInfo.enum2Name.find(value);
if (iter != kGLTypeInfo.enum2Name.end()) {
@@ -297,7 +260,7 @@ std::string_view Tags::NameOfGLType(GLenum value) {
}
}
-GLenum Tags::FindGLType(std::string_view name) {
+GLenum Tags::GLTypeFromString(std::string_view name) {
using namespace ProjectBrussel_UNITY_ID;
auto iter = kGLTypeInfo.name2Enum.find(name);
if (iter != kGLTypeInfo.name2Enum.end()) {
diff --git a/source/30-game/GraphicsTags.hpp b/source/30-game/GraphicsTags.hpp
index f83b99c..cdf79eb 100644
--- a/source/30-game/GraphicsTags.hpp
+++ b/source/30-game/GraphicsTags.hpp
@@ -1,12 +1,12 @@
#pragma once
+#include <MacrosCodegen.hpp>
+
#include <glad/glad.h>
#include <limits>
#include <string>
#include <string_view>
-#include <MacrosCodegen.hpp>
-
namespace Tags {
/// Vertex element semantics, used to identify the meaning of vertex buffer contents
enum VertexElementSemantic {
@@ -36,9 +36,6 @@ enum VertexElementSemantic {
};
BRUSSEL_ENUM(VertexElementSemantic, ToString FromString ExcludeHeuristics);
-std::string_view NameOf(VertexElementSemantic semantic);
-VertexElementSemantic FindVertexElementSemantic(std::string_view name);
-
enum VertexElementType {
VET_Float1,
VET_Float2,
@@ -66,17 +63,16 @@ enum VertexElementType {
VET_Uint4,
VET_Byte4, /// signed bytes
- VET_NORM_BEGIN,
- VET_Byte4Norm = VET_NORM_BEGIN, /// signed bytes (normalized to -1..1)
+ VET_Byte4Norm, /// signed bytes (normalized to -1..1)
VET_Ubyte4Norm, /// unsigned bytes (normalized to 0..1)
VET_Short2Norm, /// signed shorts (normalized to -1..1)
VET_Short4Norm,
VET_Ushort2Norm, /// unsigned shorts (normalized to 0..1)
VET_Ushort4Norm,
- VET_NORM_END = VET_Ushort4Norm,
};
-// TODO this enum isn't continuous, not supported yet
-// BRUSSEL_ENUM(VertexElementType, ToString FromString ExcludeHeuristics);
+constexpr auto VET_NORM_BEGIN = VET_Byte4Norm;
+constexpr auto VET_NORM_END = VET_Ushort4Norm;
+BRUSSEL_ENUM(VertexElementType, ToString FromString ExcludeHeuristics);
int SizeOf(VertexElementType type);
int VectorLenOf(VertexElementType type);
@@ -95,11 +91,12 @@ enum TexFilter {
TF_Linear,
TF_Nearest,
};
+BRUSSEL_ENUM(TexFilter, ToString FromString ExcludeHeuristics);
-std::string_view NameOfGLType(GLenum);
-GLenum FindGLType(std::string_view name);
+std::string_view GLTypeToString(GLenum);
+GLenum GLTypeFromString(std::string_view name);
-constexpr GLuint kInvalidLocation = std::numeric_limits<GLuint>::max();
+constexpr auto kInvalidLocation = std::numeric_limits<GLuint>::max();
} // namespace Tags
#include <generated/GraphicsTags.gh.inl>
diff --git a/source/30-game/Shader.cpp b/source/30-game/Shader.cpp
index 48881f0..4a58635 100644
--- a/source/30-game/Shader.cpp
+++ b/source/30-game/Shader.cpp
@@ -1,9 +1,11 @@
#include "Shader.hpp"
#include "AppConfig.hpp"
-#include "RapidJsonHelper.hpp"
-#include "ScopeGuard.hpp"
-#include "Utils.hpp"
+
+#include <Metadata.hpp>
+#include <RapidJsonHelper.hpp>
+#include <ScopeGuard.hpp>
+#include <Utils.hpp>
#include <imgui.h>
#include <misc/cpp/imgui_stdlib.h>
@@ -16,20 +18,20 @@
using namespace std::literals;
void ShaderMathVariable::ShowInfo() const {
- ImGui::BulletText("Location: %d\nName: %s\nSemantic: %s\nType: %s %dx%d",
+ ImGui::BulletText("Location: %d\nName: %s\nSemantic: %.*s\nType: %.*s %dx%d",
location,
name.c_str(),
- Tags::NameOf(semantic).data(),
- Tags::NameOfGLType(scalarType).data(),
+ PRINTF_STRING_VIEW(Metadata::EnumToString(semantic)),
+ PRINTF_STRING_VIEW(Tags::GLTypeToString(scalarType)),
width,
height);
}
void ShaderSamplerVariable::ShowInfo() const {
- ImGui::BulletText("Location: %d\nName: %s\nSemantic: %s\nType: Sampler",
+ ImGui::BulletText("Location: %d\nName: %s\nSemantic: %.*s\nType: Sampler",
location,
name.c_str(),
- Tags::NameOf(semantic).data());
+ PRINTF_STRING_VIEW(Metadata::EnumToString(semantic)));
}
bool ShaderThingId::IsValid() const {
@@ -527,18 +529,22 @@ bool Shader::IsValid() const {
namespace ProjectBrussel_UNITY_ID {
void WriteShaderVariable(rapidjson::Value& value, rapidjson::Document& root, const ShaderVariable& var) {
value.AddMember("Name", var.name, root.GetAllocator());
- value.AddMember("Semantic", rapidjson::StringRef(Tags::NameOf(var.semantic)), root.GetAllocator());
+ value.AddMember("Semantic", rapidjson::StringRef(Metadata::EnumToString(var.semantic)), root.GetAllocator());
value.AddMember("OpenGLLocation", var.location, root.GetAllocator());
}
bool ReadShaderVariable(const rapidjson::Value& value, ShaderVariable& var) {
+ using namespace Tags;
+
BRUSSEL_JSON_GET(value, "Name", std::string, var.name, return false);
{ // Semantic
auto rvSemantic = rapidjson::GetProperty(value, rapidjson::kStringType, "Semantic"sv);
if (!rvSemantic) {
- var.semantic = Tags::VES_Generic;
+ var.semantic = VES_Generic;
} else {
- var.semantic = Tags::FindVertexElementSemantic(rapidjson::AsStringView(*rvSemantic));
+ auto str = rapidjson::AsStringView(*rvSemantic);
+ auto lookup = Metadata::EnumFromString<VertexElementSemantic>(str);
+ var.semantic = lookup.value_or(VES_Generic);
}
}
BRUSSEL_JSON_GET_DEFAULT(value, "OpenGLLocation", int, var.location, 0);
@@ -547,7 +553,7 @@ bool ReadShaderVariable(const rapidjson::Value& value, ShaderVariable& var) {
void WriteShaderMathVariable(rapidjson::Value& value, rapidjson::Document& root, const ShaderMathVariable& var) {
WriteShaderVariable(value, root, var);
- value.AddMember("ScalarType", rapidjson::StringRef(Tags::NameOfGLType(var.scalarType)), root.GetAllocator());
+ value.AddMember("ScalarType", rapidjson::StringRef(Tags::GLTypeToString(var.scalarType)), root.GetAllocator());
value.AddMember("Width", var.width, root.GetAllocator());
value.AddMember("Height", var.height, root.GetAllocator());
value.AddMember("ArrayLength", var.arrayLength, root.GetAllocator());
@@ -558,7 +564,7 @@ bool ReadShaderMathVariable(const rapidjson::Value& value, ShaderMathVariable& v
{
auto rvScalar = rapidjson::GetProperty(value, rapidjson::kStringType, "ScalarType"sv);
if (!rvScalar) return false;
- var.scalarType = Tags::FindGLType(rapidjson::AsStringView(*rvScalar));
+ var.scalarType = Tags::GLTypeFromString(rapidjson::AsStringView(*rvScalar));
}
BRUSSEL_JSON_GET(value, "Width", int, var.width, return false);
BRUSSEL_JSON_GET(value, "Height", int, var.height, return false);