Commit graph

1106 commits

Author SHA1 Message Date
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
David Koloski 5f4b1bbf07
extensions/khr/ray_tracing_pipeline: Set length of capture-replay shader handle buffer after filling (#658) 2022-09-22 00:57:45 +02:00
Marijn Suijten 02a60bd9cb
Update Vulkan-Headers to 1.3.228 (#655)
* Update Vulkan-Headers to 1.3.220
* Update Vulkan-Headers to 1.3.221
* Update Vulkan-Headers to 1.3.222
* Update Vulkan-Headers to 1.3.223
* Update Vulkan-Headers to 1.3.224
* Update Vulkan-Headers to 1.3.225
* Update Vulkan-Headers to 1.3.226
* Update Vulkan-Headers to 1.3.227
* Update Vulkan-Headers to 1.3.228
2022-09-19 22:01:25 +02:00
Marijn Suijten 13fef40d48
ash: Add const STRUCTURE_TYPE to all Vulkan structures for matching with match_struct! macro (#614)
* ash: Add `const STRUCTURE_TYPE` to all Vulkan structures for matching with `match_struct!` macro

In Vulkan layers extracing a structure based on its `s_type` is a common
operation, but comparing against an enum value and subsequently casting
to the right type is verbose and error-prone.

By generating a `const STRUCTURE_TYPE` with the given value for every
Vulkan structure it becomes possible to implement a macro that abstracts
this logic away in a safer way.

* generator: Reuse `HasStructureType::STRUCTURE_TYPE` in `s_type` initializer
2022-09-19 12:39:54 +02:00
Marijn Suijten 6d0a29b638
Fix new/improved Rust 1.63 clippy lints (#649)
More `clippy::use_self` is found in manual code, and superfluous
transmutes in bindgen output are now also found and disallowed.
2022-08-12 13:34:57 +02:00
Marijn Suijten fef2c6269c
vk/prelude: Drop upstream-fixed Self:: doc workaround (#648)
The report at https://github.com/rust-lang/rust/issues/93205 was closed
as it has presumably been fixed in
https://github.com/rust-lang/rust/pull/93805 which has long trickled
down into stable releases, and I cannot reproduce the issue on `1.62.1`
anymore (latest stable as of writing) 🎉

This workaround was originally added in #559.
2022-08-11 10:15:31 -07:00
Marijn Suijten b093e67515
Release ash-window 0.11.0 2022-07-29 22:29:18 +02:00
Marijn Suijten da49568977
ash-window: Upgrade to raw-window-handle 0.4.2 (#505)
The match arms are not guarded by `cfg` anymore, allowing us to
compile-test these simple arms on every system whenever our Ash
extension helpers and types are not guarded by `cfg` attributes either.
This applies to every platform except Mac/IOS where the symbols and
external raw-window-metal crate are themselves guarded by cfg's.
2022-07-29 22:19:30 +02:00
Marijn Suijten f4acfbe2cb
ash-window: Upgrade winit example to 0.26 2022-07-29 10:42:10 -07:00
Marijn Suijten c66db26bc3
device: Replace query_count parameter in get_query_pool_results with data.len() (#644)
A slice is designed to be a cheap view into a continuous segment of
memory and easily recreated with a different offset and size.  This can
be used to our advantage to let the user set exactly how many items they
want to request, while ensuring all returned slots are filled on success
or otherwise return `NOT_READY` if not enough query results could be
copied to user memory (or block if the `WAIT` flag is set).

This also opens the door to accepting `MaybeUninit` in the future and
returning the initialized slice in the `VkResult::Ok(here)` case.
2022-07-29 17:25:39 +02:00
Marijn Suijten 9cb6d386eb
generator: Upgrade bindgen, heck and vk-parse
`heck` got its API slightly renamed, and `bindgen` fixed all code-smell
linter warnings in its output (except naming style, which is inherent).
2022-07-29 08:11:27 -07:00
Marijn Suijten e51e4158bd
ash: Add missing Apache-2.0 to Cargo.toml license field
We already ship both license files in the published crate, have both
licenses listed in the `README`, and even `ash-window` already lists
both in `Cargo.toml`.

I found this while experimenting with shields.io badges, as there's a
special link that scrapes the license straight off of crates.io:
https://img.shields.io/crates/l/ash (and many more).  This might've been
nice to use except that it's outdated until we publish the next release,
and doesn't allow a nice link to either `LICENSE-XXX` file that we have
now.
2022-07-28 09:48:15 -07:00
Marijn Suijten 79f63e1cbc
extensions: Inline all trivial functions (#638)
* extensions: Inline simple getter functions

* extensions: Inline all `unsafe fn` helper functions

* instance: Inline "skipped" `read_into_uninitialized_vector()` functions

* enums: Inline `from_raw`/`as_raw` functions
2022-07-07 17:25:05 +02:00
Marijn Suijten ce2ee4812c
extensions/ext: Add VK_EXT_image_compression_control device extension (#621) 2022-07-03 22:09:06 +02:00
Marijn Suijten 400d68fc7d
extensions/khr: Add VK_KHR_ray_tracing_maintenance1 device extension (#620) 2022-07-03 22:00:25 +02:00
Marijn Suijten 94fdc70a4c
Update Vulkan-Headers to 1.3.219 (#619)
* Update Vulkan-Headers to 1.3.212

* Update Vulkan-Headers to 1.3.213

* Update Vulkan-Headers to 1.3.214

* Update Vulkan-Headers to 1.3.215

* Update Vulkan-Headers to 1.3.216

* Update Vulkan-Headers to 1.3.217

* Update Vulkan-Headers to 1.3.218

* Update Vulkan-Headers to 1.3.219

* Changelog: reorder entries chronologically based on PR ID
2022-07-03 21:54:17 +02:00
Marijn Suijten 71d45e46f7
extensions/khr: Add VK_KHR_device_group (#631) 2022-07-01 22:19:56 +02:00
Marijn Suijten 671f98ce55
generator: Fix clippy::is_digit_ascii_radix (#637) 2022-07-01 13:09:22 -07:00
Marijn Suijten 1459da47bc
extensions/khr: Implement additional Swapchain functions since Vulkan 1.1 (#629)
* extensions/khr: Reorder `Swapchain` functions to match `KhrSwapchainFn`

* extensions/khr: Implement additional `Swapchain` functions since Vulkan 1.1

These are also made available by `VK_KHR_device_group` when
`VK_KHR_swapchain` (and for certain functions only the underlying
`VK_KHR_surface` extension) is enabled.
2022-06-05 21:47:29 +02:00
Marijn Suijten a950e14f89
Remove unused version.rs module file from git (#634)
This seems to have been forgotten in #412.
2022-06-05 12:05:21 -07:00
Marijn Suijten 965df80cf2
Inline trivial Entry wrapper methods and impl functions (#633) 2022-06-05 20:58:50 +02:00
Marijn Suijten 85fa5425d9
extensions/khr: Add VK_KHR_device_group_creation (#630) 2022-06-05 12:32:26 +02:00