Skip to content

Commit

Permalink
Merge branch 'master' into maybe-running-examples-in-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
marc0246 committed Nov 1, 2023
2 parents c86410a + 6a8a75d commit 0721de4
Show file tree
Hide file tree
Showing 34 changed files with 1,875 additions and 1,615 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,27 @@
Pull Request merge.
-->

### Public dependency updates
- [raw-window-handle](https://crates.io/raw-window-handle) 0.6
- [winit](https://crates.io/crates/winit) 0.29

### Public dependency updates

### Breaking changes

Changes to `Surface`:
- `Surface::required_extensions` now returns a result.
- `Surface::from_window[_ref]` now take `HasWindowHandle + HasDisplayHandle` as the window and return a new error type.

### Additions

- Partially validated versions of `submit` and `present` commands (called via `QueueGuard`).
- Support for the `khr_timeline_semaphore` extension.

### Bugs fixed

- Incorrect assert condition in `PipelineLayout::is_compatible_with`.

# Version 0.34.1 (2023-10-29)

### Bugs fixed
Expand Down
15 changes: 11 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[workspace]
members = [
"examples/*",
"vulkano",
"vulkano-macros",
"vulkano-shaders",
"vulkano-util",
"vulkano-win",
# "vulkano-win",
]
resolver = "2"

Expand Down Expand Up @@ -44,13 +45,19 @@ parking_lot = "0.12"
proc-macro2 = "1.0"
proc-macro-crate = "1.2"
quote = "1.0"
raw-window-handle = "0.5"
raw-window-handle = "0.6"
regex = "1.8"
serde = "1.0"
serde_json = "1.0"
shaderc = "0.8"
smallvec = "1.8"
syn = "1.0"
syn = "2.0"
thread_local = "1.1"
vk-parse = "0.12"
winit = "0.28"
winit = "0.29"

# Only used in examples
cgmath = "0.18"
png = "0.17"
rand = "0.8"
ron = "0.8"
15 changes: 0 additions & 15 deletions examples/Cargo.toml

This file was deleted.

30 changes: 19 additions & 11 deletions examples/async-update/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
use cgmath::{Matrix4, Rad};
use rand::Rng;
use std::{
error::Error,
hint,
sync::{
atomic::{AtomicBool, AtomicU64, Ordering},
Expand Down Expand Up @@ -91,18 +92,19 @@ use vulkano::{
Validated, VulkanError, VulkanLibrary,
};
use winit::{
event::{ElementState, Event, KeyboardInput, VirtualKeyCode, WindowEvent},
event::{ElementState, Event, KeyEvent, WindowEvent},
event_loop::{ControlFlow, EventLoop},
keyboard::{Key, NamedKey},
window::WindowBuilder,
};

const TRANSFER_GRANULARITY: u32 = 4096;

fn main() {
let event_loop = EventLoop::new();
fn main() -> Result<(), impl Error> {
let event_loop = EventLoop::new().unwrap();

let library = VulkanLibrary::new().unwrap();
let required_extensions = Surface::required_extensions(&event_loop);
let required_extensions = Surface::required_extensions(&event_loop).unwrap();
let instance = Instance::new(
library,
InstanceCreateInfo {
Expand Down Expand Up @@ -521,13 +523,15 @@ fn main() {

println!("\nPress space to update part of the texture");

event_loop.run(move |event, _, control_flow| {
event_loop.run(move |event, elwt| {
elwt.set_control_flow(ControlFlow::Poll);

match event {
Event::WindowEvent {
event: WindowEvent::CloseRequested,
..
} => {
*control_flow = ControlFlow::Exit;
elwt.exit();
}
Event::WindowEvent {
event: WindowEvent::Resized(_),
Expand All @@ -538,10 +542,10 @@ fn main() {
Event::WindowEvent {
event:
WindowEvent::KeyboardInput {
input:
KeyboardInput {
event:
KeyEvent {
logical_key: Key::Named(NamedKey::Space),
state: ElementState::Released,
virtual_keycode: Some(VirtualKeyCode::Space),
..
},
..
Expand All @@ -550,7 +554,10 @@ fn main() {
} => {
channel.send(()).unwrap();
}
Event::RedrawEventsCleared => {
Event::WindowEvent {
event: WindowEvent::RedrawRequested,
..
} => {
let image_extent: [u32; 2] = window.inner_size().into();

if image_extent.contains(&0) {
Expand Down Expand Up @@ -685,9 +692,10 @@ fn main() {
}
}
}
Event::AboutToWait => window.request_redraw(),
_ => (),
}
});
})
}

#[allow(clippy::too_many_arguments)]
Expand Down
21 changes: 14 additions & 7 deletions examples/buffer-allocator/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// Modified triangle example to show `SubbufferAllocator`.

use std::{
error::Error,
sync::Arc,
time::{SystemTime, UNIX_EPOCH},
};
Expand Down Expand Up @@ -55,11 +56,11 @@ use winit::{
window::WindowBuilder,
};

fn main() {
let event_loop = EventLoop::new();
fn main() -> Result<(), impl Error> {
let event_loop = EventLoop::new().unwrap();

let library = VulkanLibrary::new().unwrap();
let required_extensions = Surface::required_extensions(&event_loop);
let required_extensions = Surface::required_extensions(&event_loop).unwrap();
let instance = Instance::new(
library,
InstanceCreateInfo {
Expand Down Expand Up @@ -280,21 +281,26 @@ fn main() {
let command_buffer_allocator =
StandardCommandBufferAllocator::new(device.clone(), Default::default());

event_loop.run(move |event, _, control_flow| {
event_loop.run(move |event, elwt| {
elwt.set_control_flow(ControlFlow::Poll);

match event {
Event::WindowEvent {
event: WindowEvent::CloseRequested,
..
} => {
*control_flow = ControlFlow::Exit;
elwt.exit();
}
Event::WindowEvent {
event: WindowEvent::Resized(_),
..
} => {
recreate_swapchain = true;
}
Event::RedrawEventsCleared => {
Event::WindowEvent {
event: WindowEvent::RedrawRequested,
..
} => {
let image_extent: [u32; 2] = window.inner_size().into();

if image_extent.contains(&0) {
Expand Down Expand Up @@ -426,9 +432,10 @@ fn main() {
}
}
}
Event::AboutToWait => window.request_redraw(),
_ => (),
}
});
})
}

/// This function is called once during initialization, then again whenever the window is resized.
Expand Down
Loading

0 comments on commit 0721de4

Please sign in to comment.