Open
Conversation
This reverts commit 67b2f0a.
This forces us to use the jdata["key"] = value syntax and makes sure none of the enum conversion were missed
Also fix some DX12 fixed-width integer conversions that were broken by the last change
Add a wrapper to assert that the now-global JsonOptions are set exactly once and before any use.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is an attempt to move away from
FieldToJsonoverloaded functions for converting GFXR types intonlohmann::ordered_jsonobjects. The clang compiler (particularly on macOS) consumes a lot of memory resolving the large number ofFieldToJsonoverloads in the codebase and has previously forced us to disable the macOS GitHub Actions runners (#2640).The replacement solution is to define
to_jsonfunctions for all of the types we want to convert, as described in the nlohmann/json docs: https://github.com/nlohmann/json?tab=readme-ov-file#arbitrary-types-conversions. While it seems similar to theFieldToJsonapproach, usingto_jsongoes through thenlohmann::adl_serializerand doesn't suffer the same (Many call site)x(Many implementation) explosion in the compiler.This changeset only migrates enums, flags, and integer types from
FieldToJsontoto_jsonas they represent a bulk of theFieldToJsoncall sites. Other types from thegfxrecon::decodenamespace could be added in the future to simplify the code generators and make things more consistent.Results
For the memory-constrained GitHub runners the change makes a significant difference:
Before:

After:

On higher spec'd developer machines the difference is smaller, but still noticable:
Before
After