ShaderGen: Remove virtual methods and string from ShaderGeneratorInterface. #3431
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.
Addresses issue 9219. This is because LinearDiskCache reads/writes to the storage of ShaderUid, therefore ShaderUid must be a POD struct. So I've removed the constructor of the uid classes (moving this to the shader gen function themselves), and the virtual methods/string from the base class.
Since all the callers of these methods take a template parameter of the derived class anyway, there was no benefit to them being virtual. ShaderGeneratorInterface is now acting as a fallback for the methods unimplemented by the derived classes.
Additionally, adds a static assert to LinearDiskCache to ensure no non-POD types are used in the future.
gcc and clang both correctly optimize out all the Write() calls in the shader generation method. MSVC does it for some of them, but not all (some of the varargs cases and where a function is called, eg GetInterpolationQualifier, which is not being inlined for some reason). Aside from duplicating the shader generation code to include only the uid-writing parts, I can't think of a more straightforward solution to this problem.