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

Don't link Vulkan by default #526

Merged
merged 2 commits into from
Dec 27, 2021
Merged

Conversation

Ralith
Copy link
Collaborator

@Ralith Ralith commented Dec 23, 2021

This was found to be unreasonably disruptive to downstream CI configurations. Fixes #525.

I opted to additionally enable loaded by default, and reposition Entry::load above Entry::linked, so that a working configuration is available and easily found out of the box.

ash/src/entry.rs Outdated Show resolved Hide resolved
ash/src/entry.rs Show resolved Hide resolved
@Ralith Ralith force-pushed the no-default-link branch 3 times, most recently from 887e355 to 71a63c4 Compare December 23, 2021 19:34
ash/src/entry.rs Outdated Show resolved Hide resolved
@Ralith Ralith force-pushed the no-default-link branch 2 times, most recently from 203ec3d to 44ed205 Compare December 23, 2021 19:59
@@ -7,5 +7,5 @@ edition = "2018"
[dependencies]
winit = "0.25.0"
image = "0.10.4"
ash = { path = "../ash" }
ash = { path = "../ash", default-features = false, features = ["linked", "debug"] }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be helpful to have some explanation as to why the examples are using linked instead loaded. I assume this is because the examples are requiring the validation layer from the SDK. If that's not the case, the examples should probably use loaded to minimize friction.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a note.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aloucks The note is nice, but keep in mind that dynamic linking or (dynamic) runtime loading has no impact on being able to use the validation layers. It "just so happens" that both the .lib (needed for dynamic linking on Windows) (on Linux the runtime .so is used for this) and validation layers ship with the SDK.

FWIW I thought the examples would use linked to both showcase this feature, and because examples are generally ran on the same machine (ie. build environment == runtime environment) so it makes sense that the user intends to develop Vulkan applications, hence has the ability to both "develop" (with the SDK) and run them.

@MarijnS95
Copy link
Collaborator

Does the CI test job still need to install libvulkan-dev now?

@Ralith
Copy link
Collaborator Author

Ralith commented Dec 23, 2021

Yes, to allow tests/examples to be built with the linked feature enabled.

ash/src/entry.rs Outdated
/// Load default Vulkan library for the current platform
///
/// Prefer this over [`linked`](Self::linked) when your application can gracefully handle
/// environments that lack Vulkan support, and when the build environment might not have the
/// Vulkan loader available.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be helpful to rephrase this in such a way that emphasizes the impact on downstream dependencies.

Entry::loaded should be preferred unless you explicitly want to impose a dependency on the Vulkan SDK (e.g. perhaps you depend on validation layers). For example, bevy depends on wgpu. If wgpu decided to used Entry::linked, every developer who attempted to experiment with bevy would need to install the Vulkan SDK or face compile time linker errors.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjusted the wording to make the build environment requirements clearer.

This was found to be unreasonably disruptive to downstream CI
configurations.
Copy link
Collaborator

@Jasper-Bekkers Jasper-Bekkers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this reverts back to the old behavior so I can approve it. @MaikKlein I think it would make sense to push a new release with this fix as soon as it's merged. What do you think?

/// Compared to [`load`](Self::load), this is infallible, but requires that the build
/// environment have Vulkan development packages installed (e.g. the Vulkan SDK, or Ubuntu's
/// libvulkan-dev), and prevents the resulting binary from starting in environments that do not
/// support Vulkan.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/support Vulkan/ship with Vulkan libraries?

ash/src/entry.rs Outdated Show resolved Hide resolved
ash/src/entry.rs Outdated Show resolved Hide resolved
@@ -7,5 +7,5 @@ edition = "2018"
[dependencies]
winit = "0.25.0"
image = "0.10.4"
ash = { path = "../ash" }
ash = { path = "../ash", default-features = false, features = ["linked", "debug"] }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aloucks The note is nice, but keep in mind that dynamic linking or (dynamic) runtime loading has no impact on being able to use the validation layers. It "just so happens" that both the .lib (needed for dynamic linking on Windows) (on Linux the runtime .so is used for this) and validation layers ship with the SDK.

FWIW I thought the examples would use linked to both showcase this feature, and because examples are generally ran on the same machine (ie. build environment == runtime environment) so it makes sense that the user intends to develop Vulkan applications, hence has the ability to both "develop" (with the SDK) and run them.

@@ -22,6 +22,7 @@ raw-window-metal = "0.1"

[dev-dependencies]
winit = "0.19.4"
ash = { path = "../ash", version = "0.34", default-features = false, features = ["linked"] }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a nice way to satisfy required-features = ["ash/linked"] :)

@MarijnS95 MarijnS95 merged commit 7cf3b4f into ash-rs:master Dec 27, 2021
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.

Don't require explicitly linking libvulkan by default
5 participants