Skip to content

Commit

Permalink
Check memory type count
Browse files Browse the repository at this point in the history
See issue ash-rs/ash#920

Also reintroduce redraw event in cube example
  • Loading branch information
BigAngryPanda committed May 19, 2024
1 parent 0fcbc18 commit 196adf1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 19 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ edition = "2021"

[dependencies]
ash = { version = "0.38.*", features = ["linked", "loaded"] }
winit = "0.29.0"
winit = { version = "0.29", features = ["rwh_06"] }
shaderc = "*"
ash-window = "*"
ash-window = "0.13.*"

raw-window-handle = "0.6.2"
raw-window-handle = "0.6"

[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]
raw-window-metal = "0.4"
3 changes: 3 additions & 0 deletions examples/cube.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,9 @@ fn main() {
} => {
control_flow.exit();
},
winit::event::Event::AboutToWait => {
wnd.request_redraw();
},
winit::event::Event::WindowEvent {
event: winit::event::WindowEvent::RedrawRequested,
..
Expand Down
24 changes: 8 additions & 16 deletions src/hw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,24 +316,16 @@ impl HWDevice {
.get_physical_device_queue_family_properties(hw)
};

let memory_desc: Vec<MemoryDescription> = unsafe {
let mem_props: vk::PhysicalDeviceMemoryProperties =
lib.instance().get_physical_device_memory_properties(hw);

mem_props
.memory_types
.iter()
.enumerate()
.map(|(i, _)| MemoryDescription::new(&mem_props, i))
.filter(|m| {
m.is_local()
|| m.is_host_visible()
|| m.is_host_cached()
|| m.is_host_coherent()
})
.collect()
let mem_props: vk::PhysicalDeviceMemoryProperties = unsafe {
lib.instance().get_physical_device_memory_properties(hw)
};

let mut memory_desc: Vec<MemoryDescription> = Vec::new();

for i in 0..mem_props.memory_type_count as usize {
memory_desc.push(MemoryDescription::new(&mem_props, i));
}

let queue_desc: Vec<QueueFamilyDescription> =
queue_properties
.iter()
Expand Down

0 comments on commit 196adf1

Please sign in to comment.