Commit graph

21 commits

Author SHA1 Message Date
Michael Pollind 28a4868dc3 generator: Upgrade nom to 0.7 where parser macros have been removed (#610) 2022-05-11 11:23:20 +02:00
Marijn Suijten 06b4f8ef35
Vulkan 1.2.175: Provisional Video Extensions (#417)
* generator: Add edegecases for broken Video extension enum variants

* Replace deprecated `make_version()` with `make_api_version()`

* generator: Use the same predicate for push_next and its traits

Some structs turn out to be root structs when their name is not in the
`root_structs` set, even when they themselves extend another struct.
This was already taken care of for `push_next` which is emitted in this
situation, but the trait referenced by `push_next`'s `T` bound is still
relying on the `extends` field to not exist in `vk.xml` at all, leading
to it not being generated despite `push_next` needing it.

Fixes: 215511f ("Implement ExtendXXX for multiple root create infos if
there are more than 1")

* Update Vulkan-Headers to 12.175

* generator: Generate low-level structs with bindgen (for vk_video)
2021-06-06 11:00:29 +02:00
Marijn Suijten 95f748fc3d
generator: Use stable vk-parse 0.6 release (#434)
Following [1] a stable release including the fixed commit has been made;
we can now depend on the released crate version again.  This also
includes support for all new fields up to Vulkan 1.2.176.

[1]: https://github.com/krolli/vk-parse/issues/18#issuecomment-837815599
2021-05-11 21:36:44 +02:00
Marijn Suijten bc510f017d
generator: Add support for vkFlags64 and update to 1.2.170 (#411)
* Update Vulkan-Headers to 1.2.169

* generator: Add support for vkFlags64

Since Vulkan-Headers v1.2.170 with VK_KHR_synchronization2 there are now
bitmasks/enums using 64-bits instead of the default 32. vk-parse has
been updated to convey this info though the typedefs for these
enumerations could be parsed as well.

* generator: Insert underscores before trailing type number

Enum types like `VkAccessFlags2KHR` are turned into `VK_ACCESS2` after
demangling and `SHOUTY_SNAKE_CASE` conversion by Heck, but the enum
variants for the type start with `VK_ACCESS_2` (or similar) which fails
the `strip_suffix` and leads to long names to show up.

Inserting an underscore here makes sure the match succeeds.

* Update Vulkan-Headers to 12.170
2021-05-08 12:25:10 +02:00
Marijn Suijten 0a378b8807
Update Vulkan-Headers to 1.2.166 (#355)
* Update Vulkan-Headers to 1.2.165

* Update Vulkan-Headers to 1.2.166

* generator: Update itertools to 0.10
2021-01-24 22:13:28 +01:00
Marijn Suijten 43b5058e36
Upgrade proc_macro2/syn/quote to v1.0 (#351)
* generator: Mark IDirectFB and IDirectFBSurface as opaque

* Upgrade proc_macro2/syn/quote to v1.0

* Regenerate with quote/syn/proc_macro2 v1.0
2021-01-02 14:37:10 +01:00
Marijn Suijten bfa0309c97
Preliminary cleanup pass (#339)
* Fix clippy::manual_strip

* Fix clippy::comparison_to_empty

* Fix clippy::needless_lifetimes

* generator: Drop unnecessary edgecase for charptr array in builder

* generator: Make array type handling more linear

* prelude: Provide Result -> VkResult<()> conversion

* Add #[must_use] to Result type

* Fix all unchecked vk::Result cases

* generator: Fix typos

* generator: Assert char ptrs have `"null-terminated"` len attribute

* prelude: Provide result_with_success helper for Result -> VKresult

* Cleanup match{success} blocks with SSR

    {let $p = $f; match $q { vk::Result::SUCCESS => Ok($r), _ => Err($z), }} ==>> {$f.result_with_success($r)}

* Simplify matching on Result::SUCCESS

Using the following regex replacement:

    let err_code =\s*(.*\((\n|[^;])*?\));\s*match err_code \{\s*vk::Result::SUCCESS => Ok\((.*)\),\s*_ => Err\(err_code\),\s*\}

    $1.result_with_success($3)

* Simplify intermediate error return

    let err_code =\s*(.*\((\n|[^;])*?\));\s*if err_code != vk::Result::SUCCESS \{\s*return Err\(err_code\);\s*\}

    $1.result()?;

* Simplify error checking with .result()? and .result_with_success()

* generator: Ignore empty basetype in typedef (forward declaration)

ANativeWindow and AHardwareBuffer were [recently changed] to the
basetype category, but without an actual basetype, consequently failing
the Ident constructor with an empty name.

Since these types are already dealt with in platform_types, and there
doesn't seem to be anything sensical to define them to right now, just
ignore these cases.

[recently changed]: 0c5351f5e9 (diff-0ff049f722e55de41ee15b2c91ef380fL179-R180)

* Suggestion: Allocate data in get_ray_tracing_shader_group_handles

* generator: Update nom to 6.0

* generator: Generalize C expression conversion to TokenStream

* generator: Simplify ReferenceType::to_tokens with quote!

* generator: Refactor to not parse our own stringified token stream

* generator: Deal with pointers to static-sized arrays

* generator: Apply static-sized array pointer to size containing `*`

* generator: setter: Interpret all references as ptr, not just p_/pp_

* generator: quote::* is already imported

* generator: Replace manual fn to_tokens with quote::ToTokens trait impl

* generator: Return str reference from constant_name

* generator: Replace unused to_type_tokens with name_to_tokens

The reference argument was always None; replace it with a direct call to
name_to_tokens.

* generator: setters: Use safe mutable references instead of raw ptrs
2020-12-12 20:56:43 +01:00
Martin Krošlák e378a85c78 Update vk-parse to 0.5.0 2020-05-08 10:45:14 -07:00
Jasper Bekkers 6bdc403330
[WIP] Khr Ray Tracing (#278)
* Fix incorrect generation of commands with aliases

* Use alias name instead of the actual cmd name

* Generate vulkan ray-tracing bindings

* Add ray-tracing khr

* High level ray tracing support

* Re-enable nv ray tracing extension (this will break the build)

* Generate aliases for extension enums

* Add missing alias because the parser doesn't provide alias information here

* Fix 'unreachable pattern' warnings

* Fix clippy warning

Co-authored-by: Maik Klein <maikklein@googlemail.com>
2020-03-22 16:05:30 +01:00
Maik Klein af6acb93e5
Fix incorrect generation of commands with aliases (#279)
* Fix incorrect generation of commands with aliases

* Use alias name instead of the actual cmd name
2020-03-22 13:56:01 +01:00
Alexander Ekdahl 00f52cc5ad Vulkan 1.2 Support (#264)
* Updated vk-parse and Vulkan-Headers to Vulkan 1.2

* First pass at generating vk.rs

* Support double

* Generate from EnumSpec::Value

* Remove println

* Fix mutable pointer bug

* cargo fmt

* Update document link

* Remove mention of Vulkan 1.2 support for now

* Add clippy::wrong_self_convention
2020-01-19 09:56:12 +01:00
Aaron Loucks 284043b605 Update to 2018 edition 2019-05-25 15:25:00 -04:00
Maik Klein 9e4f25f282 Update vk_parse to 0.2 2018-11-22 16:13:09 +01:00
Maik Klein c4e4ab8fc2 Temporary implement Hash and PartialEq for certain types that only
contain primtive types
2018-08-19 10:10:11 +02:00
Brian Merchant 21a4eef1f8 pin vk-parse to crates.io 2018-08-17 12:26:32 -07:00
Maik Klein fb13cc402e Add extension structure type constants to StructureType 2018-07-07 14:49:17 +02:00
Maik Klein 9f14e404d7 Impl cexpr 2018-06-24 12:09:37 +02:00
Maik Klein dc378d7b9f Move from vkxml to vk-parse 2018-06-05 17:46:57 +02:00
Maik Klein bfed51f8d3 Save 2018-06-05 17:46:32 +02:00
Maik Klein 86068db713 Add ptr types 2018-06-05 17:46:32 +02:00
Maik Klein be08103d1d Init generator 2018-06-05 17:46:32 +02:00