Commit graph

1127 commits

Author SHA1 Message Date
Marijn Suijten dca1a004c1
changelog: Document #747 attachment_count() addition 2023-05-02 10:47:08 +02:00
Marijn Suijten ae53f73bae
Expose FramebufferCreateInfo::attachment_count builder for IMAGELESS (#747)
* Expose `FramebufferCreateInfo::attachment_count` builder for `IMAGELESS`

Don't omit the `attachment_count()` builder method, because it is valid
to set the number of attachments without providing attachments in the
`IMAGELESS` case.

Also change the generator array lookup to use the name of the count
field that is allowed to have a builder method, rather than the name of
the field that would use this as `len` field and hence cause it to be
skipped.

* Clean up clones
2023-05-02 10:44:15 +02:00
Marijn Suijten 23da5dbc8c
README: Remove deprecated builder() snippets and guidelines (#743)
* README: Autoformat

* README: Remove deprecated `builder()` snippets and guidelines

 #602 introduced builder functions directly on the raw Vulkan struct
types by using lifetime borrows which are FFI compatible (ABI is
identical) wuth raw pointers, simplifying the whole system and
protecting the user against losing lifetimes upon calling `.build()`.
However, this change wasn't propagated through to the `README` so the
code snippets were still showcasing removed `::builder()` and `.build()`
functions and documenting "the `.build()` footgun" which doesn't even
exist anymore 🎉
2023-04-16 22:19:09 +02:00
Vinh Truong 88e46b43a4
ash/device: Add missing Device::get_device_queue2() wrapper (#736)
ash/device: Add missing Device::get_device_queue2() wrapper
2023-04-08 21:58:47 +02:00
Marijn Suijten 30cb8f1d7c
generator: Run rustfmt over generated output before writing to disk (#735)
Some users are confused by seeing wildly different output after running
the generator, which is simply solved by running `rustfmt`.  As this is
both confusing and "somewhat" slow, invoke `rustfmt` directly within the
generator by piping string contents through it before redirecting to
disk.  This not only makes the output consistent, it is the fastest way
to reformat generator changes by omitting the round-trip to disk
entirely, nor having `rustfmt` recursively go through the workspace and
all files (including those that are not generated).

On a many-core machine these times are a bit skewed, but I want to
include them to prove the "speed" point nevertheless, even if simplicity
and consistency is the main reason to make this change:

Before:

    time ./target/debug/generator && time cargo fmt --all
    ./target/debug/generator  3.51s user 1.25s system 99% cpu 4.769 total
    cargo fmt --all  0.79s user 0.06s system 99% cpu 0.853 total

After:

    time ./target/debug/generator
    ./target/debug/generator  4.51s user 0.41s system 99% cpu 4.931 total
2023-04-07 01:48:26 +02:00
Marijn Suijten 42a2bd330f
CI: Replace deprecated actions-rs with simple run: cargo ... (#720)
There's no reason to use these steps anymore: besides being old,
unmaintained, and spitting out NodeJS deprecation warnings, GitHub's
`runner-images` come preloaded with all Rust tools and components we
need, and the syntax to run commands is more efficient, much shorter and
more apprehensible by simply matching what we'd use on our own
command-line, too.
2023-04-06 07:50:10 +02:00
Marijn Suijten 5732d977cf
generator: Borrow all command names and disentangle "aliases" (#733)
Turns out we were doing the wrong thing for the right reason: the
`aliases` here aren't `vk.xml` aliases: they are renames.  When
generating function pointers for extensions, a list of command
_definitions_ is collected, which can only ever be "root" `command`s.
Extensions typically reference stabilized `command`s under an alias with
the vendor tag suffixed, which the `Fn` struct field name is renamed to
using this `aliases` - now replaced with `rename_commands` - list, while
generating the rest of the "function pointer" command bits using the
"root" `command` (as this mostly pertains the parameters and return
type).  With that explanation it becomes clear why
`generate_extension_commands()` was creating an "alias" mapping from
stabilized name to vendor-suffixed extension name, and calls
`generate_function_pointers()` with that mapping - and a list of
stabilized/root `command`s - rather than passing `cmd_aliases` directly.
(This `cmd_aliases` list exists because the rename always happens in the
root `<commands>` element: extensions then `<require>` the aliased
rather than the stabilized name, so the base for this alias is found
first to look up the base command, and then stored in `rename_commands`
to rename it back to the aliased name).

With improved clarity we can now also borrow the name strings rather
than cloning them in many places.
2023-04-05 23:42:21 +02:00
Marijn Suijten 77e614d776
extensions/ext: Add VK_EXT_shader_object device extension (#732)
* extensions/ext: Add VK_EXT_shader_object device extension

* extensions/ext/shader_object: Copy remaining fn impls from `extended_dynamic_state*`
2023-04-03 10:39:06 +02:00
Marijn Suijten 7ac0027852
Update Vulkan-Headers to 1.3.246 (#723)
* Update Vulkan-Headers to 1.3.245

* Upgrade `bindgen` to `0.64`

* Update Vulkan-Headers to 1.3.246
2023-04-03 10:18:26 +02:00
Marijn Suijten 74f68f26a2
extensions/khr: Add VK_KHR_performance_query (#726) 2023-04-03 10:05:24 +02:00
Marijn Suijten f98cab47dd
extensions: Remove get_properties() helper from extension wrappers (#728)
This helper function isn't consistently implemented across most
extension wrappers, and promotes bad Vulkan patterns by not making it
obvious to the caller that `get_physical_device_properties2()` can and
should be used to fill multiple properties structs at once.
2023-03-30 11:12:36 +02:00
Marijn Suijten a9fbc7147b
Update Vulkan-Headers to 1.3.244 (#697)
* Update Vulkan-Headers to 1.3.239

* Update Vulkan-Headers to 1.3.240

* Upgrade to `bindgen 0.63` and `vk-parse 0.9`

Updates cause no semantic changes in usage nor generated output.

* generator: Support new `deprecated` attribute

* Update Vulkan-Headers to 1.3.241

* generator: Emit `#[deprecated]` annotation for type members (struct fields)

* Update Vulkan-Headers to 1.3.242

* Update Vulkan-Headers to 1.3.243

* Update Vulkan-Headers to 1.3.244
2023-03-21 07:19:17 +01:00
Marijn Suijten 61b7415156
generator: Handle <command> via vk-parse types and nom (#719)
For the upcoming `api` attribute in `vk.xml` commands also need to be
processed through `vk-parse` which has support for all the new
attributes, while `vkxml` is deprecated and completely untouched for
years.  This conversion unfortunately requires whipping up yet another
quick-and-dirty `nom` parser of a specific subset of C used in `vk.xml`
to describe parameter signatures.  This PR shows that conversion is
complete and provides no accidental semantic differences.

Also update `vk-parse` to `0.9` which contains a new `code` field on
`CommandParam` (`<param>` element) to be able to inspect the code
signature of individual parameters rather than parsing them out of (and
matching them back to `vk-parse`'s `params` array!) the `<command>`
/ `CommandDefinition` as a whole:
https://github.com/krolli/vk-parse/issues/25#issuecomment-1246330001
615ffb69eb
2023-03-21 06:30:05 +01:00
Friz64 eaf140fcb0
rewrite: Absolute basics (#713)
rewrite: Absolute basics
2023-03-13 22:06:38 +01:00
Marijn Suijten 2212bf5e42
device: Correct #717 reqirements typo (#718) 2023-03-12 20:51:54 -07:00
lilly lizard 0f6daa8438
Rename some function arguments to match the vulkan spec (#717)
renamed some function arguments that were previously called 'create_info' to match the argument names in the vulkan spec
2023-03-11 00:59:44 +01:00
Marijn Suijten 7a1686014e
Replace const fn name() with associated NAME constants (#715)
`CStr::from_bytes_with_nul_unchecked` is `const`-stable since Rust 1.59
which is already required for `ash` so it is high time to finally turn
these inlined `name()` functions into associated constants (which is a
breaking change in itself that cannot be backported).
2023-03-09 23:53:04 +01:00
Marijn Suijten 1c9e422577
ash-window: Bump MSRV to 1.64 to match raw-window-handle 0.5.1 (#716)
`raw-window-handle 0.5.1` bumped from 1.60 to 1.64 in a
semver-compatible release, failing our CI infrastructure overnight.

Keep the `ash` version at `1.60` for now.
2023-03-09 23:39:44 +01:00
Marijn Suijten 7b3df8477d
changelog: Document removal of query_count parameter from get_query_pool_results() (#710)
Commit c66db26 ("device: Replace `query_count` parameter in
`get_query_pool_results` with `data.len()` (#644)") removed this
parameter in favour of using `data.len()` to make it more obvious to use
an appropriate element type that matches the kind of request (see also
 #639) so that the stride is filled in correctly, but it was not
mentioned in the changelog yet.
2023-02-24 22:33:24 +01:00
Marijn Suijten 935e5a4490
ash-window: Sync up with 0.12.0 release 2023-02-24 22:05:04 +01:00
Marijn Suijten 9e71ab9e34
Bump MSRV to 1.60 to accomodate for winit 0.28/objc requirement (#709)
These dependencies fail to resolve on older Rust/cargo versions before
even complaining about them being a too-high MSRV.
2023-02-24 21:51:07 +01:00
Marijn Suijten 90ccc31f97
generator: Convert #define generation from vkxml to vk-parse (#708)
For upcoming `vk.xml` features (the new `api` attribute) some of our
codegen has to be converted to work on `vk-parse` types to make this
ergonomic (and there's a longstanding plan of factoring out `vkxml`
regardless).  Start with converting the `#define` code and showcasing
that it does not affect the output (beyond removing the unneeded
edgecase for `VK_HEADER_VERSION` resulting in a doc link).
2023-02-22 12:32:16 +01:00
Marijn Suijten 8c63c9e08b
examples: Upgrade winit to 0.28 (#703) 2023-02-21 11:27:23 -08:00
Marijn Suijten ee86c65757
generator: Limit pCode member workaround to VkShaderModuleCreateInfo (#707)
An upcoming extension will ship with an untyped `pCode` member (`void
*`) including a valid `len` field pointing to a `codeSize` field rather
than obscure Latex math and a `/4` expression in `altlen`.  Limit the
scope of our workaround for that SPIR-V-specific `pCode` field to
`VkShaderModuleCreateInfo`.
2023-02-17 19:50:59 +01:00
Philippe Renon 9cd6c07744
fix clippy::uninlined_format_args (#705)
* ash/util: fix `clippy::seek_to_start_instead_of_rewind`

* examples: fix `clippy::uninlined_format_args`

* ash: fix `clippy::uninlined_format_args`

* generator: fix `clippy::uninlined_format_args`

* rust: upgrade to edition 2021
2023-02-17 18:11:44 +01:00
HugoPeters1024 86dccdfcd8
examples: Fix error description in texture example (#696)
fix error description in texture example
2023-01-13 10:03:45 +01:00
Marijn Suijten 7f6954300b
changelog: Import from and synchronize with 0.37.2 release 2023-01-11 11:40:11 +01:00
Teodor Tanasoaia 043c00c404
extensions/khr/draw_indirect_count: Use the right function pointer for non-indexed draw call (#695) 2023-01-11 11:27:26 +01:00
Marijn Suijten 720eb81048
Update Vulkan-Headers to 1.3.238 (#688)
* Update Vulkan-Headers to 1.3.236

* Update Vulkan-Headers to 1.3.237

* Update Vulkan-Headers to 1.3.238
2022-12-19 19:42:05 +01:00
Marijn Suijten 4ba8df1af8
examples: Remove unneeded casts as pointed out by Rust 1.66 (#692)
Strangely some no-op cast remained in the codebase, and are only now
caught since Rust 1.66.  In both cases the input value is already of the
correct type (independent of the platform).
2022-12-19 10:18:45 -08:00
Marijn Suijten a7538ee986
Replace <<ref>> in documentation with link to ref (#693)
Rustdoc since 1.66 points out that `<<ref>>` is malformed HTML, and the
resulting `<<devsandqueues-lost-device>>` isn't very helpful to users.
Convert it to the relevant link in both documentation and `Result`
`Display` to solve both issues at once.
2022-12-19 10:17:48 -08:00
Marijn Suijten 6bd8276861
changelog: Document removal of "disabled" extension code (#689) 2022-12-12 10:36:06 -08:00
Marijn Suijten 86b0f45e48
generator: Do not generate code for "disabled" extensions (#448)
It is unlikely that disabled, reserved extensions (without naming
whatsoever) are used through Ash bindings generated from Vulkan-Headers
releases, and are best ignored to reduce diff noise and spurious issues
[1] with unfinished extension definitions.

This approach matches what is defined in the registry spec for
`supported="disabled"` [2]:

    use `supported="disabled"` to indicate this extension should never
    be processed.

[1]: https://github.com/KhronosGroup/Vulkan-Docs/issues/1549
[2]: b4e8cd820b/registry.txt (L1302-L1306)
2022-12-11 16:36:25 -08:00
Marijn Suijten 69c56eaa03
changelog: Import from and synchronize with 0.37.1 release 2022-11-23 23:26:20 +01:00
Marijn Suijten 358ba06a54
extensions/ext: Add VK_EXT_descriptor_buffer (#679) 2022-11-22 23:35:10 +01:00
Marijn Suijten 8756155817
extensions/ext: Add VK_EXT_extended_dynamic_state3 (#671) 2022-11-22 23:28:31 +01:00
Marijn Suijten 6ed9ba4b7b
Call Vec::set_len() after checking for Vulkan errors (#684)
The entire reason for calling `unsafe` `set_len()` after the Vulkan
driver function call is to ensure the `Vec` never gives safe access to
uninitialized values (as allocted via `Vec::with_capacity()`).  This
contract is broken within the implementation of these functions by
temporarily setting a nonzero length when the Vulkan driver may not have
initialized the underlying data at all, and communicated this by
returning an error code.

Simply check the error code first, before jumping to a now-infallible
codepath that calls `.set_len()` and always returns `Ok()`.
2022-11-22 23:27:33 +01:00
Marijn Suijten ba37cf3fc2
Update Vulkan-Headers to 1.3.235 (#667)
* Update Vulkan-Headers to 1.3.229

* Update Vulkan-Headers to 1.3.230

* Update Vulkan-Headers to 1.3.231

* Update Vulkan-Headers to 1.3.232

* Update Vulkan-Headers to 1.3.233

* Update Vulkan-Headers to 1.3.235

* README: Document experimental Vulkan Video bindings being semver-exempt
2022-11-22 23:13:09 +01:00
Marijn Suijten 8b4575086e
Replace as *... raw pointer-type changes with more explicit .cast() (#685)
`.cast()` allows changing the pointer type without hiding (accidental)
mutability changes (noting that `*mut` still coerces to `*.const`).

For mutability changes Rust 1.65 included `cast_mut()` and
`cast_const()`, but those would bump our MSRV too eagerly for now.
2022-11-22 10:52:14 -08:00
Charles Giessen 29b935b1c1
generator: Update list of vendor names (#676) 2022-11-07 23:47:44 +01:00
Marijn Suijten 373aee53a7
CI: Only MSRV-test published ash and ash-window crates (#677)
`bytemuck` recently bumped its MSRV to 1.60 which is incompatible with
what we're currently advertising.  Fortunately this doesn't affect MSRV
of the publicly published crates, but only `dev-dependencies` inside
`ash-window` via `winit`: make sure the CI doesn't reject this.
2022-11-07 11:58:48 -08:00
Marijn Suijten 51f59976b4
generator: Upgrade to bindgen 0.61.0 (#673)
Seems to mostly result in less unused type aliases being generated, and
improved/reworked testing infrastructure.
2022-10-20 10:41:23 -07:00
Marijn Suijten eb682d415d
extensions: Only call assume_init() when Vulkan returns SUCCESS (#669)
It is undefined behaviour to construct a safe object by calling
`MaybeUninit::assume_init()` when the object in question hasn't been
initialized by anything (in this case the underlying Vulkan call) at
all, even if the object is never "used".  Postpone the `assume_init()`
call until after checking if `vk::Result::SUCCESS` has been returned by
the native implementation, by introducing a new
`assume_init_on_success()` helper that takes a `MaybeUninit<T>`.
2022-10-14 20:27:15 +02:00
AidoP a4a85318c8
extensions/ext: Add VK_EXT_acquire_drm_display (#668)
Co-authored-by: Aidan Prangnell <aidop@trifuse.xyz>
2022-10-11 17:33:31 +02:00
Marijn Suijten df87050610
generator: Support nested arrays in builders without hardcoding (#666)
Prepare the generator for more struct fields that have nested "dynamic
arrays" with a hardcoded size of `1` (effectively arrays with pointers
to single objects) in `vk.xml`s `len` attribute.  These structs are
introduced by `VK_EXT_opacity_micromap` in 1.3.230.
2022-10-03 12:00:54 +02:00
BeastLe9enD b0a1338532
extensions/ext: Add VK_EXT_mesh_shader (#657) 2022-09-26 00:31:28 +02:00
Marijn Suijten ffd16854c4 extensions/ext: Remove misnamed, deprecated debug_utils_set_object_name() and debug_utils_set_object_tag() entirely
See also #660/#661.
2022-09-24 11:07:35 +02:00
BeastLe9enD f0e636a16d
extensions/ext: Rename debug_utils_set_object_name to set_debug_utils_object_name and debug_utils_set_object_tag to set_debug_utils_object_tag for consistency and deprecate old ones (#661) 2022-09-24 11:01:22 +02:00
Marijn Suijten b4fc334083
ash-window: Upgrade to raw-window-handle 0.5.0 (#645)
* ash-window: Upgrade to raw-window-handle 0.5.0

* Bump `raw-window-metal` to recently-released `0.3`

https://github.com/norse-rs/raw-window-metal/pull/5

* examples: Bump `winit` to `0.27.1` to resolve our MSRV tests

While the examples technically aren't part of our MSRV requirement (it's
nice, but core crate compatibility is much more important), it's
annoying to exempt these especially now that `winit` removed some
unneeded MSRV 1.60/1.61 requirements.

* Take `Raw{Display,Window}Handle` directly instead of through trait
2022-09-23 12:40:12 +02:00
Marijn Suijten 82a93ef0b4
ash-window: Link to the ash gitter instead of nonexistent ash-window (#659)
It seems there's no gitter channel for `ash-window` (404), and since
everyone is in the `ash` channel already, just use the same one.
2022-09-22 09:07:17 -07:00