Commit graph

1021 commits

Author SHA1 Message Date
Marijn Suijten 4fcd93016e
extensions/khr: Add VK_KHR_external_semaphore_win32 (#581) 2022-02-16 23:13:19 +01:00
Marijn Suijten c5f68eab9d
extensions/khr: Add VK_KHR_external_memory_win32 (#579) 2022-02-16 13:30:54 -08:00
Marijn Suijten b7aff3b432
extensions/ext: Add VK_EXT_extended_dynamic_state2 (#572) 2022-01-29 21:39:48 +01:00
Marijn Suijten 89ca1d03f4
extensions/khr: Add VK_KHR_copy_commands2 (#571) 2022-01-29 21:34:30 +01:00
Marijn Suijten d4d9276636
extensions/ext: Add VK_EXT_private_data (#570) 2022-01-28 17:12:42 -08:00
Marijn Suijten bb02b20339
Replace 1.2-extensions documentation links with 1.3-extensions (#569)
All these 1.2 links redirect to the 1.3 pages: spare the redirects by
specifying the right - latest - version directly.
2022-01-28 17:10:52 -08:00
Marijn Suijten 0fd73279e1
Use link text in docs to omit Self:: prefix in rendered docs (#561)
Suggestion from [#559].

[#559]: https://github.com/MaikKlein/ash/pull/559#discussion_r790178735
2022-01-24 11:40:58 -08:00
Marijn Suijten b5a2744694
Replace link #[doc] bits with /// in manual code files (#562)
Manual code files usually see extra documentation lines added with
`///`, making for a rather unpleasant (source code) reading experience
when mixed with a link wrapped in `#[doc]`.  This is just a copy-paste
remnant from autogenerated code (`quote` macro converts `///` to
`#[doc]`) and can easily be omitted in manual code.
2022-01-24 10:50:36 -08:00
Marijn Suijten 315f1f00c3
ci: Build-test documentation with warnings disallowed, and fix links (#559)
Broken links that snuck in (most recently in #530 and #537) while the
CI was not testing the documentation have also been corrected, to allow
it to succeed again (and to have proper docs in the first place).
2022-01-22 11:27:07 -08:00
Steve Wooster fbcc45fffe
Add conversions from Extent2D to Extent3D and Rect2D (#557)
These two conversions occur all the time in Vulkan applications. For
example, Extent2D -> Extent3D occurs whenever you need to make an image
the same size as a surface and Extent2D -> Rect2D occurs whenever you
fill out a scissors or render area from a surface resolution.

Co-authored-by: Steve Wooster <s.f.m.wooster@gmail.com>
2022-01-22 16:29:45 +01:00
Marijn Suijten cebfd544fc Release ash 0.35.1 2022-01-18 12:07:54 +01:00
Marijn Suijten a28a667d7c
changelog: Add entries for recent PRs #545, #534, #553, #551, #549 (#555)
And drop the deprecated =/- markdown syntax from our readme: this is
analogous to #/## for a h1/h2 header, instead of defining a title and
(usually smaller font) subtitle or description.
2022-01-17 20:45:10 +01:00
Marijn Suijten 5169862dbd
extensions/ext: Add VK_EXT_calibrated_timestamps extension (#556)
This extension can be used to correlate timestamps on the GPU timeline
(`vkCmdWriteTimestamp`, `vkCmdWriteTimestamp2KHR`) to the CPU timeline
(ie. `CLOCK_MONOTONIC` and friends).
2022-01-17 16:32:05 +01:00
thorjelly 98192d11f2
Convert vk_bitflags_wrapped! methods to const fn (#549) 2022-01-11 17:49:53 +01:00
Marijn Suijten 03068a8734
examples: Update winit to 0.26 and image to 0.23 (#551)
Examples-only excerpt of #547, as the generator and ash-window example
changes need more work.  Fixes #550.
2022-01-10 13:43:18 -08:00
Marijn Suijten 130c150841
ash-window: Require at least raw-window-handle 0.3.4 for 0.4 interop (#553)
`raw-window-handle 0.3.4` was pushed as a "semver-trick-like" patch
release, implementing the `0.3` trait for the `0.4` crate release [74].
This allows `ash-window` as a window-handle "consumer" crate to accept
both `0.3` and `0.4` handles from consumer crates simultaneously.  To
ensure this patch release is available even when users omit regular
`cargo update` or build with `-Z minimal-versions`, set the minimal
patch version in `Cargo.toml` to it.

[74]: https://github.com/rust-windowing/raw-window-handle/pull/74
2022-01-10 12:59:35 -08:00
Marijn Suijten 405449901c
generator: Exclude static macro code (macros.rs) from the generator (#552)
Much like `platform_types.rs` and `vk.rs` before, there is no need to
generate this file as its contents are completely static.  This allows
direct editing of the file without realizing that a copy lives in the
generator - and will overwrite `macros.rs` when the generator is being
run.
2022-01-10 12:07:54 -08:00
Marijn Suijten 570b554894
Assert that Vulkan array-getters return the same length (#534)
Originally introduced in [#489] this inserts the array-length equality
check everywhere else: in the supposedly invalid and inexistant event
where Vulkan suddenly returns less items (`count` has been modified)
than were originally queried through respective `_len()` functions (or
more likely: a slice of invalid length passed by the user) and some
elements at the end of the slice are left uninitialized, panic.

Wherever there is valid concern or possibility for this to happen - or
to circumvent assertions and panics altogether - mutable references to
mutable slices should be passed allowing the length to be promptly
updated.

[#489]: https://github.com/MaikKlein/ash/pull/489#discussion_r753020089
2022-01-06 00:17:32 +01:00
hoj-senna fdaafe760a Update README.md
loaded/linked feature: correctly identify default, adjust order
2022-01-05 15:12:37 -08:00
hoj-senna 84bf62b219 Update README.md
Change Entry::new to Entry::linked in accordance with the changelog for ash 0.35.0.
2022-01-05 15:12:37 -08:00
Marijn Suijten 762666783a changelog: Add entries for recent PRs #533, #537, #542 2022-01-03 14:51:11 -08:00
Markus Siglreithmaier adf0338ed8
example: Refactor event loop handling for continuous redraw (#542)
Switch to continuous redrawing using `Poll` and `MainEventsCleared`.

Fixes hangs in case of non-Mailbox present modes.
2022-01-03 23:24:36 +01:00
Anna Sofie Nordstrand 8f05905ecb
extensions: Add VK_KHR_get_surface_capabilities2 (#530) 2021-12-29 14:35:25 +01:00
Marijn Suijten 8a46a1508a Generate RGBA=R|G|B|A helper constant for ColorComponentFlags
When the misleading `all()` function was removed in #478 it also made
all color components for `ColorComponentFlags` significantly more
verbose to write, see #536.
2021-12-28 11:52:29 -08:00
Marijn Suijten afdab863d0 examples: Remove remaining CString allocations on string literals
These allocations and runtime assertions can all be replaced with a
`CStr` directly wrapping a binary-string literal, as long as it is
null-terminated.
2021-12-28 10:37:30 -08:00
Marijn Suijten 57303f52dc extensions/amd: Remove unnecessary CString allocations in fn load
Following the changes in a053c6a ("Remove unnecessary CString allocation
when loading functions (#379)") this addresses the remainder of string
allocations in manual extension loading code.
2021-12-28 10:37:30 -08:00
Marijn Suijten ab36e84bac ash-window: Bump to 0.9.0
This change missed out from 9e7c1bff62.
2021-12-27 23:54:09 +01:00
Marijn Suijten 9e7c1bff62
Release ash 0.35 and ash-window 0.9 without default compile-time linking (#529) 2021-12-27 23:52:23 +01:00
Benjamin Saunders 7cf3b4f09e
Don't link Vulkan by default (#526)
This was found to be unreasonably disruptive to downstream CI
configurations.
2021-12-27 11:49:40 +01:00
Marijn Suijten 61d37734f8
ci: Run clippy once more without default features (#523)
With more and more features being added to `ash`, now seems to be the
right time to make sure the crate is clean of clippy warnings when
building without any features in addition to building with the deafult
set of features.
2021-12-27 11:43:12 +01:00
Benjamin Saunders be6d767b03
Cover all features with clippy (#527)
* Fix lint

* Cover all/no features with clippy
2021-12-23 23:26:48 +01:00
Marijn Suijten f99f9cfa90
Prepare release notes for 0.34 (and ash-window 0.8) with Vulkan 1.2.203 (#515) 2021-12-22 02:39:11 +01:00
Benjamin Saunders 6e31d1f229
Disable default features in ash-window -> ash dependency (#524) 2021-12-22 02:31:13 +01:00
Benjamin Saunders 45301fffa4 Optional flag/bitfield Debug impls 2021-12-21 17:01:35 -08:00
Benjamin Saunders 1700dcdf05 Make Debug impls optional
When disabled, this buys us a 12% reduction in buildtime.
2021-12-21 17:01:35 -08:00
Benjamin Saunders e34f755ece Move debug_flags definition out of the generator 2021-12-21 17:01:35 -08:00
Marijn Suijten 0ae56a0961
extensions: Don't check extension names for interior nuls at runtime (#522)
This name is emitted by the generator and already known to not contain
any null-characters: replace the runtime iteration+comparison (hidden
behind `from_bytes_with_nul`) and `.expect()` panic with an `unsafe`
"cast" through `from_bytes_with_nul_unchecked`, just like the
function-pointer loaders.
2021-12-22 01:38:48 +01:00
Marijn Suijten 90960efded
examples: Use c_char for pointer to raw string (#521)
On platforms like Android strings use `u8` as character-type instead of
`i8` - using the appropriate `c_char` type hides this discrepancy and
allows the examples to compile for all platforms.
2021-12-21 11:42:47 -08:00
Marijn Suijten a7d5c49029 Update Vulkan-Headers to 1.2.203 2021-12-20 15:51:08 -08:00
Marijn Suijten b56f39e35c examples: Rename events_loop to event_loop 2021-12-20 15:50:02 -08:00
Marijn Suijten 9d36436a53 Remove window.id() match, simply nested matches with single if-let 2021-12-20 15:50:02 -08:00
neurotok 5b53dd94cb window event keyboard input 2021-12-20 15:50:02 -08:00
neurotok 9baeb9c19f winit v0.25.0 2021-12-20 15:50:02 -08:00
Marijn Suijten 87b00568a6 extensions: Group enum extension variants together per impl T block
Instead of generating an impl block - together with "Generated from XXX"
doc - for every single item that extends an enum type, group all these
extensions together in a single `impl` block per extension per type.

This cuts down a couple thousand lines of repeated `impl T` and `#[doc]`
annotations, and makes the code more readable at the same time: it is
now possible to immediately see exactly all the constants that a certain
extension extends a type with.
2021-12-20 15:16:44 -08:00
Marijn Suijten 8f4709e70d generator: Remove now-unnecessary alias-identical check
Back when we were still trying to come up with sensible names for
"deprecated" aliases (initially introduced as self-supporting constants)
that don't adhere to the naming standard but only remain to exist for
backwards compatibility, some of these aliases would get the same name
as the enum constant they were aliasing, resulting in (compile-time)
conflicts.

Now that all those aliases are simply not generated anymore (end-users
should just pick the properly named variant) it is not necessary to
check for and prevent these conflicts on the generator side anymore.
2021-12-20 15:13:23 -08:00
Marijn Suijten fe55ad73bd generator: Don't zip the same iterator with and without filter
`constants` is iterated twice here: once with a filter, the other time
without, and the results are zipped together.  Besides being able to
simplify the entire execution to just one `iter()` without intermediary
iterators, removing `.zip()` makes it impossible for the results in both
iterators to get mismatched when the `filter` inevitably skips elements.
Fortunately no such cases seem to exist, or at least not that effect the
resulting generated code.
2021-12-20 15:07:27 -08:00
Marijn Suijten ac94739e11 generator: Remove unnecessary impl BuildHasher from HashMap types
Some clippy lint long ago apparently suggested to explicitly specify a
type for all random generators in 8550683 ("Address all the clippy lints
(#233)"), so the `impl BuildHasher` trait was apparently passed as a
placeholder for the `RandomState` default that's selected.

This does not serve any purpose and that (likely bogus) clippy warning
no longer shows up, making it safe to remove the trait.
2021-12-20 15:05:57 -08:00
Marijn Suijten f781777931 examples: Use slice::from_ref to not loose lifetime on nested slices
As per the readme `.build()` should only be called as late as possible,
and only if absolutely necessary; such cases include slices that are
passed directly to functions.  More precisely, such build calls and the
creation of temporary slices should happen inside the same expression as
the function call to be sound and completely lifetime-checked.

This pattern of `&[my_builder.build()]` is however not possible when
constructing intermediary Vulkan objects that reference the slice.  In
the first place this slice goes out of scope after the expression that
creates the Vulkan object, which is caught and disallowed by rustc
(unless this expression itself ends in `.build()`, which is completely
 unsound as it makes rustc unable to validate this lifetime dependency).

In the second place - and as is most relevant for this patch that
removes `.build()` calls that were not surrounded by temporary slice
constructors - said expression drops the lifetime checks on anything
held by `my_builder` which _could_ go out of scope before the newly
constructed Vulkan object is used, resulting yet again in Undefined
Behaviour.

Fortunately, for slices of size 1 which are typical in Vulkan,
`std::slice::as_ref` exists which is analogous to taking a pointer to an
object and considering it an array of length 1 in C(++).  This maintains
the lifetime through `Deref` and makes rustc able to fully check all
lifetimes and prevent unsound code.

Albeit improving overall consistency, the `&[my_builder.build()]`
pattern is not substituted in aforementioned Vulkan function-call
expressions as that is considered "extraneous" [1] and demonstrates the
various ways to safely construct Vulkan objects for the observant reader.

[1]: https://github.com/MaikKlein/ash/pull/506#discussion_r762630648
2021-12-19 16:17:56 -08:00
Steve Wooster ea65db4bea
Simplify triangle example's vertex input state (#512)
Co-authored-by: Steve Wooster <s.f.m.wooster@gmail.com>
2021-12-19 12:28:34 +01:00
Marijn Suijten 428830ad4f Update Vulkan-Headers to 1.2.202 2021-12-11 11:03:45 -08:00