Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide Vulkan library loader from custom path #319

Merged
merged 1 commit into from
Aug 3, 2020
Merged

Provide Vulkan library loader from custom path #319

merged 1 commit into from
Aug 3, 2020

Conversation

MarijnS95
Copy link
Collaborator

It is in some cases necessary to load a specific Vulkan dll/so with a different name and/or from a different location. Instead of copying this function to a downstream project (and making the LoadingError constructor public to retain the same interface), split Entry::new() such that downstream projects can easily specify and use an alternate Vulkan implementation.

It is in some cases necessary to load a specific Vulkan dll/so with a
different name and/or from a different location.

Instead of copying this function to a downstream project (and making the
LoadingError constructor public to retain the same interface), split
Entry::new() such that downstream projects can easily specify and use an
alternate Vulkan implementation.
@MaikKlein MaikKlein merged commit c6d5d66 into ash-rs:master Aug 3, 2020
@MarijnS95 MarijnS95 deleted the entry-load-dll-from-arbitrary-location branch August 3, 2020 09:26
@Rua Rua mentioned this pull request Mar 3, 2021
MarijnS95 added a commit to Traverse-Research/ash that referenced this pull request Mar 8, 2021
If a `&str` were to be passed this supposedly requires `AsRef<OsStr>` to
be implemented for `str` instead of `&str`, leading to the inability to
pass string literals:

    18 |         let entry = ash::Entry::with_library("foo")?;
       |                                              ^^^^^ doesn't have a size known at compile-time
       |
      ::: /home/marijn/Code/TraverseResearch/ash/ash/src/entry_libloading.rs:73:39
       |
    73 |     pub unsafe fn with_library(path: &impl AsRef<OsStr>) -> Result<Entry, LoadingError> {
       |                                       ----------------- required by this bound in `ash::entry_libloading::<impl EntryCustom<Arc<libloading::Library>>>::with_library`

After all `Library::new` accepts an `impl AsRef<OsStr>` without borrow.

Fixes: c6d5d66 ("entry_libloading: Provide Vulkan library loader from custom path (ash-rs#319)")
MarijnS95 added a commit to Traverse-Research/ash that referenced this pull request Mar 8, 2021
All type parameters are implicitly bound by Sized; matching the `&` out
of `&str` implies that `str` must be bound by `Sized` (and that `str`
rather than `&str` implements `AsRef<OsStr>`) which is not true,
resulting in:

    18 |         let entry = ash::Entry::with_library("foo")?;
       |                                              ^^^^^ doesn't have a size known at compile-time
       |
      ::: /home/marijn/Code/TraverseResearch/ash/ash/src/entry_libloading.rs:73:39
       |
    73 |     pub unsafe fn with_library(path: &impl AsRef<OsStr>) -> Result<Entry, LoadingError> {
       |                                       ----------------- required by this bound in `ash::entry_libloading::<impl EntryCustom<Arc<libloading::Library>>>::with_library`

After all `Library::new` accepts an `impl AsRef<OsStr>` without borrow,
and `str` can't retrieve a borrow to itself.

Fixes: c6d5d66 ("entry_libloading: Provide Vulkan library loader from custom path (ash-rs#319)")
MarijnS95 added a commit to Traverse-Research/ash that referenced this pull request Mar 8, 2021
All type parameters are implicitly bound by Sized; matching the `&` out
of `&str` implies that `str` must be bound by `Sized` which is not true,
resulting in:

    18 |         let entry = ash::Entry::with_library("foo")?;
       |                                              ^^^^^ doesn't have a size known at compile-time
       |
      ::: /home/marijn/Code/TraverseResearch/ash/ash/src/entry_libloading.rs:73:39
       |
    73 |     pub unsafe fn with_library(path: &impl AsRef<OsStr>) -> Result<Entry, LoadingError> {
       |                                       ----------------- required by this bound in `ash::entry_libloading::<impl EntryCustom<Arc<libloading::Library>>>::with_library`

After all `Library::new` accepts an `impl AsRef<OsStr>` without borrow,
which is what this function is modeled after to pass the same parameter
on directly.

Fixes: c6d5d66 ("entry_libloading: Provide Vulkan library loader from custom path (ash-rs#319)")
MarijnS95 added a commit to Traverse-Research/ash that referenced this pull request Mar 8, 2021
All type parameters are implicitly bound by `Sized`; matching the `&`
out of `&str` implies that `str` must be bound by `Sized` which is not
true, resulting in:

    18 |         let entry = ash::Entry::with_library("foo")?;
       |                                              ^^^^^ doesn't have a size known at compile-time
       |
      ::: /home/marijn/Code/TraverseResearch/ash/ash/src/entry_libloading.rs:73:39
       |
    73 |     pub unsafe fn with_library(path: &impl AsRef<OsStr>) -> Result<Entry, LoadingError> {
       |                                       ----------------- required by this bound in `ash::entry_libloading::<impl EntryCustom<Arc<libloading::Library>>>::with_library`

After all `Library::new` accepts an `impl AsRef<OsStr>` without borrow,
which is what this function is modeled after to pass the same parameter
on directly.

Fixes: c6d5d66 ("entry_libloading: Provide Vulkan library loader from custom path (ash-rs#319)")
MaikKlein pushed a commit that referenced this pull request Mar 8, 2021
All type parameters are implicitly bound by `Sized`; matching the `&`
out of `&str` implies that `str` must be bound by `Sized` which is not
true, resulting in:

    18 |         let entry = ash::Entry::with_library("foo")?;
       |                                              ^^^^^ doesn't have a size known at compile-time
       |
      ::: /home/marijn/Code/TraverseResearch/ash/ash/src/entry_libloading.rs:73:39
       |
    73 |     pub unsafe fn with_library(path: &impl AsRef<OsStr>) -> Result<Entry, LoadingError> {
       |                                       ----------------- required by this bound in `ash::entry_libloading::<impl EntryCustom<Arc<libloading::Library>>>::with_library`

After all `Library::new` accepts an `impl AsRef<OsStr>` without borrow,
which is what this function is modeled after to pass the same parameter
on directly.

Fixes: c6d5d66 ("entry_libloading: Provide Vulkan library loader from custom path (#319)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants