Skip to content
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

generator: Parse and autogenerate version-related defines #431

Merged
merged 2 commits into from
May 30, 2021

Conversation

MarijnS95
Copy link
Collaborator

@MarijnS95 MarijnS95 commented May 8, 2021

Depends on #429

With this PR I want to leverage existing parsing and generation infrastructure to completely automate the generation of define macros. It doesn't change much right now but will address #428 as if by magic when generating for .175 🥳

Things we should discuss:

  • The change to SHOUTY_SNAKE_CASE - this isn't standard for const fn. We previously had a map to re-map VK_MAKE_VERSION to make_version but to do this consistently in this new system we'll have to collect a set of SHOUTY_SNAKE_CASE identifiers that were found to be const fn (!define.parameters.is_empty()) intead and map those to snake_case;
    EDIT: This is now taken care of by a map, bit verbose but we do that for many other types too;
  • Unify and normalize cexpr vs hexadecimal_number. Both can probably emit a Literal or TokenStream at this point.

Comment on lines +45 to +51
value!(CType::U64, complete!(tag!("ULL"))) |
value!(CType::U32, complete!(tag!("U")))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was never working before: the longest prefix needs to be matched first but at the same time that sets the minimum length requirement for the rest of the alt!, so tag!("U") never got matched.

Documented here, perhaps this should be a comment in-line:
https://github.com/Geal/nom/blob/38bb94e7bc45c2b4ef0c473e0e5c03ab134cdff3/src/branch/macros.rs#L93-L142

generator/src/lib.rs Outdated Show resolved Hide resolved
generator/src/lib.rs Outdated Show resolved Hide resolved
generator/src/lib.rs Outdated Show resolved Hide resolved
@MarijnS95 MarijnS95 force-pushed the autgenerate-define-exprs branch 3 times, most recently from 0be6b4b to 3773123 Compare May 10, 2021 07:36
@MarijnS95 MarijnS95 force-pushed the autgenerate-define-exprs branch 2 times, most recently from 97b1dca to 56617f4 Compare May 12, 2021 08:44
@MarijnS95 MarijnS95 changed the title [RFC] generator: Parse and autogenerate version-related defines generator: Parse and autogenerate version-related defines May 18, 2021
@MaikKlein MaikKlein merged commit b81b19a into master May 30, 2021
@MarijnS95 MarijnS95 deleted the autgenerate-define-exprs branch May 30, 2021 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ash::vk::make_version should be deprecated and ash::vk::make_api_version should take its place
3 participants