Skip to content

Commit 75a4f1a

Browse files
authored
Upgrade to ash 0.34 with ash-window 0.8 (#87)
This ash release switches over to a dynamically linked scheme where Vulkan is linked directly instead of through libloading by default. As the main library crate doesn't need to load an entrypoint such linking is not desired at all and is disabled by default (as is runtime linking, effectively no entrypoints can be loaded): it must be re-enabled by hand when building the examples.
1 parent d923c18 commit 75a4f1a

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

Cargo.toml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,31 @@ include = [
2121
backtrace = "0.3"
2222
log = "0.4"
2323
thiserror = "1.0"
24-
# Only needed for vulkan.
25-
ash = { version = "0.33", optional = true }
24+
# Only needed for vulkan. Disable the default "linked" feature to prevent forcibly
25+
# dynamic-linking against a Vulkan library on the system. This linking, and loading
26+
# an entrypoint for it is only needed by the examples.
27+
ash = { version = "0.34", optional = true, default-features = false, features = ["debug"] }
2628
# Only needed for d3d12.
2729
winapi = { version = "0.3.9", features = ["d3d12", "winerror", "impl-default", "impl-debug"], optional = true }
2830
# Only needed for visualizer.
2931
imgui = { version = "0.8", optional = true }
3032
imgui-winit-support = { version = "0.8", optional = true }
3133

3234
[dev-dependencies]
33-
ash-window = "0.7"
35+
ash-window = "0.8"
3436
raw-window-handle = "0.3"
3537
winapi = { version = "0.3.9", features = ["d3d12", "d3d12sdklayers", "dxgi1_6", "winerror", "impl-default", "impl-debug", "winuser", "windowsx", "libloaderapi"] }
3638
winit = "0.25"
3739

3840
[[example]]
3941
name = "vulkan-buffer"
4042
path = "examples/vulkan-buffer/src/main.rs"
41-
required-features = ["vulkan"]
43+
required-features = ["vulkan", "ash/linked"]
4244

4345
[[example]]
4446
name = "vulkan-visualization"
4547
path = "examples/vulkan-visualization/src/main.rs"
46-
required-features = ["vulkan", "visualizer"]
48+
required-features = ["vulkan", "ash/linked", "visualizer"]
4749

4850
[[example]]
4951
name = "d3d12-buffer"

examples/vulkan-buffer/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use gpu_allocator::vulkan::{AllocationCreateDesc, Allocator, AllocatorCreateDesc
77
use gpu_allocator::MemoryLocation;
88

99
fn main() {
10-
let entry = unsafe { ash::Entry::new() }.unwrap();
10+
let entry = ash::Entry::new();
1111

1212
// Create vulkan instance
1313
let instance = {

examples/vulkan-visualization/src/imgui_renderer.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,10 @@ impl ImGuiRenderer {
215215
.src_alpha_blend_factor(vk::BlendFactor::ZERO)
216216
.dst_alpha_blend_factor(vk::BlendFactor::ZERO)
217217
.alpha_blend_op(vk::BlendOp::ADD)
218-
.color_write_mask(vk::ColorComponentFlags::all());
218+
.color_write_mask({
219+
use vk::ColorComponentFlags::*;
220+
R | G | B | A
221+
});
219222
let color_blend_state = vk::PipelineColorBlendStateCreateInfo::builder()
220223
.logic_op(vk::LogicOp::CLEAR)
221224
.attachments(std::slice::from_ref(&attachments));

examples/vulkan-visualization/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use imgui_renderer::ImGuiRenderer;
1414
use imgui_winit_support::{HiDpiMode, WinitPlatform};
1515

1616
fn main() -> ash::prelude::VkResult<()> {
17-
let entry = unsafe { ash::Entry::new() }.unwrap();
17+
let entry = ash::Entry::new();
1818

1919
let event_loop = winit::event_loop::EventLoop::new();
2020

0 commit comments

Comments
 (0)