-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e1661f6
commit fe52c04
Showing
4 changed files
with
71 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,6 @@ | |
|
||
"ShaderDesc", | ||
"ShaderMacro", | ||
"ShaderMacroArray", | ||
"ShaderResourceDesc", | ||
"ShaderCreateInfo", | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
[1mdiff --git a/RenderStateNotation/scripts/cxx_config.py b/RenderStateNotation/scripts/cxx_config.py[m | ||
[1mindex bf11ff1..662d183 100644[m | ||
[1m--- a/RenderStateNotation/scripts/cxx_config.py[m | ||
[1m+++ b/RenderStateNotation/scripts/cxx_config.py[m | ||
[36m@@ -60,7 +60,6 @@[m [mCXX_REGISTERED_STRUCT = {[m | ||
[m | ||
"ShaderDesc",[m | ||
"ShaderMacro",[m | ||
[31m- "ShaderMacroArray",[m | ||
"ShaderResourceDesc",[m | ||
"ShaderCreateInfo",[m | ||
[m | ||
[1mdiff --git a/RenderStateNotation/scripts/cxx_template.py b/RenderStateNotation/scripts/cxx_template.py[m | ||
[1mindex 6e02f02..fccb40b 100644[m | ||
[1m--- a/RenderStateNotation/scripts/cxx_template.py[m | ||
[1m+++ b/RenderStateNotation/scripts/cxx_template.py[m | ||
[36m@@ -65,9 +65,9 @@[m [mconstexpr Uint32 JsonUnexpectedKey = 501;[m | ||
} \[m | ||
} while (false)[m | ||
[m | ||
[31m-void WriteRSN(nlohmann::json& Json, const ShaderMacro& Type, DynamicLinearAllocator& Allocator);[m | ||
[32m+[m[32mvoid WriteRSN(nlohmann::json& Json, const ShaderMacroArray& Type, DynamicLinearAllocator& Allocator);[m | ||
[m | ||
[31m-void ParseRSN(const nlohmann::json& Json, ShaderMacro& Type, DynamicLinearAllocator& Allocator);[m | ||
[32m+[m[32mvoid ParseRSN(const nlohmann::json& Json, ShaderMacroArray& Type, DynamicLinearAllocator& Allocator);[m | ||
[m | ||
template <typename Type, std::enable_if_t<!std::is_pointer<Type>::value, bool> = true>[m | ||
inline void WriteRSN(nlohmann::json& Json, const Type& Object, DynamicLinearAllocator& Allocator)[m | ||
[36m@@ -158,27 +158,28 @@[m [minline void ParseRSN(const nlohmann::json& Json, const char*& Str, DynamicLinear[m | ||
}[m | ||
[m | ||
template <>[m | ||
[31m-inline void WriteRSN(nlohmann::json& Json, const ShaderMacro* const pMacros, DynamicLinearAllocator& Allocator)[m | ||
[32m+[m[32minline void WriteRSN(nlohmann::json& Json, const ShaderMacroArray& Macros, DynamicLinearAllocator& Allocator)[m | ||
{[m | ||
[31m- for (size_t i = 0; pMacros[i].Name != nullptr || pMacros[i].Definition != nullptr; i++)[m | ||
[32m+[m[32m for (size_t i = 0; Macros.Count; i++)[m | ||
{[m | ||
auto Object = nlohmann::json::object();[m | ||
[31m- WriteRSN(Object, pMacros[i], Allocator);[m | ||
[32m+[m[32m WriteRSN(Object, Macros.Elements[i], Allocator);[m | ||
Json.push_back(Object);[m | ||
}[m | ||
}[m | ||
[m | ||
template <>[m | ||
[31m-inline void ParseRSN(const nlohmann::json& Json, const ShaderMacro*& pMacros, DynamicLinearAllocator& Allocator)[m | ||
[32m+[m[32minline void ParseRSN(const nlohmann::json& Json, ShaderMacroArray& Macros, DynamicLinearAllocator& Allocator)[m | ||
{[m | ||
if (!Json.is_array())[m | ||
throw nlohmann::json::type_error::create(JsonTypeError, std::string("type must be array, but is ") + Json.type_name(), Json);[m | ||
[m | ||
[31m- auto* pData = Allocator.ConstructArray<ShaderMacro>(Json.size() + 1);[m | ||
[32m+[m[32m auto* pData = Allocator.ConstructArray<ShaderMacro>(Json.size());[m | ||
for (size_t i = 0; i < Json.size(); i++)[m | ||
ParseRSN(Json[i], pData[i], Allocator);[m | ||
[m | ||
[31m- pMacros = pData;[m | ||
[32m+[m[32m Macros.Elements = pData;[m | ||
[32m+[m[32m Macros.Count = static_cast<Uint32>(Json.size());[m | ||
}[m | ||
[m | ||
inline void ParseRSN(const nlohmann::json& Json, const Char**& pObjects, Uint32& NumElements, DynamicLinearAllocator& Allocator)[m |