|
12 | 12 |
|
13 | 13 | #include "nbl/asset/IShader.h" |
14 | 14 | #include "nbl/asset/utils/ISPIRVOptimizer.h" |
15 | | - |
16 | | -// Less leakage than "nlohmann/json.hpp" only forward declarations |
17 | | -#include "nlohmann/json_fwd.hpp" |
| 15 | +#include "nbl/system/json.h" |
18 | 16 |
|
19 | 17 | #include "nbl/builtin/hlsl/enums.hlsl" |
20 | 18 |
|
@@ -111,11 +109,10 @@ class NBL_API2 IShaderCompiler : public core::IReferenceCounted |
111 | 109 | // |
112 | 110 | struct SMacroDefinition |
113 | 111 | { |
114 | | - friend void to_json(nlohmann::json&, const SMacroDefinition&); |
115 | | - friend void from_json(const nlohmann::json&, SMacroDefinition&); |
116 | | - |
117 | 112 | std::string_view identifier; |
118 | 113 | std::string_view definition; |
| 114 | + |
| 115 | + friend struct system::json::adl_serializer<SMacroDefinition>; |
119 | 116 | }; |
120 | 117 |
|
121 | 118 | // |
@@ -222,9 +219,8 @@ class NBL_API2 IShaderCompiler : public core::IReferenceCounted |
222 | 219 | inline bool isStandardInclude() const { return standardInclude; } |
223 | 220 |
|
224 | 221 | private: |
225 | | - friend void to_json(nlohmann::json& j, const SEntry::SPreprocessingDependency& dependency); |
226 | | - friend void from_json(const nlohmann::json& j, SEntry::SPreprocessingDependency& dependency); |
227 | 222 | friend class CCache; |
| 223 | + friend struct system::json::adl_serializer<SEntry::SPreprocessingDependency>; |
228 | 224 |
|
229 | 225 | // path or identifier |
230 | 226 | system::path requestingSourceDir = ""; |
@@ -258,8 +254,7 @@ class NBL_API2 IShaderCompiler : public core::IReferenceCounted |
258 | 254 | friend class SCompilerArgs; |
259 | 255 | friend class SEntry; |
260 | 256 | friend class CCache; |
261 | | - friend void to_json(nlohmann::json&, const SPreprocessorArgs&); |
262 | | - friend void from_json(const nlohmann::json&, SPreprocessorArgs&); |
| 257 | + friend struct system::json::adl_serializer<SPreprocessorArgs>; |
263 | 258 |
|
264 | 259 | // Default constructor needed for json serialization of SCompilerArgs |
265 | 260 | SPreprocessorArgs() {}; |
@@ -301,8 +296,7 @@ class NBL_API2 IShaderCompiler : public core::IReferenceCounted |
301 | 296 | private: |
302 | 297 | friend class SEntry; |
303 | 298 | friend class CCache; |
304 | | - friend void to_json(nlohmann::json&, const SCompilerArgs&); |
305 | | - friend void from_json(const nlohmann::json&, SCompilerArgs&); |
| 299 | + friend struct system::json::adl_serializer<SCompilerArgs>; |
306 | 300 |
|
307 | 301 | // Default constructor needed for json serialization of SEntry |
308 | 302 | SCompilerArgs() {} |
|
0 commit comments