Compare commits

...

80 commits

Author SHA1 Message Date
Alex Janka 55628b4023 raw-window-handle 0.6 2024-02-08 15:07:56 +11:00
Marijn Suijten 66c0cf42a0
Release ash 0.37.3 (#758) 2023-05-29 20:51:14 +02:00
Marijn Suijten 550182e940
Remove "drop" mention from create_* docs when the result doesn't implement Drop (#625)
Ash doesn't implement `Drop` intentionally, to not be too opinionated
about holding (heap) references to their parent objects
(`Device`->`Instance`->`Entry`) and ensuring they are destroyed in the
right order.  As such, reword the `create` documentation for `Instance`
and `Device` to mention their respective `destroy_*` function instead of
referring to them as being "droppable".

Note that `Entry` is droppable as it does not have a Vulkan `destroy`
function _and_ the dynamically loaded library (behind the "loaded"
feature) is kept alive only for the lifetime of `Entry`.
2023-05-29 20:42:41 +02:00
Marijn Suijten a6df3b2192
Update Vulkan-Headers to 1.3.251 (#741)
* Update Vulkan-Headers to 1.3.247

* Update Vulkan-Headers to 1.3.248

* Update Vulkan-Headers to 1.3.249

* Update Vulkan-Headers to 1.3.250

* Update Vulkan-Headers to 1.3.251
2023-05-29 11:06:53 +02:00
Marijn Suijten 81cf86eb44
[0.37-stable] extensions: Provide new_from_instance() fallback for Instance functions (#754)
extensions: Provide `new_from_instance()` fallback for `Instance` functions

This is a minimal, semver-compatible backport of #734 to the
`0.37-stable` branch, warning Ash users of the problem outlined below
while the issue is properly being solved in the next breaking Ash
release (by separating `Instance` and `Device` functions in the
generator to avert this problem entirely while also always providing
optimal `Device`-specific functions for extension wrappers that are
currently already loading _everything_ via `Instance` to forgo the
problem).

As discovered and detailed in #727 a few extension wrappers were loading
and calling `Instance` functions via `Device` and
`get_device_proc_addr()` which is [defined] to only return non-`NULL`
function pointers for `Device` functions.  Those wrapper functions will
always call into Ash's panicking NULL-stub functions as the desired
`Instance` function could not be loaded.

Deprecate the `new()` functions for extension wrappers that were doing
this, while pointing the reader to `new_from_instance()` and explaining
in the docs what function will always `panic!()` when the struct was
loaded using `new()` instead.

This function always takes a raw `vk::Device` directly to fill `handle`
(rather than `ash::Device` to retrieve `handle()` from), allowing users
to pass `vk::Device::null()` when they do intend to load this extension
wrapper just for calling the `Instance` function.

[defined]: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetDeviceProcAddr.html#_description
2023-05-06 21:07:08 +02:00
Marijn Suijten a2d17fe5ba
extensions/ext: Add VK_EXT_pipeline_properties device extension (#622)
* extensions/ext: Add VK_EXT_pipeline_properties device extension

* Generate traits and impls for all `validstructs` on command parameters
2023-05-06 20:49:51 +02:00
Marijn Suijten 33bc042e9c
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:54:36 +02:00
Vinh Truong 0cd90ef75d
ash/device: Add missing Device::get_device_queue2() wrapper (#736)
ash/device: Add missing Device::get_device_queue2() wrapper
2023-04-08 22:02:34 +02:00
Marijn Suijten b50a253be7
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-08 22:02:30 +02:00
Marijn Suijten 0428540fa3
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-08 22:01:39 +02:00
Marijn Suijten 508fc4ff19
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-08 21:59:55 +02:00
Marijn Suijten 115abf3dde
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 11:13:45 +02:00
Marijn Suijten ca68ebd61b
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 11:12:35 +02:00
Marijn Suijten 21f4f66095
extensions/khr: Add VK_KHR_performance_query (#726) 2023-04-03 10:40:25 +02:00
Marijn Suijten edfd3b9f8f
generator: Keep deprecated MIRROR_CLAMP_TO_EDGE_KHR alias
Somehow this stuck along when we removed all the other deprecated
aliases, because the comment annotation didn't match up with what was
normally used (but we did write a special `#[deprecated = ..]`
annotation based on `"Alias"`).  Now that this all has been normalized
in `vk.xml` behind a standardized `deprecated="reason"` attribute we
have to go out of our way to keep this constant alias alive.
2023-04-02 22:54:19 +02:00
Marijn Suijten e7cfe26dcb
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-04-02 22:54:19 +02:00
Marijn Suijten 5d130cb97d
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-04-02 22:54:18 +02:00
Marijn Suijten 449ef2f204
device: Correct #717 reqirements typo (#718) 2023-04-02 22:54:18 +02:00
lilly lizard 40c7509783
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-04-02 22:54:18 +02:00
Marijn Suijten a6215f7b18
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-04-02 22:54:18 +02:00
Marijn Suijten 8b195a8967
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-04-02 22:54:18 +02:00
Marijn Suijten 6b6f2ee8a8
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-04-02 22:29:27 +02:00
Philippe Renon 56d8507acb
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-04-02 22:29:25 +02:00
HugoPeters1024 aca947df12
examples: Fix error description in texture example (#696)
fix error description in texture example
2023-04-02 22:28:23 +02:00
Marijn Suijten 826bc89775 Release ash 0.37.2 2023-01-11 11:34:14 +01:00
Teodor Tanasoaia 5ffd797a83 extensions/khr/draw_indirect_count: Use the right function pointer for non-indexed draw call (#695) 2023-01-11 11:32:19 +01:00
Marijn Suijten c1d5b5794d
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 20:01:06 +01:00
Marijn Suijten 61d33d50cb
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 19:47:48 +01:00
Marijn Suijten c3212b8c7c
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 19:42:52 +01:00
Marijn Suijten e93dfdaaf5
Release ash 0.37.1 (#632) 2022-11-23 23:23:26 +01:00
Marijn Suijten 4b1c03e4d9 extensions/ext: Add VK_EXT_descriptor_buffer (#679) 2022-11-22 23:40:55 +01:00
Marijn Suijten 1d800d0d60 extensions/ext: Add VK_EXT_extended_dynamic_state3 (#671) 2022-11-22 23:40:55 +01:00
Marijn Suijten d176eef678 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:40:55 +01:00
Marijn Suijten 47ec56c30e 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:40:53 +01:00
Marijn Suijten 047676a443 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 23:39:49 +01:00
Charles Giessen 24000c1249 generator: Update list of vendor names (#676) 2022-11-18 10:21:34 +01:00
Marijn Suijten ca9168bc3a 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-18 10:21:34 +01:00
Marijn Suijten e400f5150c 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-11-18 10:21:34 +01:00
Marijn Suijten 1d14729721 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-16 15:58:41 +02:00
AidoP 23856e9eb8 extensions/ext: Add VK_EXT_acquire_drm_display (#668)
Co-authored-by: Aidan Prangnell <aidop@trifuse.xyz>
2022-10-16 15:58:34 +02:00
Marijn Suijten 812b9bb214 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:02:49 +02:00
BeastLe9enD c2f21d2949 extensions/ext: Add VK_EXT_mesh_shader (#657) 2022-09-26 00:31:52 +02:00
BeastLe9enD 38543a1643 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:09:20 +02:00
Marijn Suijten 359c1c1051
Release ash-window 0.12.0 2022-09-23 19:47:08 +02:00
Marijn Suijten 0a96643e26 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:43:45 +02:00
Marijn Suijten 7933bf5709 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-23 12:41:23 +02:00
David Koloski cc3d65a486 extensions/khr/ray_tracing_pipeline: Set length of capture-replay shader handle buffer after filling (#658) 2022-09-22 10:51:12 +02:00
Marijn Suijten 6a7303271a 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-21 16:10:22 +02:00
Marijn Suijten 21bbc79188 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-21 15:58:21 +02:00
Marijn Suijten 45b2b12bbc 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-09-05 11:33:52 +02:00
Marijn Suijten dc3cb6e8d8 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-09-05 11:33:41 +02:00
Marijn Suijten 29072411a6
Release ash-window 0.11.0 2022-07-29 22:24:47 +02:00
Marijn Suijten 7315d9914e 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:20:17 +02:00
Marijn Suijten 9f18e51ae4 ash-window: Upgrade winit example to 0.26 2022-07-29 22:19:59 +02:00
Marijn Suijten f5e1f93d01 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 17:26:56 +02:00
Marijn Suijten 1ee5a01d4b 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 20:59:34 +02:00
Marijn Suijten 62960ad680 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:28:10 +02:00
Marijn Suijten 0d4f2ba23a extensions/ext: Add VK_EXT_image_compression_control device extension (#621) 2022-07-06 13:24:48 +02:00
Marijn Suijten 89f3271463 extensions/khr: Add VK_KHR_ray_tracing_maintenance1 device extension (#620) 2022-07-06 13:24:47 +02:00
Marijn Suijten 85b2696a1f 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-06 13:24:26 +02:00
Marijn Suijten 9c9552b8a4 extensions/khr: Add VK_KHR_device_group (#631) 2022-07-01 22:23:05 +02:00
Marijn Suijten 3fafe975e0 generator: Fix clippy::is_digit_ascii_radix (#637) 2022-07-01 22:22:54 +02:00
Marijn Suijten 06443f8cf9 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 22:22:38 +02:00
Marijn Suijten 934f167f09 Remove unused version.rs module file from git (#634)
This seems to have been forgotten in #412.
2022-06-05 21:06:24 +02:00
Marijn Suijten b444d414ec Inline trivial Entry wrapper methods and impl functions (#633) 2022-06-05 20:59:41 +02:00
Marijn Suijten 3624b56391 extensions/khr: Add VK_KHR_device_group_creation (#630) 2022-06-05 15:49:48 +02:00
lilly lizard 8fff0584b3 Document crate features in library docs (#627) 2022-06-05 15:49:36 +02:00
Lucas Jenß 9406685ab9 examples: Fix validation errors on macOS and iOS (#623)
* Error: vkCreateDevice: VK_KHR_portability_subset must be enabled [...]
* Error: Attempting to create a VkDevice from a VkPhysicalDevice which is from a portability driver without the VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR bit in the VkInstanceCreateInfo flags being set and the VK_KHR_portability_enumeration extension enabled.
2022-06-05 15:49:21 +02:00
Benjamin Saunders a6336a5b7b Inline builder setters 2022-06-05 12:55:04 +02:00
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 90179c81dc extensions/nv: Add VK_NV_coverage_reduction_mode (#617) 2022-05-11 11:23:17 +02:00
Marijn Suijten 20b7aff6d9 extensions/ext: Add VK_EXT_sample_locations (#616) 2022-05-11 11:23:14 +02:00
i509VCB 22313c2fe6 extensions/ext: Add VK_EXT_image_drm_format_modifier (#603) 2022-04-29 14:13:45 +02:00
Marijn Suijten cc0e70e8e4 generator: Use _ as suffix instead of prefix to mask keywords (#613)
`_` as prefix is intended for unused variables and bindings; it should
be used in suffix position when intending to prevent a clash with a
keyword instead.
2022-04-15 23:38:38 +02:00
Marijn Suijten c62977cf56 ash/entry: Fix trivial_casts lint warning on Android/aarch64 (#612)
On certain platforms including Android and `aarch64` `c_char` is
unsigned, resulting in the same `u8` type as the byte-string here making
the cast redundant.

Just like any other code calling `get_instance_proc_addr`, use
`CStr::from_bytes_with_nul_unchecked` which abstracts away any
pointer-cast.
2022-04-15 23:37:00 +02:00
James Farrell 9d13caad86 Fix instructions for running the examples on a Mac. (#609)
- `$VULKAN_SDK` must now be set, and serves as a base value for the other variables;
- ICD and layers moved from the `etc` to `share` subfolder.
2022-04-08 11:44:38 +02:00
Marijn Suijten 529d20c832 Update Vulkan-Headers to 1.3.211 (#608) 2022-04-08 11:44:10 +02:00
Marijn Suijten c02e558f6a Add changelog entry and bump version-metadata for Vulkan-Headers 1.3.210 2022-04-01 09:53:34 +02:00
Marijn Suijten 2a452909ae Update Vulkan-Headers to 1.3.210 (#605) 2022-04-01 09:52:06 +02:00
Benjamin Saunders 29cf7c2a4c Inline Default impls and trivial instance/device wrapper methods (#606) 2022-04-01 09:51:09 +02:00
105 changed files with 35297 additions and 6116 deletions

View file

@ -8,26 +8,23 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1 - run: cargo check --workspace --all-targets --all-features
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: check
args: --workspace --all-targets --all-features
check_msrv: check_msrv:
name: Check MSRV (1.59.0) name: Check ash MSRV (1.59.0)
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- uses: dtolnay/rust-toolchain@1.59.0 - uses: dtolnay/rust-toolchain@1.59.0
- uses: actions-rs/cargo@v1 - run: cargo check -p ash --all-features
with:
command: check check_ash_window_msrv:
args: --workspace --all-targets --all-features name: Check ash-window MSRV (1.64.0)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: dtolnay/rust-toolchain@1.64.0
- run: cargo check -p ash-window -p examples --all-features
generated: generated:
name: Generated name: Generated
@ -36,23 +33,10 @@ jobs:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
with: with:
submodules: true submodules: true
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Run generator - name: Run generator
uses: actions-rs/cargo@v1 run: cargo run -p generator
with:
command: run
args: -p generator
- name: Format generated results
uses: actions-rs/cargo@v1
with:
command: fmt
args: -p ash
- name: Diff autogen result - name: Diff autogen result
run: git diff --quiet || (echo "::error::Generated files are different, please regenerate with cargo run -p generator!"; git diff; false) run: test -z "$(git status --porcelain)" || (echo "::error::Generated files are different, please regenerate with cargo run -p generator!"; git diff; false)
test: test:
name: Test Suite name: Test Suite
@ -61,82 +45,39 @@ jobs:
- name: Install Vulkan loader - name: Install Vulkan loader
run: sudo apt-get install libvulkan-dev run: sudo apt-get install libvulkan-dev
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Test all targets - name: Test all targets
uses: actions-rs/cargo@v1 run: cargo test --workspace --all-targets
with:
command: test
args: --workspace --all-targets
- name: Test docs - name: Test docs
uses: actions-rs/cargo@v1 run: cargo test --workspace --doc
with:
command: test
args: --workspace --doc
fmt: fmt:
name: Rustfmt name: Rustfmt
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1 - run: cargo fmt --all -- --check
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy: clippy:
name: Clippy name: Clippy
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1 - name: Clippy lint without features
with: # Only test the core ash and ash-window crate, where features reside.
profile: minimal # The examples crate would otherwise enable all default features again,
toolchain: stable # making this test moot.
override: true run: cargo clippy -p ash -p ash-window --no-default-features -- -D warnings
components: clippy - name: Clippy lint with all features
- uses: actions-rs/cargo@v1 run: cargo clippy --workspace --all-targets --all-features -- -D warnings
name: Clippy lint without features - name: Clippy lint with default features
with: run: cargo clippy --workspace --all-targets -- -D warnings
command: clippy
# Only test the core ash and ash-window crate, where features reside.
# The examples crate would otherwise enable all default features again,
# making this test moot.
args: -p ash -p ash-window --no-default-features -- -D warnings
- uses: actions-rs/cargo@v1
name: Clippy lint with all features
with:
command: clippy
args: --workspace --all-targets --all-features -- -D warnings
- uses: actions-rs/cargo@v1
name: Clippy lint with default features
with:
command: clippy
args: --workspace --all-targets -- -D warnings
docs: docs:
name: Build-test docs name: Build-test docs
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1 - name: Document all crates
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
name: Document all crates
env: env:
RUSTDOCFLAGS: -Dwarnings RUSTDOCFLAGS: -Dwarnings
with: run: cargo doc --all --all-features --no-deps --document-private-items
command: doc
args: --all --all-features --no-deps --document-private-items

View file

@ -1,4 +1,5 @@
### Changelog # Changelog
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
@ -6,6 +7,65 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] - ReleaseDate ## [Unreleased] - ReleaseDate
## [0.37.3] - 2023-05-29
### Changed
- `VK_KHR_device_group_creation`: Replaced `device()` with `instance()` (via deprecation) because it is returning `vk::Instance` (#744)
### Added
- Added `VK_EXT_pipeline_properties` device extension (#622)
- Update Vulkan-Headers to 1.3.251 (#697, #723, #741)
- Added `VK_KHR_performance_query` device extension (#726)
- Added `VK_EXT_shader_object` device extension (#732)
- Added missing `Device::get_device_queue2()` wrapper (#736)
- Added with `new_with_instance()` on the following extensions to allow loading the listed `Instance` functions: (#744)
- `VK_KHR_swapchain`: `get_physical_device_present_rectangles()`
- `VK_KHR_device_group`: `get_physical_device_present_rectangles()`
- `VK_EXT_full_screen_exclusive`: `get_physical_device_surface_present_modes2()`
- Exposed `FramebufferCreateInfoBuilder::attachment_count()` builder for `vk::FramebufferCreateFlags::IMAGELESS` (#747)
## [0.37.2] - 2022-01-11
### Added
- Update Vulkan-Headers to 1.3.238 (#688)
### Fixed
- `VK_KHR_draw_indirect_count`: use `cmd_draw_indirect_count_khr` instead of `cmd_draw_indexed_indirect_count_khr` for non-indexed draw call (#695)
## [0.37.1] - 2022-11-23
### Changed
- Inlined builder setters (partial backport from #602)
- Inlined `Default` impls and trivial `Instance`/`Device`/`Entry` wrapper methods (#606, #632)
- Renamed `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 deprecated old ones (#661)
### Added
- Added `VK_EXT_image_drm_format_modifier` device extension (#603)
- Set MSRV (Minimum Supported Rust Version) in `Cargo.toml` for clearer errors (#604)
- Update Vulkan-Headers to 1.3.235 (#605, #608, #619, #655, #667)
- Added `const STRUCTURE_TYPE` to all Vulkan structures for matching with `match_struct!` macro (#614)
- Added `VK_EXT_sample_locations` device extension (#616)
- Added `VK_NV_coverage_reduction_mode` device extension (#617)
- Added `VK_KHR_ray_tracing_maintenance1` device extension (#620)
- Added `VK_EXT_image_compression_control` device extension (#621)
- Added new functions to `VK_KHR_swapchain`, available since Vulkan 1.1 (#629)
- Added `VK_KHR_device_group_creation` instance extension (#630)
- Added `VK_KHR_device_group` device extension (#631)
- Added `VK_EXT_mesh_shader` device extension (#657)
- Added `VK_EXT_acquire_drm_display` instance extension (#668)
- Added `VK_EXT_extended_dynamic_state3` device extension (#671)
- Added `VK_EXT_descriptor_buffer` instance extension (#679)
### Fixed
- `VK_KHR_ray_tracing_pipeline`: Set the buffer length in `get_ray_tracing_capture_replay_shader_group_handles` so it no longer always returns an empty `Vec` (#658)
## [0.37.0] - 2022-03-23 ## [0.37.0] - 2022-03-23
### Changed ### Changed
@ -24,7 +84,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- extensions/khr: Drop `_khr` suffix from `get_memory_fd_properties_khr` in `ExternalMemoryFd` (#580) - `VK_KHR_external_memory_fd`: Drop `_khr` suffix from `get_memory_fd_properties_khr` (#580)
- entry: Allow querying `enumerate_instance_extension_properties()` by layer name (#574) - entry: Allow querying `enumerate_instance_extension_properties()` by layer name (#574)
### Added ### Added
@ -241,20 +301,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix XCB types - Fix XCB types
- Fix OSX build errors of the examples - Fix OSX build errors of the examples
## Before 0.30.0 ## Before 0.30.0
### 0.29.0 ### 0.29.0
- -Breaking-: Removed Display impl for flags. The Debug impl now reports flags by name.
- _Breaking_: Removed Display impl for flags. The Debug impl now reports flags by name.
- Functions now have a doc comment that links to the Vulkan spec - Functions now have a doc comment that links to the Vulkan spec
- Entry has a new method called `try_enumerate_instance_version` which can be used in a 1.0 context. - Entry has a new method called `try_enumerate_instance_version` which can be used in a 1.0 context.
- The generator now uses `BTreeMap` for better diffs. - The generator now uses `BTreeMap` for better diffs.
### 0.28.0 ### 0.28.0
- Switched to a new [changelog](https://keepachangelog.com/en/1.0.0/) format - Switched to a new [changelog](https://keepachangelog.com/en/1.0.0/) format
- Fixed a build issue on ARM. - Fixed a build issue on ARM.
- -Breaking- Arrays are now passed by reference. - _Breaking_: Arrays are now passed by reference.
- Builders are now marked as `#[transparent]`. - Builders are now marked as `#[transparent]`.
- -Breaking- Renamed `.next(..)` to `push_next`. `push_next` is only available on structs that are passed directly. Additionally `push_next` only accepts structs that can be inserted into the pointer chain. Read the readme for more information. - _Breaking_: Renamed `.next(..)` to `push_next`. `push_next` is only available on structs that are passed directly. Additionally `push_next` only accepts structs that can be inserted into the pointer chain. Read the readme for more information.
- New -experimental- extensions. Those do not follow the semver rules and can be removed at any time. - New -experimental- extensions. Those do not follow the semver rules and can be removed at any time.
- Added `AmdGpaInterface` extension. - Added `AmdGpaInterface` extension.
@ -274,6 +336,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Expose function pointers for easier interop with external libraries. - Expose function pointers for easier interop with external libraries.
- Builder now uses bool instead of Bool32. - Builder now uses bool instead of Bool32.
### 0.25.0 ### 0.25.0
- Adds support for Vulkan 1.1 - Adds support for Vulkan 1.1
@ -305,8 +368,8 @@ flags: vk::CommandPoolCreateFlags::RESET_COMMAND_BUFFER_BIT,
- Various bug fixes - Various bug fixes
### 0.18.0 ### 0.18.0
- Fixes arm build => uses libc everywhere. Remove `AlignByteSlice`. - Fixes arm build => uses libc everywhere. Remove `AlignByteSlice`.
### 0.17.0 ### 0.17.0
@ -318,10 +381,12 @@ flags: vk::CommandPoolCreateFlags::RESET_COMMAND_BUFFER_BIT,
- `map_memory` now returns a void ptr - `map_memory` now returns a void ptr
- `ash::util::Align` is a helper struct that - `ash::util::Align` is a helper struct that
can write to aligned memory. can write to aligned memory.
[Unreleased]: https://github.com/MaikKlein/ash/compare/0.37.3...HEAD
[Unreleased]: https://github.com/MaikKlein/ash/compare/0.37.0...HEAD [0.37.3]: https://github.com/MaikKlein/ash/releases/tag/0.37.3
[0.37.2]: https://github.com/MaikKlein/ash/releases/tag/0.37.2
[0.37.1]: https://github.com/MaikKlein/ash/releases/tag/0.37.1
[0.37.0]: https://github.com/MaikKlein/ash/releases/tag/0.37.0 [0.37.0]: https://github.com/MaikKlein/ash/releases/tag/0.37.0
[0.36.0]: https://github.com/MaikKlein/ash/releases/tag/0.36.0 [0.36.0]: https://github.com/MaikKlein/ash/releases/tag/0.36.0
[0.35.2]: https://github.com/MaikKlein/ash/releases/tag/0.35.2 [0.35.2]: https://github.com/MaikKlein/ash/releases/tag/0.35.2

View file

@ -6,8 +6,9 @@ A very lightweight wrapper around Vulkan
[![Documentation](https://docs.rs/ash/badge.svg)](https://docs.rs/ash) [![Documentation](https://docs.rs/ash/badge.svg)](https://docs.rs/ash)
[![Build Status](https://github.com/MaikKlein/ash/workflows/CI/badge.svg)](https://github.com/MaikKlein/ash/actions?workflow=CI) [![Build Status](https://github.com/MaikKlein/ash/workflows/CI/badge.svg)](https://github.com/MaikKlein/ash/actions?workflow=CI)
[![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE-MIT) [![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE-MIT)
[![LICENSE](https://img.shields.io/badge/license-apache-blue.svg)](LICENSE-APACHE) [![LICENSE](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE-APACHE)
[![Join the chat at https://gitter.im/MaikKlein/ash](https://badges.gitter.im/MaikKlein/ash.svg)](https://gitter.im/MaikKlein/ash?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Join the chat at https://gitter.im/MaikKlein/ash](https://badges.gitter.im/MaikKlein/ash.svg)](https://gitter.im/MaikKlein/ash?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![MSRV](https://img.shields.io/badge/rustc-1.60.0+-ab6000.svg)](https://blog.rust-lang.org/2022/04/07/Rust-1.60.0.html)
## Overview ## Overview
- [x] A true Vulkan API without compromises - [x] A true Vulkan API without compromises
@ -18,6 +19,11 @@ A very lightweight wrapper around Vulkan
- [x] Generated from `vk.xml` - [x] Generated from `vk.xml`
- [x] Support for Vulkan `1.1`, `1.2`, `1.3` - [x] Support for Vulkan `1.1`, `1.2`, `1.3`
## ⚠️ Semver compatibility warning
The Vulkan Video bindings are experimental and still seeing breaking changes in their upstream specification, and are only provided by Ash for early adopters. All related functions and types are semver-exempt [^1] (we allow breaking API changes while releasing Ash with non-breaking semver bumps).
[^1]: `generator` complexity makes it so that we cannot easily hide these bindings behind a non-`default` feature flag, and they are widespread across the generated codebase.
## Features ## Features
### Explicit returns with `Result` ### Explicit returns with `Result`
```rust ```rust
@ -231,11 +237,14 @@ Make sure that you have a Vulkan ready driver and install the [LunarG Vulkan SDK
#### Linux #### Linux
Make sure that you have a Vulkan ready driver and install the [LunarG Vulkan SDK](https://lunarg.com/vulkan-sdk/). You also have to add the library and layers to your path. Have a look at my [post](http://askubuntu.com/a/803110/77183) if you are unsure how to do that. Make sure that you have a Vulkan ready driver and install the [LunarG Vulkan SDK](https://lunarg.com/vulkan-sdk/). You also have to add the library and layers to your path. Have a look at my [post](http://askubuntu.com/a/803110/77183) if you are unsure how to do that.
#### macOS #### macOS
Install the [LunarG Vulkan SDK](https://lunarg.com/vulkan-sdk/). This basically entails extracting the downloaded tarball to any location you choose and then setting a few environment variables. Specifically, if `SDK_PATH` is set to the root extracted SDK directory, Install the [LunarG Vulkan SDK](https://lunarg.com/vulkan-sdk/). The installer puts the SDK in `$HOME/VulkanSDK/<version>` by default. You will need to set the following environment variables when running cargo:
```sh
* `DYLD_LIBRARY_PATH = $SDK_PATH/macOS/lib` VULKAN_SDK=$HOME/VulkanSDK/<version>/macOS \
* `VK_ICD_FILENAMES = $SDK_PATH/macOS/etc/vulkan/icd.d/MoltenVK_icd.json` DYLD_FALLBACK_LIBRARY_PATH=$VULKAN_SDK/lib \
* `VK_LAYER_PATH = $SDK_PATH/macOS/etc/vulkan/explicit_layer.d` VK_ICD_FILENAMES=$VULKAN_SDK/share/vulkan/icd.d/MoltenVK_icd.json \
VK_LAYER_PATH=$VULKAN_SDK/share/vulkan/explicit_layer.d \
cargo run ...
```
### [Triangle](https://github.com/MaikKlein/ash/blob/master/examples/src/bin/triangle.rs) ### [Triangle](https://github.com/MaikKlein/ash/blob/master/examples/src/bin/triangle.rs)
Displays a triangle with vertex colors. Displays a triangle with vertex colors.

View file

@ -1,8 +1,7 @@
[package] [package]
name = "ash-window" name = "ash-window"
version = "0.10.0" version = "0.12.0"
authors = ["msiglreith <m.siglreith@gmail.com>"] authors = ["msiglreith <m.siglreith@gmail.com>"]
edition = "2018"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
description = "Interop library between ash and raw-window-handle" description = "Interop library between ash and raw-window-handle"
documentation = "https://docs.rs/ash-window" documentation = "https://docs.rs/ash-window"
@ -12,18 +11,21 @@ keywords = ["window", "ash", "graphics"]
categories = ["game-engines", "graphics"] categories = ["game-engines", "graphics"]
exclude = [".github/*"] exclude = [".github/*"]
workspace = ".." workspace = ".."
rust-version = "1.59.0" edition = "2021"
rust-version = "1.64.0"
[dependencies] [dependencies]
ash = { path = "../ash", version = "0.37", default-features = false } ash = { path = "../ash", version = "0.37", default-features = false }
raw-window-handle = "0.3.4" raw-window-handle = "0.6"
[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies] [target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]
raw-window-metal = "0.1" raw-window-metal = "0.4"
[dev-dependencies] [dev-dependencies]
winit = "0.19.4" winit = "0.27.1"
ash = { path = "../ash", version = "0.37", default-features = false, features = ["linked"] } ash = { path = "../ash", version = "0.37", default-features = false, features = [
"linked",
] }
[[example]] [[example]]
name = "winit" name = "winit"

View file

@ -1,9 +1,26 @@
### Changelog # Changelog
## [Unreleased] - ReleaseDate ## [Unreleased] - ReleaseDate
- Bumped MSRV from 1.59 to 1.64 for `raw-window-handle 0.5.1`. (#709, #716)
## [0.12.0] - 2022-09-23
### Changed
- Bumped `raw-window-handle` to `0.5.0`, now taking `RawDisplayHandle` and `RawWindowHandle` directly
instead of requiring dynamic dispatch through the `HasRaw{Display,Window}Handle` traits (#645)
## [0.11.0] - 2022-07-29
### Changed
- Bumped `raw-window-handle` to `0.4.2` (#505)
## [0.10.0] - 2022-03-23 ## [0.10.0] - 2022-03-23
### Changed
- Bumped `ash` version to [`0.37`](https://github.com/MaikKlein/ash/releases/tag/0.37.0) (#600) - Bumped `ash` version to [`0.37`](https://github.com/MaikKlein/ash/releases/tag/0.37.0) (#600)
- Make `enumerate_required_extensions()` return `&[*const c_char]` instead of `Vec<&CStr>` to match `ash::vk::InstanceCreateInfo` (#590) - Make `enumerate_required_extensions()` return `&[*const c_char]` instead of `Vec<&CStr>` to match `ash::vk::InstanceCreateInfo` (#590)
@ -68,7 +85,9 @@
## Version 0.1.0 ## Version 0.1.0
Initial release for `raw-window-handle = "0.3"` with Windows, Linux, Android, MacOS/iOS support. Initial release for `raw-window-handle = "0.3"` with Windows, Linux, Android, MacOS/iOS support.
[Unreleased]: https://github.com/MaikKlein/ash/compare/ash-window-0.10.0...HEAD [Unreleased]: https://github.com/MaikKlein/ash/compare/ash-window-0.12.0...HEAD
[0.12.0]: https://github.com/MaikKlein/ash/releases/tag/ash-window-0.12.0
[0.11.0]: https://github.com/MaikKlein/ash/releases/tag/ash-window-0.11.0
[0.10.0]: https://github.com/MaikKlein/ash/releases/tag/ash-window-0.10.0 [0.10.0]: https://github.com/MaikKlein/ash/releases/tag/ash-window-0.10.0
[0.9.1]: https://github.com/MaikKlein/ash/releases/tag/ash-window-0.9.1 [0.9.1]: https://github.com/MaikKlein/ash/releases/tag/ash-window-0.9.1
[0.9.0]: https://github.com/MaikKlein/ash/releases/tag/ash-window-0.9.0 [0.9.0]: https://github.com/MaikKlein/ash/releases/tag/ash-window-0.9.0

View file

@ -7,19 +7,20 @@ Interoperability between [`ash`](https://github.com/MaikKlein/ash) and [`raw-win
[![Build Status](https://github.com/MaikKlein/ash/workflows/CI/badge.svg)](https://github.com/MaikKlein/ash/actions?workflow=CI) [![Build Status](https://github.com/MaikKlein/ash/workflows/CI/badge.svg)](https://github.com/MaikKlein/ash/actions?workflow=CI)
[![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE-MIT) [![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE-MIT)
[![LICENSE](https://img.shields.io/badge/license-apache-blue.svg)](LICENSE-APACHE) [![LICENSE](https://img.shields.io/badge/license-apache-blue.svg)](LICENSE-APACHE)
[![Join the chat at https://gitter.im/MaikKlein/ash-window](https://badges.gitter.im/MaikKlein/ash-window.svg)](https://gitter.im/MaikKlein/ash-window?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Join the chat at https://gitter.im/MaikKlein/ash](https://badges.gitter.im/MaikKlein/ash.svg)](https://gitter.im/MaikKlein/ash?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![MSRV](https://img.shields.io/badge/rustc-1.64.0+-ab6000.svg)](https://blog.rust-lang.org/2022/09/22/Rust-1.64.0.html)
## Usage ## Usage
```toml ```toml
ash-window = "0.10.0" ash-window = "0.12.0"
``` ```
The library exposes two functions: The library exposes two functions:
- [`enumerate_required_extensions`] returns the required instance extensions needed for surface creation from a specific window handle. - [`enumerate_required_extensions`] returns the required instance extensions needed for surface creation from a specific display handle.
- [`create_surface`] allows to create a surface from a type implementing [`HasRawWindowHandle`]: - [`create_surface`] allows to create a surface from a type implementing [`RawDisplayHandle`] and [`RawWindowHandle`]:
```rust ```rust
ash_window::create_surface(&entry, &instance, &window, None)?; ash_window::create_surface(&entry, &instance, &window, None)?;
@ -27,7 +28,8 @@ The library exposes two functions:
[`enumerate_required_extensions`]: https://docs.rs/ash-window/latest/ash_window/fn.enumerate_required_extensions.html [`enumerate_required_extensions`]: https://docs.rs/ash-window/latest/ash_window/fn.enumerate_required_extensions.html
[`create_surface`]: https://docs.rs/ash-window/latest/ash_window/fn.create_surface.html [`create_surface`]: https://docs.rs/ash-window/latest/ash_window/fn.create_surface.html
[`HasRawWindowHandle`]: https://docs.rs/raw-window-handle/latest/raw_window_handle/trait.HasRawWindowHandle.html [`RawDisplayHandle`]: https://docs.rs/raw-window-handle/latest/raw_window_handle/enum.RawDisplayHandle.html
[`RawWindowHandle`]: https://docs.rs/raw-window-handle/latest/raw_window_handle/enum.RawWindowHandle.html
## Versions ## Versions
```toml ```toml

View file

@ -6,17 +6,22 @@
//! On instance extensions platform specific extensions need to be enabled. //! On instance extensions platform specific extensions need to be enabled.
use ash::vk; use ash::vk;
use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle};
use std::error::Error; use std::error::Error;
use winit::{
dpi::PhysicalSize,
event::{Event, VirtualKeyCode, WindowEvent},
event_loop::{ControlFlow, EventLoop},
window::WindowBuilder,
};
fn main() -> Result<(), Box<dyn Error>> { fn main() -> Result<(), Box<dyn Error>> {
let mut events_loop = winit::EventsLoop::new(); let event_loop = EventLoop::new();
let window = winit::WindowBuilder::new()
.with_dimensions((800, 600).into())
.build(&events_loop)?;
unsafe { unsafe {
let entry = ash::Entry::linked(); let entry = ash::Entry::linked();
let surface_extensions = ash_window::enumerate_required_extensions(&window)?; let surface_extensions =
ash_window::enumerate_required_extensions(event_loop.raw_display_handle())?;
let app_desc = vk::ApplicationInfo::builder().api_version(vk::make_api_version(0, 1, 0, 0)); let app_desc = vk::ApplicationInfo::builder().api_version(vk::make_api_version(0, 1, 0, 0));
let instance_desc = vk::InstanceCreateInfo::builder() let instance_desc = vk::InstanceCreateInfo::builder()
.application_info(&app_desc) .application_info(&app_desc)
@ -24,26 +29,41 @@ fn main() -> Result<(), Box<dyn Error>> {
let instance = entry.create_instance(&instance_desc, None)?; let instance = entry.create_instance(&instance_desc, None)?;
let window = WindowBuilder::new()
.with_inner_size(PhysicalSize::<u32>::from((800, 600)))
.build(&event_loop)?;
// Create a surface from winit window. // Create a surface from winit window.
let surface = ash_window::create_surface(&entry, &instance, &window, None)?; let surface = ash_window::create_surface(
&entry,
&instance,
window.raw_display_handle(),
window.raw_window_handle(),
None,
)?;
let surface_fn = ash::extensions::khr::Surface::new(&entry, &instance); let surface_fn = ash::extensions::khr::Surface::new(&entry, &instance);
println!("surface: {:?}", surface); println!("surface: {surface:?}");
let mut running = true; event_loop.run(move |event, _, control_flow| match event {
while running { winit::event::Event::WindowEvent {
events_loop.poll_events(|event| { event:
if let winit::Event::WindowEvent { WindowEvent::CloseRequested
event: winit::WindowEvent::CloseRequested, | WindowEvent::KeyboardInput {
.. input:
} = event winit::event::KeyboardInput {
{ virtual_keycode: Some(VirtualKeyCode::Escape),
running = false; ..
} },
}); ..
} },
window_id: _,
surface_fn.destroy_surface(surface, None); } => {
*control_flow = ControlFlow::Exit;
}
Event::LoopDestroyed => {
surface_fn.destroy_surface(surface, None);
}
_ => {}
})
} }
Ok(())
} }

View file

@ -1,97 +1,115 @@
#![warn(trivial_casts, trivial_numeric_casts)] #![warn(trivial_casts, trivial_numeric_casts)]
use std::os::raw::c_char; use std::{ffi::c_void, os::raw::c_char};
use ash::{extensions::khr, prelude::*, vk, Entry, Instance}; use ash::{
use raw_window_handle::{HasRawWindowHandle, RawWindowHandle}; extensions::{ext, khr},
prelude::*,
#[cfg(any(target_os = "macos", target_os = "ios"))] vk, Entry, Instance,
use ash::extensions::ext; // portability extensions };
use raw_window_handle::{RawDisplayHandle, RawWindowHandle};
/// Create a surface from a raw surface handle. /// Create a surface from a raw surface handle.
/// ///
/// `instance` must have created with platform specific surface extensions enabled. /// `instance` must have created with platform specific surface extensions enabled, acquired
/// through [`enumerate_required_extensions()`].
/// ///
/// # Safety /// # Safety
/// ///
/// In order for the created [`vk::SurfaceKHR`] to be valid for the duration of its /// There is a [parent/child relation] between [`Instance`] and [`Entry`], and the resulting
/// usage, the [`Instance`] this was called on must be dropped later than the /// [`vk::SurfaceKHR`]. The application must not [destroy][Instance::destroy_instance()] these
/// resulting [`vk::SurfaceKHR`]. /// parent objects before first [destroying][khr::Surface::destroy_surface()] the returned
/// [`vk::SurfaceKHR`] child object. [`vk::SurfaceKHR`] does _not_ implement [drop][drop()]
/// semantics and can only be destroyed via [`destroy_surface()`][khr::Surface::destroy_surface()].
///
/// See the [`Entry::create_instance()`] documentation for more destruction ordering rules on
/// [`Instance`].
///
/// The window represented by `window_handle` must be associated with the display connection
/// in `display_handle`.
///
/// `window_handle` and `display_handle` must be associated with a valid window and display
/// connection, which must not be destroyed for the lifetime of the returned [`vk::SurfaceKHR`].
///
/// [parent/child relation]: https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#fundamentals-objectmodel-lifetime
pub unsafe fn create_surface( pub unsafe fn create_surface(
entry: &Entry, entry: &Entry,
instance: &Instance, instance: &Instance,
window_handle: &dyn HasRawWindowHandle, display_handle: RawDisplayHandle,
window_handle: RawWindowHandle,
allocation_callbacks: Option<&vk::AllocationCallbacks>, allocation_callbacks: Option<&vk::AllocationCallbacks>,
) -> VkResult<vk::SurfaceKHR> { ) -> VkResult<vk::SurfaceKHR> {
match window_handle.raw_window_handle() { match (display_handle, window_handle) {
#[cfg(target_os = "windows")] (RawDisplayHandle::Windows(_), RawWindowHandle::Win32(window)) => {
RawWindowHandle::Windows(handle) => {
let surface_desc = vk::Win32SurfaceCreateInfoKHR::builder() let surface_desc = vk::Win32SurfaceCreateInfoKHR::builder()
.hinstance(handle.hinstance) .hinstance(window.hinstance.ok_or(vk::Result::ERROR_UNKNOWN)?.get() as *mut c_void)
.hwnd(handle.hwnd); .hwnd(window.hwnd.get() as *mut c_void);
let surface_fn = khr::Win32Surface::new(entry, instance); let surface_fn = khr::Win32Surface::new(entry, instance);
surface_fn.create_win32_surface(&surface_desc, allocation_callbacks) surface_fn.create_win32_surface(&surface_desc, allocation_callbacks)
} }
#[cfg(any( (RawDisplayHandle::Wayland(display), RawWindowHandle::Wayland(window)) => {
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
))]
RawWindowHandle::Wayland(handle) => {
let surface_desc = vk::WaylandSurfaceCreateInfoKHR::builder() let surface_desc = vk::WaylandSurfaceCreateInfoKHR::builder()
.display(handle.display) .display(display.display.as_ptr())
.surface(handle.surface); .surface(window.surface.as_ptr());
let surface_fn = khr::WaylandSurface::new(entry, instance); let surface_fn = khr::WaylandSurface::new(entry, instance);
surface_fn.create_wayland_surface(&surface_desc, allocation_callbacks) surface_fn.create_wayland_surface(&surface_desc, allocation_callbacks)
} }
#[cfg(any( (RawDisplayHandle::Xlib(display), RawWindowHandle::Xlib(window)) => {
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
))]
RawWindowHandle::Xlib(handle) => {
let surface_desc = vk::XlibSurfaceCreateInfoKHR::builder() let surface_desc = vk::XlibSurfaceCreateInfoKHR::builder()
.dpy(handle.display as *mut _) .dpy(
.window(handle.window); display
.display
.ok_or(vk::Result::ERROR_UNKNOWN)?
.as_ptr()
.cast(),
)
.window(window.window);
let surface_fn = khr::XlibSurface::new(entry, instance); let surface_fn = khr::XlibSurface::new(entry, instance);
surface_fn.create_xlib_surface(&surface_desc, allocation_callbacks) surface_fn.create_xlib_surface(&surface_desc, allocation_callbacks)
} }
#[cfg(any( (RawDisplayHandle::Xcb(display), RawWindowHandle::Xcb(window)) => {
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
))]
RawWindowHandle::Xcb(handle) => {
let surface_desc = vk::XcbSurfaceCreateInfoKHR::builder() let surface_desc = vk::XcbSurfaceCreateInfoKHR::builder()
.connection(handle.connection) .connection(
.window(handle.window); display
.connection
.ok_or(vk::Result::ERROR_UNKNOWN)?
.as_ptr(),
)
.window(window.window.get());
let surface_fn = khr::XcbSurface::new(entry, instance); let surface_fn = khr::XcbSurface::new(entry, instance);
surface_fn.create_xcb_surface(&surface_desc, allocation_callbacks) surface_fn.create_xcb_surface(&surface_desc, allocation_callbacks)
} }
#[cfg(any(target_os = "android"))] (RawDisplayHandle::Android(_), RawWindowHandle::AndroidNdk(window)) => {
RawWindowHandle::Android(handle) => {
let surface_desc = let surface_desc =
vk::AndroidSurfaceCreateInfoKHR::builder().window(handle.a_native_window); vk::AndroidSurfaceCreateInfoKHR::builder().window(window.a_native_window.as_ptr());
let surface_fn = khr::AndroidSurface::new(entry, instance); let surface_fn = khr::AndroidSurface::new(entry, instance);
surface_fn.create_android_surface(&surface_desc, allocation_callbacks) surface_fn.create_android_surface(&surface_desc, allocation_callbacks)
} }
#[cfg(any(target_os = "macos"))] #[cfg(target_os = "macos")]
RawWindowHandle::MacOS(handle) => { (RawDisplayHandle::AppKit(_), RawWindowHandle::AppKit(window)) => {
use raw_window_metal::{macos, Layer}; use raw_window_metal::{appkit, Layer};
let layer = match macos::metal_layer_from_handle(handle) { let layer = match appkit::metal_layer_from_handle(window) {
Layer::Existing(layer) | Layer::Allocated(layer) => layer as *mut _, Layer::Existing(layer) | Layer::Allocated(layer) => layer.cast(),
// Layer::None => return Err(vk::Result::ERROR_INITIALIZATION_FAILED),
};
let surface_desc = vk::MetalSurfaceCreateInfoEXT::builder().layer(&*layer);
let surface_fn = ext::MetalSurface::new(entry, instance);
surface_fn.create_metal_surface(&surface_desc, allocation_callbacks)
}
#[cfg(target_os = "ios")]
(RawDisplayHandle::UiKit(_), RawWindowHandle::UiKit(window)) => {
use raw_window_metal::{uikit, Layer};
let layer = match uikit::metal_layer_from_handle(window) {
Layer::Existing(layer) | Layer::Allocated(layer) => layer.cast(),
Layer::None => return Err(vk::Result::ERROR_INITIALIZATION_FAILED), Layer::None => return Err(vk::Result::ERROR_INITIALIZATION_FAILED),
}; };
@ -100,33 +118,22 @@ pub unsafe fn create_surface(
surface_fn.create_metal_surface(&surface_desc, allocation_callbacks) surface_fn.create_metal_surface(&surface_desc, allocation_callbacks)
} }
#[cfg(any(target_os = "ios"))] _ => Err(vk::Result::ERROR_EXTENSION_NOT_PRESENT),
RawWindowHandle::IOS(handle) => {
use raw_window_metal::{ios, Layer};
let layer = match ios::metal_layer_from_handle(handle) {
Layer::Existing(layer) | Layer::Allocated(layer) => layer as *mut _,
Layer::None => return Err(vk::Result::ERROR_INITIALIZATION_FAILED),
};
let surface_desc = vk::MetalSurfaceCreateInfoEXT::builder().layer(&*layer);
let surface_fn = ext::MetalSurface::new(entry, instance);
surface_fn.create_metal_surface(&surface_desc, allocation_callbacks)
}
_ => Err(vk::Result::ERROR_EXTENSION_NOT_PRESENT), // not supported
} }
} }
/// Query the required instance extensions for creating a surface from a window handle. /// Query the required instance extensions for creating a surface from a display handle.
///
/// This [`RawDisplayHandle`] can typically be acquired from a window, but is usually also
/// accessible earlier through an "event loop" concept to allow querying required instance
/// extensions and creation of a compatible Vulkan instance prior to creating a window.
/// ///
/// The returned extensions will include all extension dependencies. /// The returned extensions will include all extension dependencies.
pub fn enumerate_required_extensions( pub fn enumerate_required_extensions(
window_handle: &dyn HasRawWindowHandle, display_handle: RawDisplayHandle,
) -> VkResult<&'static [*const c_char]> { ) -> VkResult<&'static [*const c_char]> {
let extensions = match window_handle.raw_window_handle() { let extensions = match display_handle {
#[cfg(target_os = "windows")] RawDisplayHandle::Windows(_) => {
RawWindowHandle::Windows(_) => {
const WINDOWS_EXTS: [*const c_char; 2] = [ const WINDOWS_EXTS: [*const c_char; 2] = [
khr::Surface::name().as_ptr(), khr::Surface::name().as_ptr(),
khr::Win32Surface::name().as_ptr(), khr::Win32Surface::name().as_ptr(),
@ -134,14 +141,7 @@ pub fn enumerate_required_extensions(
&WINDOWS_EXTS &WINDOWS_EXTS
} }
#[cfg(any( RawDisplayHandle::Wayland(_) => {
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
))]
RawWindowHandle::Wayland(_) => {
const WAYLAND_EXTS: [*const c_char; 2] = [ const WAYLAND_EXTS: [*const c_char; 2] = [
khr::Surface::name().as_ptr(), khr::Surface::name().as_ptr(),
khr::WaylandSurface::name().as_ptr(), khr::WaylandSurface::name().as_ptr(),
@ -149,14 +149,7 @@ pub fn enumerate_required_extensions(
&WAYLAND_EXTS &WAYLAND_EXTS
} }
#[cfg(any( RawDisplayHandle::Xlib(_) => {
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
))]
RawWindowHandle::Xlib(_) => {
const XLIB_EXTS: [*const c_char; 2] = [ const XLIB_EXTS: [*const c_char; 2] = [
khr::Surface::name().as_ptr(), khr::Surface::name().as_ptr(),
khr::XlibSurface::name().as_ptr(), khr::XlibSurface::name().as_ptr(),
@ -164,14 +157,7 @@ pub fn enumerate_required_extensions(
&XLIB_EXTS &XLIB_EXTS
} }
#[cfg(any( RawDisplayHandle::Xcb(_) => {
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
))]
RawWindowHandle::Xcb(_) => {
const XCB_EXTS: [*const c_char; 2] = [ const XCB_EXTS: [*const c_char; 2] = [
khr::Surface::name().as_ptr(), khr::Surface::name().as_ptr(),
khr::XcbSurface::name().as_ptr(), khr::XcbSurface::name().as_ptr(),
@ -179,8 +165,7 @@ pub fn enumerate_required_extensions(
&XCB_EXTS &XCB_EXTS
} }
#[cfg(any(target_os = "android"))] RawDisplayHandle::Android(_) => {
RawWindowHandle::Android(_) => {
const ANDROID_EXTS: [*const c_char; 2] = [ const ANDROID_EXTS: [*const c_char; 2] = [
khr::Surface::name().as_ptr(), khr::Surface::name().as_ptr(),
khr::AndroidSurface::name().as_ptr(), khr::AndroidSurface::name().as_ptr(),
@ -188,22 +173,12 @@ pub fn enumerate_required_extensions(
&ANDROID_EXTS &ANDROID_EXTS
} }
#[cfg(any(target_os = "macos"))] RawDisplayHandle::AppKit(_) | RawDisplayHandle::UiKit(_) => {
RawWindowHandle::MacOS(_) => { const METAL_EXTS: [*const c_char; 2] = [
const MACOS_EXTS: [*const c_char; 2] = [
khr::Surface::name().as_ptr(), khr::Surface::name().as_ptr(),
ext::MetalSurface::name().as_ptr(), ext::MetalSurface::name().as_ptr(),
]; ];
&MACOS_EXTS &METAL_EXTS
}
#[cfg(any(target_os = "ios"))]
RawWindowHandle::IOS(_) => {
const IOS_EXTS: [*const c_char; 2] = [
khr::Surface::name().as_ptr(),
ext::MetalSurface::name().as_ptr(),
];
&IOS_EXTS
} }
_ => return Err(vk::Result::ERROR_EXTENSION_NOT_PRESENT), _ => return Err(vk::Result::ERROR_EXTENSION_NOT_PRESENT),

View file

@ -1,14 +1,18 @@
[package] [package]
name = "ash" name = "ash"
version = "0.37.0+1.3.209" version = "0.37.3+1.3.251"
authors = ["maik klein <maikklein@googlemail.com>"] authors = [
"Maik Klein <maikklein@googlemail.com>",
"Benjamin Saunders <ben.e.saunders@gmail.com>",
"Marijn Suijten <marijn@traverseresearch.nl>",
]
description = "Vulkan bindings for Rust" description = "Vulkan bindings for Rust"
license = "MIT" license = "MIT OR Apache-2.0"
repository = "https://github.com/MaikKlein/ash" repository = "https://github.com/MaikKlein/ash"
readme = "../README.md" readme = "../README.md"
keywords = ["vulkan", "graphic"] keywords = ["vulkan", "graphic"]
documentation = "https://docs.rs/ash" documentation = "https://docs.rs/ash"
edition = "2018" edition = "2021"
rust-version = "1.59.0" rust-version = "1.59.0"
[dependencies] [dependencies]
@ -20,7 +24,7 @@ default = ["loaded", "debug"]
linked = [] linked = []
# Support searching for the Vulkan loader manually at runtime. # Support searching for the Vulkan loader manually at runtime.
loaded = ["libloading"] loaded = ["libloading"]
# Whether Vulkan structs should implement Debug # Whether Vulkan structs should implement Debug.
debug = [] debug = []
[package.metadata.release] [package.metadata.release]

View file

@ -13,12 +13,12 @@ fn main() {
("windows", "64") => "Lib", ("windows", "64") => "Lib",
_ => "lib", _ => "lib",
}; };
println!("cargo:rustc-link-search={}/{}", var, suffix); println!("cargo:rustc-link-search={var}/{suffix}");
} }
let lib = match &*target_family { let lib = match &*target_family {
"windows" => "vulkan-1", "windows" => "vulkan-1",
_ => "vulkan", _ => "vulkan",
}; };
println!("cargo:rustc-link-lib={}", lib); println!("cargo:rustc-link-lib={lib}");
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -37,9 +37,15 @@ impl Entry {
/// development packages installed (e.g. the Vulkan SDK, or Ubuntu's `libvulkan-dev`). /// development packages installed (e.g. the Vulkan SDK, or Ubuntu's `libvulkan-dev`).
/// ///
/// # Safety /// # Safety
///
/// `dlopen`ing native libraries is inherently unsafe. The safety guidelines /// `dlopen`ing native libraries is inherently unsafe. The safety guidelines
/// for [`Library::new()`] and [`Library::get()`] apply here. /// for [`Library::new()`] and [`Library::get()`] apply here.
/// ///
/// No Vulkan functions loaded directly or indirectly from this [`Entry`]
/// may be called after it is [dropped][drop()].
///
/// # Example
///
/// ```no_run /// ```no_run
/// use ash::{vk, Entry}; /// use ash::{vk, Entry};
/// # fn main() -> Result<(), Box<dyn std::error::Error>> { /// # fn main() -> Result<(), Box<dyn std::error::Error>> {
@ -86,6 +92,11 @@ impl Entry {
/// Note that instance/device functions are still fetched via `vkGetInstanceProcAddr` and /// Note that instance/device functions are still fetched via `vkGetInstanceProcAddr` and
/// `vkGetDeviceProcAddr` for maximum performance. /// `vkGetDeviceProcAddr` for maximum performance.
/// ///
/// Any Vulkan function acquired directly or indirectly from this [`Entry`] may be called after it
/// is [dropped][drop()].
///
/// # Example
///
/// ```no_run /// ```no_run
/// use ash::{vk, Entry}; /// use ash::{vk, Entry};
/// # fn main() -> Result<(), Box<dyn std::error::Error>> { /// # fn main() -> Result<(), Box<dyn std::error::Error>> {
@ -116,8 +127,12 @@ impl Entry {
/// Load Vulkan library at `path` /// Load Vulkan library at `path`
/// ///
/// # Safety /// # Safety
///
/// `dlopen`ing native libraries is inherently unsafe. The safety guidelines /// `dlopen`ing native libraries is inherently unsafe. The safety guidelines
/// for [`Library::new()`] and [`Library::get()`] apply here. /// for [`Library::new()`] and [`Library::get()`] apply here.
///
/// No Vulkan functions loaded directly or indirectly from this [`Entry`]
/// may be called after it is [dropped][drop()].
#[cfg(feature = "loaded")] #[cfg(feature = "loaded")]
#[cfg_attr(docsrs, doc(cfg(feature = "loaded")))] #[cfg_attr(docsrs, doc(cfg(feature = "loaded")))]
pub unsafe fn load_from(path: impl AsRef<OsStr>) -> Result<Self, LoadingError> { pub unsafe fn load_from(path: impl AsRef<OsStr>) -> Result<Self, LoadingError> {
@ -140,8 +155,9 @@ impl Entry {
/// Load entry points based on an already-loaded [`vk::StaticFn`] /// Load entry points based on an already-loaded [`vk::StaticFn`]
/// ///
/// # Safety /// # Safety
/// `static_fn` must contain valid function pointers that comply with the semantics specified by ///
/// Vulkan 1.0, which must remain valid for at least the lifetime of the returned [`Entry`]. /// `static_fn` must contain valid function pointers that comply with the semantics specified
/// by Vulkan 1.0, which must remain valid for at least the lifetime of the returned [`Entry`].
pub unsafe fn from_static_fn(static_fn: vk::StaticFn) -> Self { pub unsafe fn from_static_fn(static_fn: vk::StaticFn) -> Self {
let load_fn = |name: &std::ffi::CStr| { let load_fn = |name: &std::ffi::CStr| {
mem::transmute((static_fn.get_instance_proc_addr)( mem::transmute((static_fn.get_instance_proc_addr)(
@ -165,15 +181,20 @@ impl Entry {
} }
} }
#[inline]
pub fn fp_v1_0(&self) -> &vk::EntryFnV1_0 { pub fn fp_v1_0(&self) -> &vk::EntryFnV1_0 {
&self.entry_fn_1_0 &self.entry_fn_1_0
} }
#[inline]
pub fn static_fn(&self) -> &vk::StaticFn { pub fn static_fn(&self) -> &vk::StaticFn {
&self.static_fn &self.static_fn
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumerateInstanceVersion.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumerateInstanceVersion.html>
///
/// # Example
///
/// ```no_run /// ```no_run
/// # use ash::{Entry, vk}; /// # use ash::{Entry, vk};
/// # fn main() -> Result<(), Box<dyn std::error::Error>> { /// # fn main() -> Result<(), Box<dyn std::error::Error>> {
@ -190,14 +211,17 @@ impl Entry {
/// } /// }
/// # Ok(()) } /// # Ok(()) }
/// ``` /// ```
#[inline]
pub fn try_enumerate_instance_version(&self) -> VkResult<Option<u32>> { pub fn try_enumerate_instance_version(&self) -> VkResult<Option<u32>> {
unsafe { unsafe {
let mut api_version = 0; let mut api_version = 0;
let enumerate_instance_version: Option<vk::PFN_vkEnumerateInstanceVersion> = { let enumerate_instance_version: Option<vk::PFN_vkEnumerateInstanceVersion> = {
let name = b"vkEnumerateInstanceVersion\0".as_ptr() as *const _; let name = ::std::ffi::CStr::from_bytes_with_nul_unchecked(
b"vkEnumerateInstanceVersion\0",
);
mem::transmute((self.static_fn.get_instance_proc_addr)( mem::transmute((self.static_fn.get_instance_proc_addr)(
vk::Instance::null(), vk::Instance::null(),
name, name.as_ptr(),
)) ))
}; };
if let Some(enumerate_instance_version) = enumerate_instance_version { if let Some(enumerate_instance_version) = enumerate_instance_version {
@ -212,9 +236,14 @@ impl Entry {
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateInstance.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateInstance.html>
/// ///
/// # Safety /// # Safety
/// In order for the created [`Instance`] to be valid for the duration of its ///
/// usage, the [`Entry`](Self) this was called on must be dropped later than the /// The resulting [`Instance`] and any function-pointer objects (e.g. [`Device`][crate::Device]
/// resulting [`Instance`]. /// and [extensions][crate::extensions]) loaded from it may not be used after this [`Entry`]
/// object is dropped, unless it was crated using [`Entry::linked()`].
///
/// [`Instance`] does _not_ implement [drop][drop()] semantics and can only be destroyed via
/// [`destroy_instance()`][Instance::destroy_instance()].
#[inline]
pub unsafe fn create_instance( pub unsafe fn create_instance(
&self, &self,
create_info: &vk::InstanceCreateInfo, create_info: &vk::InstanceCreateInfo,
@ -231,6 +260,7 @@ impl Entry {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumerateInstanceLayerProperties.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumerateInstanceLayerProperties.html>
#[inline]
pub fn enumerate_instance_layer_properties(&self) -> VkResult<Vec<vk::LayerProperties>> { pub fn enumerate_instance_layer_properties(&self) -> VkResult<Vec<vk::LayerProperties>> {
unsafe { unsafe {
read_into_uninitialized_vector(|count, data| { read_into_uninitialized_vector(|count, data| {
@ -240,6 +270,7 @@ impl Entry {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumerateInstanceExtensionProperties.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumerateInstanceExtensionProperties.html>
#[inline]
pub fn enumerate_instance_extension_properties( pub fn enumerate_instance_extension_properties(
&self, &self,
layer_name: Option<&CStr>, layer_name: Option<&CStr>,
@ -256,6 +287,7 @@ impl Entry {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetInstanceProcAddr.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetInstanceProcAddr.html>
#[inline]
pub unsafe fn get_instance_proc_addr( pub unsafe fn get_instance_proc_addr(
&self, &self,
instance: vk::Instance, instance: vk::Instance,
@ -268,6 +300,7 @@ impl Entry {
/// Vulkan core 1.1 /// Vulkan core 1.1
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
impl Entry { impl Entry {
#[inline]
pub fn fp_v1_1(&self) -> &vk::EntryFnV1_1 { pub fn fp_v1_1(&self) -> &vk::EntryFnV1_1 {
&self.entry_fn_1_1 &self.entry_fn_1_1
} }
@ -276,6 +309,7 @@ impl Entry {
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumerateInstanceVersion.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumerateInstanceVersion.html>
/// ///
/// Please use [`try_enumerate_instance_version()`][Self::try_enumerate_instance_version()] instead. /// Please use [`try_enumerate_instance_version()`][Self::try_enumerate_instance_version()] instead.
#[inline]
pub fn enumerate_instance_version(&self) -> VkResult<u32> { pub fn enumerate_instance_version(&self) -> VkResult<u32> {
unsafe { unsafe {
let mut api_version = 0; let mut api_version = 0;
@ -288,6 +322,7 @@ impl Entry {
/// Vulkan core 1.2 /// Vulkan core 1.2
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
impl Entry { impl Entry {
#[inline]
pub fn fp_v1_2(&self) -> &vk::EntryFnV1_2 { pub fn fp_v1_2(&self) -> &vk::EntryFnV1_2 {
&self.entry_fn_1_2 &self.entry_fn_1_2
} }
@ -296,6 +331,7 @@ impl Entry {
/// Vulkan core 1.3 /// Vulkan core 1.3
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
impl Entry { impl Entry {
#[inline]
pub fn fp_v1_3(&self) -> &vk::EntryFnV1_3 { pub fn fp_v1_3(&self) -> &vk::EntryFnV1_3 {
&self.entry_fn_1_3 &self.entry_fn_1_3
} }
@ -304,6 +340,7 @@ impl Entry {
#[cfg(feature = "linked")] #[cfg(feature = "linked")]
#[cfg_attr(docsrs, doc(cfg(feature = "linked")))] #[cfg_attr(docsrs, doc(cfg(feature = "linked")))]
impl Default for Entry { impl Default for Entry {
#[inline]
fn default() -> Self { fn default() -> Self {
Self::linked() Self::linked()
} }
@ -363,8 +400,8 @@ mod loaded {
impl fmt::Display for LoadingError { impl fmt::Display for LoadingError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self { match self {
LoadingError::LibraryLoadFailure(err) => fmt::Display::fmt(err, f), Self::LibraryLoadFailure(err) => fmt::Display::fmt(err, f),
LoadingError::MissingEntryPoint(err) => fmt::Display::fmt(err, f), Self::MissingEntryPoint(err) => fmt::Display::fmt(err, f),
} }
} }
} }
@ -372,8 +409,8 @@ mod loaded {
impl Error for LoadingError { impl Error for LoadingError {
fn source(&self) -> Option<&(dyn Error + 'static)> { fn source(&self) -> Option<&(dyn Error + 'static)> {
Some(match self { Some(match self {
LoadingError::LibraryLoadFailure(err) => err, Self::LibraryLoadFailure(err) => err,
LoadingError::MissingEntryPoint(err) => err, Self::MissingEntryPoint(err) => err,
}) })
} }
} }

View file

@ -0,0 +1,55 @@
use crate::prelude::*;
use crate::vk;
use crate::{Entry, Instance};
use std::ffi::CStr;
use std::mem;
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_EXT_acquire_drm_display.html>
#[derive(Clone)]
pub struct AcquireDrmDisplay {
fp: vk::ExtAcquireDrmDisplayFn,
}
impl AcquireDrmDisplay {
pub fn new(entry: &Entry, instance: &Instance) -> Self {
let handle = instance.handle();
let fp = vk::ExtAcquireDrmDisplayFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(handle, name.as_ptr()))
});
Self { fp }
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkAcquireDrmDisplayEXT.html>
#[inline]
pub unsafe fn acquire_drm_display(
&self,
physical_device: vk::PhysicalDevice,
drm_fd: i32,
display: vk::DisplayKHR,
) -> VkResult<()> {
(self.fp.acquire_drm_display_ext)(physical_device, drm_fd, display).result()
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDrmDisplayEXT.html>
#[inline]
pub unsafe fn get_drm_display(
&self,
physical_device: vk::PhysicalDevice,
drm_fd: i32,
connector_id: u32,
) -> VkResult<vk::DisplayKHR> {
let mut display = mem::MaybeUninit::uninit();
(self.fp.get_drm_display_ext)(physical_device, drm_fd, connector_id, display.as_mut_ptr())
.assume_init_on_success(display)
}
#[inline]
pub const fn name() -> &'static CStr {
vk::ExtAcquireDrmDisplayFn::name()
}
#[inline]
pub fn fp(&self) -> &vk::ExtAcquireDrmDisplayFn {
&self.fp
}
}

View file

@ -19,6 +19,7 @@ impl BufferDeviceAddress {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetBufferDeviceAddressEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetBufferDeviceAddressEXT.html>
#[inline]
pub unsafe fn get_buffer_device_address( pub unsafe fn get_buffer_device_address(
&self, &self,
info: &vk::BufferDeviceAddressInfoEXT, info: &vk::BufferDeviceAddressInfoEXT,
@ -26,14 +27,17 @@ impl BufferDeviceAddress {
(self.fp.get_buffer_device_address_ext)(self.handle, info) (self.fp.get_buffer_device_address_ext)(self.handle, info)
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::ExtBufferDeviceAddressFn::name() vk::ExtBufferDeviceAddressFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::ExtBufferDeviceAddressFn { pub fn fp(&self) -> &vk::ExtBufferDeviceAddressFn {
&self.fp &self.fp
} }
#[inline]
pub fn device(&self) -> vk::Device { pub fn device(&self) -> vk::Device {
self.handle self.handle
} }

View file

@ -1,4 +1,4 @@
use crate::prelude::{read_into_uninitialized_vector, VkResult}; use crate::prelude::*;
use crate::vk; use crate::vk;
use crate::{Entry, Instance}; use crate::{Entry, Instance};
use std::ffi::CStr; use std::ffi::CStr;
@ -20,6 +20,7 @@ impl CalibratedTimestamps {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceCalibrateableTimeDomainsEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceCalibrateableTimeDomainsEXT.html>
#[inline]
pub unsafe fn get_physical_device_calibrateable_time_domains( pub unsafe fn get_physical_device_calibrateable_time_domains(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -36,6 +37,7 @@ impl CalibratedTimestamps {
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetCalibratedTimestampsEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetCalibratedTimestampsEXT.html>
/// ///
/// Returns a tuple containing `(timestamps, max_deviation)` /// Returns a tuple containing `(timestamps, max_deviation)`
#[inline]
pub unsafe fn get_calibrated_timestamps( pub unsafe fn get_calibrated_timestamps(
&self, &self,
device: vk::Device, device: vk::Device,
@ -53,14 +55,17 @@ impl CalibratedTimestamps {
.result_with_success((timestamps, max_deviation)) .result_with_success((timestamps, max_deviation))
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::ExtCalibratedTimestampsFn::name() vk::ExtCalibratedTimestampsFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::ExtCalibratedTimestampsFn { pub fn fp(&self) -> &vk::ExtCalibratedTimestampsFn {
&self.fp &self.fp
} }
#[inline]
pub fn instance(&self) -> vk::Instance { pub fn instance(&self) -> vk::Instance {
self.handle self.handle
} }

View file

@ -20,6 +20,7 @@ impl DebugMarker {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDebugMarkerSetObjectNameEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDebugMarkerSetObjectNameEXT.html>
#[inline]
pub unsafe fn debug_marker_set_object_name( pub unsafe fn debug_marker_set_object_name(
&self, &self,
name_info: &vk::DebugMarkerObjectNameInfoEXT, name_info: &vk::DebugMarkerObjectNameInfoEXT,
@ -28,6 +29,7 @@ impl DebugMarker {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdDebugMarkerBeginEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdDebugMarkerBeginEXT.html>
#[inline]
pub unsafe fn cmd_debug_marker_begin( pub unsafe fn cmd_debug_marker_begin(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -37,11 +39,13 @@ impl DebugMarker {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdDebugMarkerEndEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdDebugMarkerEndEXT.html>
#[inline]
pub unsafe fn cmd_debug_marker_end(&self, command_buffer: vk::CommandBuffer) { pub unsafe fn cmd_debug_marker_end(&self, command_buffer: vk::CommandBuffer) {
(self.fp.cmd_debug_marker_end_ext)(command_buffer); (self.fp.cmd_debug_marker_end_ext)(command_buffer);
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdDebugMarkerInsertEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdDebugMarkerInsertEXT.html>
#[inline]
pub unsafe fn cmd_debug_marker_insert( pub unsafe fn cmd_debug_marker_insert(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -50,14 +54,17 @@ impl DebugMarker {
(self.fp.cmd_debug_marker_insert_ext)(command_buffer, marker_info); (self.fp.cmd_debug_marker_insert_ext)(command_buffer, marker_info);
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::ExtDebugMarkerFn::name() vk::ExtDebugMarkerFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::ExtDebugMarkerFn { pub fn fp(&self) -> &vk::ExtDebugMarkerFn {
&self.fp &self.fp
} }
#[inline]
pub fn device(&self) -> vk::Device { pub fn device(&self) -> vk::Device {
self.handle self.handle
} }

View file

@ -21,6 +21,7 @@ impl DebugReport {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyDebugReportCallbackEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyDebugReportCallbackEXT.html>
#[inline]
pub unsafe fn destroy_debug_report_callback( pub unsafe fn destroy_debug_report_callback(
&self, &self,
debug: vk::DebugReportCallbackEXT, debug: vk::DebugReportCallbackEXT,
@ -34,6 +35,7 @@ impl DebugReport {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateDebugReportCallbackEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateDebugReportCallbackEXT.html>
#[inline]
pub unsafe fn create_debug_report_callback( pub unsafe fn create_debug_report_callback(
&self, &self,
create_info: &vk::DebugReportCallbackCreateInfoEXT, create_info: &vk::DebugReportCallbackCreateInfoEXT,
@ -49,14 +51,17 @@ impl DebugReport {
.result_with_success(debug_cb) .result_with_success(debug_cb)
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::ExtDebugReportFn::name() vk::ExtDebugReportFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::ExtDebugReportFn { pub fn fp(&self) -> &vk::ExtDebugReportFn {
&self.fp &self.fp
} }
#[inline]
pub fn instance(&self) -> vk::Instance { pub fn instance(&self) -> vk::Instance {
self.handle self.handle
} }

View file

@ -20,24 +20,49 @@ impl DebugUtils {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkSetDebugUtilsObjectNameEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkSetDebugUtilsObjectNameEXT.html>
#[deprecated = "Backwards-compatible alias containing a typo, use `set_debug_utils_object_name()` instead"]
#[inline]
pub unsafe fn debug_utils_set_object_name( pub unsafe fn debug_utils_set_object_name(
&self, &self,
device: vk::Device, device: vk::Device,
name_info: &vk::DebugUtilsObjectNameInfoEXT, name_info: &vk::DebugUtilsObjectNameInfoEXT,
) -> VkResult<()> {
self.set_debug_utils_object_name(device, name_info)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkSetDebugUtilsObjectNameEXT.html>
#[inline]
pub unsafe fn set_debug_utils_object_name(
&self,
device: vk::Device,
name_info: &vk::DebugUtilsObjectNameInfoEXT,
) -> VkResult<()> { ) -> VkResult<()> {
(self.fp.set_debug_utils_object_name_ext)(device, name_info).result() (self.fp.set_debug_utils_object_name_ext)(device, name_info).result()
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkSetDebugUtilsObjectTagEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkSetDebugUtilsObjectTagEXT.html>
#[deprecated = "Backwards-compatible alias containing a typo, use `set_debug_utils_object_tag()` instead"]
#[inline]
pub unsafe fn debug_utils_set_object_tag( pub unsafe fn debug_utils_set_object_tag(
&self, &self,
device: vk::Device, device: vk::Device,
tag_info: &vk::DebugUtilsObjectTagInfoEXT, tag_info: &vk::DebugUtilsObjectTagInfoEXT,
) -> VkResult<()> {
self.set_debug_utils_object_tag(device, tag_info)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkSetDebugUtilsObjectTagEXT.html>
#[inline]
pub unsafe fn set_debug_utils_object_tag(
&self,
device: vk::Device,
tag_info: &vk::DebugUtilsObjectTagInfoEXT,
) -> VkResult<()> { ) -> VkResult<()> {
(self.fp.set_debug_utils_object_tag_ext)(device, tag_info).result() (self.fp.set_debug_utils_object_tag_ext)(device, tag_info).result()
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBeginDebugUtilsLabelEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBeginDebugUtilsLabelEXT.html>
#[inline]
pub unsafe fn cmd_begin_debug_utils_label( pub unsafe fn cmd_begin_debug_utils_label(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -47,11 +72,13 @@ impl DebugUtils {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdEndDebugUtilsLabelEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdEndDebugUtilsLabelEXT.html>
#[inline]
pub unsafe fn cmd_end_debug_utils_label(&self, command_buffer: vk::CommandBuffer) { pub unsafe fn cmd_end_debug_utils_label(&self, command_buffer: vk::CommandBuffer) {
(self.fp.cmd_end_debug_utils_label_ext)(command_buffer); (self.fp.cmd_end_debug_utils_label_ext)(command_buffer);
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdInsertDebugUtilsLabelEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdInsertDebugUtilsLabelEXT.html>
#[inline]
pub unsafe fn cmd_insert_debug_utils_label( pub unsafe fn cmd_insert_debug_utils_label(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -61,6 +88,7 @@ impl DebugUtils {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkQueueBeginDebugUtilsLabelEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkQueueBeginDebugUtilsLabelEXT.html>
#[inline]
pub unsafe fn queue_begin_debug_utils_label( pub unsafe fn queue_begin_debug_utils_label(
&self, &self,
queue: vk::Queue, queue: vk::Queue,
@ -70,11 +98,13 @@ impl DebugUtils {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkQueueEndDebugUtilsLabelEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkQueueEndDebugUtilsLabelEXT.html>
#[inline]
pub unsafe fn queue_end_debug_utils_label(&self, queue: vk::Queue) { pub unsafe fn queue_end_debug_utils_label(&self, queue: vk::Queue) {
(self.fp.queue_end_debug_utils_label_ext)(queue); (self.fp.queue_end_debug_utils_label_ext)(queue);
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkQueueInsertDebugUtilsLabelEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkQueueInsertDebugUtilsLabelEXT.html>
#[inline]
pub unsafe fn queue_insert_debug_utils_label( pub unsafe fn queue_insert_debug_utils_label(
&self, &self,
queue: vk::Queue, queue: vk::Queue,
@ -84,6 +114,7 @@ impl DebugUtils {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateDebugUtilsMessengerEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateDebugUtilsMessengerEXT.html>
#[inline]
pub unsafe fn create_debug_utils_messenger( pub unsafe fn create_debug_utils_messenger(
&self, &self,
create_info: &vk::DebugUtilsMessengerCreateInfoEXT, create_info: &vk::DebugUtilsMessengerCreateInfoEXT,
@ -100,6 +131,7 @@ impl DebugUtils {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyDebugUtilsMessengerEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyDebugUtilsMessengerEXT.html>
#[inline]
pub unsafe fn destroy_debug_utils_messenger( pub unsafe fn destroy_debug_utils_messenger(
&self, &self,
messenger: vk::DebugUtilsMessengerEXT, messenger: vk::DebugUtilsMessengerEXT,
@ -109,6 +141,7 @@ impl DebugUtils {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkSubmitDebugUtilsMessageEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkSubmitDebugUtilsMessageEXT.html>
#[inline]
pub unsafe fn submit_debug_utils_message( pub unsafe fn submit_debug_utils_message(
&self, &self,
message_severity: vk::DebugUtilsMessageSeverityFlagsEXT, message_severity: vk::DebugUtilsMessageSeverityFlagsEXT,
@ -123,14 +156,17 @@ impl DebugUtils {
); );
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::ExtDebugUtilsFn::name() vk::ExtDebugUtilsFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::ExtDebugUtilsFn { pub fn fp(&self) -> &vk::ExtDebugUtilsFn {
&self.fp &self.fp
} }
#[inline]
pub fn instance(&self) -> vk::Instance { pub fn instance(&self) -> vk::Instance {
self.handle self.handle
} }

View file

@ -0,0 +1,211 @@
use crate::prelude::*;
use crate::vk;
use crate::{Device, Instance};
use std::ffi::CStr;
use std::mem;
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_EXT_descriptor_buffer.html>
#[derive(Clone)]
pub struct DescriptorBuffer {
handle: vk::Device,
fp: vk::ExtDescriptorBufferFn,
}
impl DescriptorBuffer {
pub fn new(instance: &Instance, device: &Device) -> Self {
let handle = device.handle();
let fp = vk::ExtDescriptorBufferFn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr()))
});
Self { handle, fp }
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDescriptorSetLayoutSizeEXT.html>
#[inline]
pub unsafe fn get_descriptor_set_layout_size(
&self,
layout: vk::DescriptorSetLayout,
) -> vk::DeviceSize {
let mut count = 0;
(self.fp.get_descriptor_set_layout_size_ext)(self.handle, layout, &mut count);
count
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDescriptorSetLayoutBindingOffsetEXT.html>
#[inline]
pub unsafe fn get_descriptor_set_layout_binding_offset(
&self,
layout: vk::DescriptorSetLayout,
binding: u32,
) -> vk::DeviceSize {
let mut offset = 0;
(self.fp.get_descriptor_set_layout_binding_offset_ext)(
self.handle,
layout,
binding,
&mut offset,
);
offset
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDescriptorEXT.html>
#[inline]
pub unsafe fn get_descriptor(
&self,
descriptor_info: &vk::DescriptorGetInfoEXT,
descriptor: &mut [u8],
) {
(self.fp.get_descriptor_ext)(
self.handle,
descriptor_info,
descriptor.len(),
descriptor.as_mut_ptr().cast(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBindDescriptorBuffersEXT.html>
#[inline]
pub unsafe fn cmd_bind_descriptor_buffers(
&self,
command_buffer: vk::CommandBuffer,
binding_info: &[vk::DescriptorBufferBindingInfoEXT],
) {
(self.fp.cmd_bind_descriptor_buffers_ext)(
command_buffer,
binding_info.len() as u32,
binding_info.as_ptr(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDescriptorBufferOffsetsEXT.html>
#[inline]
pub unsafe fn cmd_set_descriptor_buffer_offsets(
&self,
command_buffer: vk::CommandBuffer,
pipeline_bind_point: vk::PipelineBindPoint,
layout: vk::PipelineLayout,
first_set: u32,
buffer_indices: &[u32],
offsets: &[vk::DeviceSize],
) {
assert_eq!(buffer_indices.len(), offsets.len());
(self.fp.cmd_set_descriptor_buffer_offsets_ext)(
command_buffer,
pipeline_bind_point,
layout,
first_set,
buffer_indices.len() as u32,
buffer_indices.as_ptr(),
offsets.as_ptr(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBindDescriptorBufferEmbeddedSamplersEXT.html>
#[inline]
pub unsafe fn cmd_bind_descriptor_buffer_embedded_samplers(
&self,
command_buffer: vk::CommandBuffer,
pipeline_bind_point: vk::PipelineBindPoint,
layout: vk::PipelineLayout,
set: u32,
) {
(self.fp.cmd_bind_descriptor_buffer_embedded_samplers_ext)(
command_buffer,
pipeline_bind_point,
layout,
set,
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetBufferOpaqueCaptureDescriptorDataEXT.html>
#[inline]
pub unsafe fn get_buffer_opaque_capture_descriptor_data(
&self,
info: &vk::BufferCaptureDescriptorDataInfoEXT,
data: &mut [u8],
) -> VkResult<()> {
(self.fp.get_buffer_opaque_capture_descriptor_data_ext)(
self.handle,
info,
data.as_mut_ptr().cast(),
)
.result()
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetImageOpaqueCaptureDescriptorDataEXT.html>
#[inline]
pub unsafe fn get_image_opaque_capture_descriptor_data(
&self,
info: &vk::ImageCaptureDescriptorDataInfoEXT,
data: &mut [u8],
) -> VkResult<()> {
(self.fp.get_image_opaque_capture_descriptor_data_ext)(
self.handle,
info,
data.as_mut_ptr().cast(),
)
.result()
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetImageViewOpaqueCaptureDescriptorDataEXT.html>
#[inline]
pub unsafe fn get_image_view_opaque_capture_descriptor_data(
&self,
info: &vk::ImageViewCaptureDescriptorDataInfoEXT,
data: &mut [u8],
) -> VkResult<()> {
(self.fp.get_image_view_opaque_capture_descriptor_data_ext)(
self.handle,
info,
data.as_mut_ptr().cast(),
)
.result()
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetSamplerOpaqueCaptureDescriptorDataEXT.html>
#[inline]
pub unsafe fn get_sampler_opaque_capture_descriptor_data(
&self,
info: &vk::SamplerCaptureDescriptorDataInfoEXT,
data: &mut [u8],
) -> VkResult<()> {
(self.fp.get_sampler_opaque_capture_descriptor_data_ext)(
self.handle,
info,
data.as_mut_ptr().cast(),
)
.result()
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT.html>
#[inline]
pub unsafe fn get_acceleration_structure_opaque_capture_descriptor_data(
&self,
info: &vk::AccelerationStructureCaptureDescriptorDataInfoEXT,
data: &mut [u8],
) -> VkResult<()> {
(self
.fp
.get_acceleration_structure_opaque_capture_descriptor_data_ext)(
self.handle,
info,
data.as_mut_ptr().cast(),
)
.result()
}
#[inline]
pub const fn name() -> &'static CStr {
vk::ExtDescriptorBufferFn::name()
}
#[inline]
pub fn fp(&self) -> &vk::ExtDescriptorBufferFn {
&self.fp
}
#[inline]
pub fn device(&self) -> vk::Device {
self.handle
}
}

View file

@ -18,6 +18,7 @@ impl ExtendedDynamicState {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetCullModeEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetCullModeEXT.html>
#[inline]
pub unsafe fn cmd_set_cull_mode( pub unsafe fn cmd_set_cull_mode(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -27,6 +28,7 @@ impl ExtendedDynamicState {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetFrontFaceEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetFrontFaceEXT.html>
#[inline]
pub unsafe fn cmd_set_front_face( pub unsafe fn cmd_set_front_face(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -36,6 +38,7 @@ impl ExtendedDynamicState {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetPrimitiveTopologyEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetPrimitiveTopologyEXT.html>
#[inline]
pub unsafe fn cmd_set_primitive_topology( pub unsafe fn cmd_set_primitive_topology(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -45,6 +48,7 @@ impl ExtendedDynamicState {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetViewportWithCountEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetViewportWithCountEXT.html>
#[inline]
pub unsafe fn cmd_set_viewport_with_count( pub unsafe fn cmd_set_viewport_with_count(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -58,6 +62,7 @@ impl ExtendedDynamicState {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetScissorWithCountEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetScissorWithCountEXT.html>
#[inline]
pub unsafe fn cmd_set_scissor_with_count( pub unsafe fn cmd_set_scissor_with_count(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -71,6 +76,7 @@ impl ExtendedDynamicState {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBindVertexBuffers2EXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBindVertexBuffers2EXT.html>
#[inline]
pub unsafe fn cmd_bind_vertex_buffers2( pub unsafe fn cmd_bind_vertex_buffers2(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -105,6 +111,7 @@ impl ExtendedDynamicState {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthTestEnableEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthTestEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_depth_test_enable( pub unsafe fn cmd_set_depth_test_enable(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -114,6 +121,7 @@ impl ExtendedDynamicState {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthWriteEnableEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthWriteEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_depth_write_enable( pub unsafe fn cmd_set_depth_write_enable(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -123,6 +131,7 @@ impl ExtendedDynamicState {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthCompareOpEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthCompareOpEXT.html>
#[inline]
pub unsafe fn cmd_set_depth_compare_op( pub unsafe fn cmd_set_depth_compare_op(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -132,6 +141,7 @@ impl ExtendedDynamicState {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthBoundsTestEnableEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthBoundsTestEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_depth_bounds_test_enable( pub unsafe fn cmd_set_depth_bounds_test_enable(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -144,6 +154,7 @@ impl ExtendedDynamicState {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetStencilTestEnableEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetStencilTestEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_stencil_test_enable( pub unsafe fn cmd_set_stencil_test_enable(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -153,6 +164,7 @@ impl ExtendedDynamicState {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetStencilOpEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetStencilOpEXT.html>
#[inline]
pub unsafe fn cmd_set_stencil_op( pub unsafe fn cmd_set_stencil_op(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -172,10 +184,12 @@ impl ExtendedDynamicState {
) )
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::ExtExtendedDynamicStateFn::name() vk::ExtExtendedDynamicStateFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::ExtExtendedDynamicStateFn { pub fn fp(&self) -> &vk::ExtExtendedDynamicStateFn {
&self.fp &self.fp
} }

View file

@ -18,6 +18,7 @@ impl ExtendedDynamicState2 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetPatchControlPointsEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetPatchControlPointsEXT.html>
#[inline]
pub unsafe fn cmd_set_patch_control_points( pub unsafe fn cmd_set_patch_control_points(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -27,6 +28,7 @@ impl ExtendedDynamicState2 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetRasterizerDiscardEnableEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetRasterizerDiscardEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_rasterizer_discard_enable( pub unsafe fn cmd_set_rasterizer_discard_enable(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -39,6 +41,7 @@ impl ExtendedDynamicState2 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthBiasEnableEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthBiasEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_depth_bias_enable( pub unsafe fn cmd_set_depth_bias_enable(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -48,6 +51,7 @@ impl ExtendedDynamicState2 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetLogicOpEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetLogicOpEXT.html>
#[inline]
pub unsafe fn cmd_set_logic_op( pub unsafe fn cmd_set_logic_op(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -57,6 +61,7 @@ impl ExtendedDynamicState2 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetPrimitiveRestartEnableEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetPrimitiveRestartEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_primitive_restart_enable( pub unsafe fn cmd_set_primitive_restart_enable(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -68,10 +73,12 @@ impl ExtendedDynamicState2 {
) )
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::ExtExtendedDynamicState2Fn::name() vk::ExtExtendedDynamicState2Fn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::ExtExtendedDynamicState2Fn { pub fn fp(&self) -> &vk::ExtExtendedDynamicState2Fn {
&self.fp &self.fp
} }

View file

@ -0,0 +1,409 @@
use crate::vk;
use crate::{Device, Instance};
use std::ffi::CStr;
use std::mem;
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_extended_dynamic_state3.html>
#[derive(Clone)]
pub struct ExtendedDynamicState3 {
fp: vk::ExtExtendedDynamicState3Fn,
}
impl ExtendedDynamicState3 {
pub fn new(instance: &Instance, device: &Device) -> Self {
let fp = vk::ExtExtendedDynamicState3Fn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
});
Self { fp }
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetTessellationDomainOriginEXT.html>
#[inline]
pub unsafe fn cmd_set_tessellation_domain_origin(
&self,
command_buffer: vk::CommandBuffer,
domain_origin: vk::TessellationDomainOrigin,
) {
(self.fp.cmd_set_tessellation_domain_origin_ext)(command_buffer, domain_origin)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthClampEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_depth_clamp_enable(
&self,
command_buffer: vk::CommandBuffer,
depth_clamp_enable: bool,
) {
(self.fp.cmd_set_depth_clamp_enable_ext)(command_buffer, depth_clamp_enable.into())
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetPolygonModeEXT.html>
#[inline]
pub unsafe fn cmd_set_polygon_mode(
&self,
command_buffer: vk::CommandBuffer,
polygon_mode: vk::PolygonMode,
) {
(self.fp.cmd_set_polygon_mode_ext)(command_buffer, polygon_mode)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetRasterizationSamplesEXT.html>
#[inline]
pub unsafe fn cmd_set_rasterization_samples(
&self,
command_buffer: vk::CommandBuffer,
rasterization_samples: vk::SampleCountFlags,
) {
(self.fp.cmd_set_rasterization_samples_ext)(command_buffer, rasterization_samples)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetSampleMaskEXT.html>
#[inline]
pub unsafe fn cmd_set_sample_mask(
&self,
command_buffer: vk::CommandBuffer,
samples: vk::SampleCountFlags,
sample_mask: &[vk::SampleMask],
) {
assert!(
samples.as_raw().is_power_of_two(),
"Only one SampleCount bit must be set"
);
assert_eq!(samples.as_raw() as usize / 32, sample_mask.len());
(self.fp.cmd_set_sample_mask_ext)(command_buffer, samples, sample_mask.as_ptr())
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetAlphaToCoverageEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_alpha_to_coverage_enable(
&self,
command_buffer: vk::CommandBuffer,
alpha_to_coverage_enable: bool,
) {
(self.fp.cmd_set_alpha_to_coverage_enable_ext)(
command_buffer,
alpha_to_coverage_enable.into(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetAlphaToOneEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_alpha_to_one_enable(
&self,
command_buffer: vk::CommandBuffer,
alpha_to_one_enable: bool,
) {
(self.fp.cmd_set_alpha_to_one_enable_ext)(command_buffer, alpha_to_one_enable.into())
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetLogicOpEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_logic_op_enable(
&self,
command_buffer: vk::CommandBuffer,
logic_op_enable: bool,
) {
(self.fp.cmd_set_logic_op_enable_ext)(command_buffer, logic_op_enable.into())
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetColorBlendEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_color_blend_enable(
&self,
command_buffer: vk::CommandBuffer,
first_attachment: u32,
color_blend_enables: &[vk::Bool32],
) {
(self.fp.cmd_set_color_blend_enable_ext)(
command_buffer,
first_attachment,
color_blend_enables.len() as u32,
color_blend_enables.as_ptr(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetColorBlendEquationEXT.html>
#[inline]
pub unsafe fn cmd_set_color_blend_equation(
&self,
command_buffer: vk::CommandBuffer,
first_attachment: u32,
color_blend_equations: &[vk::ColorBlendEquationEXT],
) {
(self.fp.cmd_set_color_blend_equation_ext)(
command_buffer,
first_attachment,
color_blend_equations.len() as u32,
color_blend_equations.as_ptr(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetColorWriteMaskEXT.html>
#[inline]
pub unsafe fn cmd_set_color_write_mask(
&self,
command_buffer: vk::CommandBuffer,
first_attachment: u32,
color_write_masks: &[vk::ColorComponentFlags],
) {
(self.fp.cmd_set_color_write_mask_ext)(
command_buffer,
first_attachment,
color_write_masks.len() as u32,
color_write_masks.as_ptr(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetRasterizationStreamEXT.html>
#[inline]
pub unsafe fn cmd_set_rasterization_stream(
&self,
command_buffer: vk::CommandBuffer,
rasterization_stream: u32,
) {
(self.fp.cmd_set_rasterization_stream_ext)(command_buffer, rasterization_stream)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetConservativeRasterizationModeEXT.html>
#[inline]
pub unsafe fn cmd_set_conservative_rasterization_mode(
&self,
command_buffer: vk::CommandBuffer,
conservative_rasterization_mode: vk::ConservativeRasterizationModeEXT,
) {
(self.fp.cmd_set_conservative_rasterization_mode_ext)(
command_buffer,
conservative_rasterization_mode,
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetExtraPrimitiveOverestimationSizeEXT.html>
#[inline]
pub unsafe fn cmd_set_extra_primitive_overestimation_size(
&self,
command_buffer: vk::CommandBuffer,
extra_primitive_overestimation_size: f32,
) {
(self.fp.cmd_set_extra_primitive_overestimation_size_ext)(
command_buffer,
extra_primitive_overestimation_size,
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthClipEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_depth_clip_enable(
&self,
command_buffer: vk::CommandBuffer,
depth_clip_enable: bool,
) {
(self.fp.cmd_set_depth_clip_enable_ext)(command_buffer, depth_clip_enable.into())
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetSampleLocationsEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_sample_locations_enable(
&self,
command_buffer: vk::CommandBuffer,
sample_locations_enable: bool,
) {
(self.fp.cmd_set_sample_locations_enable_ext)(
command_buffer,
sample_locations_enable.into(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetColorBlendAdvancedEXT.html>
#[inline]
pub unsafe fn cmd_set_color_blend_advanced(
&self,
command_buffer: vk::CommandBuffer,
first_attachment: u32,
color_blend_advanced: &[vk::ColorBlendAdvancedEXT],
) {
(self.fp.cmd_set_color_blend_advanced_ext)(
command_buffer,
first_attachment,
color_blend_advanced.len() as u32,
color_blend_advanced.as_ptr(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetProvokingVertexModeEXT.html>
#[inline]
pub unsafe fn cmd_set_provoking_vertex_mode(
&self,
command_buffer: vk::CommandBuffer,
provoking_vertex_mode: vk::ProvokingVertexModeEXT,
) {
(self.fp.cmd_set_provoking_vertex_mode_ext)(command_buffer, provoking_vertex_mode)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetLineRasterizationModeEXT.html>
#[inline]
pub unsafe fn cmd_set_line_rasterization_mode(
&self,
command_buffer: vk::CommandBuffer,
line_rasterization_mode: vk::LineRasterizationModeEXT,
) {
(self.fp.cmd_set_line_rasterization_mode_ext)(command_buffer, line_rasterization_mode)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetLineStippleEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_line_stipple_enable(
&self,
command_buffer: vk::CommandBuffer,
stippled_line_enable: bool,
) {
(self.fp.cmd_set_line_stipple_enable_ext)(command_buffer, stippled_line_enable.into())
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthClipNegativeOneToOneEXT.html>
#[inline]
pub unsafe fn cmd_set_depth_clip_negative_one_to_one(
&self,
command_buffer: vk::CommandBuffer,
negative_one_to_one: bool,
) {
(self.fp.cmd_set_depth_clip_negative_one_to_one_ext)(
command_buffer,
negative_one_to_one.into(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetViewportWScalingEnableNV.html>
#[inline]
pub unsafe fn cmd_set_viewport_w_scaling_enable_nv(
&self,
command_buffer: vk::CommandBuffer,
viewport_w_scaling_enable: bool,
) {
(self.fp.cmd_set_viewport_w_scaling_enable_nv)(
command_buffer,
viewport_w_scaling_enable.into(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetViewportSwizzleNV.html>
#[inline]
pub unsafe fn cmd_set_viewport_swizzle_nv(
&self,
command_buffer: vk::CommandBuffer,
first_attachment: u32,
viewport_swizzles: &[vk::ViewportSwizzleNV],
) {
(self.fp.cmd_set_viewport_swizzle_nv)(
command_buffer,
first_attachment,
viewport_swizzles.len() as u32,
viewport_swizzles.as_ptr(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetCoverageToColorEnableNV.html>
#[inline]
pub unsafe fn cmd_set_coverage_to_color_enable_nv(
&self,
command_buffer: vk::CommandBuffer,
coverage_to_color_enable: bool,
) {
(self.fp.cmd_set_coverage_to_color_enable_nv)(
command_buffer,
coverage_to_color_enable.into(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetCoverageToColorLocationNV.html>
#[inline]
pub unsafe fn cmd_set_coverage_to_color_location_nv(
&self,
command_buffer: vk::CommandBuffer,
coverage_to_color_location: u32,
) {
(self.fp.cmd_set_coverage_to_color_location_nv)(command_buffer, coverage_to_color_location)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetCoverageModulationModeNV.html>
#[inline]
pub unsafe fn cmd_set_coverage_modulation_mode_nv(
&self,
command_buffer: vk::CommandBuffer,
coverage_modulation_mode: vk::CoverageModulationModeNV,
) {
(self.fp.cmd_set_coverage_modulation_mode_nv)(command_buffer, coverage_modulation_mode)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetCoverageModulationTableEnableNV.html>
#[inline]
pub unsafe fn cmd_set_coverage_modulation_table_enable_nv(
&self,
command_buffer: vk::CommandBuffer,
coverage_modulation_table_enable: bool,
) {
(self.fp.cmd_set_coverage_modulation_table_enable_nv)(
command_buffer,
coverage_modulation_table_enable.into(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetCoverageModulationTableNV.html>
#[inline]
pub unsafe fn cmd_set_coverage_modulation_table_nv(
&self,
command_buffer: vk::CommandBuffer,
coverage_modulation_table: &[f32],
) {
(self.fp.cmd_set_coverage_modulation_table_nv)(
command_buffer,
coverage_modulation_table.len() as u32,
coverage_modulation_table.as_ptr(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetShadingRateImageEnableNV.html>
#[inline]
pub unsafe fn cmd_set_shading_rate_image_enable_nv(
&self,
command_buffer: vk::CommandBuffer,
shading_rate_image_enable: bool,
) {
(self.fp.cmd_set_shading_rate_image_enable_nv)(
command_buffer,
shading_rate_image_enable.into(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetRepresentativeFragmentTestEnableNV.html>
#[inline]
pub unsafe fn cmd_set_representative_fragment_test_enable_nv(
&self,
command_buffer: vk::CommandBuffer,
representative_fragment_test_enable: bool,
) {
(self.fp.cmd_set_representative_fragment_test_enable_nv)(
command_buffer,
representative_fragment_test_enable.into(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetCoverageReductionModeNV.html>
#[inline]
pub unsafe fn cmd_set_coverage_reduction_mode_nv(
&self,
command_buffer: vk::CommandBuffer,
coverage_reduction_mode: vk::CoverageReductionModeNV,
) {
(self.fp.cmd_set_coverage_reduction_mode_nv)(command_buffer, coverage_reduction_mode)
}
#[inline]
pub const fn name() -> &'static CStr {
vk::ExtExtendedDynamicState3Fn::name()
}
#[inline]
pub fn fp(&self) -> &vk::ExtExtendedDynamicState3Fn {
&self.fp
}
}

View file

@ -1,9 +1,10 @@
use crate::prelude::*; use crate::prelude::*;
use crate::vk; use crate::vk;
use crate::{Device, Instance}; use crate::{Device, Entry, Instance};
use std::ffi::CStr; use std::ffi::CStr;
use std::mem; use std::mem;
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_EXT_full_screen_exclusive.html>
#[derive(Clone)] #[derive(Clone)]
pub struct FullScreenExclusive { pub struct FullScreenExclusive {
handle: vk::Device, handle: vk::Device,
@ -11,6 +12,13 @@ pub struct FullScreenExclusive {
} }
impl FullScreenExclusive { impl FullScreenExclusive {
/// # Warning
/// [`Instance`] functions cannot be loaded from a [`Device`] and will always panic when called:
/// - [`Self::get_physical_device_surface_present_modes2()`]
///
/// Load this struct using an [`Instance`] instead via [`Self::new_from_instance()`] if the
/// above [`Instance`] function is called. This will be solved in the next breaking `ash`
/// release: <https://github.com/ash-rs/ash/issues/727>.
pub fn new(instance: &Instance, device: &Device) -> Self { pub fn new(instance: &Instance, device: &Device) -> Self {
let handle = device.handle(); let handle = device.handle();
let fp = vk::ExtFullScreenExclusiveFn::load(|name| unsafe { let fp = vk::ExtFullScreenExclusiveFn::load(|name| unsafe {
@ -19,7 +27,21 @@ impl FullScreenExclusive {
Self { handle, fp } Self { handle, fp }
} }
/// Loads all functions on the [`Instance`] instead of [`Device`]. This incurs an extra
/// dispatch table for [`Device`] functions but also allows the [`Instance`] function to be
/// loaded instead of always panicking. See also [`Self::new()`] for more details.
///
/// It is okay to pass [`vk::Device::null()`] when this struct is only used to call the
/// [`Instance`] function.
pub fn new_from_instance(entry: &Entry, instance: &Instance, device: vk::Device) -> Self {
let fp = vk::ExtFullScreenExclusiveFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
});
Self { handle: device, fp }
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkAcquireFullScreenExclusiveModeEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkAcquireFullScreenExclusiveModeEXT.html>
#[inline]
pub unsafe fn acquire_full_screen_exclusive_mode( pub unsafe fn acquire_full_screen_exclusive_mode(
&self, &self,
swapchain: vk::SwapchainKHR, swapchain: vk::SwapchainKHR,
@ -28,6 +50,11 @@ impl FullScreenExclusive {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSurfacePresentModes2EXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSurfacePresentModes2EXT.html>
///
/// # Warning
///
/// Function will always panic unless this struct is loaded via [`Self::new_from_instance()`].
#[inline]
pub unsafe fn get_physical_device_surface_present_modes2( pub unsafe fn get_physical_device_surface_present_modes2(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -44,6 +71,7 @@ impl FullScreenExclusive {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkReleaseFullScreenExclusiveModeEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkReleaseFullScreenExclusiveModeEXT.html>
#[inline]
pub unsafe fn release_full_screen_exclusive_mode( pub unsafe fn release_full_screen_exclusive_mode(
&self, &self,
swapchain: vk::SwapchainKHR, swapchain: vk::SwapchainKHR,
@ -52,6 +80,7 @@ impl FullScreenExclusive {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceGroupSurfacePresentModes2EXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceGroupSurfacePresentModes2EXT.html>
#[inline]
pub unsafe fn get_device_group_surface_present_modes2( pub unsafe fn get_device_group_surface_present_modes2(
&self, &self,
surface_info: &vk::PhysicalDeviceSurfaceInfo2KHR, surface_info: &vk::PhysicalDeviceSurfaceInfo2KHR,
@ -65,14 +94,17 @@ impl FullScreenExclusive {
.result_with_success(present_modes) .result_with_success(present_modes)
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::ExtFullScreenExclusiveFn::name() vk::ExtFullScreenExclusiveFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::ExtFullScreenExclusiveFn { pub fn fp(&self) -> &vk::ExtFullScreenExclusiveFn {
&self.fp &self.fp
} }
#[inline]
pub fn device(&self) -> vk::Device { pub fn device(&self) -> vk::Device {
self.handle self.handle
} }

View file

@ -22,6 +22,7 @@ impl HeadlessSurface {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateHeadlessSurfaceEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateHeadlessSurfaceEXT.html>
#[inline]
pub unsafe fn create_headless_surface( pub unsafe fn create_headless_surface(
&self, &self,
create_info: &vk::HeadlessSurfaceCreateInfoEXT, create_info: &vk::HeadlessSurfaceCreateInfoEXT,
@ -37,14 +38,17 @@ impl HeadlessSurface {
.result_with_success(surface) .result_with_success(surface)
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::ExtHeadlessSurfaceFn::name() vk::ExtHeadlessSurfaceFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::ExtHeadlessSurfaceFn { pub fn fp(&self) -> &vk::ExtHeadlessSurfaceFn {
&self.fp &self.fp
} }
#[inline]
pub fn instance(&self) -> vk::Instance { pub fn instance(&self) -> vk::Instance {
self.handle self.handle
} }

View file

@ -0,0 +1,47 @@
use crate::vk;
use crate::{Device, Instance};
use std::ffi::CStr;
use std::mem;
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_EXT_image_compression_control.html>
#[derive(Clone)]
pub struct ImageCompressionControl {
handle: vk::Device,
fp: vk::ExtImageCompressionControlFn,
}
impl ImageCompressionControl {
pub fn new(instance: &Instance, device: &Device) -> Self {
let handle = device.handle();
let fp = vk::ExtImageCompressionControlFn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr()))
});
Self { handle, fp }
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetImageSubresourceLayout2EXT.html>
#[inline]
pub unsafe fn get_image_subresource_layout2(
&self,
image: vk::Image,
subresource: &vk::ImageSubresource2EXT,
layout: &mut vk::SubresourceLayout2EXT,
) {
(self.fp.get_image_subresource_layout2_ext)(self.handle, image, subresource, layout)
}
#[inline]
pub const fn name() -> &'static CStr {
vk::ExtImageCompressionControlFn::name()
}
#[inline]
pub fn fp(&self) -> &vk::ExtImageCompressionControlFn {
&self.fp
}
#[inline]
pub fn device(&self) -> vk::Device {
self.handle
}
}

View file

@ -0,0 +1,48 @@
use crate::prelude::*;
use crate::vk;
use crate::{Device, Instance};
use std::ffi::CStr;
use std::mem;
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_EXT_image_drm_format_modifier.html>
#[derive(Clone)]
pub struct ImageDrmFormatModifier {
handle: vk::Device,
fp: vk::ExtImageDrmFormatModifierFn,
}
impl ImageDrmFormatModifier {
pub fn new(instance: &Instance, device: &Device) -> Self {
let handle = device.handle();
let fp = vk::ExtImageDrmFormatModifierFn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr()))
});
Self { handle, fp }
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetImageDrmFormatModifierPropertiesEXT.html>
#[inline]
pub unsafe fn get_image_drm_format_modifier_properties(
&self,
image: vk::Image,
properties: &mut vk::ImageDrmFormatModifierPropertiesEXT,
) -> VkResult<()> {
(self.fp.get_image_drm_format_modifier_properties_ext)(self.handle, image, properties)
.result()
}
#[inline]
pub const fn name() -> &'static CStr {
vk::ExtImageDrmFormatModifierFn::name()
}
#[inline]
pub fn fp(&self) -> &vk::ExtImageDrmFormatModifierFn {
&self.fp
}
#[inline]
pub fn device(&self) -> vk::Device {
self.handle
}
}

View file

@ -0,0 +1,94 @@
use crate::vk;
use crate::{Device, Instance};
use std::ffi::CStr;
use std::mem;
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_mesh_shader.html>
#[derive(Clone)]
pub struct MeshShader {
fp: vk::ExtMeshShaderFn,
}
impl MeshShader {
pub fn new(instance: &Instance, device: &Device) -> Self {
let fp = vk::ExtMeshShaderFn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
});
Self { fp }
}
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdDrawMeshTasksEXT.html>
#[inline]
pub unsafe fn cmd_draw_mesh_tasks(
&self,
command_buffer: vk::CommandBuffer,
group_count_x: u32,
group_count_y: u32,
group_count_z: u32,
) {
(self.fp.cmd_draw_mesh_tasks_ext)(
command_buffer,
group_count_x,
group_count_y,
group_count_z,
);
}
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdDrawMeshTasksIndirectEXT.html>
///
/// `buffer` contains `draw_count` [`vk::DrawMeshTasksIndirectCommandEXT`] structures starting at `offset` in bytes, holding the draw parameters.
#[inline]
pub unsafe fn cmd_draw_mesh_tasks_indirect(
&self,
command_buffer: vk::CommandBuffer,
buffer: vk::Buffer,
offset: vk::DeviceSize,
draw_count: u32,
stride: u32,
) {
(self.fp.cmd_draw_mesh_tasks_indirect_ext)(
command_buffer,
buffer,
offset,
draw_count,
stride,
);
}
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdDrawMeshTasksIndirectCountEXT.html>
///
/// `buffer` contains a maximum of `max_draw_count` [`vk::DrawMeshTasksIndirectCommandEXT`] structures starting at `offset` in bytes, holding the draw parameters.
/// `count_buffer` is the buffer containing the draw count, starting at `count_buffer_offset` in bytes.
/// The actual number of executed draw calls is the minimum of the count specified in `count_buffer` and `max_draw_count`.
#[inline]
pub unsafe fn cmd_draw_mesh_tasks_indirect_count(
&self,
command_buffer: vk::CommandBuffer,
buffer: vk::Buffer,
offset: vk::DeviceSize,
count_buffer: vk::Buffer,
count_buffer_offset: vk::DeviceSize,
max_draw_count: u32,
stride: u32,
) {
(self.fp.cmd_draw_mesh_tasks_indirect_count_ext)(
command_buffer,
buffer,
offset,
count_buffer,
count_buffer_offset,
max_draw_count,
stride,
);
}
#[inline]
pub const fn name() -> &'static CStr {
vk::ExtMeshShaderFn::name()
}
#[inline]
pub fn fp(&self) -> &vk::ExtMeshShaderFn {
&self.fp
}
}

View file

@ -21,6 +21,7 @@ impl MetalSurface {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateMetalSurfaceEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateMetalSurfaceEXT.html>
#[inline]
pub unsafe fn create_metal_surface( pub unsafe fn create_metal_surface(
&self, &self,
create_info: &vk::MetalSurfaceCreateInfoEXT, create_info: &vk::MetalSurfaceCreateInfoEXT,
@ -36,14 +37,17 @@ impl MetalSurface {
.result_with_success(surface) .result_with_success(surface)
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::ExtMetalSurfaceFn::name() vk::ExtMetalSurfaceFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::ExtMetalSurfaceFn { pub fn fp(&self) -> &vk::ExtMetalSurfaceFn {
&self.fp &self.fp
} }
#[inline]
pub fn instance(&self) -> vk::Instance { pub fn instance(&self) -> vk::Instance {
self.handle self.handle
} }

View file

@ -1,3 +1,4 @@
pub use self::acquire_drm_display::AcquireDrmDisplay;
pub use self::buffer_device_address::BufferDeviceAddress; pub use self::buffer_device_address::BufferDeviceAddress;
pub use self::calibrated_timestamps::CalibratedTimestamps; pub use self::calibrated_timestamps::CalibratedTimestamps;
#[allow(deprecated)] #[allow(deprecated)]
@ -5,15 +6,24 @@ pub use self::debug_marker::DebugMarker;
#[allow(deprecated)] #[allow(deprecated)]
pub use self::debug_report::DebugReport; pub use self::debug_report::DebugReport;
pub use self::debug_utils::DebugUtils; pub use self::debug_utils::DebugUtils;
pub use self::descriptor_buffer::DescriptorBuffer;
pub use self::extended_dynamic_state::ExtendedDynamicState; pub use self::extended_dynamic_state::ExtendedDynamicState;
pub use self::extended_dynamic_state2::ExtendedDynamicState2; pub use self::extended_dynamic_state2::ExtendedDynamicState2;
pub use self::extended_dynamic_state3::ExtendedDynamicState3;
pub use self::full_screen_exclusive::FullScreenExclusive; pub use self::full_screen_exclusive::FullScreenExclusive;
pub use self::headless_surface::HeadlessSurface; pub use self::headless_surface::HeadlessSurface;
pub use self::image_compression_control::ImageCompressionControl;
pub use self::image_drm_format_modifier::ImageDrmFormatModifier;
pub use self::mesh_shader::MeshShader;
pub use self::metal_surface::MetalSurface; pub use self::metal_surface::MetalSurface;
pub use self::physical_device_drm::PhysicalDeviceDrm; pub use self::physical_device_drm::PhysicalDeviceDrm;
pub use self::pipeline_properties::PipelineProperties;
pub use self::private_data::PrivateData; pub use self::private_data::PrivateData;
pub use self::sample_locations::SampleLocations;
pub use self::shader_object::ShaderObject;
pub use self::tooling_info::ToolingInfo; pub use self::tooling_info::ToolingInfo;
mod acquire_drm_display;
mod buffer_device_address; mod buffer_device_address;
mod calibrated_timestamps; mod calibrated_timestamps;
#[deprecated(note = "Please use the [DebugUtils](struct.DebugUtils.html) extension instead.")] #[deprecated(note = "Please use the [DebugUtils](struct.DebugUtils.html) extension instead.")]
@ -21,11 +31,19 @@ mod debug_marker;
#[deprecated(note = "Please use the [DebugUtils](struct.DebugUtils.html) extension instead.")] #[deprecated(note = "Please use the [DebugUtils](struct.DebugUtils.html) extension instead.")]
mod debug_report; mod debug_report;
mod debug_utils; mod debug_utils;
mod descriptor_buffer;
mod extended_dynamic_state; mod extended_dynamic_state;
mod extended_dynamic_state2; mod extended_dynamic_state2;
mod extended_dynamic_state3;
mod full_screen_exclusive; mod full_screen_exclusive;
mod headless_surface; mod headless_surface;
mod image_compression_control;
mod image_drm_format_modifier;
mod mesh_shader;
mod metal_surface; mod metal_surface;
mod physical_device_drm; mod physical_device_drm;
mod pipeline_properties;
mod private_data; mod private_data;
mod sample_locations;
mod shader_object;
mod tooling_info; mod tooling_info;

View file

@ -6,6 +6,7 @@ use std::ffi::CStr;
pub struct PhysicalDeviceDrm; pub struct PhysicalDeviceDrm;
impl PhysicalDeviceDrm { impl PhysicalDeviceDrm {
#[inline]
pub unsafe fn get_properties( pub unsafe fn get_properties(
instance: &Instance, instance: &Instance,
pdevice: vk::PhysicalDevice, pdevice: vk::PhysicalDevice,
@ -18,6 +19,7 @@ impl PhysicalDeviceDrm {
props_drm props_drm
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::ExtPhysicalDeviceDrmFn::name() vk::ExtPhysicalDeviceDrmFn::name()
} }

View file

@ -0,0 +1,52 @@
use crate::prelude::*;
use crate::vk;
use crate::{Device, Instance};
use std::ffi::CStr;
use std::mem;
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_EXT_pipeline_properties.html>
#[derive(Clone)]
pub struct PipelineProperties {
handle: vk::Device,
fp: vk::ExtPipelinePropertiesFn,
}
impl PipelineProperties {
pub fn new(instance: &Instance, device: &Device) -> Self {
let handle = device.handle();
let fp = vk::ExtPipelinePropertiesFn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr()))
});
Self { handle, fp }
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPipelinePropertiesEXT.html>
#[inline]
pub unsafe fn get_pipeline_properties(
&self,
pipeline_info: &vk::PipelineInfoEXT,
pipeline_properties: &mut impl vk::GetPipelinePropertiesEXTParamPipelineProperties,
) -> VkResult<()> {
(self.fp.get_pipeline_properties_ext)(
self.handle,
pipeline_info,
<*mut _>::cast(pipeline_properties),
)
.result()
}
#[inline]
pub const fn name() -> &'static CStr {
vk::ExtPipelinePropertiesFn::name()
}
#[inline]
pub fn fp(&self) -> &vk::ExtPipelinePropertiesFn {
&self.fp
}
#[inline]
pub fn device(&self) -> vk::Device {
self.handle
}
}

View file

@ -22,6 +22,7 @@ impl PrivateData {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreatePrivateDataSlotEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreatePrivateDataSlotEXT.html>
#[inline]
pub unsafe fn create_private_data_slot( pub unsafe fn create_private_data_slot(
&self, &self,
create_info: &vk::PrivateDataSlotCreateInfoEXT, create_info: &vk::PrivateDataSlotCreateInfoEXT,
@ -38,6 +39,7 @@ impl PrivateData {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyPrivateDataSlotEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyPrivateDataSlotEXT.html>
#[inline]
pub unsafe fn destroy_private_data_slot( pub unsafe fn destroy_private_data_slot(
&self, &self,
private_data_slot: vk::PrivateDataSlotEXT, private_data_slot: vk::PrivateDataSlotEXT,
@ -51,6 +53,7 @@ impl PrivateData {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkSetPrivateDataEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkSetPrivateDataEXT.html>
#[inline]
pub unsafe fn set_private_data<T: vk::Handle>( pub unsafe fn set_private_data<T: vk::Handle>(
&self, &self,
object: T, object: T,
@ -68,6 +71,7 @@ impl PrivateData {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPrivateDataEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPrivateDataEXT.html>
#[inline]
pub unsafe fn get_private_data<T: vk::Handle>( pub unsafe fn get_private_data<T: vk::Handle>(
&self, &self,
object: T, object: T,
@ -84,14 +88,17 @@ impl PrivateData {
data data
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::ExtPrivateDataFn::name() vk::ExtPrivateDataFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::ExtPrivateDataFn { pub fn fp(&self) -> &vk::ExtPrivateDataFn {
&self.fp &self.fp
} }
#[inline]
pub fn device(&self) -> vk::Device { pub fn device(&self) -> vk::Device {
self.handle self.handle
} }

View file

@ -0,0 +1,54 @@
use crate::vk;
use crate::{Entry, Instance};
use std::ffi::CStr;
use std::mem;
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_EXT_sample_locations.html>
#[derive(Clone)]
pub struct SampleLocations {
fp: vk::ExtSampleLocationsFn,
}
impl SampleLocations {
pub fn new(entry: &Entry, instance: &Instance) -> Self {
let fp = vk::ExtSampleLocationsFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
});
Self { fp }
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceMultisamplePropertiesEXT.html>
#[inline]
pub unsafe fn get_physical_device_multisample_properties(
&self,
physical_device: vk::PhysicalDevice,
samples: vk::SampleCountFlags,
multisample_properties: &mut vk::MultisamplePropertiesEXT,
) {
(self.fp.get_physical_device_multisample_properties_ext)(
physical_device,
samples,
multisample_properties,
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetSampleLocationsEXT.html>
#[inline]
pub unsafe fn cmd_set_sample_locations(
&self,
command_buffer: vk::CommandBuffer,
sample_locations_info: &vk::SampleLocationsInfoEXT,
) {
(self.fp.cmd_set_sample_locations_ext)(command_buffer, sample_locations_info)
}
#[inline]
pub const fn name() -> &'static CStr {
vk::ExtSampleLocationsFn::name()
}
#[inline]
pub fn fp(&self) -> &vk::ExtSampleLocationsFn {
&self.fp
}
}

View file

@ -0,0 +1,719 @@
use crate::prelude::*;
use crate::vk;
use crate::RawPtr;
use crate::{Device, Instance};
use std::ffi::CStr;
use std::mem;
use std::ptr;
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_shader_object.html>
#[derive(Clone)]
pub struct ShaderObject {
handle: vk::Device,
fp: vk::ExtShaderObjectFn,
}
impl ShaderObject {
pub fn new(instance: &Instance, device: &Device) -> Self {
let handle = device.handle();
let fp = vk::ExtShaderObjectFn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr()))
});
Self { handle, fp }
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateShadersEXT.html>
#[inline]
pub unsafe fn create_shaders(
&self,
create_infos: &[vk::ShaderCreateInfoEXT],
allocator: Option<&vk::AllocationCallbacks>,
) -> VkResult<Vec<vk::ShaderEXT>> {
let mut shaders = Vec::with_capacity(create_infos.len());
(self.fp.create_shaders_ext)(
self.handle,
create_infos.len() as u32,
create_infos.as_ptr(),
allocator.as_raw_ptr(),
shaders.as_mut_ptr(),
)
.result()?;
shaders.set_len(create_infos.len());
Ok(shaders)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyShaderEXT.html>
#[inline]
pub unsafe fn destroy_shader(
&self,
shader: vk::ShaderEXT,
allocator: Option<&vk::AllocationCallbacks>,
) {
(self.fp.destroy_shader_ext)(self.handle, shader, allocator.as_raw_ptr())
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetShaderBinaryDataEXT.html>
#[inline]
pub unsafe fn get_shader_binary_data(&self, shader: vk::ShaderEXT) -> VkResult<Vec<u8>> {
read_into_uninitialized_vector(|count, data: *mut u8| {
(self.fp.get_shader_binary_data_ext)(self.handle, shader, count, data.cast())
})
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBindShadersEXT.html>
#[inline]
pub unsafe fn cmd_bind_shaders(
&self,
command_buffer: vk::CommandBuffer,
stages: &[vk::ShaderStageFlags],
shaders: &[vk::ShaderEXT],
) {
assert_eq!(stages.len(), shaders.len());
(self.fp.cmd_bind_shaders_ext)(
command_buffer,
stages.len() as u32,
stages.as_ptr(),
shaders.as_ptr(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetVertexInputEXT.html>
#[inline]
pub unsafe fn cmd_set_vertex_input(
&self,
command_buffer: vk::CommandBuffer,
vertex_binding_descriptions: &[vk::VertexInputBindingDescription2EXT],
vertex_attribute_descriptions: &[vk::VertexInputAttributeDescription2EXT],
) {
(self.fp.cmd_set_vertex_input_ext)(
command_buffer,
vertex_binding_descriptions.len() as u32,
vertex_binding_descriptions.as_ptr(),
vertex_attribute_descriptions.len() as u32,
vertex_attribute_descriptions.as_ptr(),
)
}
// --- extended_dynamic_state functions ---
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetCullModeEXT.html>
#[inline]
pub unsafe fn cmd_set_cull_mode(
&self,
command_buffer: vk::CommandBuffer,
cull_mode: vk::CullModeFlags,
) {
(self.fp.cmd_set_cull_mode_ext)(command_buffer, cull_mode)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetFrontFaceEXT.html>
#[inline]
pub unsafe fn cmd_set_front_face(
&self,
command_buffer: vk::CommandBuffer,
front_face: vk::FrontFace,
) {
(self.fp.cmd_set_front_face_ext)(command_buffer, front_face)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetPrimitiveTopologyEXT.html>
#[inline]
pub unsafe fn cmd_set_primitive_topology(
&self,
command_buffer: vk::CommandBuffer,
primitive_topology: vk::PrimitiveTopology,
) {
(self.fp.cmd_set_primitive_topology_ext)(command_buffer, primitive_topology)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetViewportWithCountEXT.html>
#[inline]
pub unsafe fn cmd_set_viewport_with_count(
&self,
command_buffer: vk::CommandBuffer,
viewports: &[vk::Viewport],
) {
(self.fp.cmd_set_viewport_with_count_ext)(
command_buffer,
viewports.len() as u32,
viewports.as_ptr(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetScissorWithCountEXT.html>
#[inline]
pub unsafe fn cmd_set_scissor_with_count(
&self,
command_buffer: vk::CommandBuffer,
scissors: &[vk::Rect2D],
) {
(self.fp.cmd_set_scissor_with_count_ext)(
command_buffer,
scissors.len() as u32,
scissors.as_ptr(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBindVertexBuffers2EXT.html>
#[inline]
pub unsafe fn cmd_bind_vertex_buffers2(
&self,
command_buffer: vk::CommandBuffer,
first_binding: u32,
buffers: &[vk::Buffer],
offsets: &[vk::DeviceSize],
sizes: Option<&[vk::DeviceSize]>,
strides: Option<&[vk::DeviceSize]>,
) {
assert_eq!(offsets.len(), buffers.len());
let p_sizes = if let Some(sizes) = sizes {
assert_eq!(sizes.len(), buffers.len());
sizes.as_ptr()
} else {
ptr::null()
};
let p_strides = if let Some(strides) = strides {
assert_eq!(strides.len(), buffers.len());
strides.as_ptr()
} else {
ptr::null()
};
(self.fp.cmd_bind_vertex_buffers2_ext)(
command_buffer,
first_binding,
buffers.len() as u32,
buffers.as_ptr(),
offsets.as_ptr(),
p_sizes,
p_strides,
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthTestEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_depth_test_enable(
&self,
command_buffer: vk::CommandBuffer,
depth_test_enable: bool,
) {
(self.fp.cmd_set_depth_test_enable_ext)(command_buffer, depth_test_enable.into())
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthWriteEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_depth_write_enable(
&self,
command_buffer: vk::CommandBuffer,
depth_write_enable: bool,
) {
(self.fp.cmd_set_depth_write_enable_ext)(command_buffer, depth_write_enable.into())
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthCompareOpEXT.html>
#[inline]
pub unsafe fn cmd_set_depth_compare_op(
&self,
command_buffer: vk::CommandBuffer,
depth_compare_op: vk::CompareOp,
) {
(self.fp.cmd_set_depth_compare_op_ext)(command_buffer, depth_compare_op)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthBoundsTestEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_depth_bounds_test_enable(
&self,
command_buffer: vk::CommandBuffer,
depth_bounds_test_enable: bool,
) {
(self.fp.cmd_set_depth_bounds_test_enable_ext)(
command_buffer,
depth_bounds_test_enable.into(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetStencilTestEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_stencil_test_enable(
&self,
command_buffer: vk::CommandBuffer,
stencil_test_enable: bool,
) {
(self.fp.cmd_set_stencil_test_enable_ext)(command_buffer, stencil_test_enable.into())
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetStencilOpEXT.html>
#[inline]
pub unsafe fn cmd_set_stencil_op(
&self,
command_buffer: vk::CommandBuffer,
face_mask: vk::StencilFaceFlags,
fail_op: vk::StencilOp,
pass_op: vk::StencilOp,
depth_fail_op: vk::StencilOp,
compare_op: vk::CompareOp,
) {
(self.fp.cmd_set_stencil_op_ext)(
command_buffer,
face_mask,
fail_op,
pass_op,
depth_fail_op,
compare_op,
)
}
// --- extended_dynamic_state2 functions ---
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetPatchControlPointsEXT.html>
#[inline]
pub unsafe fn cmd_set_patch_control_points(
&self,
command_buffer: vk::CommandBuffer,
patch_control_points: u32,
) {
(self.fp.cmd_set_patch_control_points_ext)(command_buffer, patch_control_points)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetRasterizerDiscardEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_rasterizer_discard_enable(
&self,
command_buffer: vk::CommandBuffer,
rasterizer_discard_enable: bool,
) {
(self.fp.cmd_set_rasterizer_discard_enable_ext)(
command_buffer,
rasterizer_discard_enable.into(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthBiasEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_depth_bias_enable(
&self,
command_buffer: vk::CommandBuffer,
depth_bias_enable: bool,
) {
(self.fp.cmd_set_depth_bias_enable_ext)(command_buffer, depth_bias_enable.into())
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetLogicOpEXT.html>
#[inline]
pub unsafe fn cmd_set_logic_op(
&self,
command_buffer: vk::CommandBuffer,
logic_op: vk::LogicOp,
) {
(self.fp.cmd_set_logic_op_ext)(command_buffer, logic_op)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetPrimitiveRestartEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_primitive_restart_enable(
&self,
command_buffer: vk::CommandBuffer,
primitive_restart_enable: bool,
) {
(self.fp.cmd_set_primitive_restart_enable_ext)(
command_buffer,
primitive_restart_enable.into(),
)
}
// --- extended_dynamic_state3 functions ---
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetTessellationDomainOriginEXT.html>
#[inline]
pub unsafe fn cmd_set_tessellation_domain_origin(
&self,
command_buffer: vk::CommandBuffer,
domain_origin: vk::TessellationDomainOrigin,
) {
(self.fp.cmd_set_tessellation_domain_origin_ext)(command_buffer, domain_origin)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthClampEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_depth_clamp_enable(
&self,
command_buffer: vk::CommandBuffer,
depth_clamp_enable: bool,
) {
(self.fp.cmd_set_depth_clamp_enable_ext)(command_buffer, depth_clamp_enable.into())
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetPolygonModeEXT.html>
#[inline]
pub unsafe fn cmd_set_polygon_mode(
&self,
command_buffer: vk::CommandBuffer,
polygon_mode: vk::PolygonMode,
) {
(self.fp.cmd_set_polygon_mode_ext)(command_buffer, polygon_mode)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetRasterizationSamplesEXT.html>
#[inline]
pub unsafe fn cmd_set_rasterization_samples(
&self,
command_buffer: vk::CommandBuffer,
rasterization_samples: vk::SampleCountFlags,
) {
(self.fp.cmd_set_rasterization_samples_ext)(command_buffer, rasterization_samples)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetSampleMaskEXT.html>
#[inline]
pub unsafe fn cmd_set_sample_mask(
&self,
command_buffer: vk::CommandBuffer,
samples: vk::SampleCountFlags,
sample_mask: &[vk::SampleMask],
) {
assert!(
samples.as_raw().is_power_of_two(),
"Only one SampleCount bit must be set"
);
assert_eq!(samples.as_raw() as usize / 32, sample_mask.len());
(self.fp.cmd_set_sample_mask_ext)(command_buffer, samples, sample_mask.as_ptr())
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetAlphaToCoverageEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_alpha_to_coverage_enable(
&self,
command_buffer: vk::CommandBuffer,
alpha_to_coverage_enable: bool,
) {
(self.fp.cmd_set_alpha_to_coverage_enable_ext)(
command_buffer,
alpha_to_coverage_enable.into(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetAlphaToOneEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_alpha_to_one_enable(
&self,
command_buffer: vk::CommandBuffer,
alpha_to_one_enable: bool,
) {
(self.fp.cmd_set_alpha_to_one_enable_ext)(command_buffer, alpha_to_one_enable.into())
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetLogicOpEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_logic_op_enable(
&self,
command_buffer: vk::CommandBuffer,
logic_op_enable: bool,
) {
(self.fp.cmd_set_logic_op_enable_ext)(command_buffer, logic_op_enable.into())
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetColorBlendEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_color_blend_enable(
&self,
command_buffer: vk::CommandBuffer,
first_attachment: u32,
color_blend_enables: &[vk::Bool32],
) {
(self.fp.cmd_set_color_blend_enable_ext)(
command_buffer,
first_attachment,
color_blend_enables.len() as u32,
color_blend_enables.as_ptr(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetColorBlendEquationEXT.html>
#[inline]
pub unsafe fn cmd_set_color_blend_equation(
&self,
command_buffer: vk::CommandBuffer,
first_attachment: u32,
color_blend_equations: &[vk::ColorBlendEquationEXT],
) {
(self.fp.cmd_set_color_blend_equation_ext)(
command_buffer,
first_attachment,
color_blend_equations.len() as u32,
color_blend_equations.as_ptr(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetColorWriteMaskEXT.html>
#[inline]
pub unsafe fn cmd_set_color_write_mask(
&self,
command_buffer: vk::CommandBuffer,
first_attachment: u32,
color_write_masks: &[vk::ColorComponentFlags],
) {
(self.fp.cmd_set_color_write_mask_ext)(
command_buffer,
first_attachment,
color_write_masks.len() as u32,
color_write_masks.as_ptr(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetRasterizationStreamEXT.html>
#[inline]
pub unsafe fn cmd_set_rasterization_stream(
&self,
command_buffer: vk::CommandBuffer,
rasterization_stream: u32,
) {
(self.fp.cmd_set_rasterization_stream_ext)(command_buffer, rasterization_stream)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetConservativeRasterizationModeEXT.html>
#[inline]
pub unsafe fn cmd_set_conservative_rasterization_mode(
&self,
command_buffer: vk::CommandBuffer,
conservative_rasterization_mode: vk::ConservativeRasterizationModeEXT,
) {
(self.fp.cmd_set_conservative_rasterization_mode_ext)(
command_buffer,
conservative_rasterization_mode,
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetExtraPrimitiveOverestimationSizeEXT.html>
#[inline]
pub unsafe fn cmd_set_extra_primitive_overestimation_size(
&self,
command_buffer: vk::CommandBuffer,
extra_primitive_overestimation_size: f32,
) {
(self.fp.cmd_set_extra_primitive_overestimation_size_ext)(
command_buffer,
extra_primitive_overestimation_size,
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthClipEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_depth_clip_enable(
&self,
command_buffer: vk::CommandBuffer,
depth_clip_enable: bool,
) {
(self.fp.cmd_set_depth_clip_enable_ext)(command_buffer, depth_clip_enable.into())
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetSampleLocationsEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_sample_locations_enable(
&self,
command_buffer: vk::CommandBuffer,
sample_locations_enable: bool,
) {
(self.fp.cmd_set_sample_locations_enable_ext)(
command_buffer,
sample_locations_enable.into(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetColorBlendAdvancedEXT.html>
#[inline]
pub unsafe fn cmd_set_color_blend_advanced(
&self,
command_buffer: vk::CommandBuffer,
first_attachment: u32,
color_blend_advanced: &[vk::ColorBlendAdvancedEXT],
) {
(self.fp.cmd_set_color_blend_advanced_ext)(
command_buffer,
first_attachment,
color_blend_advanced.len() as u32,
color_blend_advanced.as_ptr(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetProvokingVertexModeEXT.html>
#[inline]
pub unsafe fn cmd_set_provoking_vertex_mode(
&self,
command_buffer: vk::CommandBuffer,
provoking_vertex_mode: vk::ProvokingVertexModeEXT,
) {
(self.fp.cmd_set_provoking_vertex_mode_ext)(command_buffer, provoking_vertex_mode)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetLineRasterizationModeEXT.html>
#[inline]
pub unsafe fn cmd_set_line_rasterization_mode(
&self,
command_buffer: vk::CommandBuffer,
line_rasterization_mode: vk::LineRasterizationModeEXT,
) {
(self.fp.cmd_set_line_rasterization_mode_ext)(command_buffer, line_rasterization_mode)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetLineStippleEnableEXT.html>
#[inline]
pub unsafe fn cmd_set_line_stipple_enable(
&self,
command_buffer: vk::CommandBuffer,
stippled_line_enable: bool,
) {
(self.fp.cmd_set_line_stipple_enable_ext)(command_buffer, stippled_line_enable.into())
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthClipNegativeOneToOneEXT.html>
#[inline]
pub unsafe fn cmd_set_depth_clip_negative_one_to_one(
&self,
command_buffer: vk::CommandBuffer,
negative_one_to_one: bool,
) {
(self.fp.cmd_set_depth_clip_negative_one_to_one_ext)(
command_buffer,
negative_one_to_one.into(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetViewportWScalingEnableNV.html>
#[inline]
pub unsafe fn cmd_set_viewport_w_scaling_enable_nv(
&self,
command_buffer: vk::CommandBuffer,
viewport_w_scaling_enable: bool,
) {
(self.fp.cmd_set_viewport_w_scaling_enable_nv)(
command_buffer,
viewport_w_scaling_enable.into(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetViewportSwizzleNV.html>
#[inline]
pub unsafe fn cmd_set_viewport_swizzle_nv(
&self,
command_buffer: vk::CommandBuffer,
first_attachment: u32,
viewport_swizzles: &[vk::ViewportSwizzleNV],
) {
(self.fp.cmd_set_viewport_swizzle_nv)(
command_buffer,
first_attachment,
viewport_swizzles.len() as u32,
viewport_swizzles.as_ptr(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetCoverageToColorEnableNV.html>
#[inline]
pub unsafe fn cmd_set_coverage_to_color_enable_nv(
&self,
command_buffer: vk::CommandBuffer,
coverage_to_color_enable: bool,
) {
(self.fp.cmd_set_coverage_to_color_enable_nv)(
command_buffer,
coverage_to_color_enable.into(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetCoverageToColorLocationNV.html>
#[inline]
pub unsafe fn cmd_set_coverage_to_color_location_nv(
&self,
command_buffer: vk::CommandBuffer,
coverage_to_color_location: u32,
) {
(self.fp.cmd_set_coverage_to_color_location_nv)(command_buffer, coverage_to_color_location)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetCoverageModulationModeNV.html>
#[inline]
pub unsafe fn cmd_set_coverage_modulation_mode_nv(
&self,
command_buffer: vk::CommandBuffer,
coverage_modulation_mode: vk::CoverageModulationModeNV,
) {
(self.fp.cmd_set_coverage_modulation_mode_nv)(command_buffer, coverage_modulation_mode)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetCoverageModulationTableEnableNV.html>
#[inline]
pub unsafe fn cmd_set_coverage_modulation_table_enable_nv(
&self,
command_buffer: vk::CommandBuffer,
coverage_modulation_table_enable: bool,
) {
(self.fp.cmd_set_coverage_modulation_table_enable_nv)(
command_buffer,
coverage_modulation_table_enable.into(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetCoverageModulationTableNV.html>
#[inline]
pub unsafe fn cmd_set_coverage_modulation_table_nv(
&self,
command_buffer: vk::CommandBuffer,
coverage_modulation_table: &[f32],
) {
(self.fp.cmd_set_coverage_modulation_table_nv)(
command_buffer,
coverage_modulation_table.len() as u32,
coverage_modulation_table.as_ptr(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetShadingRateImageEnableNV.html>
#[inline]
pub unsafe fn cmd_set_shading_rate_image_enable_nv(
&self,
command_buffer: vk::CommandBuffer,
shading_rate_image_enable: bool,
) {
(self.fp.cmd_set_shading_rate_image_enable_nv)(
command_buffer,
shading_rate_image_enable.into(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetRepresentativeFragmentTestEnableNV.html>
#[inline]
pub unsafe fn cmd_set_representative_fragment_test_enable_nv(
&self,
command_buffer: vk::CommandBuffer,
representative_fragment_test_enable: bool,
) {
(self.fp.cmd_set_representative_fragment_test_enable_nv)(
command_buffer,
representative_fragment_test_enable.into(),
)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetCoverageReductionModeNV.html>
#[inline]
pub unsafe fn cmd_set_coverage_reduction_mode_nv(
&self,
command_buffer: vk::CommandBuffer,
coverage_reduction_mode: vk::CoverageReductionModeNV,
) {
(self.fp.cmd_set_coverage_reduction_mode_nv)(command_buffer, coverage_reduction_mode)
}
pub const fn name() -> &'static CStr {
vk::ExtShaderObjectFn::name()
}
#[inline]
pub fn fp(&self) -> &vk::ExtShaderObjectFn {
&self.fp
}
#[inline]
pub fn device(&self) -> vk::Device {
self.handle
}
}

View file

@ -18,6 +18,7 @@ impl ToolingInfo {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceToolPropertiesEXT.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceToolPropertiesEXT.html>
#[inline]
pub unsafe fn get_physical_device_tool_properties( pub unsafe fn get_physical_device_tool_properties(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -27,10 +28,12 @@ impl ToolingInfo {
}) })
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::ExtToolingInfoFn::name() vk::ExtToolingInfoFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::ExtToolingInfoFn { pub fn fp(&self) -> &vk::ExtToolingInfoFn {
&self.fp &self.fp
} }

View file

@ -20,6 +20,7 @@ impl AccelerationStructure {
Self { handle, fp } Self { handle, fp }
} }
#[inline]
pub unsafe fn get_properties( pub unsafe fn get_properties(
instance: &Instance, instance: &Instance,
pdevice: vk::PhysicalDevice, pdevice: vk::PhysicalDevice,
@ -33,6 +34,7 @@ impl AccelerationStructure {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateAccelerationStructureKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateAccelerationStructureKHR.html>
#[inline]
pub unsafe fn create_acceleration_structure( pub unsafe fn create_acceleration_structure(
&self, &self,
create_info: &vk::AccelerationStructureCreateInfoKHR, create_info: &vk::AccelerationStructureCreateInfoKHR,
@ -49,6 +51,7 @@ impl AccelerationStructure {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyAccelerationStructureKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyAccelerationStructureKHR.html>
#[inline]
pub unsafe fn destroy_acceleration_structure( pub unsafe fn destroy_acceleration_structure(
&self, &self,
accel_struct: vk::AccelerationStructureKHR, accel_struct: vk::AccelerationStructureKHR,
@ -62,6 +65,7 @@ impl AccelerationStructure {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBuildAccelerationStructuresKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBuildAccelerationStructuresKHR.html>
#[inline]
pub unsafe fn cmd_build_acceleration_structures( pub unsafe fn cmd_build_acceleration_structures(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -88,6 +92,7 @@ impl AccelerationStructure {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBuildAccelerationStructuresIndirectKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBuildAccelerationStructuresIndirectKHR.html>
#[inline]
pub unsafe fn cmd_build_acceleration_structures_indirect( pub unsafe fn cmd_build_acceleration_structures_indirect(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -120,6 +125,7 @@ impl AccelerationStructure {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkBuildAccelerationStructuresKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkBuildAccelerationStructuresKHR.html>
#[inline]
pub unsafe fn build_acceleration_structures( pub unsafe fn build_acceleration_structures(
&self, &self,
deferred_operation: vk::DeferredOperationKHR, deferred_operation: vk::DeferredOperationKHR,
@ -148,6 +154,7 @@ impl AccelerationStructure {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCopyAccelerationStructureKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCopyAccelerationStructureKHR.html>
#[inline]
pub unsafe fn copy_acceleration_structure( pub unsafe fn copy_acceleration_structure(
&self, &self,
deferred_operation: vk::DeferredOperationKHR, deferred_operation: vk::DeferredOperationKHR,
@ -157,6 +164,7 @@ impl AccelerationStructure {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCopyAccelerationStructureToMemoryKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCopyAccelerationStructureToMemoryKHR.html>
#[inline]
pub unsafe fn copy_acceleration_structure_to_memory( pub unsafe fn copy_acceleration_structure_to_memory(
&self, &self,
deferred_operation: vk::DeferredOperationKHR, deferred_operation: vk::DeferredOperationKHR,
@ -167,6 +175,7 @@ impl AccelerationStructure {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCopyMemoryToAccelerationStructureKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCopyMemoryToAccelerationStructureKHR.html>
#[inline]
pub unsafe fn copy_memory_to_acceleration_structure( pub unsafe fn copy_memory_to_acceleration_structure(
&self, &self,
deferred_operation: vk::DeferredOperationKHR, deferred_operation: vk::DeferredOperationKHR,
@ -177,6 +186,7 @@ impl AccelerationStructure {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkWriteAccelerationStructuresPropertiesKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkWriteAccelerationStructuresPropertiesKHR.html>
#[inline]
pub unsafe fn write_acceleration_structures_properties( pub unsafe fn write_acceleration_structures_properties(
&self, &self,
acceleration_structures: &[vk::AccelerationStructureKHR], acceleration_structures: &[vk::AccelerationStructureKHR],
@ -190,13 +200,14 @@ impl AccelerationStructure {
acceleration_structures.as_ptr(), acceleration_structures.as_ptr(),
query_type, query_type,
data.len(), data.len(),
data.as_mut_ptr() as *mut std::ffi::c_void, data.as_mut_ptr().cast(),
stride, stride,
) )
.result() .result()
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdCopyAccelerationStructureKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdCopyAccelerationStructureKHR.html>
#[inline]
pub unsafe fn cmd_copy_acceleration_structure( pub unsafe fn cmd_copy_acceleration_structure(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -206,6 +217,7 @@ impl AccelerationStructure {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdCopyAccelerationStructureToMemoryKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdCopyAccelerationStructureToMemoryKHR.html>
#[inline]
pub unsafe fn cmd_copy_acceleration_structure_to_memory( pub unsafe fn cmd_copy_acceleration_structure_to_memory(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -215,6 +227,7 @@ impl AccelerationStructure {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdCopyMemoryToAccelerationStructureKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdCopyMemoryToAccelerationStructureKHR.html>
#[inline]
pub unsafe fn cmd_copy_memory_to_acceleration_structure( pub unsafe fn cmd_copy_memory_to_acceleration_structure(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -224,6 +237,7 @@ impl AccelerationStructure {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetAccelerationStructureHandleKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetAccelerationStructureHandleKHR.html>
#[inline]
pub unsafe fn get_acceleration_structure_device_address( pub unsafe fn get_acceleration_structure_device_address(
&self, &self,
info: &vk::AccelerationStructureDeviceAddressInfoKHR, info: &vk::AccelerationStructureDeviceAddressInfoKHR,
@ -232,6 +246,7 @@ impl AccelerationStructure {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdWriteAccelerationStructuresPropertiesKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdWriteAccelerationStructuresPropertiesKHR.html>
#[inline]
pub unsafe fn cmd_write_acceleration_structures_properties( pub unsafe fn cmd_write_acceleration_structures_properties(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -251,6 +266,7 @@ impl AccelerationStructure {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceAccelerationStructureCompatibilityKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceAccelerationStructureCompatibilityKHR.html>
#[inline]
pub unsafe fn get_device_acceleration_structure_compatibility( pub unsafe fn get_device_acceleration_structure_compatibility(
&self, &self,
version: &vk::AccelerationStructureVersionInfoKHR, version: &vk::AccelerationStructureVersionInfoKHR,
@ -267,6 +283,7 @@ impl AccelerationStructure {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetAccelerationStructureBuildSizesKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetAccelerationStructureBuildSizesKHR.html>
#[inline]
pub unsafe fn get_acceleration_structure_build_sizes( pub unsafe fn get_acceleration_structure_build_sizes(
&self, &self,
build_type: vk::AccelerationStructureBuildTypeKHR, build_type: vk::AccelerationStructureBuildTypeKHR,
@ -288,14 +305,17 @@ impl AccelerationStructure {
size_info size_info
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrAccelerationStructureFn::name() vk::KhrAccelerationStructureFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrAccelerationStructureFn { pub fn fp(&self) -> &vk::KhrAccelerationStructureFn {
&self.fp &self.fp
} }
#[inline]
pub fn device(&self) -> vk::Device { pub fn device(&self) -> vk::Device {
self.handle self.handle
} }

View file

@ -21,6 +21,7 @@ impl AndroidSurface {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateAndroidSurfaceKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateAndroidSurfaceKHR.html>
#[inline]
pub unsafe fn create_android_surface( pub unsafe fn create_android_surface(
&self, &self,
create_info: &vk::AndroidSurfaceCreateInfoKHR, create_info: &vk::AndroidSurfaceCreateInfoKHR,
@ -36,14 +37,17 @@ impl AndroidSurface {
.result_with_success(surface) .result_with_success(surface)
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrAndroidSurfaceFn::name() vk::KhrAndroidSurfaceFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrAndroidSurfaceFn { pub fn fp(&self) -> &vk::KhrAndroidSurfaceFn {
&self.fp &self.fp
} }
#[inline]
pub fn instance(&self) -> vk::Instance { pub fn instance(&self) -> vk::Instance {
self.handle self.handle
} }

View file

@ -19,6 +19,7 @@ impl BufferDeviceAddress {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetBufferDeviceAddressKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetBufferDeviceAddressKHR.html>
#[inline]
pub unsafe fn get_buffer_device_address( pub unsafe fn get_buffer_device_address(
&self, &self,
info: &vk::BufferDeviceAddressInfoKHR, info: &vk::BufferDeviceAddressInfoKHR,
@ -27,6 +28,7 @@ impl BufferDeviceAddress {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetBufferOpaqueCaptureAddressKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetBufferOpaqueCaptureAddressKHR.html>
#[inline]
pub unsafe fn get_buffer_opaque_capture_address( pub unsafe fn get_buffer_opaque_capture_address(
&self, &self,
info: &vk::BufferDeviceAddressInfoKHR, info: &vk::BufferDeviceAddressInfoKHR,
@ -35,6 +37,7 @@ impl BufferDeviceAddress {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceMemoryOpaqueCaptureAddressKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceMemoryOpaqueCaptureAddressKHR.html>
#[inline]
pub unsafe fn get_device_memory_opaque_capture_address( pub unsafe fn get_device_memory_opaque_capture_address(
&self, &self,
info: &vk::DeviceMemoryOpaqueCaptureAddressInfoKHR, info: &vk::DeviceMemoryOpaqueCaptureAddressInfoKHR,
@ -42,14 +45,17 @@ impl BufferDeviceAddress {
(self.fp.get_device_memory_opaque_capture_address_khr)(self.handle, info) (self.fp.get_device_memory_opaque_capture_address_khr)(self.handle, info)
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrBufferDeviceAddressFn::name() vk::KhrBufferDeviceAddressFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrBufferDeviceAddressFn { pub fn fp(&self) -> &vk::KhrBufferDeviceAddressFn {
&self.fp &self.fp
} }
#[inline]
pub fn device(&self) -> vk::Device { pub fn device(&self) -> vk::Device {
self.handle self.handle
} }

View file

@ -18,6 +18,7 @@ impl CopyCommands2 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdCopyBuffer2KHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdCopyBuffer2KHR.html>
#[inline]
pub unsafe fn cmd_copy_buffer2( pub unsafe fn cmd_copy_buffer2(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -26,6 +27,7 @@ impl CopyCommands2 {
(self.fp.cmd_copy_buffer2_khr)(command_buffer, copy_buffer_info) (self.fp.cmd_copy_buffer2_khr)(command_buffer, copy_buffer_info)
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdCopyImage2KHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdCopyImage2KHR.html>
#[inline]
pub unsafe fn cmd_copy_image2( pub unsafe fn cmd_copy_image2(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -34,6 +36,7 @@ impl CopyCommands2 {
(self.fp.cmd_copy_image2_khr)(command_buffer, copy_image_info) (self.fp.cmd_copy_image2_khr)(command_buffer, copy_image_info)
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdCopyBufferToImage2KHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdCopyBufferToImage2KHR.html>
#[inline]
pub unsafe fn cmd_copy_buffer_to_image2( pub unsafe fn cmd_copy_buffer_to_image2(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -42,6 +45,7 @@ impl CopyCommands2 {
(self.fp.cmd_copy_buffer_to_image2_khr)(command_buffer, copy_buffer_to_image_info) (self.fp.cmd_copy_buffer_to_image2_khr)(command_buffer, copy_buffer_to_image_info)
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdCopyImageToBuffer2KHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdCopyImageToBuffer2KHR.html>
#[inline]
pub unsafe fn cmd_copy_image_to_buffer2( pub unsafe fn cmd_copy_image_to_buffer2(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -50,6 +54,7 @@ impl CopyCommands2 {
(self.fp.cmd_copy_image_to_buffer2_khr)(command_buffer, copy_image_to_buffer_info) (self.fp.cmd_copy_image_to_buffer2_khr)(command_buffer, copy_image_to_buffer_info)
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBlitImage2KHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBlitImage2KHR.html>
#[inline]
pub unsafe fn cmd_blit_image2( pub unsafe fn cmd_blit_image2(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -58,6 +63,7 @@ impl CopyCommands2 {
(self.fp.cmd_blit_image2_khr)(command_buffer, blit_image_info) (self.fp.cmd_blit_image2_khr)(command_buffer, blit_image_info)
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdResolveImage2KHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdResolveImage2KHR.html>
#[inline]
pub unsafe fn cmd_resolve_image2( pub unsafe fn cmd_resolve_image2(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -66,10 +72,12 @@ impl CopyCommands2 {
(self.fp.cmd_resolve_image2_khr)(command_buffer, resolve_image_info) (self.fp.cmd_resolve_image2_khr)(command_buffer, resolve_image_info)
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrCopyCommands2Fn::name() vk::KhrCopyCommands2Fn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrCopyCommands2Fn { pub fn fp(&self) -> &vk::KhrCopyCommands2Fn {
&self.fp &self.fp
} }

View file

@ -21,6 +21,7 @@ impl CreateRenderPass2 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateRenderPass2.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateRenderPass2.html>
#[inline]
pub unsafe fn create_render_pass2( pub unsafe fn create_render_pass2(
&self, &self,
create_info: &vk::RenderPassCreateInfo2, create_info: &vk::RenderPassCreateInfo2,
@ -37,6 +38,7 @@ impl CreateRenderPass2 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBeginRenderPass2.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBeginRenderPass2.html>
#[inline]
pub unsafe fn cmd_begin_render_pass2( pub unsafe fn cmd_begin_render_pass2(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -51,6 +53,7 @@ impl CreateRenderPass2 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdNextSubpass2.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdNextSubpass2.html>
#[inline]
pub unsafe fn cmd_next_subpass2( pub unsafe fn cmd_next_subpass2(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -61,6 +64,7 @@ impl CreateRenderPass2 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdEndRenderPass2.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdEndRenderPass2.html>
#[inline]
pub unsafe fn cmd_end_render_pass2( pub unsafe fn cmd_end_render_pass2(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -69,14 +73,17 @@ impl CreateRenderPass2 {
(self.fp.cmd_end_render_pass2_khr)(command_buffer, subpass_end_info); (self.fp.cmd_end_render_pass2_khr)(command_buffer, subpass_end_info);
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrCreateRenderpass2Fn::name() vk::KhrCreateRenderpass2Fn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrCreateRenderpass2Fn { pub fn fp(&self) -> &vk::KhrCreateRenderpass2Fn {
&self.fp &self.fp
} }
#[inline]
pub fn device(&self) -> vk::Device { pub fn device(&self) -> vk::Device {
self.handle self.handle
} }

View file

@ -21,6 +21,7 @@ impl DeferredHostOperations {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateDeferredOperationKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateDeferredOperationKHR.html>
#[inline]
pub unsafe fn create_deferred_operation( pub unsafe fn create_deferred_operation(
&self, &self,
allocation_callbacks: Option<&vk::AllocationCallbacks>, allocation_callbacks: Option<&vk::AllocationCallbacks>,
@ -35,6 +36,7 @@ impl DeferredHostOperations {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDeferredOperationJoinKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDeferredOperationJoinKHR.html>
#[inline]
pub unsafe fn deferred_operation_join( pub unsafe fn deferred_operation_join(
&self, &self,
operation: vk::DeferredOperationKHR, operation: vk::DeferredOperationKHR,
@ -43,6 +45,7 @@ impl DeferredHostOperations {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyDeferredOperationKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyDeferredOperationKHR.html>
#[inline]
pub unsafe fn destroy_deferred_operation( pub unsafe fn destroy_deferred_operation(
&self, &self,
operation: vk::DeferredOperationKHR, operation: vk::DeferredOperationKHR,
@ -56,6 +59,7 @@ impl DeferredHostOperations {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeferredOperationMaxConcurrencyKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeferredOperationMaxConcurrencyKHR.html>
#[inline]
pub unsafe fn get_deferred_operation_max_concurrency( pub unsafe fn get_deferred_operation_max_concurrency(
&self, &self,
operation: vk::DeferredOperationKHR, operation: vk::DeferredOperationKHR,
@ -64,6 +68,7 @@ impl DeferredHostOperations {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeferredOperationResultKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeferredOperationResultKHR.html>
#[inline]
pub unsafe fn get_deferred_operation_result( pub unsafe fn get_deferred_operation_result(
&self, &self,
operation: vk::DeferredOperationKHR, operation: vk::DeferredOperationKHR,
@ -71,14 +76,17 @@ impl DeferredHostOperations {
(self.fp.get_deferred_operation_result_khr)(self.handle, operation).result() (self.fp.get_deferred_operation_result_khr)(self.handle, operation).result()
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrDeferredHostOperationsFn::name() vk::KhrDeferredHostOperationsFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrDeferredHostOperationsFn { pub fn fp(&self) -> &vk::KhrDeferredHostOperationsFn {
&self.fp &self.fp
} }
#[inline]
pub fn device(&self) -> vk::Device { pub fn device(&self) -> vk::Device {
self.handle self.handle
} }

View file

@ -0,0 +1,193 @@
#[cfg(doc)]
use super::Swapchain;
use crate::prelude::*;
use crate::vk;
use crate::{Device, Entry, Instance};
use std::ffi::CStr;
use std::mem;
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_KHR_device_group.html>
#[derive(Clone)]
pub struct DeviceGroup {
handle: vk::Device,
fp: vk::KhrDeviceGroupFn,
}
impl DeviceGroup {
/// # Warning
/// [`Instance`] functions cannot be loaded from a [`Device`] and will always panic when called:
/// - [`Self::get_physical_device_present_rectangles()`]
///
/// Load this struct using an [`Instance`] instead via [`Self::new_from_instance()`] if the
/// above [`Instance`] function is called. This will be solved in the next breaking `ash`
/// release: <https://github.com/ash-rs/ash/issues/727>.
pub fn new(instance: &Instance, device: &Device) -> Self {
let handle = device.handle();
let fp = vk::KhrDeviceGroupFn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr()))
});
Self { handle, fp }
}
/// Loads all functions on the [`Instance`] instead of [`Device`]. This incurs an extra
/// dispatch table for [`Device`] functions but also allows the [`Instance`] function to be
/// loaded instead of always panicking. See also [`Self::new()`] for more details.
///
/// It is okay to pass [`vk::Device::null()`] when this struct is only used to call the
/// [`Instance`] function.
pub fn new_from_instance(entry: &Entry, instance: &Instance, device: vk::Device) -> Self {
let fp = vk::KhrDeviceGroupFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
});
Self { handle: device, fp }
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceGroupPeerMemoryFeaturesKHR.html>
#[inline]
pub unsafe fn get_device_group_peer_memory_features(
&self,
heap_index: u32,
local_device_index: u32,
remote_device_index: u32,
) -> vk::PeerMemoryFeatureFlags {
let mut peer_memory_features = mem::zeroed();
(self.fp.get_device_group_peer_memory_features_khr)(
self.handle,
heap_index,
local_device_index,
remote_device_index,
&mut peer_memory_features,
);
peer_memory_features
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDeviceMaskKHR.html>
#[inline]
pub unsafe fn cmd_set_device_mask(&self, command_buffer: vk::CommandBuffer, device_mask: u32) {
(self.fp.cmd_set_device_mask_khr)(command_buffer, device_mask)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdDispatchBaseKHR.html>
#[inline]
pub unsafe fn cmd_dispatch_base(
&self,
command_buffer: vk::CommandBuffer,
base_group: (u32, u32, u32),
group_count: (u32, u32, u32),
) {
(self.fp.cmd_dispatch_base_khr)(
command_buffer,
base_group.0,
base_group.1,
base_group.2,
group_count.0,
group_count.1,
group_count.2,
)
}
/// Requires [`VK_KHR_surface`] to be enabled.
///
/// Also available as [`Swapchain::get_device_group_present_capabilities()`] since [Vulkan 1.1].
///
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceGroupPresentCapabilitiesKHR.html>
///
/// [Vulkan 1.1]: https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_VERSION_1_1.html
/// [`VK_KHR_surface`]: https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_KHR_surface.html
#[inline]
pub unsafe fn get_device_group_present_capabilities(
&self,
device_group_present_capabilities: &mut vk::DeviceGroupPresentCapabilitiesKHR,
) -> VkResult<()> {
(self.fp.get_device_group_present_capabilities_khr)(
self.handle,
device_group_present_capabilities,
)
.result()
}
/// Requires [`VK_KHR_surface`] to be enabled.
///
/// Also available as [`Swapchain::get_device_group_surface_present_modes()`] since [Vulkan 1.1].
///
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceGroupSurfacePresentModesKHR.html>
///
/// [Vulkan 1.1]: https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_VERSION_1_1.html
/// [`VK_KHR_surface`]: https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_KHR_surface.html
#[inline]
pub unsafe fn get_device_group_surface_present_modes(
&self,
surface: vk::SurfaceKHR,
) -> VkResult<vk::DeviceGroupPresentModeFlagsKHR> {
let mut modes = mem::zeroed();
(self.fp.get_device_group_surface_present_modes_khr)(self.handle, surface, &mut modes)
.result_with_success(modes)
}
/// Requires [`VK_KHR_surface`] to be enabled.
///
/// Also available as [`Swapchain::get_physical_device_present_rectangles()`] since [Vulkan 1.1].
///
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDevicePresentRectanglesKHR.html>
///
/// [Vulkan 1.1]: https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_VERSION_1_1.html
/// [`VK_KHR_surface`]: https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_KHR_surface.html
///
/// # Warning
///
/// Function will always panic unless this struct is loaded via [`Self::new_from_instance()`].
#[inline]
pub unsafe fn get_physical_device_present_rectangles(
&self,
physical_device: vk::PhysicalDevice,
surface: vk::SurfaceKHR,
) -> VkResult<Vec<vk::Rect2D>> {
read_into_uninitialized_vector(|count, data| {
(self.fp.get_physical_device_present_rectangles_khr)(
physical_device,
surface,
count,
data,
)
})
}
/// On success, returns the next image's index and whether the swapchain is suboptimal for the surface.
///
/// Requires [`VK_KHR_swapchain`] to be enabled.
///
/// Also available as [`Swapchain::acquire_next_image2()`] since [Vulkan 1.1].
///
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkAcquireNextImage2KHR.html>
///
/// [Vulkan 1.1]: https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_VERSION_1_1.html
/// [`VK_KHR_swapchain`]: https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_KHR_swapchain.html
#[inline]
pub unsafe fn acquire_next_image2(
&self,
acquire_info: &vk::AcquireNextImageInfoKHR,
) -> VkResult<(u32, bool)> {
let mut index = 0;
let err_code = (self.fp.acquire_next_image2_khr)(self.handle, acquire_info, &mut index);
match err_code {
vk::Result::SUCCESS => Ok((index, false)),
vk::Result::SUBOPTIMAL_KHR => Ok((index, true)),
_ => Err(err_code),
}
}
#[inline]
pub const fn name() -> &'static CStr {
vk::KhrDeviceGroupFn::name()
}
#[inline]
pub fn fp(&self) -> &vk::KhrDeviceGroupFn {
&self.fp
}
#[inline]
pub fn device(&self) -> vk::Device {
self.handle
}
}

View file

@ -0,0 +1,72 @@
use crate::prelude::*;
use crate::vk;
use crate::{Entry, Instance};
use std::ffi::CStr;
use std::mem;
use std::ptr;
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_KHR_device_group_creation.html>
#[derive(Clone)]
pub struct DeviceGroupCreation {
handle: vk::Instance,
fp: vk::KhrDeviceGroupCreationFn,
}
impl DeviceGroupCreation {
pub fn new(entry: Entry, instance: &Instance) -> Self {
let handle = instance.handle();
let fp = vk::KhrDeviceGroupCreationFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(handle, name.as_ptr()))
});
Self { handle, fp }
}
/// Retrieve the number of elements to pass to [`enumerate_physical_device_groups()`][Self::enumerate_physical_device_groups()]
#[inline]
pub unsafe fn enumerate_physical_device_groups_len(&self) -> VkResult<usize> {
let mut group_count = 0;
(self.fp.enumerate_physical_device_groups_khr)(
self.handle,
&mut group_count,
ptr::null_mut(),
)
.result_with_success(group_count as usize)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumeratePhysicalDeviceGroupsKHR.html>
///
/// Call [`enumerate_physical_device_groups_len()`][Self::enumerate_physical_device_groups_len()] to query the number of elements to pass to `out`.
/// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer.
#[inline]
pub unsafe fn enumerate_physical_device_groups(
&self,
out: &mut [vk::PhysicalDeviceGroupProperties],
) -> VkResult<()> {
let mut count = out.len() as u32;
(self.fp.enumerate_physical_device_groups_khr)(self.handle, &mut count, out.as_mut_ptr())
.result()?;
assert_eq!(count as usize, out.len());
Ok(())
}
#[inline]
pub const fn name() -> &'static CStr {
vk::KhrDeviceGroupCreationFn::name()
}
#[inline]
pub fn fp(&self) -> &vk::KhrDeviceGroupCreationFn {
&self.fp
}
#[deprecated = "typo: this function is called `device()`, but returns an `Instance`."]
#[inline]
pub fn device(&self) -> vk::Instance {
self.handle
}
#[inline]
pub fn instance(&self) -> vk::Instance {
self.handle
}
}

View file

@ -21,6 +21,7 @@ impl Display {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceDisplayPropertiesKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceDisplayPropertiesKHR.html>
#[inline]
pub unsafe fn get_physical_device_display_properties( pub unsafe fn get_physical_device_display_properties(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -31,6 +32,7 @@ impl Display {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceDisplayPlanePropertiesKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceDisplayPlanePropertiesKHR.html>
#[inline]
pub unsafe fn get_physical_device_display_plane_properties( pub unsafe fn get_physical_device_display_plane_properties(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -41,6 +43,7 @@ impl Display {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDisplayPlaneSupportedDisplaysKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDisplayPlaneSupportedDisplaysKHR.html>
#[inline]
pub unsafe fn get_display_plane_supported_displays( pub unsafe fn get_display_plane_supported_displays(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -57,6 +60,7 @@ impl Display {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDisplayModePropertiesKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDisplayModePropertiesKHR.html>
#[inline]
pub unsafe fn get_display_mode_properties( pub unsafe fn get_display_mode_properties(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -68,6 +72,7 @@ impl Display {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateDisplayModeKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateDisplayModeKHR.html>
#[inline]
pub unsafe fn create_display_mode( pub unsafe fn create_display_mode(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -83,10 +88,11 @@ impl Display {
allocation_callbacks.as_raw_ptr(), allocation_callbacks.as_raw_ptr(),
display_mode.as_mut_ptr(), display_mode.as_mut_ptr(),
) )
.result_with_success(display_mode.assume_init()) .assume_init_on_success(display_mode)
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDisplayPlaneCapabilitiesKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDisplayPlaneCapabilitiesKHR.html>
#[inline]
pub unsafe fn get_display_plane_capabilities( pub unsafe fn get_display_plane_capabilities(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -100,10 +106,11 @@ impl Display {
plane_index, plane_index,
display_plane_capabilities.as_mut_ptr(), display_plane_capabilities.as_mut_ptr(),
) )
.result_with_success(display_plane_capabilities.assume_init()) .assume_init_on_success(display_plane_capabilities)
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateDisplayPlaneSurfaceKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateDisplayPlaneSurfaceKHR.html>
#[inline]
pub unsafe fn create_display_plane_surface( pub unsafe fn create_display_plane_surface(
&self, &self,
create_info: &vk::DisplaySurfaceCreateInfoKHR, create_info: &vk::DisplaySurfaceCreateInfoKHR,
@ -116,17 +123,20 @@ impl Display {
allocation_callbacks.as_raw_ptr(), allocation_callbacks.as_raw_ptr(),
surface.as_mut_ptr(), surface.as_mut_ptr(),
) )
.result_with_success(surface.assume_init()) .assume_init_on_success(surface)
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrDisplayFn::name() vk::KhrDisplayFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrDisplayFn { pub fn fp(&self) -> &vk::KhrDisplayFn {
&self.fp &self.fp
} }
#[inline]
pub fn instance(&self) -> vk::Instance { pub fn instance(&self) -> vk::Instance {
self.handle self.handle
} }

View file

@ -21,31 +21,36 @@ impl DisplaySwapchain {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateSharedSwapchainsKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateSharedSwapchainsKHR.html>
#[inline]
pub unsafe fn create_shared_swapchains( pub unsafe fn create_shared_swapchains(
&self, &self,
create_infos: &[vk::SwapchainCreateInfoKHR], create_infos: &[vk::SwapchainCreateInfoKHR],
allocation_callbacks: Option<&vk::AllocationCallbacks>, allocation_callbacks: Option<&vk::AllocationCallbacks>,
) -> VkResult<Vec<vk::SwapchainKHR>> { ) -> VkResult<Vec<vk::SwapchainKHR>> {
let mut swapchains = Vec::with_capacity(create_infos.len()); let mut swapchains = Vec::with_capacity(create_infos.len());
let err_code = (self.fp.create_shared_swapchains_khr)( (self.fp.create_shared_swapchains_khr)(
self.handle, self.handle,
create_infos.len() as u32, create_infos.len() as u32,
create_infos.as_ptr(), create_infos.as_ptr(),
allocation_callbacks.as_raw_ptr(), allocation_callbacks.as_raw_ptr(),
swapchains.as_mut_ptr(), swapchains.as_mut_ptr(),
); )
.result()?;
swapchains.set_len(create_infos.len()); swapchains.set_len(create_infos.len());
err_code.result_with_success(swapchains) Ok(swapchains)
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrDisplaySwapchainFn::name() vk::KhrDisplaySwapchainFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrDisplaySwapchainFn { pub fn fp(&self) -> &vk::KhrDisplaySwapchainFn {
&self.fp &self.fp
} }
#[inline]
pub fn device(&self) -> vk::Device { pub fn device(&self) -> vk::Device {
self.handle self.handle
} }

View file

@ -17,6 +17,7 @@ impl DrawIndirectCount {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdDrawIndexedIndirectCountKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdDrawIndexedIndirectCountKHR.html>
#[inline]
pub unsafe fn cmd_draw_indexed_indirect_count( pub unsafe fn cmd_draw_indexed_indirect_count(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -39,6 +40,7 @@ impl DrawIndirectCount {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdDrawIndirectCountKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdDrawIndirectCountKHR.html>
#[inline]
pub unsafe fn cmd_draw_indirect_count( pub unsafe fn cmd_draw_indirect_count(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -49,7 +51,7 @@ impl DrawIndirectCount {
max_draw_count: u32, max_draw_count: u32,
stride: u32, stride: u32,
) { ) {
(self.fp.cmd_draw_indexed_indirect_count_khr)( (self.fp.cmd_draw_indirect_count_khr)(
command_buffer, command_buffer,
buffer, buffer,
offset, offset,
@ -60,10 +62,12 @@ impl DrawIndirectCount {
); );
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrDrawIndirectCountFn::name() vk::KhrDrawIndirectCountFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrDrawIndirectCountFn { pub fn fp(&self) -> &vk::KhrDrawIndirectCountFn {
&self.fp &self.fp
} }

View file

@ -17,6 +17,7 @@ impl DynamicRendering {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBeginRenderingKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBeginRenderingKHR.html>
#[inline]
pub unsafe fn cmd_begin_rendering( pub unsafe fn cmd_begin_rendering(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -26,14 +27,17 @@ impl DynamicRendering {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdEndRenderingKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdEndRenderingKHR.html>
#[inline]
pub unsafe fn cmd_end_rendering(&self, command_buffer: vk::CommandBuffer) { pub unsafe fn cmd_end_rendering(&self, command_buffer: vk::CommandBuffer) {
(self.fp.cmd_end_rendering_khr)(command_buffer) (self.fp.cmd_end_rendering_khr)(command_buffer)
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrDynamicRenderingFn::name() vk::KhrDynamicRenderingFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrDynamicRenderingFn { pub fn fp(&self) -> &vk::KhrDynamicRenderingFn {
&self.fp &self.fp
} }

View file

@ -20,24 +20,29 @@ impl ExternalFenceFd {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkImportFenceFdKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkImportFenceFdKHR.html>
#[inline]
pub unsafe fn import_fence_fd(&self, import_info: &vk::ImportFenceFdInfoKHR) -> VkResult<()> { pub unsafe fn import_fence_fd(&self, import_info: &vk::ImportFenceFdInfoKHR) -> VkResult<()> {
(self.fp.import_fence_fd_khr)(self.handle, import_info).result() (self.fp.import_fence_fd_khr)(self.handle, import_info).result()
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetFenceFdKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetFenceFdKHR.html>
#[inline]
pub unsafe fn get_fence_fd(&self, get_info: &vk::FenceGetFdInfoKHR) -> VkResult<i32> { pub unsafe fn get_fence_fd(&self, get_info: &vk::FenceGetFdInfoKHR) -> VkResult<i32> {
let mut fd = -1; let mut fd = -1;
(self.fp.get_fence_fd_khr)(self.handle, get_info, &mut fd).result_with_success(fd) (self.fp.get_fence_fd_khr)(self.handle, get_info, &mut fd).result_with_success(fd)
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrExternalFenceFdFn::name() vk::KhrExternalFenceFdFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrExternalFenceFdFn { pub fn fp(&self) -> &vk::KhrExternalFenceFdFn {
&self.fp &self.fp
} }
#[inline]
pub fn device(&self) -> vk::Device { pub fn device(&self) -> vk::Device {
self.handle self.handle
} }

View file

@ -22,6 +22,7 @@ impl ExternalFenceWin32 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkImportFenceWin32HandleKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkImportFenceWin32HandleKHR.html>
#[inline]
pub unsafe fn import_fence_win32_handle( pub unsafe fn import_fence_win32_handle(
&self, &self,
import_info: &vk::ImportFenceWin32HandleInfoKHR, import_info: &vk::ImportFenceWin32HandleInfoKHR,
@ -30,6 +31,7 @@ impl ExternalFenceWin32 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetFenceWin32HandleKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetFenceWin32HandleKHR.html>
#[inline]
pub unsafe fn get_fence_win32_handle( pub unsafe fn get_fence_win32_handle(
&self, &self,
get_info: &vk::FenceGetWin32HandleInfoKHR, get_info: &vk::FenceGetWin32HandleInfoKHR,
@ -39,14 +41,17 @@ impl ExternalFenceWin32 {
.result_with_success(handle) .result_with_success(handle)
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrExternalFenceWin32Fn::name() vk::KhrExternalFenceWin32Fn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrExternalFenceWin32Fn { pub fn fp(&self) -> &vk::KhrExternalFenceWin32Fn {
&self.fp &self.fp
} }
#[inline]
pub fn device(&self) -> vk::Device { pub fn device(&self) -> vk::Device {
self.handle self.handle
} }

View file

@ -20,12 +20,14 @@ impl ExternalMemoryFd {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetMemoryFdKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetMemoryFdKHR.html>
pub unsafe fn get_memory_fd(&self, create_info: &vk::MemoryGetFdInfoKHR) -> VkResult<i32> { #[inline]
pub unsafe fn get_memory_fd(&self, get_fd_info: &vk::MemoryGetFdInfoKHR) -> VkResult<i32> {
let mut fd = -1; let mut fd = -1;
(self.fp.get_memory_fd_khr)(self.handle, create_info, &mut fd).result_with_success(fd) (self.fp.get_memory_fd_khr)(self.handle, get_fd_info, &mut fd).result_with_success(fd)
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetMemoryFdPropertiesKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetMemoryFdPropertiesKHR.html>
#[inline]
pub unsafe fn get_memory_fd_properties( pub unsafe fn get_memory_fd_properties(
&self, &self,
handle_type: vk::ExternalMemoryHandleTypeFlags, handle_type: vk::ExternalMemoryHandleTypeFlags,
@ -41,14 +43,17 @@ impl ExternalMemoryFd {
.result_with_success(memory_fd_properties) .result_with_success(memory_fd_properties)
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrExternalMemoryFdFn::name() vk::KhrExternalMemoryFdFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrExternalMemoryFdFn { pub fn fp(&self) -> &vk::KhrExternalMemoryFdFn {
&self.fp &self.fp
} }
#[inline]
pub fn device(&self) -> vk::Device { pub fn device(&self) -> vk::Device {
self.handle self.handle
} }

View file

@ -22,6 +22,7 @@ impl ExternalMemoryWin32 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetMemoryWin32HandleKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetMemoryWin32HandleKHR.html>
#[inline]
pub unsafe fn get_memory_win32_handle( pub unsafe fn get_memory_win32_handle(
&self, &self,
create_info: &vk::MemoryGetWin32HandleInfoKHR, create_info: &vk::MemoryGetWin32HandleInfoKHR,
@ -32,6 +33,7 @@ impl ExternalMemoryWin32 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetMemoryWin32HandlePropertiesKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetMemoryWin32HandlePropertiesKHR.html>
#[inline]
pub unsafe fn get_memory_win32_handle_properties( pub unsafe fn get_memory_win32_handle_properties(
&self, &self,
handle_type: vk::ExternalMemoryHandleTypeFlags, handle_type: vk::ExternalMemoryHandleTypeFlags,
@ -47,14 +49,17 @@ impl ExternalMemoryWin32 {
.result_with_success(memory_win32_handle_properties) .result_with_success(memory_win32_handle_properties)
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrExternalMemoryWin32Fn::name() vk::KhrExternalMemoryWin32Fn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrExternalMemoryWin32Fn { pub fn fp(&self) -> &vk::KhrExternalMemoryWin32Fn {
&self.fp &self.fp
} }
#[inline]
pub fn device(&self) -> vk::Device { pub fn device(&self) -> vk::Device {
self.handle self.handle
} }

View file

@ -20,6 +20,7 @@ impl ExternalSemaphoreFd {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkImportSemaphoreFdKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkImportSemaphoreFdKHR.html>
#[inline]
pub unsafe fn import_semaphore_fd( pub unsafe fn import_semaphore_fd(
&self, &self,
import_info: &vk::ImportSemaphoreFdInfoKHR, import_info: &vk::ImportSemaphoreFdInfoKHR,
@ -28,19 +29,23 @@ impl ExternalSemaphoreFd {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetSemaphoreFdKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetSemaphoreFdKHR.html>
#[inline]
pub unsafe fn get_semaphore_fd(&self, get_info: &vk::SemaphoreGetFdInfoKHR) -> VkResult<i32> { pub unsafe fn get_semaphore_fd(&self, get_info: &vk::SemaphoreGetFdInfoKHR) -> VkResult<i32> {
let mut fd = -1; let mut fd = -1;
(self.fp.get_semaphore_fd_khr)(self.handle, get_info, &mut fd).result_with_success(fd) (self.fp.get_semaphore_fd_khr)(self.handle, get_info, &mut fd).result_with_success(fd)
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrExternalSemaphoreFdFn::name() vk::KhrExternalSemaphoreFdFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrExternalSemaphoreFdFn { pub fn fp(&self) -> &vk::KhrExternalSemaphoreFdFn {
&self.fp &self.fp
} }
#[inline]
pub fn device(&self) -> vk::Device { pub fn device(&self) -> vk::Device {
self.handle self.handle
} }

View file

@ -22,6 +22,7 @@ impl ExternalSemaphoreWin32 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkImportSemaphoreWin32HandleKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkImportSemaphoreWin32HandleKHR.html>
#[inline]
pub unsafe fn import_semaphore_win32_handle( pub unsafe fn import_semaphore_win32_handle(
&self, &self,
import_info: &vk::ImportSemaphoreWin32HandleInfoKHR, import_info: &vk::ImportSemaphoreWin32HandleInfoKHR,
@ -30,6 +31,7 @@ impl ExternalSemaphoreWin32 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetSemaphoreWin32HandleKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetSemaphoreWin32HandleKHR.html>
#[inline]
pub unsafe fn get_semaphore_win32_handle( pub unsafe fn get_semaphore_win32_handle(
&self, &self,
get_info: &vk::SemaphoreGetWin32HandleInfoKHR, get_info: &vk::SemaphoreGetWin32HandleInfoKHR,
@ -39,14 +41,17 @@ impl ExternalSemaphoreWin32 {
.result_with_success(handle) .result_with_success(handle)
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrExternalSemaphoreWin32Fn::name() vk::KhrExternalSemaphoreWin32Fn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrExternalSemaphoreWin32Fn { pub fn fp(&self) -> &vk::KhrExternalSemaphoreWin32Fn {
&self.fp &self.fp
} }
#[inline]
pub fn device(&self) -> vk::Device { pub fn device(&self) -> vk::Device {
self.handle self.handle
} }

View file

@ -20,6 +20,7 @@ impl GetMemoryRequirements2 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetBufferMemoryRequirements2KHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetBufferMemoryRequirements2KHR.html>
#[inline]
pub unsafe fn get_buffer_memory_requirements2( pub unsafe fn get_buffer_memory_requirements2(
&self, &self,
info: &vk::BufferMemoryRequirementsInfo2KHR, info: &vk::BufferMemoryRequirementsInfo2KHR,
@ -29,6 +30,7 @@ impl GetMemoryRequirements2 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetImageMemoryRequirements2KHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetImageMemoryRequirements2KHR.html>
#[inline]
pub unsafe fn get_image_memory_requirements2( pub unsafe fn get_image_memory_requirements2(
&self, &self,
info: &vk::ImageMemoryRequirementsInfo2KHR, info: &vk::ImageMemoryRequirementsInfo2KHR,
@ -38,6 +40,7 @@ impl GetMemoryRequirements2 {
} }
/// Retrieve the number of elements to pass to [`get_image_sparse_memory_requirements2()`][Self::get_image_sparse_memory_requirements2()] /// Retrieve the number of elements to pass to [`get_image_sparse_memory_requirements2()`][Self::get_image_sparse_memory_requirements2()]
#[inline]
pub unsafe fn get_image_sparse_memory_requirements2_len( pub unsafe fn get_image_sparse_memory_requirements2_len(
&self, &self,
info: &vk::ImageSparseMemoryRequirementsInfo2KHR, info: &vk::ImageSparseMemoryRequirementsInfo2KHR,
@ -56,6 +59,7 @@ impl GetMemoryRequirements2 {
/// ///
/// Call [`get_image_sparse_memory_requirements2_len()`][Self::get_image_sparse_memory_requirements2_len()] to query the number of elements to pass to `out`. /// Call [`get_image_sparse_memory_requirements2_len()`][Self::get_image_sparse_memory_requirements2_len()] to query the number of elements to pass to `out`.
/// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer. /// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer.
#[inline]
pub unsafe fn get_image_sparse_memory_requirements2( pub unsafe fn get_image_sparse_memory_requirements2(
&self, &self,
info: &vk::ImageSparseMemoryRequirementsInfo2KHR, info: &vk::ImageSparseMemoryRequirementsInfo2KHR,
@ -71,14 +75,17 @@ impl GetMemoryRequirements2 {
assert_eq!(count as usize, out.len()); assert_eq!(count as usize, out.len());
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrGetMemoryRequirements2Fn::name() vk::KhrGetMemoryRequirements2Fn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrGetMemoryRequirements2Fn { pub fn fp(&self) -> &vk::KhrGetMemoryRequirements2Fn {
&self.fp &self.fp
} }
#[inline]
pub fn device(&self) -> vk::Device { pub fn device(&self) -> vk::Device {
self.handle self.handle
} }

View file

@ -19,6 +19,7 @@ impl GetPhysicalDeviceProperties2 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceFeatures2KHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceFeatures2KHR.html>
#[inline]
pub unsafe fn get_physical_device_features2( pub unsafe fn get_physical_device_features2(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -28,6 +29,7 @@ impl GetPhysicalDeviceProperties2 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceFormatProperties2KHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceFormatProperties2KHR.html>
#[inline]
pub unsafe fn get_physical_device_format_properties2( pub unsafe fn get_physical_device_format_properties2(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -42,6 +44,7 @@ impl GetPhysicalDeviceProperties2 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceImageFormatProperties2KHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceImageFormatProperties2KHR.html>
#[inline]
pub unsafe fn get_physical_device_image_format_properties2( pub unsafe fn get_physical_device_image_format_properties2(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -57,6 +60,7 @@ impl GetPhysicalDeviceProperties2 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceMemoryProperties2KHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceMemoryProperties2KHR.html>
#[inline]
pub unsafe fn get_physical_device_memory_properties2( pub unsafe fn get_physical_device_memory_properties2(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -66,6 +70,7 @@ impl GetPhysicalDeviceProperties2 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceProperties2KHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceProperties2KHR.html>
#[inline]
pub unsafe fn get_physical_device_properties2( pub unsafe fn get_physical_device_properties2(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -75,6 +80,7 @@ impl GetPhysicalDeviceProperties2 {
} }
/// Retrieve the number of elements to pass to [`get_physical_device_queue_family_properties2()`][Self::get_physical_device_queue_family_properties2()] /// Retrieve the number of elements to pass to [`get_physical_device_queue_family_properties2()`][Self::get_physical_device_queue_family_properties2()]
#[inline]
pub unsafe fn get_physical_device_queue_family_properties2_len( pub unsafe fn get_physical_device_queue_family_properties2_len(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -92,6 +98,7 @@ impl GetPhysicalDeviceProperties2 {
/// ///
/// Call [`get_physical_device_queue_family_properties2_len()`][Self::get_physical_device_queue_family_properties2_len()] to query the number of elements to pass to `out`. /// Call [`get_physical_device_queue_family_properties2_len()`][Self::get_physical_device_queue_family_properties2_len()] to query the number of elements to pass to `out`.
/// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer. /// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer.
#[inline]
pub unsafe fn get_physical_device_queue_family_properties2( pub unsafe fn get_physical_device_queue_family_properties2(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -107,6 +114,7 @@ impl GetPhysicalDeviceProperties2 {
} }
/// Retrieve the number of elements to pass to [`get_physical_device_sparse_image_format_properties2()`][Self::get_physical_device_sparse_image_format_properties2()] /// Retrieve the number of elements to pass to [`get_physical_device_sparse_image_format_properties2()`][Self::get_physical_device_sparse_image_format_properties2()]
#[inline]
pub unsafe fn get_physical_device_sparse_image_format_properties2_len( pub unsafe fn get_physical_device_sparse_image_format_properties2_len(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -128,6 +136,7 @@ impl GetPhysicalDeviceProperties2 {
/// ///
/// Call [`get_physical_device_sparse_image_format_properties2_len()`][Self::get_physical_device_sparse_image_format_properties2_len()] to query the number of elements to pass to `out`. /// Call [`get_physical_device_sparse_image_format_properties2_len()`][Self::get_physical_device_sparse_image_format_properties2_len()] to query the number of elements to pass to `out`.
/// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer. /// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer.
#[inline]
pub unsafe fn get_physical_device_sparse_image_format_properties2( pub unsafe fn get_physical_device_sparse_image_format_properties2(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -146,10 +155,12 @@ impl GetPhysicalDeviceProperties2 {
assert_eq!(count as usize, out.len()); assert_eq!(count as usize, out.len());
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrGetPhysicalDeviceProperties2Fn::name() vk::KhrGetPhysicalDeviceProperties2Fn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrGetPhysicalDeviceProperties2Fn { pub fn fp(&self) -> &vk::KhrGetPhysicalDeviceProperties2Fn {
&self.fp &self.fp
} }

View file

@ -18,6 +18,7 @@ impl GetSurfaceCapabilities2 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSurfaceCapabilities2KHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSurfaceCapabilities2KHR.html>
#[inline]
pub unsafe fn get_physical_device_surface_capabilities2( pub unsafe fn get_physical_device_surface_capabilities2(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -33,6 +34,7 @@ impl GetSurfaceCapabilities2 {
} }
/// Retrieve the number of elements to pass to [`get_physical_device_surface_formats2()`][Self::get_physical_device_surface_formats2()] /// Retrieve the number of elements to pass to [`get_physical_device_surface_formats2()`][Self::get_physical_device_surface_formats2()]
#[inline]
pub unsafe fn get_physical_device_surface_formats2_len( pub unsafe fn get_physical_device_surface_formats2_len(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -52,6 +54,7 @@ impl GetSurfaceCapabilities2 {
/// ///
/// Call [`get_physical_device_surface_formats2_len()`][Self::get_physical_device_surface_formats2_len()] to query the number of elements to pass to `out`. /// Call [`get_physical_device_surface_formats2_len()`][Self::get_physical_device_surface_formats2_len()] to query the number of elements to pass to `out`.
/// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer. /// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer.
#[inline]
pub unsafe fn get_physical_device_surface_formats2( pub unsafe fn get_physical_device_surface_formats2(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -69,10 +72,12 @@ impl GetSurfaceCapabilities2 {
err_code.result() err_code.result()
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrGetSurfaceCapabilities2Fn::name() vk::KhrGetSurfaceCapabilities2Fn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrGetSurfaceCapabilities2Fn { pub fn fp(&self) -> &vk::KhrGetSurfaceCapabilities2Fn {
&self.fp &self.fp
} }

View file

@ -19,6 +19,7 @@ impl Maintenance1 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkTrimCommandPoolKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkTrimCommandPoolKHR.html>
#[inline]
pub unsafe fn trim_command_pool( pub unsafe fn trim_command_pool(
&self, &self,
command_pool: vk::CommandPool, command_pool: vk::CommandPool,
@ -27,14 +28,17 @@ impl Maintenance1 {
(self.fp.trim_command_pool_khr)(self.handle, command_pool, flags); (self.fp.trim_command_pool_khr)(self.handle, command_pool, flags);
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrMaintenance1Fn::name() vk::KhrMaintenance1Fn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrMaintenance1Fn { pub fn fp(&self) -> &vk::KhrMaintenance1Fn {
&self.fp &self.fp
} }
#[inline]
pub fn device(&self) -> vk::Device { pub fn device(&self) -> vk::Device {
self.handle self.handle
} }

View file

@ -19,6 +19,7 @@ impl Maintenance3 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDescriptorSetLayoutSupportKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDescriptorSetLayoutSupportKHR.html>
#[inline]
pub unsafe fn get_descriptor_set_layout_support( pub unsafe fn get_descriptor_set_layout_support(
&self, &self,
create_info: &vk::DescriptorSetLayoutCreateInfo, create_info: &vk::DescriptorSetLayoutCreateInfo,
@ -27,14 +28,17 @@ impl Maintenance3 {
(self.fp.get_descriptor_set_layout_support_khr)(self.handle, create_info, out); (self.fp.get_descriptor_set_layout_support_khr)(self.handle, create_info, out);
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrMaintenance3Fn::name() vk::KhrMaintenance3Fn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrMaintenance3Fn { pub fn fp(&self) -> &vk::KhrMaintenance3Fn {
&self.fp &self.fp
} }
#[inline]
pub fn device(&self) -> vk::Device { pub fn device(&self) -> vk::Device {
self.handle self.handle
} }

View file

@ -19,32 +19,35 @@ impl Maintenance4 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceBufferMemoryRequirementsKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceBufferMemoryRequirementsKHR.html>
#[inline]
pub unsafe fn get_device_buffer_memory_requirements( pub unsafe fn get_device_buffer_memory_requirements(
&self, &self,
create_info: &vk::DeviceBufferMemoryRequirementsKHR, memory_requirements: &vk::DeviceBufferMemoryRequirementsKHR,
out: &mut vk::MemoryRequirements2, out: &mut vk::MemoryRequirements2,
) { ) {
(self.fp.get_device_buffer_memory_requirements_khr)(self.handle, create_info, out) (self.fp.get_device_buffer_memory_requirements_khr)(self.handle, memory_requirements, out)
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceImageMemoryRequirementsKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceImageMemoryRequirementsKHR.html>
#[inline]
pub unsafe fn get_device_image_memory_requirements( pub unsafe fn get_device_image_memory_requirements(
&self, &self,
create_info: &vk::DeviceImageMemoryRequirementsKHR, memory_requirements: &vk::DeviceImageMemoryRequirementsKHR,
out: &mut vk::MemoryRequirements2, out: &mut vk::MemoryRequirements2,
) { ) {
(self.fp.get_device_image_memory_requirements_khr)(self.handle, create_info, out) (self.fp.get_device_image_memory_requirements_khr)(self.handle, memory_requirements, out)
} }
/// Retrieve the number of elements to pass to [`get_device_image_sparse_memory_requirements()`][Self::get_device_image_sparse_memory_requirements()] /// Retrieve the number of elements to pass to [`get_device_image_sparse_memory_requirements()`][Self::get_device_image_sparse_memory_requirements()]
#[inline]
pub unsafe fn get_device_image_sparse_memory_requirements_len( pub unsafe fn get_device_image_sparse_memory_requirements_len(
&self, &self,
create_info: &vk::DeviceImageMemoryRequirementsKHR, memory_requirements: &vk::DeviceImageMemoryRequirementsKHR,
) -> usize { ) -> usize {
let mut count = 0; let mut count = 0;
(self.fp.get_device_image_sparse_memory_requirements_khr)( (self.fp.get_device_image_sparse_memory_requirements_khr)(
self.handle, self.handle,
create_info, memory_requirements,
&mut count, &mut count,
std::ptr::null_mut(), std::ptr::null_mut(),
); );
@ -55,29 +58,33 @@ impl Maintenance4 {
/// ///
/// Call [`get_device_image_sparse_memory_requirements_len()`][Self::get_device_image_sparse_memory_requirements_len()] to query the number of elements to pass to `out`. /// Call [`get_device_image_sparse_memory_requirements_len()`][Self::get_device_image_sparse_memory_requirements_len()] to query the number of elements to pass to `out`.
/// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer. /// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer.
#[inline]
pub unsafe fn get_device_image_sparse_memory_requirements( pub unsafe fn get_device_image_sparse_memory_requirements(
&self, &self,
create_info: &vk::DeviceImageMemoryRequirementsKHR, memory_requirements: &vk::DeviceImageMemoryRequirementsKHR,
out: &mut [vk::SparseImageMemoryRequirements2], out: &mut [vk::SparseImageMemoryRequirements2],
) { ) {
let mut count = out.len() as u32; let mut count = out.len() as u32;
(self.fp.get_device_image_sparse_memory_requirements_khr)( (self.fp.get_device_image_sparse_memory_requirements_khr)(
self.handle, self.handle,
create_info, memory_requirements,
&mut count, &mut count,
out.as_mut_ptr(), out.as_mut_ptr(),
); );
assert_eq!(count as usize, out.len()); assert_eq!(count as usize, out.len());
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrMaintenance4Fn::name() vk::KhrMaintenance4Fn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrMaintenance4Fn { pub fn fp(&self) -> &vk::KhrMaintenance4Fn {
&self.fp &self.fp
} }
#[inline]
pub fn device(&self) -> vk::Device { pub fn device(&self) -> vk::Device {
self.handle self.handle
} }

View file

@ -4,6 +4,8 @@ pub use self::buffer_device_address::BufferDeviceAddress;
pub use self::copy_commands2::CopyCommands2; pub use self::copy_commands2::CopyCommands2;
pub use self::create_render_pass2::CreateRenderPass2; pub use self::create_render_pass2::CreateRenderPass2;
pub use self::deferred_host_operations::DeferredHostOperations; pub use self::deferred_host_operations::DeferredHostOperations;
pub use self::device_group::DeviceGroup;
pub use self::device_group_creation::DeviceGroupCreation;
pub use self::display::Display; pub use self::display::Display;
pub use self::display_swapchain::DisplaySwapchain; pub use self::display_swapchain::DisplaySwapchain;
pub use self::draw_indirect_count::DrawIndirectCount; pub use self::draw_indirect_count::DrawIndirectCount;
@ -20,9 +22,11 @@ pub use self::get_surface_capabilities2::GetSurfaceCapabilities2;
pub use self::maintenance1::Maintenance1; pub use self::maintenance1::Maintenance1;
pub use self::maintenance3::Maintenance3; pub use self::maintenance3::Maintenance3;
pub use self::maintenance4::Maintenance4; pub use self::maintenance4::Maintenance4;
pub use self::performance_query::PerformanceQuery;
pub use self::pipeline_executable_properties::PipelineExecutableProperties; pub use self::pipeline_executable_properties::PipelineExecutableProperties;
pub use self::present_wait::PresentWait; pub use self::present_wait::PresentWait;
pub use self::push_descriptor::PushDescriptor; pub use self::push_descriptor::PushDescriptor;
pub use self::ray_tracing_maintenance1::RayTracingMaintenance1;
pub use self::ray_tracing_pipeline::RayTracingPipeline; pub use self::ray_tracing_pipeline::RayTracingPipeline;
pub use self::surface::Surface; pub use self::surface::Surface;
pub use self::swapchain::Swapchain; pub use self::swapchain::Swapchain;
@ -39,6 +43,8 @@ mod buffer_device_address;
mod copy_commands2; mod copy_commands2;
mod create_render_pass2; mod create_render_pass2;
mod deferred_host_operations; mod deferred_host_operations;
mod device_group;
mod device_group_creation;
mod display; mod display;
mod display_swapchain; mod display_swapchain;
mod draw_indirect_count; mod draw_indirect_count;
@ -55,9 +61,11 @@ mod get_surface_capabilities2;
mod maintenance1; mod maintenance1;
mod maintenance3; mod maintenance3;
mod maintenance4; mod maintenance4;
mod performance_query;
mod pipeline_executable_properties; mod pipeline_executable_properties;
mod present_wait; mod present_wait;
mod push_descriptor; mod push_descriptor;
mod ray_tracing_maintenance1;
mod ray_tracing_pipeline; mod ray_tracing_pipeline;
mod surface; mod surface;
mod swapchain; mod swapchain;

View file

@ -0,0 +1,121 @@
use crate::prelude::*;
use crate::vk;
use crate::{Entry, Instance};
use std::ffi::CStr;
use std::mem;
use std::ptr;
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_KHR_performance_query.html>
#[derive(Clone)]
pub struct PerformanceQuery {
handle: vk::Instance,
fp: vk::KhrPerformanceQueryFn,
}
impl PerformanceQuery {
pub fn new(entry: &Entry, instance: &Instance) -> Self {
let handle = instance.handle();
let fp = vk::KhrPerformanceQueryFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(handle, name.as_ptr()))
});
Self { handle, fp }
}
/// Retrieve the number of elements to pass to [`enumerate_physical_device_queue_family_performance_query_counters()`][Self::enumerate_physical_device_queue_family_performance_query_counters()]
#[inline]
pub unsafe fn enumerate_physical_device_queue_family_performance_query_counters_len(
&self,
physical_device: vk::PhysicalDevice,
queue_family_index: u32,
) -> VkResult<usize> {
let mut count = 0;
(self
.fp
.enumerate_physical_device_queue_family_performance_query_counters_khr)(
physical_device,
queue_family_index,
&mut count,
ptr::null_mut(),
ptr::null_mut(),
)
.result_with_success(count as usize)
}
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR.html>
///
/// Call [`enumerate_physical_device_queue_family_performance_query_counters_len()`][Self::enumerate_physical_device_queue_family_performance_query_counters_len()] to query the number of elements to pass to `out_counters` and `out_counter_descriptions`.
/// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer.
#[inline]
pub unsafe fn enumerate_physical_device_queue_family_performance_query_counters(
&self,
physical_device: vk::PhysicalDevice,
queue_family_index: u32,
out_counters: &mut [vk::PerformanceCounterKHR],
out_counter_descriptions: &mut [vk::PerformanceCounterDescriptionKHR],
) -> VkResult<()> {
assert_eq!(out_counters.len(), out_counter_descriptions.len());
let mut count = out_counters.len() as u32;
(self
.fp
.enumerate_physical_device_queue_family_performance_query_counters_khr)(
physical_device,
queue_family_index,
&mut count,
out_counters.as_mut_ptr(),
out_counter_descriptions.as_mut_ptr(),
)
.result()?;
assert_eq!(count as usize, out_counters.len());
assert_eq!(count as usize, out_counter_descriptions.len());
Ok(())
}
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR.html>
#[inline]
pub unsafe fn get_physical_device_queue_family_performance_query_passes(
&self,
physical_device: vk::PhysicalDevice,
performance_query_create_info: &vk::QueryPoolPerformanceCreateInfoKHR,
) -> u32 {
let mut num_passes = 0;
(self
.fp
.get_physical_device_queue_family_performance_query_passes_khr)(
physical_device,
performance_query_create_info,
&mut num_passes,
);
num_passes
}
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkAcquireProfilingLockKHR.html>
#[inline]
pub unsafe fn acquire_profiling_lock(
&self,
device: vk::Device,
info: &vk::AcquireProfilingLockInfoKHR,
) -> VkResult<()> {
(self.fp.acquire_profiling_lock_khr)(device, info).result()
}
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkReleaseProfilingLockKHR.html>
#[inline]
pub unsafe fn release_profiling_lock(&self, device: vk::Device) {
(self.fp.release_profiling_lock_khr)(device)
}
#[inline]
pub const fn name() -> &'static CStr {
vk::KhrPerformanceQueryFn::name()
}
#[inline]
pub fn fp(&self) -> &vk::KhrPerformanceQueryFn {
&self.fp
}
#[inline]
pub fn instance(&self) -> vk::Instance {
self.handle
}
}

View file

@ -20,6 +20,7 @@ impl PipelineExecutableProperties {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPipelineExecutableInternalRepresentationsKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPipelineExecutableInternalRepresentationsKHR.html>
#[inline]
pub unsafe fn get_pipeline_executable_internal_representations( pub unsafe fn get_pipeline_executable_internal_representations(
&self, &self,
executable_info: &vk::PipelineExecutableInfoKHR, executable_info: &vk::PipelineExecutableInfoKHR,
@ -35,6 +36,7 @@ impl PipelineExecutableProperties {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPipelineExecutablePropertiesKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPipelineExecutablePropertiesKHR.html>
#[inline]
pub unsafe fn get_pipeline_executable_properties( pub unsafe fn get_pipeline_executable_properties(
&self, &self,
pipeline_info: &vk::PipelineInfoKHR, pipeline_info: &vk::PipelineInfoKHR,
@ -50,6 +52,7 @@ impl PipelineExecutableProperties {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPipelineExecutableStatisticsKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPipelineExecutableStatisticsKHR.html>
#[inline]
pub unsafe fn get_pipeline_executable_statistics( pub unsafe fn get_pipeline_executable_statistics(
&self, &self,
executable_info: &vk::PipelineExecutableInfoKHR, executable_info: &vk::PipelineExecutableInfoKHR,
@ -64,14 +67,17 @@ impl PipelineExecutableProperties {
}) })
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrPipelineExecutablePropertiesFn::name() vk::KhrPipelineExecutablePropertiesFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrPipelineExecutablePropertiesFn { pub fn fp(&self) -> &vk::KhrPipelineExecutablePropertiesFn {
&self.fp &self.fp
} }
#[inline]
pub fn device(&self) -> vk::Device { pub fn device(&self) -> vk::Device {
self.handle self.handle
} }

View file

@ -20,6 +20,7 @@ impl PresentWait {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkWaitForPresentKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkWaitForPresentKHR.html>
#[inline]
pub unsafe fn wait_for_present( pub unsafe fn wait_for_present(
&self, &self,
swapchain: vk::SwapchainKHR, swapchain: vk::SwapchainKHR,
@ -29,14 +30,17 @@ impl PresentWait {
(self.fp.wait_for_present_khr)(self.handle, swapchain, present_id, timeout).result() (self.fp.wait_for_present_khr)(self.handle, swapchain, present_id, timeout).result()
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrPresentWaitFn::name() vk::KhrPresentWaitFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrPresentWaitFn { pub fn fp(&self) -> &vk::KhrPresentWaitFn {
&self.fp &self.fp
} }
#[inline]
pub fn device(&self) -> vk::Device { pub fn device(&self) -> vk::Device {
self.handle self.handle
} }

View file

@ -18,6 +18,7 @@ impl PushDescriptor {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdPushDescriptorSetKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdPushDescriptorSetKHR.html>
#[inline]
pub unsafe fn cmd_push_descriptor_set( pub unsafe fn cmd_push_descriptor_set(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -37,6 +38,7 @@ impl PushDescriptor {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdPushDescriptorSetWithTemplateKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdPushDescriptorSetWithTemplateKHR.html>
#[inline]
pub unsafe fn cmd_push_descriptor_set_with_template( pub unsafe fn cmd_push_descriptor_set_with_template(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -54,10 +56,12 @@ impl PushDescriptor {
); );
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrPushDescriptorFn::name() vk::KhrPushDescriptorFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrPushDescriptorFn { pub fn fp(&self) -> &vk::KhrPushDescriptorFn {
&self.fp &self.fp
} }

View file

@ -0,0 +1,42 @@
use crate::vk;
use crate::{Device, Instance};
use std::ffi::CStr;
use std::mem;
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_KHR_ray_tracing_maintenance1.html>
#[derive(Clone)]
pub struct RayTracingMaintenance1 {
fp: vk::KhrRayTracingMaintenance1Fn,
}
impl RayTracingMaintenance1 {
pub fn new(instance: &Instance, device: &Device) -> Self {
let handle = device.handle();
let fp = vk::KhrRayTracingMaintenance1Fn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr()))
});
Self { fp }
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdTraceRaysIndirect2KHR.html>
///
/// `indirect_device_address` is a buffer device address which is a pointer to a [`vk::TraceRaysIndirectCommand2KHR`] structure containing the trace ray parameters.
#[inline]
pub unsafe fn cmd_trace_rays_indirect2(
&self,
command_buffer: vk::CommandBuffer,
indirect_device_address: vk::DeviceAddress,
) {
(self.fp.cmd_trace_rays_indirect2_khr)(command_buffer, indirect_device_address);
}
#[inline]
pub const fn name() -> &'static CStr {
vk::KhrRayTracingMaintenance1Fn::name()
}
#[inline]
pub fn fp(&self) -> &vk::KhrRayTracingMaintenance1Fn {
&self.fp
}
}

View file

@ -20,6 +20,7 @@ impl RayTracingPipeline {
Self { handle, fp } Self { handle, fp }
} }
#[inline]
pub unsafe fn get_properties( pub unsafe fn get_properties(
instance: &Instance, instance: &Instance,
pdevice: vk::PhysicalDevice, pdevice: vk::PhysicalDevice,
@ -33,6 +34,7 @@ impl RayTracingPipeline {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdTraceRaysKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdTraceRaysKHR.html>
#[inline]
pub unsafe fn cmd_trace_rays( pub unsafe fn cmd_trace_rays(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -57,6 +59,7 @@ impl RayTracingPipeline {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateRayTracingPipelinesKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateRayTracingPipelinesKHR.html>
#[inline]
pub unsafe fn create_ray_tracing_pipelines( pub unsafe fn create_ray_tracing_pipelines(
&self, &self,
deferred_operation: vk::DeferredOperationKHR, deferred_operation: vk::DeferredOperationKHR,
@ -78,6 +81,7 @@ impl RayTracingPipeline {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetRayTracingShaderGroupHandlesKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetRayTracingShaderGroupHandlesKHR.html>
#[inline]
pub unsafe fn get_ray_tracing_shader_group_handles( pub unsafe fn get_ray_tracing_shader_group_handles(
&self, &self,
pipeline: vk::Pipeline, pipeline: vk::Pipeline,
@ -86,19 +90,21 @@ impl RayTracingPipeline {
data_size: usize, data_size: usize,
) -> VkResult<Vec<u8>> { ) -> VkResult<Vec<u8>> {
let mut data = Vec::<u8>::with_capacity(data_size); let mut data = Vec::<u8>::with_capacity(data_size);
let err_code = (self.fp.get_ray_tracing_shader_group_handles_khr)( (self.fp.get_ray_tracing_shader_group_handles_khr)(
self.handle, self.handle,
pipeline, pipeline,
first_group, first_group,
group_count, group_count,
data_size, data_size,
data.as_mut_ptr() as *mut std::ffi::c_void, data.as_mut_ptr().cast(),
); )
.result()?;
data.set_len(data_size); data.set_len(data_size);
err_code.result_with_success(data) Ok(data)
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetRayTracingCaptureReplayShaderGroupHandlesKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetRayTracingCaptureReplayShaderGroupHandlesKHR.html>
#[inline]
pub unsafe fn get_ray_tracing_capture_replay_shader_group_handles( pub unsafe fn get_ray_tracing_capture_replay_shader_group_handles(
&self, &self,
pipeline: vk::Pipeline, pipeline: vk::Pipeline,
@ -106,8 +112,7 @@ impl RayTracingPipeline {
group_count: u32, group_count: u32,
data_size: usize, data_size: usize,
) -> VkResult<Vec<u8>> { ) -> VkResult<Vec<u8>> {
let mut data: Vec<u8> = Vec::with_capacity(data_size); let mut data = Vec::<u8>::with_capacity(data_size);
(self (self
.fp .fp
.get_ray_tracing_capture_replay_shader_group_handles_khr)( .get_ray_tracing_capture_replay_shader_group_handles_khr)(
@ -116,12 +121,17 @@ impl RayTracingPipeline {
first_group, first_group,
group_count, group_count,
data_size, data_size,
data.as_mut_ptr() as *mut _, data.as_mut_ptr().cast(),
) )
.result_with_success(data) .result()?;
data.set_len(data_size);
Ok(data)
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdTraceRaysIndirectKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdTraceRaysIndirectKHR.html>
///
/// `indirect_device_address` is a buffer device address which is a pointer to a [`vk::TraceRaysIndirectCommandKHR`] structure containing the trace ray parameters.
#[inline]
pub unsafe fn cmd_trace_rays_indirect( pub unsafe fn cmd_trace_rays_indirect(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -142,6 +152,7 @@ impl RayTracingPipeline {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetRayTracingShaderGroupStackSizeKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetRayTracingShaderGroupStackSizeKHR.html>
#[inline]
pub unsafe fn get_ray_tracing_shader_group_stack_size( pub unsafe fn get_ray_tracing_shader_group_stack_size(
&self, &self,
pipeline: vk::Pipeline, pipeline: vk::Pipeline,
@ -157,6 +168,7 @@ impl RayTracingPipeline {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetRayTracingPipelineStackSizeKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetRayTracingPipelineStackSizeKHR.html>
#[inline]
pub unsafe fn cmd_set_ray_tracing_pipeline_stack_size( pub unsafe fn cmd_set_ray_tracing_pipeline_stack_size(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -165,14 +177,17 @@ impl RayTracingPipeline {
(self.fp.cmd_set_ray_tracing_pipeline_stack_size_khr)(command_buffer, pipeline_stack_size); (self.fp.cmd_set_ray_tracing_pipeline_stack_size_khr)(command_buffer, pipeline_stack_size);
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrRayTracingPipelineFn::name() vk::KhrRayTracingPipelineFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrRayTracingPipelineFn { pub fn fp(&self) -> &vk::KhrRayTracingPipelineFn {
&self.fp &self.fp
} }
#[inline]
pub fn device(&self) -> vk::Device { pub fn device(&self) -> vk::Device {
self.handle self.handle
} }

View file

@ -21,6 +21,7 @@ impl Surface {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSurfaceSupportKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSurfaceSupportKHR.html>
#[inline]
pub unsafe fn get_physical_device_surface_support( pub unsafe fn get_physical_device_surface_support(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -38,6 +39,7 @@ impl Surface {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSurfacePresentModesKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSurfacePresentModesKHR.html>
#[inline]
pub unsafe fn get_physical_device_surface_present_modes( pub unsafe fn get_physical_device_surface_present_modes(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -54,6 +56,7 @@ impl Surface {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSurfaceCapabilitiesKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSurfaceCapabilitiesKHR.html>
#[inline]
pub unsafe fn get_physical_device_surface_capabilities( pub unsafe fn get_physical_device_surface_capabilities(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -69,6 +72,7 @@ impl Surface {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSurfaceFormatsKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSurfaceFormatsKHR.html>
#[inline]
pub unsafe fn get_physical_device_surface_formats( pub unsafe fn get_physical_device_surface_formats(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -80,6 +84,7 @@ impl Surface {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroySurfaceKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroySurfaceKHR.html>
#[inline]
pub unsafe fn destroy_surface( pub unsafe fn destroy_surface(
&self, &self,
surface: vk::SurfaceKHR, surface: vk::SurfaceKHR,
@ -88,14 +93,17 @@ impl Surface {
(self.fp.destroy_surface_khr)(self.handle, surface, allocation_callbacks.as_raw_ptr()); (self.fp.destroy_surface_khr)(self.handle, surface, allocation_callbacks.as_raw_ptr());
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrSurfaceFn::name() vk::KhrSurfaceFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrSurfaceFn { pub fn fp(&self) -> &vk::KhrSurfaceFn {
&self.fp &self.fp
} }
#[inline]
pub fn instance(&self) -> vk::Instance { pub fn instance(&self) -> vk::Instance {
self.handle self.handle
} }

View file

@ -1,10 +1,13 @@
#[cfg(doc)]
use super::DeviceGroup;
use crate::prelude::*; use crate::prelude::*;
use crate::vk; use crate::vk;
use crate::RawPtr; use crate::RawPtr;
use crate::{Device, Instance}; use crate::{Device, Entry, Instance};
use std::ffi::CStr; use std::ffi::CStr;
use std::mem; use std::mem;
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_KHR_swapchain.html>
#[derive(Clone)] #[derive(Clone)]
pub struct Swapchain { pub struct Swapchain {
handle: vk::Device, handle: vk::Device,
@ -12,6 +15,13 @@ pub struct Swapchain {
} }
impl Swapchain { impl Swapchain {
/// # Warning
/// [`Instance`] functions cannot be loaded from a [`Device`] and will always panic when called:
/// - [`Self::get_physical_device_present_rectangles()`]
///
/// Load this struct using an [`Instance`] instead via [`Self::new_from_instance()`] if the
/// above [`Instance`] function is called. This will be solved in the next breaking `ash`
/// release: <https://github.com/ash-rs/ash/issues/727>.
pub fn new(instance: &Instance, device: &Device) -> Self { pub fn new(instance: &Instance, device: &Device) -> Self {
let handle = device.handle(); let handle = device.handle();
let fp = vk::KhrSwapchainFn::load(|name| unsafe { let fp = vk::KhrSwapchainFn::load(|name| unsafe {
@ -20,7 +30,38 @@ impl Swapchain {
Self { handle, fp } Self { handle, fp }
} }
/// Loads all functions on the [`Instance`] instead of [`Device`]. This incurs an extra
/// dispatch table for [`Device`] functions but also allows the [`Instance`] function to be
/// loaded instead of always panicking. See also [`Self::new()`] for more details.
///
/// It is okay to pass [`vk::Device::null()`] when this struct is only used to call the
/// [`Instance`] function.
pub fn new_from_instance(entry: &Entry, instance: &Instance, device: vk::Device) -> Self {
let fp = vk::KhrSwapchainFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
});
Self { handle: device, fp }
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateSwapchainKHR.html>
#[inline]
pub unsafe fn create_swapchain(
&self,
create_info: &vk::SwapchainCreateInfoKHR,
allocation_callbacks: Option<&vk::AllocationCallbacks>,
) -> VkResult<vk::SwapchainKHR> {
let mut swapchain = mem::zeroed();
(self.fp.create_swapchain_khr)(
self.handle,
create_info,
allocation_callbacks.as_raw_ptr(),
&mut swapchain,
)
.result_with_success(swapchain)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroySwapchainKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroySwapchainKHR.html>
#[inline]
pub unsafe fn destroy_swapchain( pub unsafe fn destroy_swapchain(
&self, &self,
swapchain: vk::SwapchainKHR, swapchain: vk::SwapchainKHR,
@ -29,8 +70,21 @@ impl Swapchain {
(self.fp.destroy_swapchain_khr)(self.handle, swapchain, allocation_callbacks.as_raw_ptr()); (self.fp.destroy_swapchain_khr)(self.handle, swapchain, allocation_callbacks.as_raw_ptr());
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetSwapchainImagesKHR.html>
#[inline]
pub unsafe fn get_swapchain_images(
&self,
swapchain: vk::SwapchainKHR,
) -> VkResult<Vec<vk::Image>> {
read_into_uninitialized_vector(|count, data| {
(self.fp.get_swapchain_images_khr)(self.handle, swapchain, count, data)
})
}
/// On success, returns the next image's index and whether the swapchain is suboptimal for the surface. /// On success, returns the next image's index and whether the swapchain is suboptimal for the surface.
///
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkAcquireNextImageKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkAcquireNextImageKHR.html>
#[inline]
pub unsafe fn acquire_next_image( pub unsafe fn acquire_next_image(
&self, &self,
swapchain: vk::SwapchainKHR, swapchain: vk::SwapchainKHR,
@ -54,24 +108,10 @@ impl Swapchain {
} }
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateSwapchainKHR.html>
pub unsafe fn create_swapchain(
&self,
create_info: &vk::SwapchainCreateInfoKHR,
allocation_callbacks: Option<&vk::AllocationCallbacks>,
) -> VkResult<vk::SwapchainKHR> {
let mut swapchain = mem::zeroed();
(self.fp.create_swapchain_khr)(
self.handle,
create_info,
allocation_callbacks.as_raw_ptr(),
&mut swapchain,
)
.result_with_success(swapchain)
}
/// On success, returns whether the swapchain is suboptimal for the surface. /// On success, returns whether the swapchain is suboptimal for the surface.
///
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkQueuePresentKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkQueuePresentKHR.html>
#[inline]
pub unsafe fn queue_present( pub unsafe fn queue_present(
&self, &self,
queue: vk::Queue, queue: vk::Queue,
@ -85,24 +125,111 @@ impl Swapchain {
} }
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetSwapchainImagesKHR.html> /// Only available since [Vulkan 1.1].
pub unsafe fn get_swapchain_images( ///
/// Also available as [`DeviceGroup::get_device_group_present_capabilities()`]
/// when [`VK_KHR_surface`] is enabled.
///
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceGroupPresentCapabilitiesKHR.html>
///
/// [Vulkan 1.1]: https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_VERSION_1_1.html
/// [`VK_KHR_surface`]: https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_KHR_surface.html
#[inline]
pub unsafe fn get_device_group_present_capabilities(
&self, &self,
swapchain: vk::SwapchainKHR, device_group_present_capabilities: &mut vk::DeviceGroupPresentCapabilitiesKHR,
) -> VkResult<Vec<vk::Image>> { ) -> VkResult<()> {
(self.fp.get_device_group_present_capabilities_khr)(
self.handle,
device_group_present_capabilities,
)
.result()
}
/// Only available since [Vulkan 1.1].
///
/// Also available as [`DeviceGroup::get_device_group_surface_present_modes()`]
/// when [`VK_KHR_surface`] is enabled.
///
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceGroupSurfacePresentModesKHR.html>
///
/// [Vulkan 1.1]: https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_VERSION_1_1.html
/// [`VK_KHR_surface`]: https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_KHR_surface.html
#[inline]
pub unsafe fn get_device_group_surface_present_modes(
&self,
surface: vk::SurfaceKHR,
) -> VkResult<vk::DeviceGroupPresentModeFlagsKHR> {
let mut modes = mem::zeroed();
(self.fp.get_device_group_surface_present_modes_khr)(self.handle, surface, &mut modes)
.result_with_success(modes)
}
/// Only available since [Vulkan 1.1].
///
/// Also available as [`DeviceGroup::get_physical_device_present_rectangles()`]
/// when [`VK_KHR_surface`] is enabled.
///
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDevicePresentRectanglesKHR.html>
///
/// [Vulkan 1.1]: https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_VERSION_1_1.html
/// [`VK_KHR_surface`]: https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_KHR_surface.html
///
/// # Warning
///
/// Function will always panic unless this struct is loaded via [`Self::new_from_instance()`].
#[inline]
pub unsafe fn get_physical_device_present_rectangles(
&self,
physical_device: vk::PhysicalDevice,
surface: vk::SurfaceKHR,
) -> VkResult<Vec<vk::Rect2D>> {
read_into_uninitialized_vector(|count, data| { read_into_uninitialized_vector(|count, data| {
(self.fp.get_swapchain_images_khr)(self.handle, swapchain, count, data) (self.fp.get_physical_device_present_rectangles_khr)(
physical_device,
surface,
count,
data,
)
}) })
} }
/// On success, returns the next image's index and whether the swapchain is suboptimal for the surface.
///
/// Only available since [Vulkan 1.1].
///
/// Also available as [`DeviceGroup::acquire_next_image2()`]
/// when [`VK_KHR_swapchain`] is enabled.
///
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkAcquireNextImage2KHR.html>
///
/// [Vulkan 1.1]: https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_VERSION_1_1.html
/// [`VK_KHR_swapchain`]: https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_KHR_swapchain.html
#[inline]
pub unsafe fn acquire_next_image2(
&self,
acquire_info: &vk::AcquireNextImageInfoKHR,
) -> VkResult<(u32, bool)> {
let mut index = 0;
let err_code = (self.fp.acquire_next_image2_khr)(self.handle, acquire_info, &mut index);
match err_code {
vk::Result::SUCCESS => Ok((index, false)),
vk::Result::SUBOPTIMAL_KHR => Ok((index, true)),
_ => Err(err_code),
}
}
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrSwapchainFn::name() vk::KhrSwapchainFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrSwapchainFn { pub fn fp(&self) -> &vk::KhrSwapchainFn {
&self.fp &self.fp
} }
#[inline]
pub fn device(&self) -> vk::Device { pub fn device(&self) -> vk::Device {
self.handle self.handle
} }

View file

@ -18,6 +18,7 @@ impl Synchronization2 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdPipelineBarrier2KHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdPipelineBarrier2KHR.html>
#[inline]
pub unsafe fn cmd_pipeline_barrier2( pub unsafe fn cmd_pipeline_barrier2(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -27,6 +28,7 @@ impl Synchronization2 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdResetEvent2KHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdResetEvent2KHR.html>
#[inline]
pub unsafe fn cmd_reset_event2( pub unsafe fn cmd_reset_event2(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -37,6 +39,7 @@ impl Synchronization2 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetEvent2KHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetEvent2KHR.html>
#[inline]
pub unsafe fn cmd_set_event2( pub unsafe fn cmd_set_event2(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -47,6 +50,7 @@ impl Synchronization2 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdWaitEvents2KHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdWaitEvents2KHR.html>
#[inline]
pub unsafe fn cmd_wait_events2( pub unsafe fn cmd_wait_events2(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -63,6 +67,7 @@ impl Synchronization2 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdWriteTimestamp2KHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdWriteTimestamp2KHR.html>
#[inline]
pub unsafe fn cmd_write_timestamp2( pub unsafe fn cmd_write_timestamp2(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -74,6 +79,7 @@ impl Synchronization2 {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkQueueSubmit2KHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkQueueSubmit2KHR.html>
#[inline]
pub unsafe fn queue_submit2( pub unsafe fn queue_submit2(
&self, &self,
queue: vk::Queue, queue: vk::Queue,
@ -83,10 +89,12 @@ impl Synchronization2 {
(self.fp.queue_submit2_khr)(queue, submits.len() as u32, submits.as_ptr(), fence).result() (self.fp.queue_submit2_khr)(queue, submits.len() as u32, submits.as_ptr(), fence).result()
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrSynchronization2Fn::name() vk::KhrSynchronization2Fn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrSynchronization2Fn { pub fn fp(&self) -> &vk::KhrSynchronization2Fn {
&self.fp &self.fp
} }

View file

@ -20,6 +20,7 @@ impl TimelineSemaphore {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetSemaphoreCounterValue.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetSemaphoreCounterValue.html>
#[inline]
pub unsafe fn get_semaphore_counter_value(&self, semaphore: vk::Semaphore) -> VkResult<u64> { pub unsafe fn get_semaphore_counter_value(&self, semaphore: vk::Semaphore) -> VkResult<u64> {
let mut value = 0; let mut value = 0;
(self.fp.get_semaphore_counter_value_khr)(self.handle, semaphore, &mut value) (self.fp.get_semaphore_counter_value_khr)(self.handle, semaphore, &mut value)
@ -27,6 +28,7 @@ impl TimelineSemaphore {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkWaitSemaphores.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkWaitSemaphores.html>
#[inline]
pub unsafe fn wait_semaphores( pub unsafe fn wait_semaphores(
&self, &self,
wait_info: &vk::SemaphoreWaitInfo, wait_info: &vk::SemaphoreWaitInfo,
@ -36,18 +38,22 @@ impl TimelineSemaphore {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkSignalSemaphore.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkSignalSemaphore.html>
#[inline]
pub unsafe fn signal_semaphore(&self, signal_info: &vk::SemaphoreSignalInfo) -> VkResult<()> { pub unsafe fn signal_semaphore(&self, signal_info: &vk::SemaphoreSignalInfo) -> VkResult<()> {
(self.fp.signal_semaphore_khr)(self.handle, signal_info).result() (self.fp.signal_semaphore_khr)(self.handle, signal_info).result()
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrTimelineSemaphoreFn::name() vk::KhrTimelineSemaphoreFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrTimelineSemaphoreFn { pub fn fp(&self) -> &vk::KhrTimelineSemaphoreFn {
&self.fp &self.fp
} }
#[inline]
pub fn device(&self) -> vk::Device { pub fn device(&self) -> vk::Device {
self.handle self.handle
} }

View file

@ -21,6 +21,7 @@ impl WaylandSurface {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateWaylandSurfaceKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateWaylandSurfaceKHR.html>
#[inline]
pub unsafe fn create_wayland_surface( pub unsafe fn create_wayland_surface(
&self, &self,
create_info: &vk::WaylandSurfaceCreateInfoKHR, create_info: &vk::WaylandSurfaceCreateInfoKHR,
@ -37,6 +38,7 @@ impl WaylandSurface {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceWaylandPresentationSupportKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceWaylandPresentationSupportKHR.html>
#[inline]
pub unsafe fn get_physical_device_wayland_presentation_support( pub unsafe fn get_physical_device_wayland_presentation_support(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -52,14 +54,17 @@ impl WaylandSurface {
b > 0 b > 0
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrWaylandSurfaceFn::name() vk::KhrWaylandSurfaceFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrWaylandSurfaceFn { pub fn fp(&self) -> &vk::KhrWaylandSurfaceFn {
&self.fp &self.fp
} }
#[inline]
pub fn instance(&self) -> vk::Instance { pub fn instance(&self) -> vk::Instance {
self.handle self.handle
} }

View file

@ -21,6 +21,7 @@ impl Win32Surface {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateWin32SurfaceKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateWin32SurfaceKHR.html>
#[inline]
pub unsafe fn create_win32_surface( pub unsafe fn create_win32_surface(
&self, &self,
create_info: &vk::Win32SurfaceCreateInfoKHR, create_info: &vk::Win32SurfaceCreateInfoKHR,
@ -37,6 +38,7 @@ impl Win32Surface {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceWin32PresentationSupportKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceWin32PresentationSupportKHR.html>
#[inline]
pub unsafe fn get_physical_device_win32_presentation_support( pub unsafe fn get_physical_device_win32_presentation_support(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -50,14 +52,17 @@ impl Win32Surface {
b > 0 b > 0
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrWin32SurfaceFn::name() vk::KhrWin32SurfaceFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrWin32SurfaceFn { pub fn fp(&self) -> &vk::KhrWin32SurfaceFn {
&self.fp &self.fp
} }
#[inline]
pub fn instance(&self) -> vk::Instance { pub fn instance(&self) -> vk::Instance {
self.handle self.handle
} }

View file

@ -21,6 +21,7 @@ impl XcbSurface {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateXcbSurfaceKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateXcbSurfaceKHR.html>
#[inline]
pub unsafe fn create_xcb_surface( pub unsafe fn create_xcb_surface(
&self, &self,
create_info: &vk::XcbSurfaceCreateInfoKHR, create_info: &vk::XcbSurfaceCreateInfoKHR,
@ -37,6 +38,7 @@ impl XcbSurface {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceXcbPresentationSupportKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceXcbPresentationSupportKHR.html>
#[inline]
pub unsafe fn get_physical_device_xcb_presentation_support( pub unsafe fn get_physical_device_xcb_presentation_support(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -54,14 +56,17 @@ impl XcbSurface {
b > 0 b > 0
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrXcbSurfaceFn::name() vk::KhrXcbSurfaceFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrXcbSurfaceFn { pub fn fp(&self) -> &vk::KhrXcbSurfaceFn {
&self.fp &self.fp
} }
#[inline]
pub fn instance(&self) -> vk::Instance { pub fn instance(&self) -> vk::Instance {
self.handle self.handle
} }

View file

@ -21,6 +21,7 @@ impl XlibSurface {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateXlibSurfaceKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateXlibSurfaceKHR.html>
#[inline]
pub unsafe fn create_xlib_surface( pub unsafe fn create_xlib_surface(
&self, &self,
create_info: &vk::XlibSurfaceCreateInfoKHR, create_info: &vk::XlibSurfaceCreateInfoKHR,
@ -37,6 +38,7 @@ impl XlibSurface {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceXlibPresentationSupportKHR.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceXlibPresentationSupportKHR.html>
#[inline]
pub unsafe fn get_physical_device_xlib_presentation_support( pub unsafe fn get_physical_device_xlib_presentation_support(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -54,14 +56,17 @@ impl XlibSurface {
b > 0 b > 0
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::KhrXlibSurfaceFn::name() vk::KhrXlibSurfaceFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::KhrXlibSurfaceFn { pub fn fp(&self) -> &vk::KhrXlibSurfaceFn {
&self.fp &self.fp
} }
#[inline]
pub fn instance(&self) -> vk::Instance { pub fn instance(&self) -> vk::Instance {
self.handle self.handle
} }

View file

@ -21,6 +21,7 @@ impl IOSSurface {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateIOSSurfaceMVK.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateIOSSurfaceMVK.html>
#[inline]
pub unsafe fn create_ios_surface( pub unsafe fn create_ios_surface(
&self, &self,
create_info: &vk::IOSSurfaceCreateInfoMVK, create_info: &vk::IOSSurfaceCreateInfoMVK,
@ -36,14 +37,17 @@ impl IOSSurface {
.result_with_success(surface) .result_with_success(surface)
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::MvkIosSurfaceFn::name() vk::MvkIosSurfaceFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::MvkIosSurfaceFn { pub fn fp(&self) -> &vk::MvkIosSurfaceFn {
&self.fp &self.fp
} }
#[inline]
pub fn instance(&self) -> vk::Instance { pub fn instance(&self) -> vk::Instance {
self.handle self.handle
} }

View file

@ -21,6 +21,7 @@ impl MacOSSurface {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateMacOSSurfaceMVK.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateMacOSSurfaceMVK.html>
#[inline]
pub unsafe fn create_mac_os_surface( pub unsafe fn create_mac_os_surface(
&self, &self,
create_info: &vk::MacOSSurfaceCreateInfoMVK, create_info: &vk::MacOSSurfaceCreateInfoMVK,
@ -36,14 +37,17 @@ impl MacOSSurface {
.result_with_success(surface) .result_with_success(surface)
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::MvkMacosSurfaceFn::name() vk::MvkMacosSurfaceFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::MvkMacosSurfaceFn { pub fn fp(&self) -> &vk::MvkMacosSurfaceFn {
&self.fp &self.fp
} }
#[inline]
pub fn instance(&self) -> vk::Instance { pub fn instance(&self) -> vk::Instance {
self.handle self.handle
} }

View file

@ -21,6 +21,7 @@ impl ViSurface {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateViSurfaceNN.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateViSurfaceNN.html>
#[inline]
pub unsafe fn create_vi_surface( pub unsafe fn create_vi_surface(
&self, &self,
create_info: &vk::ViSurfaceCreateInfoNN, create_info: &vk::ViSurfaceCreateInfoNN,
@ -36,14 +37,17 @@ impl ViSurface {
.result_with_success(surface) .result_with_success(surface)
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::NnViSurfaceFn::name() vk::NnViSurfaceFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::NnViSurfaceFn { pub fn fp(&self) -> &vk::NnViSurfaceFn {
&self.fp &self.fp
} }
#[inline]
pub fn instance(&self) -> vk::Instance { pub fn instance(&self) -> vk::Instance {
self.handle self.handle
} }

View file

@ -0,0 +1,70 @@
use crate::prelude::*;
use crate::vk;
use crate::{Entry, Instance};
use std::ffi::CStr;
use std::mem;
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_NV_coverage_reduction_mode.html>
#[derive(Clone)]
pub struct CoverageReductionMode {
fp: vk::NvCoverageReductionModeFn,
}
impl CoverageReductionMode {
pub fn new(entry: &Entry, instance: &Instance) -> Self {
let fp = vk::NvCoverageReductionModeFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
});
Self { fp }
}
/// Retrieve the number of elements to pass to [`get_physical_device_supported_framebuffer_mixed_samples_combinations()`][Self::get_physical_device_supported_framebuffer_mixed_samples_combinations()]
#[inline]
pub unsafe fn get_physical_device_supported_framebuffer_mixed_samples_combinations_len(
&self,
physical_device: vk::PhysicalDevice,
) -> VkResult<usize> {
let mut count = 0;
(self
.fp
.get_physical_device_supported_framebuffer_mixed_samples_combinations_nv)(
physical_device,
&mut count,
std::ptr::null_mut(),
)
.result_with_success(count as usize)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV.html>
///
/// Call [`get_physical_device_supported_framebuffer_mixed_samples_combinations_len()`][Self::get_physical_device_supported_framebuffer_mixed_samples_combinations_len()] to query the number of elements to pass to `out`.
/// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer.
#[inline]
pub unsafe fn get_physical_device_supported_framebuffer_mixed_samples_combinations(
&self,
physical_device: vk::PhysicalDevice,
out: &mut [vk::FramebufferMixedSamplesCombinationNV],
) -> VkResult<()> {
let mut count = out.len() as u32;
(self
.fp
.get_physical_device_supported_framebuffer_mixed_samples_combinations_nv)(
physical_device,
&mut count,
out.as_mut_ptr(),
)
.result()?;
assert_eq!(count as usize, out.len());
Ok(())
}
#[inline]
pub const fn name() -> &'static CStr {
vk::NvCoverageReductionModeFn::name()
}
#[inline]
pub fn fp(&self) -> &vk::NvCoverageReductionModeFn {
&self.fp
}
}

View file

@ -19,6 +19,7 @@ impl DeviceDiagnosticCheckpoints {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetCheckpointNV.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetCheckpointNV.html>
#[inline]
pub unsafe fn cmd_set_checkpoint( pub unsafe fn cmd_set_checkpoint(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -28,6 +29,7 @@ impl DeviceDiagnosticCheckpoints {
} }
/// Retrieve the number of elements to pass to [`get_queue_checkpoint_data()`][Self::get_queue_checkpoint_data()] /// Retrieve the number of elements to pass to [`get_queue_checkpoint_data()`][Self::get_queue_checkpoint_data()]
#[inline]
pub unsafe fn get_queue_checkpoint_data_len(&self, queue: vk::Queue) -> usize { pub unsafe fn get_queue_checkpoint_data_len(&self, queue: vk::Queue) -> usize {
let mut count = 0; let mut count = 0;
(self.fp.get_queue_checkpoint_data_nv)(queue, &mut count, std::ptr::null_mut()); (self.fp.get_queue_checkpoint_data_nv)(queue, &mut count, std::ptr::null_mut());
@ -38,6 +40,7 @@ impl DeviceDiagnosticCheckpoints {
/// ///
/// Call [`get_queue_checkpoint_data_len()`][Self::get_queue_checkpoint_data_len()] to query the number of elements to pass to `out`. /// Call [`get_queue_checkpoint_data_len()`][Self::get_queue_checkpoint_data_len()] to query the number of elements to pass to `out`.
/// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer. /// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer.
#[inline]
pub unsafe fn get_queue_checkpoint_data( pub unsafe fn get_queue_checkpoint_data(
&self, &self,
queue: vk::Queue, queue: vk::Queue,
@ -48,10 +51,12 @@ impl DeviceDiagnosticCheckpoints {
assert_eq!(count as usize, out.len()); assert_eq!(count as usize, out.len());
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::NvDeviceDiagnosticCheckpointsFn::name() vk::NvDeviceDiagnosticCheckpointsFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::NvDeviceDiagnosticCheckpointsFn { pub fn fp(&self) -> &vk::NvDeviceDiagnosticCheckpointsFn {
&self.fp &self.fp
} }

View file

@ -17,6 +17,7 @@ impl MeshShader {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdDrawMeshTasksNV.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdDrawMeshTasksNV.html>
#[inline]
pub unsafe fn cmd_draw_mesh_tasks( pub unsafe fn cmd_draw_mesh_tasks(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -27,6 +28,7 @@ impl MeshShader {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdDrawMeshTasksIndirectNV.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdDrawMeshTasksIndirectNV.html>
#[inline]
pub unsafe fn cmd_draw_mesh_tasks_indirect( pub unsafe fn cmd_draw_mesh_tasks_indirect(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -45,6 +47,7 @@ impl MeshShader {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdDrawMeshTasksIndirectCountNV.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdDrawMeshTasksIndirectCountNV.html>
#[inline]
pub unsafe fn cmd_draw_mesh_tasks_indirect_count( pub unsafe fn cmd_draw_mesh_tasks_indirect_count(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -66,10 +69,12 @@ impl MeshShader {
); );
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::NvMeshShaderFn::name() vk::NvMeshShaderFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::NvMeshShaderFn { pub fn fp(&self) -> &vk::NvMeshShaderFn {
&self.fp &self.fp
} }

View file

@ -1,7 +1,9 @@
pub use self::coverage_reduction_mode::CoverageReductionMode;
pub use self::device_diagnostic_checkpoints::DeviceDiagnosticCheckpoints; pub use self::device_diagnostic_checkpoints::DeviceDiagnosticCheckpoints;
pub use self::mesh_shader::MeshShader; pub use self::mesh_shader::MeshShader;
pub use self::ray_tracing::RayTracing; pub use self::ray_tracing::RayTracing;
mod coverage_reduction_mode;
mod device_diagnostic_checkpoints; mod device_diagnostic_checkpoints;
mod mesh_shader; mod mesh_shader;
mod ray_tracing; mod ray_tracing;

View file

@ -20,6 +20,7 @@ impl RayTracing {
Self { handle, fp } Self { handle, fp }
} }
#[inline]
pub unsafe fn get_properties( pub unsafe fn get_properties(
instance: &Instance, instance: &Instance,
pdevice: vk::PhysicalDevice, pdevice: vk::PhysicalDevice,
@ -33,6 +34,7 @@ impl RayTracing {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateAccelerationStructureNV.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateAccelerationStructureNV.html>
#[inline]
pub unsafe fn create_acceleration_structure( pub unsafe fn create_acceleration_structure(
&self, &self,
create_info: &vk::AccelerationStructureCreateInfoNV, create_info: &vk::AccelerationStructureCreateInfoNV,
@ -49,6 +51,7 @@ impl RayTracing {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyAccelerationStructureNV.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyAccelerationStructureNV.html>
#[inline]
pub unsafe fn destroy_acceleration_structure( pub unsafe fn destroy_acceleration_structure(
&self, &self,
accel_struct: vk::AccelerationStructureNV, accel_struct: vk::AccelerationStructureNV,
@ -62,6 +65,7 @@ impl RayTracing {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetAccelerationStructureMemoryRequirementsNV.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetAccelerationStructureMemoryRequirementsNV.html>
#[inline]
pub unsafe fn get_acceleration_structure_memory_requirements( pub unsafe fn get_acceleration_structure_memory_requirements(
&self, &self,
info: &vk::AccelerationStructureMemoryRequirementsInfoNV, info: &vk::AccelerationStructureMemoryRequirementsInfoNV,
@ -76,6 +80,7 @@ impl RayTracing {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkBindAccelerationStructureMemoryNV.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkBindAccelerationStructureMemoryNV.html>
#[inline]
pub unsafe fn bind_acceleration_structure_memory( pub unsafe fn bind_acceleration_structure_memory(
&self, &self,
bind_info: &[vk::BindAccelerationStructureMemoryInfoNV], bind_info: &[vk::BindAccelerationStructureMemoryInfoNV],
@ -89,6 +94,7 @@ impl RayTracing {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBuildAccelerationStructureNV.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBuildAccelerationStructureNV.html>
#[inline]
pub unsafe fn cmd_build_acceleration_structure( pub unsafe fn cmd_build_acceleration_structure(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -115,6 +121,7 @@ impl RayTracing {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdCopyAccelerationStructureNV.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdCopyAccelerationStructureNV.html>
#[inline]
pub unsafe fn cmd_copy_acceleration_structure( pub unsafe fn cmd_copy_acceleration_structure(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -126,6 +133,7 @@ impl RayTracing {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdTraceRaysNV.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdTraceRaysNV.html>
#[inline]
pub unsafe fn cmd_trace_rays( pub unsafe fn cmd_trace_rays(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -164,6 +172,7 @@ impl RayTracing {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateRayTracingPipelinesNV.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateRayTracingPipelinesNV.html>
#[inline]
pub unsafe fn create_ray_tracing_pipelines( pub unsafe fn create_ray_tracing_pipelines(
&self, &self,
pipeline_cache: vk::PipelineCache, pipeline_cache: vk::PipelineCache,
@ -183,6 +192,7 @@ impl RayTracing {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetRayTracingShaderGroupHandlesNV.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetRayTracingShaderGroupHandlesNV.html>
#[inline]
pub unsafe fn get_ray_tracing_shader_group_handles( pub unsafe fn get_ray_tracing_shader_group_handles(
&self, &self,
pipeline: vk::Pipeline, pipeline: vk::Pipeline,
@ -196,12 +206,13 @@ impl RayTracing {
first_group, first_group,
group_count, group_count,
data.len(), data.len(),
data.as_mut_ptr() as *mut std::ffi::c_void, data.as_mut_ptr().cast(),
) )
.result() .result()
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetAccelerationStructureHandleNV.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetAccelerationStructureHandleNV.html>
#[inline]
pub unsafe fn get_acceleration_structure_handle( pub unsafe fn get_acceleration_structure_handle(
&self, &self,
accel_struct: vk::AccelerationStructureNV, accel_struct: vk::AccelerationStructureNV,
@ -212,12 +223,13 @@ impl RayTracing {
self.handle, self.handle,
accel_struct, accel_struct,
std::mem::size_of::<u64>(), std::mem::size_of::<u64>(),
handle_ptr as *mut std::ffi::c_void, handle_ptr.cast(),
) )
.result_with_success(handle) .result_with_success(handle)
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdWriteAccelerationStructuresPropertiesNV.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdWriteAccelerationStructuresPropertiesNV.html>
#[inline]
pub unsafe fn cmd_write_acceleration_structures_properties( pub unsafe fn cmd_write_acceleration_structures_properties(
&self, &self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
@ -237,18 +249,22 @@ impl RayTracing {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCompileDeferredNV.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCompileDeferredNV.html>
#[inline]
pub unsafe fn compile_deferred(&self, pipeline: vk::Pipeline, shader: u32) -> VkResult<()> { pub unsafe fn compile_deferred(&self, pipeline: vk::Pipeline, shader: u32) -> VkResult<()> {
(self.fp.compile_deferred_nv)(self.handle, pipeline, shader).result() (self.fp.compile_deferred_nv)(self.handle, pipeline, shader).result()
} }
#[inline]
pub const fn name() -> &'static CStr { pub const fn name() -> &'static CStr {
vk::NvRayTracingFn::name() vk::NvRayTracingFn::name()
} }
#[inline]
pub fn fp(&self) -> &vk::NvRayTracingFn { pub fn fp(&self) -> &vk::NvRayTracingFn {
&self.fp &self.fp
} }
#[inline]
pub fn device(&self) -> vk::Device { pub fn device(&self) -> vk::Device {
self.handle self.handle
} }

View file

@ -1,3 +1,5 @@
#[cfg(doc)]
use super::Entry;
use crate::device::Device; use crate::device::Device;
use crate::prelude::*; use crate::prelude::*;
use crate::vk; use crate::vk;
@ -33,6 +35,7 @@ impl Instance {
} }
} }
#[inline]
pub fn handle(&self) -> vk::Instance { pub fn handle(&self) -> vk::Instance {
self.handle self.handle
} }
@ -41,11 +44,13 @@ impl Instance {
/// Vulkan core 1.3 /// Vulkan core 1.3
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
impl Instance { impl Instance {
#[inline]
pub fn fp_v1_3(&self) -> &vk::InstanceFnV1_3 { pub fn fp_v1_3(&self) -> &vk::InstanceFnV1_3 {
&self.instance_fn_1_3 &self.instance_fn_1_3
} }
/// Retrieve the number of elements to pass to [`get_physical_device_tool_properties()`][Self::get_physical_device_tool_properties()] /// Retrieve the number of elements to pass to [`get_physical_device_tool_properties()`][Self::get_physical_device_tool_properties()]
#[inline]
pub unsafe fn get_physical_device_tool_properties_len( pub unsafe fn get_physical_device_tool_properties_len(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -63,6 +68,7 @@ impl Instance {
/// ///
/// Call [`get_physical_device_tool_properties_len()`][Self::get_physical_device_tool_properties_len()] to query the number of elements to pass to `out`. /// Call [`get_physical_device_tool_properties_len()`][Self::get_physical_device_tool_properties_len()] to query the number of elements to pass to `out`.
/// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer. /// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer.
#[inline]
pub unsafe fn get_physical_device_tool_properties( pub unsafe fn get_physical_device_tool_properties(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -83,6 +89,7 @@ impl Instance {
/// Vulkan core 1.2 /// Vulkan core 1.2
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
impl Instance { impl Instance {
#[inline]
pub fn fp_v1_2(&self) -> &vk::InstanceFnV1_2 { pub fn fp_v1_2(&self) -> &vk::InstanceFnV1_2 {
&self.instance_fn_1_2 &self.instance_fn_1_2
} }
@ -91,11 +98,13 @@ impl Instance {
/// Vulkan core 1.1 /// Vulkan core 1.1
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
impl Instance { impl Instance {
#[inline]
pub fn fp_v1_1(&self) -> &vk::InstanceFnV1_1 { pub fn fp_v1_1(&self) -> &vk::InstanceFnV1_1 {
&self.instance_fn_1_1 &self.instance_fn_1_1
} }
/// Retrieve the number of elements to pass to [`enumerate_physical_device_groups()`][Self::enumerate_physical_device_groups()] /// Retrieve the number of elements to pass to [`enumerate_physical_device_groups()`][Self::enumerate_physical_device_groups()]
#[inline]
pub unsafe fn enumerate_physical_device_groups_len(&self) -> VkResult<usize> { pub unsafe fn enumerate_physical_device_groups_len(&self) -> VkResult<usize> {
let mut group_count = 0; let mut group_count = 0;
(self.instance_fn_1_1.enumerate_physical_device_groups)( (self.instance_fn_1_1.enumerate_physical_device_groups)(
@ -110,6 +119,7 @@ impl Instance {
/// ///
/// Call [`enumerate_physical_device_groups_len()`][Self::enumerate_physical_device_groups_len()] to query the number of elements to pass to `out`. /// Call [`enumerate_physical_device_groups_len()`][Self::enumerate_physical_device_groups_len()] to query the number of elements to pass to `out`.
/// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer. /// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer.
#[inline]
pub unsafe fn enumerate_physical_device_groups( pub unsafe fn enumerate_physical_device_groups(
&self, &self,
out: &mut [vk::PhysicalDeviceGroupProperties], out: &mut [vk::PhysicalDeviceGroupProperties],
@ -126,6 +136,7 @@ impl Instance {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceFeatures2.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceFeatures2.html>
#[inline]
pub unsafe fn get_physical_device_features2( pub unsafe fn get_physical_device_features2(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -135,6 +146,7 @@ impl Instance {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceProperties2.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceProperties2.html>
#[inline]
pub unsafe fn get_physical_device_properties2( pub unsafe fn get_physical_device_properties2(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -144,6 +156,7 @@ impl Instance {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceFormatProperties2.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceFormatProperties2.html>
#[inline]
pub unsafe fn get_physical_device_format_properties2( pub unsafe fn get_physical_device_format_properties2(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -154,6 +167,7 @@ impl Instance {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceImageFormatProperties2.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceImageFormatProperties2.html>
#[inline]
pub unsafe fn get_physical_device_image_format_properties2( pub unsafe fn get_physical_device_image_format_properties2(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -171,6 +185,7 @@ impl Instance {
} }
/// Retrieve the number of elements to pass to [`get_physical_device_queue_family_properties2()`][Self::get_physical_device_queue_family_properties2()] /// Retrieve the number of elements to pass to [`get_physical_device_queue_family_properties2()`][Self::get_physical_device_queue_family_properties2()]
#[inline]
pub unsafe fn get_physical_device_queue_family_properties2_len( pub unsafe fn get_physical_device_queue_family_properties2_len(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -190,6 +205,7 @@ impl Instance {
/// ///
/// Call [`get_physical_device_queue_family_properties2_len()`][Self::get_physical_device_queue_family_properties2_len()] to query the number of elements to pass to `out`. /// Call [`get_physical_device_queue_family_properties2_len()`][Self::get_physical_device_queue_family_properties2_len()] to query the number of elements to pass to `out`.
/// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer. /// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer.
#[inline]
pub unsafe fn get_physical_device_queue_family_properties2( pub unsafe fn get_physical_device_queue_family_properties2(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -207,6 +223,7 @@ impl Instance {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceMemoryProperties2.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceMemoryProperties2.html>
#[inline]
pub unsafe fn get_physical_device_memory_properties2( pub unsafe fn get_physical_device_memory_properties2(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -216,6 +233,7 @@ impl Instance {
} }
/// Retrieve the number of elements to pass to [`get_physical_device_sparse_image_format_properties2()`][Self::get_physical_device_sparse_image_format_properties2()] /// Retrieve the number of elements to pass to [`get_physical_device_sparse_image_format_properties2()`][Self::get_physical_device_sparse_image_format_properties2()]
#[inline]
pub unsafe fn get_physical_device_sparse_image_format_properties2_len( pub unsafe fn get_physical_device_sparse_image_format_properties2_len(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -237,6 +255,7 @@ impl Instance {
/// ///
/// Call [`get_physical_device_sparse_image_format_properties2_len()`][Self::get_physical_device_sparse_image_format_properties2_len()] to query the number of elements to pass to `out`. /// Call [`get_physical_device_sparse_image_format_properties2_len()`][Self::get_physical_device_sparse_image_format_properties2_len()] to query the number of elements to pass to `out`.
/// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer. /// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer.
#[inline]
pub unsafe fn get_physical_device_sparse_image_format_properties2( pub unsafe fn get_physical_device_sparse_image_format_properties2(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -256,6 +275,7 @@ impl Instance {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceExternalBufferProperties.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceExternalBufferProperties.html>
#[inline]
pub unsafe fn get_physical_device_external_buffer_properties( pub unsafe fn get_physical_device_external_buffer_properties(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -272,6 +292,7 @@ impl Instance {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceExternalFenceProperties.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceExternalFenceProperties.html>
#[inline]
pub unsafe fn get_physical_device_external_fence_properties( pub unsafe fn get_physical_device_external_fence_properties(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -288,6 +309,7 @@ impl Instance {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceExternalSemaphoreProperties.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceExternalSemaphoreProperties.html>
#[inline]
pub unsafe fn get_physical_device_external_semaphore_properties( pub unsafe fn get_physical_device_external_semaphore_properties(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -307,6 +329,7 @@ impl Instance {
/// Vulkan core 1.0 /// Vulkan core 1.0
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
impl Instance { impl Instance {
#[inline]
pub fn fp_v1_0(&self) -> &vk::InstanceFnV1_0 { pub fn fp_v1_0(&self) -> &vk::InstanceFnV1_0 {
&self.instance_fn_1_0 &self.instance_fn_1_0
} }
@ -314,9 +337,18 @@ impl Instance {
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateDevice.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateDevice.html>
/// ///
/// # Safety /// # Safety
/// In order for the created [`Device`] to be valid for the duration of its ///
/// usage, the [`Instance`] this was called on must be dropped later than the /// There is a [parent/child relation] between [`Instance`] and the resulting [`Device`]. The
/// resulting [`Device`]. /// application must not [destroy][Instance::destroy_instance()] the parent [`Instance`] object
/// before first [destroying][Device::destroy_device()] the returned [`Device`] child object.
/// [`Device`] does _not_ implement [drop][drop()] semantics and can only be destroyed via
/// [`destroy_device()`][Device::destroy_device()].
///
/// See the [`Entry::create_instance()`] documentation for more destruction ordering rules on
/// [`Instance`].
///
/// [parent/child relation]: https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#fundamentals-objectmodel-lifetime
#[inline]
pub unsafe fn create_device( pub unsafe fn create_device(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -335,6 +367,7 @@ impl Instance {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceProcAddr.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceProcAddr.html>
#[inline]
pub unsafe fn get_device_proc_addr( pub unsafe fn get_device_proc_addr(
&self, &self,
device: vk::Device, device: vk::Device,
@ -344,11 +377,13 @@ impl Instance {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyInstance.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyInstance.html>
#[inline]
pub unsafe fn destroy_instance(&self, allocation_callbacks: Option<&vk::AllocationCallbacks>) { pub unsafe fn destroy_instance(&self, allocation_callbacks: Option<&vk::AllocationCallbacks>) {
(self.instance_fn_1_0.destroy_instance)(self.handle(), allocation_callbacks.as_raw_ptr()); (self.instance_fn_1_0.destroy_instance)(self.handle(), allocation_callbacks.as_raw_ptr());
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceFormatProperties.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceFormatProperties.html>
#[inline]
pub unsafe fn get_physical_device_format_properties( pub unsafe fn get_physical_device_format_properties(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -364,6 +399,7 @@ impl Instance {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceImageFormatProperties.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceImageFormatProperties.html>
#[inline]
pub unsafe fn get_physical_device_image_format_properties( pub unsafe fn get_physical_device_image_format_properties(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -389,6 +425,7 @@ impl Instance {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceMemoryProperties.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceMemoryProperties.html>
#[inline]
pub unsafe fn get_physical_device_memory_properties( pub unsafe fn get_physical_device_memory_properties(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -402,6 +439,7 @@ impl Instance {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceProperties.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceProperties.html>
#[inline]
pub unsafe fn get_physical_device_properties( pub unsafe fn get_physical_device_properties(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -412,6 +450,7 @@ impl Instance {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceQueueFamilyProperties.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceQueueFamilyProperties.html>
#[inline]
pub unsafe fn get_physical_device_queue_family_properties( pub unsafe fn get_physical_device_queue_family_properties(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -429,6 +468,7 @@ impl Instance {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceFeatures.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceFeatures.html>
#[inline]
pub unsafe fn get_physical_device_features( pub unsafe fn get_physical_device_features(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
@ -439,6 +479,7 @@ impl Instance {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumeratePhysicalDevices.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumeratePhysicalDevices.html>
#[inline]
pub unsafe fn enumerate_physical_devices(&self) -> VkResult<Vec<vk::PhysicalDevice>> { pub unsafe fn enumerate_physical_devices(&self) -> VkResult<Vec<vk::PhysicalDevice>> {
read_into_uninitialized_vector(|count, data| { read_into_uninitialized_vector(|count, data| {
(self.instance_fn_1_0.enumerate_physical_devices)(self.handle(), count, data) (self.instance_fn_1_0.enumerate_physical_devices)(self.handle(), count, data)
@ -446,6 +487,7 @@ impl Instance {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumerateDeviceExtensionProperties.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumerateDeviceExtensionProperties.html>
#[inline]
pub unsafe fn enumerate_device_extension_properties( pub unsafe fn enumerate_device_extension_properties(
&self, &self,
device: vk::PhysicalDevice, device: vk::PhysicalDevice,
@ -461,6 +503,7 @@ impl Instance {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumerateDeviceLayerProperties.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumerateDeviceLayerProperties.html>
#[inline]
pub unsafe fn enumerate_device_layer_properties( pub unsafe fn enumerate_device_layer_properties(
&self, &self,
device: vk::PhysicalDevice, device: vk::PhysicalDevice,
@ -471,6 +514,7 @@ impl Instance {
} }
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSparseImageFormatProperties.html> /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSparseImageFormatProperties.html>
#[inline]
pub unsafe fn get_physical_device_sparse_image_format_properties( pub unsafe fn get_physical_device_sparse_image_format_properties(
&self, &self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,

View file

@ -33,6 +33,12 @@
//! Load the Vulkan library linked at compile time using [`Entry::linked()`], or load it at runtime //! Load the Vulkan library linked at compile time using [`Entry::linked()`], or load it at runtime
//! using [`Entry::load()`], which uses `libloading`. If you want to perform entry point loading //! using [`Entry::load()`], which uses `libloading`. If you want to perform entry point loading
//! yourself, call [`Entry::from_static_fn()`]. //! yourself, call [`Entry::from_static_fn()`].
//!
//! ## Crate features
//!
//! * **debug** (default): Whether Vulkan structs should implement `Debug`.
//! * **loaded** (default): Support searching for the Vulkan loader manually at runtime.
//! * **linked**: Link the Vulkan loader at compile time.
pub use crate::device::Device; pub use crate::device::Device;
pub use crate::entry::Entry; pub use crate::entry::Entry;
@ -66,6 +72,107 @@ impl<'r, T> RawPtr<T> for Option<&'r T> {
} }
} }
/// Given a mutable raw pointer to a type with an `s_type` member such as [`vk::BaseOutStructure`],
/// match on a set of Vulkan structures. The struct will be rebound to the given variable of the
/// type of the given Vulkan structure.
///
/// Note that all match bodies have to be enclosed by curly braces due to macro parsing limitations.
/// It is unfortunately not possible to write `x @ ash::vk::SomeStruct => one_line_expression(),`.
///
/// ```
/// let mut info = ash::vk::DeviceCreateInfo::default();
/// let info: *mut ash::vk::BaseOutStructure = <*mut _>::cast(&mut info);
/// unsafe {
/// ash::match_out_struct!(match info {
/// info @ ash::vk::DeviceQueueCreateInfo => {
/// dbg!(&info); // Unreachable
/// }
/// info @ ash::vk::DeviceCreateInfo => {
/// dbg!(&info);
/// }
/// })
/// }
/// ```
///
/// In addition this macro propagates implicit return values just like normal `match` blocks, as
/// long as a default value or expression is provided in the "any" match arm
/// (`_ => { some_value() }`). For the time being said arm must be wrapped in curly braces; an
/// expression like `_ => None` is not yet supported.
///
/// ```
/// # let mut info = ash::vk::DeviceCreateInfo::default();
/// # let info: *mut ash::vk::BaseOutStructure = <*mut _>::cast(&mut info);
/// let device_create_flags: Option<ash::vk::DeviceCreateFlags> = unsafe {
/// ash::match_out_struct!(match info {
/// info @ ash::vk::DeviceQueueCreateInfo => {
/// dbg!(&info); // Unreachable
/// Some(ash::vk::DeviceCreateFlags::empty())
/// }
/// info @ ash::vk::DeviceCreateInfo => {
/// dbg!(&info);
/// Some(info.flags)
/// }
/// _ => {
/// None
/// }
/// })
/// };
/// ```
#[macro_export]
macro_rules! match_out_struct {
(match $p:ident { $($bind:ident @ $ty:path => $body:block $(,)?)+ $(_ => $any:block $(,)?)? }) => {
match std::ptr::addr_of!((*$p).s_type).read() {
$(<$ty as $crate::vk::TaggedStructure>::STRUCTURE_TYPE => {
let $bind = $p
.cast::<$ty>()
.as_mut()
.unwrap();
$body
}),+
_ => { $($any)? }
}
};
}
/// Given an immutable raw pointer to a type with an `s_type` member such as [`vk::BaseInStructure`],
/// match on a set of Vulkan structures. The struct will be rebound to the given variable of the
/// type of the given Vulkan structure.
///
/// Note that all match bodies have to be enclosed by curly braces due to macro parsing limitations.
/// It is unfortunately not possible to write `x @ ash::vk::SomeStruct => one_line_expression(),`.
///
/// ```
/// let info = ash::vk::DeviceCreateInfo::default();
/// let info: *const ash::vk::BaseInStructure = <*const _>::cast(&info);
/// unsafe {
/// ash::match_in_struct!(match info {
/// info @ ash::vk::DeviceQueueCreateInfo => {
/// dbg!(&info); // Unreachable
/// }
/// info @ ash::vk::DeviceCreateInfo => {
/// dbg!(&info);
/// }
/// })
/// }
/// ```
///
/// See the [`match_out_struct!`] documentation for an example with implicit return values.
#[macro_export]
macro_rules! match_in_struct {
(match $p:ident { $($bind:ident @ $ty:path => $body:block $(,)?)+ $(_ => $any:block $(,)?)? }) => {
match std::ptr::addr_of!((*$p).s_type).read() {
$(<$ty as $crate::vk::TaggedStructure>::STRUCTURE_TYPE => {
let $bind = $p
.cast::<$ty>()
.as_ref()
.unwrap();
$body
}),+
_ => { $($any)? }
}
};
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::vk; use super::vk;

View file

@ -1,30 +1,37 @@
use std::convert::TryInto; use std::convert::TryInto;
#[cfg(feature = "debug")] #[cfg(feature = "debug")]
use std::fmt; use std::fmt;
use std::mem;
use crate::vk; use crate::vk;
pub type VkResult<T> = Result<T, vk::Result>; pub type VkResult<T> = Result<T, vk::Result>;
impl vk::Result { impl vk::Result {
#[inline]
pub fn result(self) -> VkResult<()> { pub fn result(self) -> VkResult<()> {
self.result_with_success(()) self.result_with_success(())
} }
#[inline]
pub fn result_with_success<T>(self, v: T) -> VkResult<T> { pub fn result_with_success<T>(self, v: T) -> VkResult<T> {
match self { match self {
Self::SUCCESS => Ok(v), Self::SUCCESS => Ok(v),
_ => Err(self), _ => Err(self),
} }
} }
#[inline]
pub unsafe fn assume_init_on_success<T>(self, v: mem::MaybeUninit<T>) -> VkResult<T> {
self.result().map(move |()| v.assume_init())
}
} }
/// Repeatedly calls `f` until it does not return [`vk::Result::INCOMPLETE`] anymore, /// Repeatedly calls `f` until it does not return [`vk::Result::INCOMPLETE`] anymore, ensuring all
/// ensuring all available data has been read into the vector. /// available data has been read into the vector.
/// ///
/// See for example [`vkEnumerateInstanceExtensionProperties`]: the number of available /// See for example [`vkEnumerateInstanceExtensionProperties`]: the number of available items may
/// items may change between calls; [`vk::Result::INCOMPLETE`] is returned when the count /// change between calls; [`vk::Result::INCOMPLETE`] is returned when the count increased (and the
/// increased (and the vector is not large enough after querying the initial size), /// vector is not large enough after querying the initial size), requiring Ash to try again.
/// requiring Ash to try again.
/// ///
/// [`vkEnumerateInstanceExtensionProperties`]: https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumerateInstanceExtensionProperties.html /// [`vkEnumerateInstanceExtensionProperties`]: https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumerateInstanceExtensionProperties.html
pub(crate) unsafe fn read_into_uninitialized_vector<N: Copy + Default + TryInto<usize>, T>( pub(crate) unsafe fn read_into_uninitialized_vector<N: Copy + Default + TryInto<usize>, T>(
@ -41,24 +48,24 @@ where
let err_code = f(&mut count, data.as_mut_ptr()); let err_code = f(&mut count, data.as_mut_ptr());
if err_code != vk::Result::INCOMPLETE { if err_code != vk::Result::INCOMPLETE {
err_code.result()?;
data.set_len(count.try_into().expect("`N` failed to convert to `usize`")); data.set_len(count.try_into().expect("`N` failed to convert to `usize`"));
break err_code.result_with_success(data); break Ok(data);
} }
} }
} }
/// Repeatedly calls `f` until it does not return [`vk::Result::INCOMPLETE`] anymore, /// Repeatedly calls `f` until it does not return [`vk::Result::INCOMPLETE`] anymore, ensuring all
/// ensuring all available data has been read into the vector. /// available data has been read into the vector.
/// ///
/// Items in the target vector are [`default()`][`Default::default()`]-initialized which /// Items in the target vector are [`default()`][Default::default()]-initialized which is required
/// is required for [`vk::BaseOutStructure`]-like structs where [`vk::BaseOutStructure::s_type`] /// for [`vk::BaseOutStructure`]-like structs where [`vk::BaseOutStructure::s_type`] needs to be a
/// needs to be a valid type and [`vk::BaseOutStructure::p_next`] a valid or /// valid type and [`vk::BaseOutStructure::p_next`] a valid or [`null`][std::ptr::null_mut()]
/// [`null`][`std::ptr::null_mut()`] pointer. /// pointer.
/// ///
/// See for example [`vkEnumerateInstanceExtensionProperties`]: the number of available /// See for example [`vkEnumerateInstanceExtensionProperties`]: the number of available items may
/// items may change between calls; [`vk::Result::INCOMPLETE`] is returned when the count /// change between calls; [`vk::Result::INCOMPLETE`] is returned when the count increased (and the
/// increased (and the vector is not large enough after querying the initial size), /// vector is not large enough after querying the initial size), requiring Ash to try again.
/// requiring Ash to try again.
/// ///
/// [`vkEnumerateInstanceExtensionProperties`]: https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumerateInstanceExtensionProperties.html /// [`vkEnumerateInstanceExtensionProperties`]: https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumerateInstanceExtensionProperties.html
pub(crate) unsafe fn read_into_defaulted_vector< pub(crate) unsafe fn read_into_defaulted_vector<
@ -107,7 +114,7 @@ pub(crate) fn debug_flags<Value: Into<u64> + Copy>(
if !first { if !first {
f.write_str(" | ")?; f.write_str(" | ")?;
} }
write!(f, "{:b}", accum)?; write!(f, "{accum:b}")?;
} }
Ok(()) Ok(())
} }

View file

@ -31,7 +31,7 @@ impl<T: Copy> Align<T> {
use std::slice::from_raw_parts_mut; use std::slice::from_raw_parts_mut;
if self.elem_size == size_of::<T>() as u64 { if self.elem_size == size_of::<T>() as u64 {
unsafe { unsafe {
let mapped_slice = from_raw_parts_mut(self.ptr as *mut T, slice.len()); let mapped_slice = from_raw_parts_mut(self.ptr.cast(), slice.len());
mapped_slice.copy_from_slice(slice); mapped_slice.copy_from_slice(slice);
} }
} else { } else {
@ -75,7 +75,9 @@ impl<'a, T: Copy + 'a> Iterator for AlignIter<'a, T> {
} }
unsafe { unsafe {
// Need to cast to *mut u8 because () has size 0 // Need to cast to *mut u8 because () has size 0
let ptr = (self.align.ptr as *mut u8).offset(self.current as isize) as *mut T; let ptr = (self.align.ptr.cast::<u8>())
.offset(self.current as isize)
.cast();
self.current += self.align.elem_size; self.current += self.align.elem_size;
Some(&mut *ptr) Some(&mut *ptr)
} }
@ -102,7 +104,9 @@ impl<'a, T: Copy + 'a> Iterator for AlignIter<'a, T> {
/// let words = ash::util::read_spv(&mut std::io::Cursor::new(&SPIRV[..])).unwrap(); /// let words = ash::util::read_spv(&mut std::io::Cursor::new(&SPIRV[..])).unwrap();
/// ``` /// ```
pub fn read_spv<R: io::Read + io::Seek>(x: &mut R) -> io::Result<Vec<u32>> { pub fn read_spv<R: io::Read + io::Seek>(x: &mut R) -> io::Result<Vec<u32>> {
// TODO use stream_len() once it is stabilized and remove the subsequent rewind() call
let size = x.seek(io::SeekFrom::End(0))?; let size = x.seek(io::SeekFrom::End(0))?;
x.rewind()?;
if size % 4 != 0 { if size % 4 != 0 {
return Err(io::Error::new( return Err(io::Error::new(
io::ErrorKind::InvalidData, io::ErrorKind::InvalidData,
@ -117,8 +121,9 @@ pub fn read_spv<R: io::Read + io::Seek>(x: &mut R) -> io::Result<Vec<u32>> {
// Zero-initialize the result to prevent read_exact from possibly // Zero-initialize the result to prevent read_exact from possibly
// reading uninitialized memory. // reading uninitialized memory.
let mut result = vec![0u32; words]; let mut result = vec![0u32; words];
x.seek(io::SeekFrom::Start(0))?; x.read_exact(unsafe {
x.read_exact(unsafe { slice::from_raw_parts_mut(result.as_mut_ptr() as *mut u8, words * 4) })?; slice::from_raw_parts_mut(result.as_mut_ptr().cast::<u8>(), words * 4)
})?;
const MAGIC_NUMBER: u32 = 0x0723_0203; const MAGIC_NUMBER: u32 = 0x0723_0203;
if !result.is_empty() && result[0] == MAGIC_NUMBER.swap_bytes() { if !result.is_empty() && result[0] == MAGIC_NUMBER.swap_bytes() {
for word in &mut result { for word in &mut result {

View file

@ -1,3 +0,0 @@
pub use crate::device::{DeviceV1_0, DeviceV1_1, DeviceV1_2};
pub use crate::entry::{EntryV1_0, EntryV1_1, EntryV1_2};
pub use crate::instance::{InstanceV1_0, InstanceV1_1, InstanceV1_2};

View file

@ -27,9 +27,7 @@ pub use features::*;
mod prelude; mod prelude;
pub use prelude::*; pub use prelude::*;
/// Native bindings from Vulkan headers, generated by bindgen /// Native bindings from Vulkan headers, generated by bindgen
#[allow(nonstandard_style)] #[allow(clippy::useless_transmute, nonstandard_style)]
#[allow(deref_nullptr)]
#[allow(trivial_casts, trivial_numeric_casts)]
pub mod native; pub mod native;
mod platform_types; mod platform_types;
pub use platform_types::*; pub use platform_types::*;

View file

@ -166,6 +166,8 @@ pub type PhysicalDeviceShaderAtomicInt64FeaturesKHR = PhysicalDeviceShaderAtomic
pub type PhysicalDeviceDepthStencilResolvePropertiesKHR = pub type PhysicalDeviceDepthStencilResolvePropertiesKHR =
PhysicalDeviceDepthStencilResolveProperties; PhysicalDeviceDepthStencilResolveProperties;
pub type SubpassDescriptionDepthStencilResolveKHR = SubpassDescriptionDepthStencilResolve; pub type SubpassDescriptionDepthStencilResolveKHR = SubpassDescriptionDepthStencilResolve;
pub type PhysicalDeviceFragmentShaderBarycentricFeaturesNV =
PhysicalDeviceFragmentShaderBarycentricFeaturesKHR;
pub type ImageStencilUsageCreateInfoEXT = ImageStencilUsageCreateInfo; pub type ImageStencilUsageCreateInfoEXT = ImageStencilUsageCreateInfo;
pub type PhysicalDeviceScalarBlockLayoutFeaturesEXT = PhysicalDeviceScalarBlockLayoutFeatures; pub type PhysicalDeviceScalarBlockLayoutFeaturesEXT = PhysicalDeviceScalarBlockLayoutFeatures;
pub type PhysicalDeviceUniformBufferStandardLayoutFeaturesKHR = pub type PhysicalDeviceUniformBufferStandardLayoutFeaturesKHR =
@ -188,6 +190,7 @@ pub type PhysicalDeviceSeparateDepthStencilLayoutsFeaturesKHR =
PhysicalDeviceSeparateDepthStencilLayoutsFeatures; PhysicalDeviceSeparateDepthStencilLayoutsFeatures;
pub type AttachmentReferenceStencilLayoutKHR = AttachmentReferenceStencilLayout; pub type AttachmentReferenceStencilLayoutKHR = AttachmentReferenceStencilLayout;
pub type AttachmentDescriptionStencilLayoutKHR = AttachmentDescriptionStencilLayout; pub type AttachmentDescriptionStencilLayoutKHR = AttachmentDescriptionStencilLayout;
pub type PipelineInfoEXT = PipelineInfoKHR;
pub type PhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT = pub type PhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT =
PhysicalDeviceShaderDemoteToHelperInvocationFeatures; PhysicalDeviceShaderDemoteToHelperInvocationFeatures;
pub type PhysicalDeviceTexelBufferAlignmentPropertiesEXT = pub type PhysicalDeviceTexelBufferAlignmentPropertiesEXT =
@ -197,6 +200,8 @@ pub type PhysicalDeviceSubgroupSizeControlPropertiesEXT =
PhysicalDeviceSubgroupSizeControlProperties; PhysicalDeviceSubgroupSizeControlProperties;
pub type PipelineShaderStageRequiredSubgroupSizeCreateInfoEXT = pub type PipelineShaderStageRequiredSubgroupSizeCreateInfoEXT =
PipelineShaderStageRequiredSubgroupSizeCreateInfo; PipelineShaderStageRequiredSubgroupSizeCreateInfo;
pub type ShaderRequiredSubgroupSizeCreateInfoEXT =
PipelineShaderStageRequiredSubgroupSizeCreateInfo;
pub type MemoryOpaqueCaptureAddressAllocateInfoKHR = MemoryOpaqueCaptureAddressAllocateInfo; pub type MemoryOpaqueCaptureAddressAllocateInfoKHR = MemoryOpaqueCaptureAddressAllocateInfo;
pub type DeviceMemoryOpaqueCaptureAddressInfoKHR = DeviceMemoryOpaqueCaptureAddressInfo; pub type DeviceMemoryOpaqueCaptureAddressInfoKHR = DeviceMemoryOpaqueCaptureAddressInfo;
pub type PhysicalDevicePipelineCreationCacheControlFeaturesEXT = pub type PhysicalDevicePipelineCreationCacheControlFeaturesEXT =
@ -221,6 +226,10 @@ pub type CopyImageToBufferInfo2KHR = CopyImageToBufferInfo2;
pub type ResolveImageInfo2KHR = ResolveImageInfo2; pub type ResolveImageInfo2KHR = ResolveImageInfo2;
pub type PhysicalDeviceShaderTerminateInvocationFeaturesKHR = pub type PhysicalDeviceShaderTerminateInvocationFeaturesKHR =
PhysicalDeviceShaderTerminateInvocationFeatures; PhysicalDeviceShaderTerminateInvocationFeatures;
pub type PhysicalDeviceMutableDescriptorTypeFeaturesVALVE =
PhysicalDeviceMutableDescriptorTypeFeaturesEXT;
pub type MutableDescriptorTypeListVALVE = MutableDescriptorTypeListEXT;
pub type MutableDescriptorTypeCreateInfoVALVE = MutableDescriptorTypeCreateInfoEXT;
pub type MemoryBarrier2KHR = MemoryBarrier2; pub type MemoryBarrier2KHR = MemoryBarrier2;
pub type ImageMemoryBarrier2KHR = ImageMemoryBarrier2; pub type ImageMemoryBarrier2KHR = ImageMemoryBarrier2;
pub type BufferMemoryBarrier2KHR = BufferMemoryBarrier2; pub type BufferMemoryBarrier2KHR = BufferMemoryBarrier2;
@ -240,3 +249,5 @@ pub type RenderingAttachmentInfoKHR = RenderingAttachmentInfo;
pub type PhysicalDeviceDynamicRenderingFeaturesKHR = PhysicalDeviceDynamicRenderingFeatures; pub type PhysicalDeviceDynamicRenderingFeaturesKHR = PhysicalDeviceDynamicRenderingFeatures;
pub type CommandBufferInheritanceRenderingInfoKHR = CommandBufferInheritanceRenderingInfo; pub type CommandBufferInheritanceRenderingInfoKHR = CommandBufferInheritanceRenderingInfo;
pub type AttachmentSampleCountInfoNV = AttachmentSampleCountInfoAMD; pub type AttachmentSampleCountInfoNV = AttachmentSampleCountInfoAMD;
pub type PhysicalDeviceRasterizationOrderAttachmentAccessFeaturesARM =
PhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT;

View file

@ -906,6 +906,7 @@ impl DeviceDiagnosticsConfigFlagsNV {
pub const ENABLE_SHADER_DEBUG_INFO: Self = Self(0b1); pub const ENABLE_SHADER_DEBUG_INFO: Self = Self(0b1);
pub const ENABLE_RESOURCE_TRACKING: Self = Self(0b10); pub const ENABLE_RESOURCE_TRACKING: Self = Self(0b10);
pub const ENABLE_AUTOMATIC_CHECKPOINTS: Self = Self(0b100); pub const ENABLE_AUTOMATIC_CHECKPOINTS: Self = Self(0b100);
pub const ENABLE_SHADER_ERROR_REPORTING: Self = Self(0b1000);
} }
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
@ -922,6 +923,14 @@ impl PipelineCreationFeedbackFlags {
} }
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkMemoryDecompressionMethodFlagBitsNV.html>"]
pub struct MemoryDecompressionMethodFlagsNV(pub(crate) Flags64);
vk_bitflags_wrapped!(MemoryDecompressionMethodFlagsNV, Flags64);
impl MemoryDecompressionMethodFlagsNV {
pub const GDEFLATE_1_0: Self = Self(0b1);
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkPerformanceCounterDescriptionFlagBitsKHR.html>"] #[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkPerformanceCounterDescriptionFlagBitsKHR.html>"]
pub struct PerformanceCounterDescriptionFlagsKHR(pub(crate) Flags); pub struct PerformanceCounterDescriptionFlagsKHR(pub(crate) Flags);
vk_bitflags_wrapped!(PerformanceCounterDescriptionFlagsKHR, Flags); vk_bitflags_wrapped!(PerformanceCounterDescriptionFlagsKHR, Flags);
@ -1054,7 +1063,7 @@ impl PipelineStageFlags2 {
pub const ALL_TRANSFER: Self = Self(0b1_0000_0000_0000); pub const ALL_TRANSFER: Self = Self(0b1_0000_0000_0000);
pub const ALL_TRANSFER_KHR: Self = Self::ALL_TRANSFER; pub const ALL_TRANSFER_KHR: Self = Self::ALL_TRANSFER;
pub const TRANSFER: Self = Self::ALL_TRANSFER_KHR; pub const TRANSFER: Self = Self::ALL_TRANSFER_KHR;
pub const TRANSFER_KHR: Self = Self::TRANSFER; pub const TRANSFER_KHR: Self = Self::ALL_TRANSFER;
pub const BOTTOM_OF_PIPE: Self = Self(0b10_0000_0000_0000); pub const BOTTOM_OF_PIPE: Self = Self(0b10_0000_0000_0000);
pub const BOTTOM_OF_PIPE_KHR: Self = Self::BOTTOM_OF_PIPE; pub const BOTTOM_OF_PIPE_KHR: Self = Self::BOTTOM_OF_PIPE;
pub const HOST: Self = Self(0b100_0000_0000_0000); pub const HOST: Self = Self(0b100_0000_0000_0000);
@ -1115,11 +1124,50 @@ vk_bitflags_wrapped!(PipelineDepthStencilStateCreateFlags, Flags);
impl PipelineDepthStencilStateCreateFlags {} impl PipelineDepthStencilStateCreateFlags {}
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkGraphicsPipelineLibraryFlagBitsEXT.html>"]
pub struct GraphicsPipelineLibraryFlagsEXT(pub(crate) Flags);
vk_bitflags_wrapped!(GraphicsPipelineLibraryFlagsEXT, Flags);
impl GraphicsPipelineLibraryFlagsEXT {
pub const VERTEX_INPUT_INTERFACE: Self = Self(0b1);
pub const PRE_RASTERIZATION_SHADERS: Self = Self(0b10);
pub const FRAGMENT_SHADER: Self = Self(0b100);
pub const FRAGMENT_OUTPUT_INTERFACE: Self = Self(0b1000);
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkDeviceAddressBindingFlagBitsEXT.html>"]
pub struct DeviceAddressBindingFlagsEXT(pub(crate) Flags);
vk_bitflags_wrapped!(DeviceAddressBindingFlagsEXT, Flags);
impl DeviceAddressBindingFlagsEXT {
pub const INTERNAL_OBJECT: Self = Self(0b1);
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkPresentScalingFlagBitsEXT.html>"]
pub struct PresentScalingFlagsEXT(pub(crate) Flags);
vk_bitflags_wrapped!(PresentScalingFlagsEXT, Flags);
impl PresentScalingFlagsEXT {
pub const ONE_TO_ONE: Self = Self(0b1);
pub const ASPECT_RATIO_STRETCH: Self = Self(0b10);
pub const STRETCH: Self = Self(0b100);
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkPresentGravityFlagBitsEXT.html>"]
pub struct PresentGravityFlagsEXT(pub(crate) Flags);
vk_bitflags_wrapped!(PresentGravityFlagsEXT, Flags);
impl PresentGravityFlagsEXT {
pub const MIN: Self = Self(0b1);
pub const MAX: Self = Self(0b10);
pub const CENTERED: Self = Self(0b100);
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoCodecOperationFlagBitsKHR.html>"] #[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoCodecOperationFlagBitsKHR.html>"]
pub struct VideoCodecOperationFlagsKHR(pub(crate) Flags); pub struct VideoCodecOperationFlagsKHR(pub(crate) Flags);
vk_bitflags_wrapped!(VideoCodecOperationFlagsKHR, Flags); vk_bitflags_wrapped!(VideoCodecOperationFlagsKHR, Flags);
impl VideoCodecOperationFlagsKHR { impl VideoCodecOperationFlagsKHR {
pub const INVALID: Self = Self(0); pub const NONE: Self = Self(0);
} }
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
@ -1159,25 +1207,14 @@ impl VideoCapabilityFlagsKHR {
pub struct VideoSessionCreateFlagsKHR(pub(crate) Flags); pub struct VideoSessionCreateFlagsKHR(pub(crate) Flags);
vk_bitflags_wrapped!(VideoSessionCreateFlagsKHR, Flags); vk_bitflags_wrapped!(VideoSessionCreateFlagsKHR, Flags);
impl VideoSessionCreateFlagsKHR { impl VideoSessionCreateFlagsKHR {
pub const DEFAULT: Self = Self(0);
pub const PROTECTED_CONTENT: Self = Self(0b1); pub const PROTECTED_CONTENT: Self = Self(0b1);
} }
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoCodingQualityPresetFlagBitsKHR.html>"] #[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoDecodeH264PictureLayoutFlagBitsKHR.html>"]
pub struct VideoCodingQualityPresetFlagsKHR(pub(crate) Flags); pub struct VideoDecodeH264PictureLayoutFlagsKHR(pub(crate) Flags);
vk_bitflags_wrapped!(VideoCodingQualityPresetFlagsKHR, Flags); vk_bitflags_wrapped!(VideoDecodeH264PictureLayoutFlagsKHR, Flags);
impl VideoCodingQualityPresetFlagsKHR { impl VideoDecodeH264PictureLayoutFlagsKHR {
pub const NORMAL: Self = Self(0b1);
pub const POWER: Self = Self(0b10);
pub const QUALITY: Self = Self(0b100);
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoDecodeH264PictureLayoutFlagBitsEXT.html>"]
pub struct VideoDecodeH264PictureLayoutFlagsEXT(pub(crate) Flags);
vk_bitflags_wrapped!(VideoDecodeH264PictureLayoutFlagsEXT, Flags);
impl VideoDecodeH264PictureLayoutFlagsEXT {
pub const PROGRESSIVE: Self = Self(0); pub const PROGRESSIVE: Self = Self(0);
pub const INTERLACED_INTERLEAVED_LINES: Self = Self(0b1); pub const INTERLACED_INTERLEAVED_LINES: Self = Self(0b1);
pub const INTERLACED_SEPARATE_PLANES: Self = Self(0b10); pub const INTERLACED_SEPARATE_PLANES: Self = Self(0b10);
@ -1188,36 +1225,50 @@ impl VideoDecodeH264PictureLayoutFlagsEXT {
pub struct VideoCodingControlFlagsKHR(pub(crate) Flags); pub struct VideoCodingControlFlagsKHR(pub(crate) Flags);
vk_bitflags_wrapped!(VideoCodingControlFlagsKHR, Flags); vk_bitflags_wrapped!(VideoCodingControlFlagsKHR, Flags);
impl VideoCodingControlFlagsKHR { impl VideoCodingControlFlagsKHR {
pub const DEFAULT: Self = Self(0);
pub const RESET: Self = Self(0b1); pub const RESET: Self = Self(0b1);
} }
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoDecodeUsageFlagBitsKHR.html>"]
pub struct VideoDecodeUsageFlagsKHR(pub(crate) Flags);
vk_bitflags_wrapped!(VideoDecodeUsageFlagsKHR, Flags);
impl VideoDecodeUsageFlagsKHR {
pub const DEFAULT: Self = Self(0);
pub const TRANSCODING: Self = Self(0b1);
pub const OFFLINE: Self = Self(0b10);
pub const STREAMING: Self = Self(0b100);
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoDecodeCapabilityFlagBitsKHR.html>"] #[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoDecodeCapabilityFlagBitsKHR.html>"]
pub struct VideoDecodeCapabilityFlagsKHR(pub(crate) Flags); pub struct VideoDecodeCapabilityFlagsKHR(pub(crate) Flags);
vk_bitflags_wrapped!(VideoDecodeCapabilityFlagsKHR, Flags); vk_bitflags_wrapped!(VideoDecodeCapabilityFlagsKHR, Flags);
impl VideoDecodeCapabilityFlagsKHR { impl VideoDecodeCapabilityFlagsKHR {
pub const DEFAULT: Self = Self(0);
pub const DPB_AND_OUTPUT_COINCIDE: Self = Self(0b1); pub const DPB_AND_OUTPUT_COINCIDE: Self = Self(0b1);
pub const DPB_AND_OUTPUT_DISTINCT: Self = Self(0b10); pub const DPB_AND_OUTPUT_DISTINCT: Self = Self(0b10);
} }
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoDecodeFlagBitsKHR.html>"] #[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoEncodeUsageFlagBitsKHR.html>"]
pub struct VideoDecodeFlagsKHR(pub(crate) Flags); pub struct VideoEncodeUsageFlagsKHR(pub(crate) Flags);
vk_bitflags_wrapped!(VideoDecodeFlagsKHR, Flags); vk_bitflags_wrapped!(VideoEncodeUsageFlagsKHR, Flags);
impl VideoDecodeFlagsKHR { impl VideoEncodeUsageFlagsKHR {
pub const DEFAULT: Self = Self(0); pub const DEFAULT: Self = Self(0);
pub const RESERVED_0: Self = Self(0b1); pub const TRANSCODING: Self = Self(0b1);
pub const STREAMING: Self = Self(0b10);
pub const RECORDING: Self = Self(0b100);
pub const CONFERENCING: Self = Self(0b1000);
} }
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoEncodeFlagBitsKHR.html>"] #[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoEncodeContentFlagBitsKHR.html>"]
pub struct VideoEncodeFlagsKHR(pub(crate) Flags); pub struct VideoEncodeContentFlagsKHR(pub(crate) Flags);
vk_bitflags_wrapped!(VideoEncodeFlagsKHR, Flags); vk_bitflags_wrapped!(VideoEncodeContentFlagsKHR, Flags);
impl VideoEncodeFlagsKHR { impl VideoEncodeContentFlagsKHR {
pub const DEFAULT: Self = Self(0); pub const DEFAULT: Self = Self(0);
pub const RESERVED_0: Self = Self(0b1); pub const CAMERA: Self = Self(0b1);
pub const DESKTOP: Self = Self(0b10);
pub const RENDERED: Self = Self(0b100);
} }
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
@ -1225,17 +1276,16 @@ impl VideoEncodeFlagsKHR {
pub struct VideoEncodeCapabilityFlagsKHR(pub(crate) Flags); pub struct VideoEncodeCapabilityFlagsKHR(pub(crate) Flags);
vk_bitflags_wrapped!(VideoEncodeCapabilityFlagsKHR, Flags); vk_bitflags_wrapped!(VideoEncodeCapabilityFlagsKHR, Flags);
impl VideoEncodeCapabilityFlagsKHR { impl VideoEncodeCapabilityFlagsKHR {
pub const DEFAULT: Self = Self(0);
pub const PRECEDING_EXTERNALLY_ENCODED_BYTES: Self = Self(0b1); pub const PRECEDING_EXTERNALLY_ENCODED_BYTES: Self = Self(0b1);
} }
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoEncodeRateControlFlagBitsKHR.html>"] #[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoEncodeFeedbackFlagBitsKHR.html>"]
pub struct VideoEncodeRateControlFlagsKHR(pub(crate) Flags); pub struct VideoEncodeFeedbackFlagsKHR(pub(crate) Flags);
vk_bitflags_wrapped!(VideoEncodeRateControlFlagsKHR, Flags); vk_bitflags_wrapped!(VideoEncodeFeedbackFlagsKHR, Flags);
impl VideoEncodeRateControlFlagsKHR { impl VideoEncodeFeedbackFlagsKHR {
pub const DEFAULT: Self = Self(0); pub const BITSTREAM_BUFFER_OFFSET: Self = Self(0b1);
pub const RESERVED_0: Self = Self(0b1); pub const BITSTREAM_BYTES_WRITTEN: Self = Self(0b10);
} }
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
@ -1243,9 +1293,10 @@ impl VideoEncodeRateControlFlagsKHR {
pub struct VideoEncodeRateControlModeFlagsKHR(pub(crate) Flags); pub struct VideoEncodeRateControlModeFlagsKHR(pub(crate) Flags);
vk_bitflags_wrapped!(VideoEncodeRateControlModeFlagsKHR, Flags); vk_bitflags_wrapped!(VideoEncodeRateControlModeFlagsKHR, Flags);
impl VideoEncodeRateControlModeFlagsKHR { impl VideoEncodeRateControlModeFlagsKHR {
pub const NONE: Self = Self(0); pub const DEFAULT: Self = Self(0);
pub const CBR: Self = Self(1); pub const DISABLED: Self = Self(0b1);
pub const VBR: Self = Self(2); pub const CBR: Self = Self(0b10);
pub const VBR: Self = Self(0b100);
} }
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
@ -1253,59 +1304,32 @@ impl VideoEncodeRateControlModeFlagsKHR {
pub struct VideoEncodeH264CapabilityFlagsEXT(pub(crate) Flags); pub struct VideoEncodeH264CapabilityFlagsEXT(pub(crate) Flags);
vk_bitflags_wrapped!(VideoEncodeH264CapabilityFlagsEXT, Flags); vk_bitflags_wrapped!(VideoEncodeH264CapabilityFlagsEXT, Flags);
impl VideoEncodeH264CapabilityFlagsEXT { impl VideoEncodeH264CapabilityFlagsEXT {
pub const DIRECT_8X8_INFERENCE: Self = Self(0b1); pub const DIRECT_8X8_INFERENCE_ENABLED: Self = Self(0b1);
pub const SEPARATE_COLOUR_PLANE: Self = Self(0b10); pub const DIRECT_8X8_INFERENCE_DISABLED: Self = Self(0b10);
pub const QPPRIME_Y_ZERO_TRANSFORM_BYPASS: Self = Self(0b100); pub const SEPARATE_COLOUR_PLANE: Self = Self(0b100);
pub const SCALING_LISTS: Self = Self(0b1000); pub const QPPRIME_Y_ZERO_TRANSFORM_BYPASS: Self = Self(0b1000);
pub const HRD_COMPLIANCE: Self = Self(0b1_0000); pub const SCALING_LISTS: Self = Self(0b1_0000);
pub const CHROMA_QP_OFFSET: Self = Self(0b10_0000); pub const HRD_COMPLIANCE: Self = Self(0b10_0000);
pub const SECOND_CHROMA_QP_OFFSET: Self = Self(0b100_0000); pub const CHROMA_QP_OFFSET: Self = Self(0b100_0000);
pub const PIC_INIT_QP_MINUS26: Self = Self(0b1000_0000); pub const SECOND_CHROMA_QP_OFFSET: Self = Self(0b1000_0000);
pub const WEIGHTED_PRED: Self = Self(0b1_0000_0000); pub const PIC_INIT_QP_MINUS26: Self = Self(0b1_0000_0000);
pub const WEIGHTED_BIPRED_EXPLICIT: Self = Self(0b10_0000_0000); pub const WEIGHTED_PRED: Self = Self(0b10_0000_0000);
pub const WEIGHTED_BIPRED_IMPLICIT: Self = Self(0b100_0000_0000); pub const WEIGHTED_BIPRED_EXPLICIT: Self = Self(0b100_0000_0000);
pub const WEIGHTED_PRED_NO_TABLE: Self = Self(0b1000_0000_0000); pub const WEIGHTED_BIPRED_IMPLICIT: Self = Self(0b1000_0000_0000);
pub const TRANSFORM_8X8: Self = Self(0b1_0000_0000_0000); pub const WEIGHTED_PRED_NO_TABLE: Self = Self(0b1_0000_0000_0000);
pub const CABAC: Self = Self(0b10_0000_0000_0000); pub const TRANSFORM_8X8: Self = Self(0b10_0000_0000_0000);
pub const CAVLC: Self = Self(0b100_0000_0000_0000); pub const CABAC: Self = Self(0b100_0000_0000_0000);
pub const DEBLOCKING_FILTER_DISABLED: Self = Self(0b1000_0000_0000_0000); pub const CAVLC: Self = Self(0b1000_0000_0000_0000);
pub const DEBLOCKING_FILTER_ENABLED: Self = Self(0b1_0000_0000_0000_0000); pub const DEBLOCKING_FILTER_DISABLED: Self = Self(0b1_0000_0000_0000_0000);
pub const DEBLOCKING_FILTER_PARTIAL: Self = Self(0b10_0000_0000_0000_0000); pub const DEBLOCKING_FILTER_ENABLED: Self = Self(0b10_0000_0000_0000_0000);
pub const DISABLE_DIRECT_SPATIAL_MV_PRED: Self = Self(0b100_0000_0000_0000_0000); pub const DEBLOCKING_FILTER_PARTIAL: Self = Self(0b100_0000_0000_0000_0000);
pub const MULTIPLE_SLICE_PER_FRAME: Self = Self(0b1000_0000_0000_0000_0000); pub const DISABLE_DIRECT_SPATIAL_MV_PRED: Self = Self(0b1000_0000_0000_0000_0000);
pub const SLICE_MB_COUNT: Self = Self(0b1_0000_0000_0000_0000_0000); pub const MULTIPLE_SLICE_PER_FRAME: Self = Self(0b1_0000_0000_0000_0000_0000);
pub const ROW_UNALIGNED_SLICE: Self = Self(0b10_0000_0000_0000_0000_0000); pub const SLICE_MB_COUNT: Self = Self(0b10_0000_0000_0000_0000_0000);
pub const DIFFERENT_SLICE_TYPE: Self = Self(0b100_0000_0000_0000_0000_0000); pub const ROW_UNALIGNED_SLICE: Self = Self(0b100_0000_0000_0000_0000_0000);
} pub const DIFFERENT_SLICE_TYPE: Self = Self(0b1000_0000_0000_0000_0000_0000);
#[repr(transparent)] pub const B_FRAME_IN_L1_LIST: Self = Self(0b1_0000_0000_0000_0000_0000_0000);
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub const DIFFERENT_REFERENCE_FINAL_LISTS: Self = Self(0b10_0000_0000_0000_0000_0000_0000);
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoEncodeH264InputModeFlagBitsEXT.html>"]
pub struct VideoEncodeH264InputModeFlagsEXT(pub(crate) Flags);
vk_bitflags_wrapped!(VideoEncodeH264InputModeFlagsEXT, Flags);
impl VideoEncodeH264InputModeFlagsEXT {
pub const FRAME: Self = Self(0b1);
pub const SLICE: Self = Self(0b10);
pub const NON_VCL: Self = Self(0b100);
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoEncodeH264OutputModeFlagBitsEXT.html>"]
pub struct VideoEncodeH264OutputModeFlagsEXT(pub(crate) Flags);
vk_bitflags_wrapped!(VideoEncodeH264OutputModeFlagsEXT, Flags);
impl VideoEncodeH264OutputModeFlagsEXT {
pub const FRAME: Self = Self(0b1);
pub const SLICE: Self = Self(0b10);
pub const NON_VCL: Self = Self(0b100);
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoEncodeH264RateControlStructureFlagBitsEXT.html>"]
pub struct VideoEncodeH264RateControlStructureFlagsEXT(pub(crate) Flags);
vk_bitflags_wrapped!(VideoEncodeH264RateControlStructureFlagsEXT, Flags);
impl VideoEncodeH264RateControlStructureFlagsEXT {
pub const UNKNOWN: Self = Self(0);
pub const FLAT: Self = Self(0b1);
pub const DYADIC: Self = Self(0b10);
} }
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
@ -1425,50 +1449,23 @@ impl VideoEncodeH265CapabilityFlagsEXT {
pub const LOG2_PARALLEL_MERGE_LEVEL_MINUS2: Self = Self(0b1000_0000); pub const LOG2_PARALLEL_MERGE_LEVEL_MINUS2: Self = Self(0b1000_0000);
pub const SIGN_DATA_HIDING_ENABLED: Self = Self(0b1_0000_0000); pub const SIGN_DATA_HIDING_ENABLED: Self = Self(0b1_0000_0000);
pub const TRANSFORM_SKIP_ENABLED: Self = Self(0b10_0000_0000); pub const TRANSFORM_SKIP_ENABLED: Self = Self(0b10_0000_0000);
pub const PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT: Self = Self(0b100_0000_0000); pub const TRANSFORM_SKIP_DISABLED: Self = Self(0b100_0000_0000);
pub const WEIGHTED_PRED: Self = Self(0b1000_0000_0000); pub const PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT: Self = Self(0b1000_0000_0000);
pub const WEIGHTED_BIPRED: Self = Self(0b1_0000_0000_0000); pub const WEIGHTED_PRED: Self = Self(0b1_0000_0000_0000);
pub const WEIGHTED_PRED_NO_TABLE: Self = Self(0b10_0000_0000_0000); pub const WEIGHTED_BIPRED: Self = Self(0b10_0000_0000_0000);
pub const TRANSQUANT_BYPASS_ENABLED: Self = Self(0b100_0000_0000_0000); pub const WEIGHTED_PRED_NO_TABLE: Self = Self(0b100_0000_0000_0000);
pub const ENTROPY_CODING_SYNC_ENABLED: Self = Self(0b1000_0000_0000_0000); pub const TRANSQUANT_BYPASS_ENABLED: Self = Self(0b1000_0000_0000_0000);
pub const DEBLOCKING_FILTER_OVERRIDE_ENABLED: Self = Self(0b1_0000_0000_0000_0000); pub const ENTROPY_CODING_SYNC_ENABLED: Self = Self(0b1_0000_0000_0000_0000);
pub const MULTIPLE_TILE_PER_FRAME: Self = Self(0b10_0000_0000_0000_0000); pub const DEBLOCKING_FILTER_OVERRIDE_ENABLED: Self = Self(0b10_0000_0000_0000_0000);
pub const MULTIPLE_SLICE_PER_TILE: Self = Self(0b100_0000_0000_0000_0000); pub const MULTIPLE_TILE_PER_FRAME: Self = Self(0b100_0000_0000_0000_0000);
pub const MULTIPLE_TILE_PER_SLICE: Self = Self(0b1000_0000_0000_0000_0000); pub const MULTIPLE_SLICE_PER_TILE: Self = Self(0b1000_0000_0000_0000_0000);
pub const SLICE_SEGMENT_CTB_COUNT: Self = Self(0b1_0000_0000_0000_0000_0000); pub const MULTIPLE_TILE_PER_SLICE: Self = Self(0b1_0000_0000_0000_0000_0000);
pub const ROW_UNALIGNED_SLICE_SEGMENT: Self = Self(0b10_0000_0000_0000_0000_0000); pub const SLICE_SEGMENT_CTB_COUNT: Self = Self(0b10_0000_0000_0000_0000_0000);
pub const DEPENDENT_SLICE_SEGMENT: Self = Self(0b100_0000_0000_0000_0000_0000); pub const ROW_UNALIGNED_SLICE_SEGMENT: Self = Self(0b100_0000_0000_0000_0000_0000);
pub const DIFFERENT_SLICE_TYPE: Self = Self(0b1000_0000_0000_0000_0000_0000); pub const DEPENDENT_SLICE_SEGMENT: Self = Self(0b1000_0000_0000_0000_0000_0000);
} pub const DIFFERENT_SLICE_TYPE: Self = Self(0b1_0000_0000_0000_0000_0000_0000);
#[repr(transparent)] pub const B_FRAME_IN_L1_LIST: Self = Self(0b10_0000_0000_0000_0000_0000_0000);
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub const DIFFERENT_REFERENCE_FINAL_LISTS: Self = Self(0b100_0000_0000_0000_0000_0000_0000);
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoEncodeH265InputModeFlagBitsEXT.html>"]
pub struct VideoEncodeH265InputModeFlagsEXT(pub(crate) Flags);
vk_bitflags_wrapped!(VideoEncodeH265InputModeFlagsEXT, Flags);
impl VideoEncodeH265InputModeFlagsEXT {
pub const FRAME: Self = Self(0b1);
pub const SLICE_SEGMENT: Self = Self(0b10);
pub const NON_VCL: Self = Self(0b100);
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoEncodeH265OutputModeFlagBitsEXT.html>"]
pub struct VideoEncodeH265OutputModeFlagsEXT(pub(crate) Flags);
vk_bitflags_wrapped!(VideoEncodeH265OutputModeFlagsEXT, Flags);
impl VideoEncodeH265OutputModeFlagsEXT {
pub const FRAME: Self = Self(0b1);
pub const SLICE_SEGMENT: Self = Self(0b10);
pub const NON_VCL: Self = Self(0b100);
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkVideoEncodeH265RateControlStructureFlagBitsEXT.html>"]
pub struct VideoEncodeH265RateControlStructureFlagsEXT(pub(crate) Flags);
vk_bitflags_wrapped!(VideoEncodeH265RateControlStructureFlagsEXT, Flags);
impl VideoEncodeH265RateControlStructureFlagsEXT {
pub const UNKNOWN: Self = Self(0);
pub const FLAT: Self = Self(0b1);
pub const DYADIC: Self = Self(0b10);
} }
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
@ -1493,7 +1490,134 @@ impl VideoEncodeH265TransformBlockSizeFlagsEXT {
} }
#[repr(transparent)] #[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkExportMetalObjectTypeFlagBitsEXT.html>"]
pub struct ExportMetalObjectTypeFlagsEXT(pub(crate) Flags);
vk_bitflags_wrapped!(ExportMetalObjectTypeFlagsEXT, Flags);
impl ExportMetalObjectTypeFlagsEXT {
pub const METAL_DEVICE: Self = Self(0b1);
pub const METAL_COMMAND_QUEUE: Self = Self(0b10);
pub const METAL_BUFFER: Self = Self(0b100);
pub const METAL_TEXTURE: Self = Self(0b1000);
pub const METAL_IOSURFACE: Self = Self(0b1_0000);
pub const METAL_SHARED_EVENT: Self = Self(0b10_0000);
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkInstanceCreateFlagBits.html>"] #[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkInstanceCreateFlagBits.html>"]
pub struct InstanceCreateFlags(pub(crate) Flags); pub struct InstanceCreateFlags(pub(crate) Flags);
vk_bitflags_wrapped!(InstanceCreateFlags, Flags); vk_bitflags_wrapped!(InstanceCreateFlags, Flags);
impl InstanceCreateFlags {} impl InstanceCreateFlags {}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkImageCompressionFlagBitsEXT.html>"]
pub struct ImageCompressionFlagsEXT(pub(crate) Flags);
vk_bitflags_wrapped!(ImageCompressionFlagsEXT, Flags);
impl ImageCompressionFlagsEXT {
pub const DEFAULT: Self = Self(0);
pub const FIXED_RATE_DEFAULT: Self = Self(0b1);
pub const FIXED_RATE_EXPLICIT: Self = Self(0b10);
pub const DISABLED: Self = Self(0b100);
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkImageCompressionFixedRateFlagBitsEXT.html>"]
pub struct ImageCompressionFixedRateFlagsEXT(pub(crate) Flags);
vk_bitflags_wrapped!(ImageCompressionFixedRateFlagsEXT, Flags);
impl ImageCompressionFixedRateFlagsEXT {
pub const NONE: Self = Self(0);
pub const TYPE_1BPC: Self = Self(0b1);
pub const TYPE_2BPC: Self = Self(0b10);
pub const TYPE_3BPC: Self = Self(0b100);
pub const TYPE_4BPC: Self = Self(0b1000);
pub const TYPE_5BPC: Self = Self(0b1_0000);
pub const TYPE_6BPC: Self = Self(0b10_0000);
pub const TYPE_7BPC: Self = Self(0b100_0000);
pub const TYPE_8BPC: Self = Self(0b1000_0000);
pub const TYPE_9BPC: Self = Self(0b1_0000_0000);
pub const TYPE_10BPC: Self = Self(0b10_0000_0000);
pub const TYPE_11BPC: Self = Self(0b100_0000_0000);
pub const TYPE_12BPC: Self = Self(0b1000_0000_0000);
pub const TYPE_13BPC: Self = Self(0b1_0000_0000_0000);
pub const TYPE_14BPC: Self = Self(0b10_0000_0000_0000);
pub const TYPE_15BPC: Self = Self(0b100_0000_0000_0000);
pub const TYPE_16BPC: Self = Self(0b1000_0000_0000_0000);
pub const TYPE_17BPC: Self = Self(0b1_0000_0000_0000_0000);
pub const TYPE_18BPC: Self = Self(0b10_0000_0000_0000_0000);
pub const TYPE_19BPC: Self = Self(0b100_0000_0000_0000_0000);
pub const TYPE_20BPC: Self = Self(0b1000_0000_0000_0000_0000);
pub const TYPE_21BPC: Self = Self(0b1_0000_0000_0000_0000_0000);
pub const TYPE_22BPC: Self = Self(0b10_0000_0000_0000_0000_0000);
pub const TYPE_23BPC: Self = Self(0b100_0000_0000_0000_0000_0000);
pub const TYPE_24BPC: Self = Self(0b1000_0000_0000_0000_0000_0000);
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkOpticalFlowGridSizeFlagBitsNV.html>"]
pub struct OpticalFlowGridSizeFlagsNV(pub(crate) Flags);
vk_bitflags_wrapped!(OpticalFlowGridSizeFlagsNV, Flags);
impl OpticalFlowGridSizeFlagsNV {
pub const UNKNOWN: Self = Self(0);
pub const TYPE_1X1: Self = Self(0b1);
pub const TYPE_2X2: Self = Self(0b10);
pub const TYPE_4X4: Self = Self(0b100);
pub const TYPE_8X8: Self = Self(0b1000);
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkOpticalFlowUsageFlagBitsNV.html>"]
pub struct OpticalFlowUsageFlagsNV(pub(crate) Flags);
vk_bitflags_wrapped!(OpticalFlowUsageFlagsNV, Flags);
impl OpticalFlowUsageFlagsNV {
pub const UNKNOWN: Self = Self(0);
pub const INPUT: Self = Self(0b1);
pub const OUTPUT: Self = Self(0b10);
pub const HINT: Self = Self(0b100);
pub const COST: Self = Self(0b1000);
pub const GLOBAL_FLOW: Self = Self(0b1_0000);
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkOpticalFlowSessionCreateFlagBitsNV.html>"]
pub struct OpticalFlowSessionCreateFlagsNV(pub(crate) Flags);
vk_bitflags_wrapped!(OpticalFlowSessionCreateFlagsNV, Flags);
impl OpticalFlowSessionCreateFlagsNV {
pub const ENABLE_HINT: Self = Self(0b1);
pub const ENABLE_COST: Self = Self(0b10);
pub const ENABLE_GLOBAL_FLOW: Self = Self(0b100);
pub const ALLOW_REGIONS: Self = Self(0b1000);
pub const BOTH_DIRECTIONS: Self = Self(0b1_0000);
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkOpticalFlowExecuteFlagBitsNV.html>"]
pub struct OpticalFlowExecuteFlagsNV(pub(crate) Flags);
vk_bitflags_wrapped!(OpticalFlowExecuteFlagsNV, Flags);
impl OpticalFlowExecuteFlagsNV {
pub const DISABLE_TEMPORAL_HINTS: Self = Self(0b1);
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkBuildMicromapFlagBitsEXT.html>"]
pub struct BuildMicromapFlagsEXT(pub(crate) Flags);
vk_bitflags_wrapped!(BuildMicromapFlagsEXT, Flags);
impl BuildMicromapFlagsEXT {
pub const PREFER_FAST_TRACE: Self = Self(0b1);
pub const PREFER_FAST_BUILD: Self = Self(0b10);
pub const ALLOW_COMPACTION: Self = Self(0b100);
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkMicromapCreateFlagBitsEXT.html>"]
pub struct MicromapCreateFlagsEXT(pub(crate) Flags);
vk_bitflags_wrapped!(MicromapCreateFlagsEXT, Flags);
impl MicromapCreateFlagsEXT {
pub const DEVICE_ADDRESS_CAPTURE_REPLAY: Self = Self(0b1);
}
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkShaderCreateFlagBitsEXT.html>"]
pub struct ShaderCreateFlagsEXT(pub(crate) Flags);
vk_bitflags_wrapped!(ShaderCreateFlagsEXT, Flags);
impl ShaderCreateFlagsEXT {
pub const LINK_STAGE: Self = Self(0b1);
}

File diff suppressed because it is too large Load diff

View file

@ -10,6 +10,7 @@ pub const MAX_MEMORY_HEAPS: usize = 16;
pub const LOD_CLAMP_NONE: f32 = 1000.00; pub const LOD_CLAMP_NONE: f32 = 1000.00;
pub const REMAINING_MIP_LEVELS: u32 = !0; pub const REMAINING_MIP_LEVELS: u32 = !0;
pub const REMAINING_ARRAY_LAYERS: u32 = !0; pub const REMAINING_ARRAY_LAYERS: u32 = !0;
pub const REMAINING_3D_SLICES_EXT: u32 = !0;
pub const WHOLE_SIZE: u64 = !0; pub const WHOLE_SIZE: u64 = !0;
pub const ATTACHMENT_UNUSED: u32 = !0; pub const ATTACHMENT_UNUSED: u32 = !0;
pub const TRUE: Bool32 = 1; pub const TRUE: Bool32 = 1;
@ -23,4 +24,5 @@ pub const MAX_DRIVER_NAME_SIZE: usize = 256;
pub const MAX_DRIVER_INFO_SIZE: usize = 256; pub const MAX_DRIVER_INFO_SIZE: usize = 256;
pub const SHADER_UNUSED_KHR: u32 = !0; pub const SHADER_UNUSED_KHR: u32 = !0;
pub const MAX_GLOBAL_PRIORITY_SIZE_KHR: usize = 16; pub const MAX_GLOBAL_PRIORITY_SIZE_KHR: usize = 16;
pub const MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT: usize = 32;
pub const SHADER_UNUSED_NV: u32 = SHADER_UNUSED_KHR; pub const SHADER_UNUSED_NV: u32 = SHADER_UNUSED_KHR;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -999,7 +999,7 @@ pub type PFN_vkCmdSetDepthBias = unsafe extern "system" fn(
); );
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub type PFN_vkCmdSetBlendConstants = pub type PFN_vkCmdSetBlendConstants =
unsafe extern "system" fn(command_buffer: CommandBuffer, blend_constants: *const [f32; 4]); unsafe extern "system" fn(command_buffer: CommandBuffer, blend_constants: *const [f32; 4usize]);
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub type PFN_vkCmdSetDepthBounds = unsafe extern "system" fn( pub type PFN_vkCmdSetDepthBounds = unsafe extern "system" fn(
command_buffer: CommandBuffer, command_buffer: CommandBuffer,
@ -2876,7 +2876,7 @@ impl DeviceFnV1_0 {
cmd_set_blend_constants: unsafe { cmd_set_blend_constants: unsafe {
unsafe extern "system" fn cmd_set_blend_constants( unsafe extern "system" fn cmd_set_blend_constants(
_command_buffer: CommandBuffer, _command_buffer: CommandBuffer,
_blend_constants: *const [f32; 4], _blend_constants: *const [f32; 4usize],
) { ) {
panic!(concat!( panic!(concat!(
"Unable to load ", "Unable to load ",

File diff suppressed because it is too large Load diff

View file

@ -1,33 +1,26 @@
#![allow(non_camel_case_types)]
use std::os::raw::*; use std::os::raw::*;
pub type RROutput = c_ulong; pub type RROutput = c_ulong;
pub type VisualID = c_uint; pub type VisualID = c_uint;
pub type Display = *const c_void; pub type Display = *const c_void;
pub type Window = c_ulong; pub type Window = c_ulong;
#[allow(non_camel_case_types)]
pub type xcb_connection_t = c_void; pub type xcb_connection_t = c_void;
#[allow(non_camel_case_types)]
pub type xcb_window_t = u32; pub type xcb_window_t = u32;
#[allow(non_camel_case_types)]
pub type xcb_visualid_t = u32; pub type xcb_visualid_t = u32;
pub type MirConnection = *const c_void; pub type MirConnection = *const c_void;
pub type MirSurface = *const c_void; pub type MirSurface = *const c_void;
pub type HINSTANCE = *const c_void; pub type HINSTANCE = *const c_void;
pub type HWND = *const c_void; pub type HWND = *const c_void;
#[allow(non_camel_case_types)]
pub type wl_display = c_void; pub type wl_display = c_void;
#[allow(non_camel_case_types)]
pub type wl_surface = c_void; pub type wl_surface = c_void;
pub type HANDLE = *mut c_void; pub type HANDLE = *mut c_void;
pub type HMONITOR = HANDLE; pub type HMONITOR = HANDLE;
pub type DWORD = c_ulong; pub type DWORD = c_ulong;
pub type LPCWSTR = *const u16; pub type LPCWSTR = *const u16;
#[allow(non_camel_case_types)]
pub type zx_handle_t = u32; pub type zx_handle_t = u32;
#[allow(non_camel_case_types)]
pub type _screen_context = c_void; pub type _screen_context = c_void;
#[allow(non_camel_case_types)]
pub type _screen_window = c_void; pub type _screen_window = c_void;
#[allow(non_camel_case_types)]
pub type SECURITY_ATTRIBUTES = c_void; pub type SECURITY_ATTRIBUTES = c_void;
// Opaque types // Opaque types
pub type ANativeWindow = c_void; pub type ANativeWindow = c_void;
@ -39,3 +32,10 @@ pub type GgpStreamDescriptor = u32;
pub type GgpFrameToken = u64; pub type GgpFrameToken = u64;
pub type IDirectFB = c_void; pub type IDirectFB = c_void;
pub type IDirectFBSurface = c_void; pub type IDirectFBSurface = c_void;
pub type __IOSurface = c_void;
pub type IOSurfaceRef = *mut __IOSurface;
pub type MTLBuffer_id = *mut c_void;
pub type MTLCommandQueue_id = *mut c_void;
pub type MTLDevice_id = *mut c_void;
pub type MTLSharedEvent_id = *mut c_void;
pub type MTLTexture_id = *mut c_void;

View file

@ -29,11 +29,7 @@ impl Packed24_8 {
} }
} }
// Intradoc `Self::` links refuse to resolve if `ColorComponentFlags` impl vk::ColorComponentFlags {
// isn't directly in scope: https://github.com/rust-lang/rust/issues/93205
use vk::ColorComponentFlags;
impl ColorComponentFlags {
/// Contraction of [`R`][Self::R] | [`G`][Self::G] | [`B`][Self::B] | [`A`][Self::A] /// Contraction of [`R`][Self::R] | [`G`][Self::G] | [`B`][Self::B] | [`A`][Self::A]
pub const RGBA: Self = Self(Self::R.0 | Self::G.0 | Self::B.0 | Self::A.0); pub const RGBA: Self = Self(Self::R.0 | Self::G.0 | Self::B.0 | Self::A.0);
} }
@ -56,3 +52,10 @@ impl From<vk::Extent2D> for vk::Rect2D {
} }
} }
} }
/// Structures implementing this trait are layout-compatible with [`vk::BaseInStructure`] and
/// [`vk::BaseOutStructure`]. Such structures have an `s_type` field indicating its type, which
/// must always match the value of [`TaggedStructure::STRUCTURE_TYPE`].
pub unsafe trait TaggedStructure {
const STRUCTURE_TYPE: vk::StructureType;
}

View file

@ -2,11 +2,12 @@
name = "examples" name = "examples"
version = "0.1.0" version = "0.1.0"
authors = ["maik klein <maikklein@googlemail.com>"] authors = ["maik klein <maikklein@googlemail.com>"]
edition = "2018" edition = "2021"
[dependencies] [dependencies]
winit = "0.26" image = "0.24"
image = "0.23" raw-window-handle = "0.5"
winit = "0.27.1"
# The examples require the validation layers, which means the SDK or # The examples require the validation layers, which means the SDK or
# equivalent development packages should be present, so we can link # equivalent development packages should be present, so we can link
# directly and benefit from the infallible `Entry` constructor. # directly and benefit from the infallible `Entry` constructor.

Some files were not shown because too many files have changed in this diff Show more