-
-
Notifications
You must be signed in to change notification settings - Fork 439
[3.0] Implement name-related improvements identified in previous Vulkan PR #2503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop/3.0
Are you sure you want to change the base?
[3.0] Implement name-related improvements identified in previous Vulkan PR #2503
Conversation
This looks like it's from some sort of built-in renamer. Don't think we'll ever use this since we have a custom renamer.
… work with native name attributes
Not sure why these were not being coerced when the Vulkan PR was merged, but they started getting coerced in this PR. This technically is a good thing since it means the coerce backing types code is now working as previously intended. However, the previously intended implementation missed an edge case, which this commit fixes.
This is because the structs were impossible to reasonably construct before.
VaListTagHandle is an extra handle struct that seems to generate on Linux (and not on Windows) and breaks global prefix determination.
OpenAL: ContextErrorCode seems to always be replaced with ErrorCode, even on Windows. Not sure why. This also happened during the last PR, but I didn't commit it.
…name trimmer code
Honestly, what I wrote is a complete guess, I'll likely revisit these once I understand them more.
77f3ef3 to
9c9fbfc
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This reverts commit 9c9fbfc.
|
Going to revert acronym casing changes as discussed in the Discord before reopening PR for review. |
b06e648 to
53fbdd3
Compare
c6a07d7 to
9bbf8be
Compare
Exanite
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self code review complete. Going to mark as ready for review.
Note that I only have the non-generated changes committed.
The generated changes are here: Exanite#19
This is because the generated changes hide the non-generated changes (it goes over the 1k file limit).
Feel free to comment on the linked PR as well.
It will be merged into this PR after the non-generated changes are reviewed.
DO NOT merge the PR until the generated changes are merged, and preferably, reviewed.
| + "conflicts with members of other types.", | ||
| responseFile.FilePath, | ||
| key | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is from the Microsoft branch
| /// Then if no override is found, then the name's affixes are removed, | ||
| /// the name is prettified, and the name's affixes are added back. | ||
| /// </summary> | ||
| private string ApplyPrettifyOnlyPipeline( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is from the Microsoft branch, but heavily modified.
| ICulturedStringTransformer nameTransformer) | ||
| { | ||
| // Check for overrides | ||
| foreach (var (nativeName, overriddenName) in nameOverrides) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally this code isn't duplicated with the code in Trim(), but to do this performantly requires a decent amount of refactoring.
| attributes = attributes.WithNativeName(groupInfo.NativeName); | ||
| } | ||
|
|
||
| var baseTypeSyntax = ParseTypeName(baseType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ParseTypeName fixes an issue where IFieldSymbol.ConstantValue was returning null.
Summary of the PR
This PR focuses on implementing the naming-related improvements identified in #2457.
Depending on the scope of the tasks, some of these tasks may be pushed to another PR.
Important changes:
-HandleEXTinstead of-EXTHandle.AccelerationStructureHandleKHR-DelegateEXTinstead ofEXTDelegate.pfn struct BufferCallbackSOFTandpfn delegate BufferCallbackDelegateSOFTalGetSourcei64vDirectSOFTare now trimmed and prettified asGetSourcei64vDirectSOFTinstead ofGetSourcei64VDirectSOFT. Note the capitalization ofv. This is because affixes are added after prettification.TrimEnumMemberImpliedVendorstrims enum member vendor suffixes if it matches the enum type vendor suffix.INameTrimmer.Orderis used to order the trimmers instead of the version.List<string>?) have been made non-nullable. Most of these get allocated anyway and it makes the code more maintainable. If there is any performance issue (mainly concerning the Microsoft job), I will take the time to optimize it.NativeTypeName,NameAffix,TransformedRelated issues, Discord discussions, or proposals
Previous Vulkan PR (initial bindings generation): #2457
Discord thread: https://discord.com/channels/521092042781229087/1376331581198827520/1442651368207941643
Further Comments
Tasks not part of this PR
These are the tasks from my previous PR. These have been sorted and trimmed down to ensure that this PR remains focused. These may be added to this PR.
If you want to see the original, unmodified set of tasks, please see #2457.
These will also be part of a future PR.
SType)NativeNamefor resolving API profilesFuture PRs
TransformFunctions.Silk.NET.SDL.ConditionHandle.gen.csinstead ofConditionHandle.gen.cswhen running multiple jobs at the same time.SDL_MAX_SINT64generation on Linuxpublic const nint SDL_MAX_SINT64 = unchecked(0x7FFFFFFFFFFFFFFF);does not compileExtractNestedTypingandTransformHandlesinto a new set ofExtract-mods.ExtractNestedTyping, but forTransformHandlesit is useful forAddApiProfilesto be executed after all types are extracted, but not yet transformed.AddApiProfilesstrictly work off ofNativeNameattributes.Mat4X4case. The "X" should be lowercased.EGLasEglCurrent Todos
Prepare to merge.
Completed Todos
Newest groups at the top. Order within a group is chronological.
Note that I also wrote a summary at the top. The summary is more comprehensive, but this section can be useful getting additional context. Also see my commit descriptions if more context is needed.
INameTrimmer.Order
INameTrimmer.INameTrimmer.Orderproperty and internalTrimmerOrderenum.Fix misc issues I noticed
VkVendorIdmembers are not trimmed properlyAttribMaskin OpenGL are not getting rewritten.fieldSymbol.ConstantValueis null, but why it is null is unclear. Maybe a Roslyn bug? Example member:DepthBufferBit = unchecked((uint)0x00000100). Note that similar expressions in Vulkan are fine, eg:unchecked((ulong)0x00000002UL). Maybe it is because the literal type and cast type are different.ParseTypeName(baseType)instead ofIdentifierName(baseType).Fix issues introduced by name affix system
MixKhronosDatacode removals to the currentdevelop/3.0branch and see what changes would be made. This is to ensure I don't accidentally remove functionality when deleting code.Name affix system
PFNVkDebugUtilsMessengerCallbackEXTandBufferTHandlePFNVkDebugUtilsMessengerCallbackEXTprefixPFNVkDebugUtilsMessengerCallbackDelegateEXTsuffixAccelerationStructureHandleKHRsuffixNameSuffixattributes.HandleEXTinstead ofEXTHandlefor readability.Name metadata
GLEnumand the other OpenGL enumsName prettification
Change naming convention to not capitalize acronyms (i.e., strictly pascal cased)See: https://discord.com/channels/521092042781229087/1376331581198827520/1395097379329282089Update generated method class names in the rsp files to be strictly pascal caseStdVideoEncodeH264SliceHeaderFlagsproperty names. They currently aren't getting prettified.Fix bugs from original PR
Handle struct improvements