Commit graph

22 commits

Author SHA1 Message Date
Marijn Suijten befb8cdd36
Switch to safe CStr::from_bytes_until_nul on sized c_char array wrapper (#746)
Certain structs contain sized character arrays that are converted to
`CStr` for convenient accss to the user and our `Debug` implementation
using unsafe `CStr::from_ptr(...as_ptr())`.  There is no need to
round-trip to a pointer and possibly read out of bounds if the
NUL-terminator index (string length) is instead searched for by the
newly stabilized `CStr::from_bytes_until_nul()` fn since Rust 1.69
(which panics if no NUL-terminator is found before the end of the
slice).

Unfortunately `unsafe` is still needed to cast the array from a `c_char`
(`i8` on most platforms) to `u8`, which is what `from_bytes_until_nul()`
accepts.
2023-12-02 20:04:57 +01:00
Marijn Suijten 4bbfa54146
Rename examples to ash-examples (#820)
[Dependabot complains] that:

     the binary target name `examples` is forbidden, it conflicts with with cargo's build directory names

And fails to provide dependency upgrades for Rust code.  Fix that by
renaming the folder and crate to `ash-examples`.

[Dependabot complains]: https://github.com/ash-rs/ash/network/updates/748770724
2023-11-17 17:27:28 +01:00
dependabot[bot] d0c5e97826
build(deps): bump actions/checkout from 1 to 4 in /.github/workflows (#812)
Bumps [actions/checkout](https://github.com/actions/checkout) from 1 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v1...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-03 18:38:00 +01:00
Marijn Suijten 4180359ba7
gitmodules: Disable update to prevent cloning on cargo checkout (#808)
When using a `git` reference on this repo, `cargo` will unnecessarily
clone the `Vulkan-Headers` submodule (which is only needed by maintainers
together with the `generator`).  By setting the update mode to `none`
(https://git-scm.com/docs/gitmodules#Documentation/gitmodules.txt-submoduleltnamegtupdate)
this is disabled, and `git submodule update` will now also no longer
fetch/clone/update the repository unless `--checkout` is used
(https://git-scm.com/docs/git-submodule#Documentation/git-submodule.txt-checkout).

I.e. running `cargo update` on a repo with a `git` dependency on `ash`:

    Updating git repository `https://github.com/ash-rs/ash`
    Skipping git submodule `https://github.com/KhronosGroup/Vulkan-Headers` due to update strategy in .gitmodules
2023-10-30 12:20:28 +01:00
Marijn Suijten 49de0341a0
CI: Cross-lint for Mac, iOS and Windows (#796)
* CI: Cross-lint for Mac, iOS and Windows

We have some conditional code specific to Mac and iOS which is currently
untested in the CI, allowing non-compiling code in PRs like #795 to go
unnoticed.

* Fix new clippy lints
2023-10-11 20:58:21 +02:00
Marijn Suijten f840977b72
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:30:46 +02:00
Marijn Suijten 30cb8f1d7c
generator: Run rustfmt over generated output before writing to disk (#735)
Some users are confused by seeing wildly different output after running
the generator, which is simply solved by running `rustfmt`.  As this is
both confusing and "somewhat" slow, invoke `rustfmt` directly within the
generator by piping string contents through it before redirecting to
disk.  This not only makes the output consistent, it is the fastest way
to reformat generator changes by omitting the round-trip to disk
entirely, nor having `rustfmt` recursively go through the workspace and
all files (including those that are not generated).

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

Before:

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

After:

    time ./target/debug/generator
    ./target/debug/generator  4.51s user 0.41s system 99% cpu 4.931 total
2023-04-07 01:48:26 +02:00
Marijn Suijten 42a2bd330f
CI: Replace deprecated actions-rs with simple run: cargo ... (#720)
There's no reason to use these steps anymore: besides being old,
unmaintained, and spitting out NodeJS deprecation warnings, GitHub's
`runner-images` come preloaded with all Rust tools and components we
need, and the syntax to run commands is more efficient, much shorter and
more apprehensible by simply matching what we'd use on our own
command-line, too.
2023-04-06 07:50:10 +02:00
Friz64 eaf140fcb0
rewrite: Absolute basics (#713)
rewrite: Absolute basics
2023-03-13 22:06:38 +01:00
Marijn Suijten 1c9e422577
ash-window: Bump MSRV to 1.64 to match raw-window-handle 0.5.1 (#716)
`raw-window-handle 0.5.1` bumped from 1.60 to 1.64 in a
semver-compatible release, failing our CI infrastructure overnight.

Keep the `ash` version at `1.60` for now.
2023-03-09 23:39:44 +01:00
Marijn Suijten 9e71ab9e34
Bump MSRV to 1.60 to accomodate for winit 0.28/objc requirement (#709)
These dependencies fail to resolve on older Rust/cargo versions before
even complaining about them being a too-high MSRV.
2023-02-24 21:51:07 +01:00
Marijn Suijten 373aee53a7
CI: Only MSRV-test published ash and ash-window crates (#677)
`bytemuck` recently bumped its MSRV to 1.60 which is incompatible with
what we're currently advertising.  Fortunately this doesn't affect MSRV
of the publicly published crates, but only `dev-dependencies` inside
`ash-window` via `winit`: make sure the CI doesn't reject this.
2022-11-07 11:58:48 -08:00
Marijn Suijten e43e9c0c9b
Set MSRV through rust-version in Cargo.toml and validate in CI (#604)
[#590] introduced an unsuspecting MSRV bump.  While we're pro-ba-bly
fine having these at the benefit of better code (in this case more
appropriate `const` annotations), they should at least be clear to us
when merging through a CI failure (or up-front bump of this version in
the CI script).  At the same time setting [`rust-version` in
`Cargo.toml`] provides a more helpful "requires newer rustc" error
message (since Rust 1.56.0) instead of showing potentially tons of
irrelevant compile errors in this crate to the user.

[#590]: https://github.com/MaikKlein/ash/pull/590
[`rust-version` in `Cargo.toml`]: https://doc.rust-lang.org/cargo/reference/manifest.html?highlight=pack#the-rust-version-field
2022-03-27 14:30:10 -07:00
Marijn Suijten 315f1f00c3
ci: Build-test documentation with warnings disallowed, and fix links (#559)
Broken links that snuck in (most recently in #530 and #537) while the
CI was not testing the documentation have also been corrected, to allow
it to succeed again (and to have proper docs in the first place).
2022-01-22 11:27:07 -08:00
Marijn Suijten 61d37734f8
ci: Run clippy once more without default features (#523)
With more and more features being added to `ash`, now seems to be the
right time to make sure the crate is clean of clippy warnings when
building without any features in addition to building with the deafult
set of features.
2021-12-27 11:43:12 +01:00
Benjamin Saunders be6d767b03
Cover all features with clippy (#527)
* Fix lint

* Cover all/no features with clippy
2021-12-23 23:26:48 +01:00
Benjamin Saunders aa7b429f4f
Support linking Vulkan directly (#457)
* Mark EntryCustom::new_custom as unsafe

Passing a badly-behaved `load` function can invoke undefined behavior.

* Document required feature for Entry

* Support linking Vulkan directly

This is the preferred pattern in most environments when an application
cannot function without Vulkan, as it saves the libloading dependency,
eliminates an error case, and makes the Vulkan dependency visible to
the OS.

* Rename libloading feature to "loaded"

* Link by default

* Guide users towards linking the loader directly

* Remove unnecessary error type

InstanceError::LoadError was never constructed.

* Unify entry types

Simplifies the interface and allows a bunch of code to become
monomorphic.
2021-09-09 22:50:34 +02:00
Marijn Suijten 8444db4fb2
ci: Test docs in addition to cargo t --all-targets (#392)
* ci: Test docs in addition to `cargo t --all-targets`

Unfortunately docs are not explicitly (build-)tested as part of
`--all-targets` allowing broken code to slip in as shown by #390.

Also remove the `rust` listing type which is the default, leaving only
`no_run` (until the CI has a loadable Vulkan library).

* ash: Fix errors and warnings in (now tested) documentation comments
2021-03-14 11:31:17 +01:00
Marijn Suijten dba9e6b691
ci: Run the generator and fail if output is different (#393)
Make sure the submodule hash, state of the generator and resulting
source files in ash are in sync for every submission.
2021-03-14 11:29:49 +01:00
Marijn Suijten 8a46286005 CI: Test/check/lint all targets in all workspaces 2020-09-02 17:08:20 -07:00
maik da9fa12eb9 Rename workflow 2019-10-20 17:45:18 +02:00
Maik Klein 6dd7f98d07
Add github actions (#244)
* Add github actions

* Update readme

* Delete travis and appveyor

* Rm Iamdone

* Update bors
2019-10-20 17:41:13 +02:00