Skip to content

Commit

Permalink
Merge branch 'master' into workspace-dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
marc0246 committed Oct 30, 2023
2 parents 7c3ff0d + 9f47346 commit b54005b
Show file tree
Hide file tree
Showing 11 changed files with 1,023 additions and 242 deletions.
30 changes: 0 additions & 30 deletions .gitlab-ci.yml

This file was deleted.

70 changes: 0 additions & 70 deletions .travis.yml

This file was deleted.

8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,17 @@
### Additions

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

### Bugs fixed

# Version 0.34.1 (2023-10-29)

### Bugs fixed

- `StandardDescriptorSetAllocator` panicking due to an arithmetic overflow when arithmetic overflow checks are enabled.
- Vulkano-util still depending on the now-deprecated vulkano-win.

# Version 0.34.0 (2023-10-25)

### Public dependency updates
Expand Down
2 changes: 0 additions & 2 deletions vulkano-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,4 @@ readme = "../README.md"
[dependencies]
ahash = { workspace = true }
vulkano = { workspace = true }
# FIXME: These need to be removed.
vulkano-win = { version = "0.34.0", path = "../vulkano-win" }
winit = { version = "0.28" }
18 changes: 15 additions & 3 deletions vulkano-util/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ impl VulkanoContext {
/// # Panics
///
/// - Panics where the underlying Vulkano struct creations fail
// FIXME:
#[allow(deprecated)]
pub fn new(mut config: VulkanoConfig) -> Self {
let library = match VulkanLibrary::new() {
Ok(x) => x,
Expand All @@ -139,7 +137,21 @@ impl VulkanoContext {
};

// Append required extensions
config.instance_create_info.enabled_extensions = vulkano_win::required_extensions(&library)
// HACK: This should be replaced with `Surface::required_extensions`, but will need to
// happen in the next minor version bump. It should have been done before releasing 0.34.
config.instance_create_info.enabled_extensions = library
.supported_extensions()
.intersection(&InstanceExtensions {
khr_surface: true,
khr_xlib_surface: true,
khr_xcb_surface: true,
khr_wayland_surface: true,
khr_android_surface: true,
khr_win32_surface: true,
mvk_ios_surface: true,
mvk_macos_surface: true,
..InstanceExtensions::empty()
})
.union(&config.instance_create_info.enabled_extensions);

// Create instance
Expand Down
39 changes: 38 additions & 1 deletion vulkano/src/command_buffer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ use crate::{
query::{QueryControlFlags, QueryPipelineStatisticFlags},
range_map::RangeMap,
render_pass::{Framebuffer, Subpass},
sync::{semaphore::Semaphore, PipelineStageAccessFlags, PipelineStages},
sync::{
semaphore::{Semaphore, SemaphoreType},
PipelineStageAccessFlags, PipelineStages,
},
DeviceSize, Requires, RequiresAllOf, RequiresOneOf, ValidationError,
};
use ahash::HashMap;
Expand Down Expand Up @@ -774,6 +777,7 @@ impl SubmitInfo {

let &SemaphoreSubmitInfo {
semaphore: _,
value: _,
stages,
_ne: _,
} = semaphore_submit_info;
Expand All @@ -791,6 +795,11 @@ impl SubmitInfo {
}
}

// unsafe
// VUID-VkSubmitInfo2-semaphore-03882
// VUID-VkSubmitInfo2-semaphore-03883
// VUID-VkSubmitInfo2-semaphore-03884

Ok(())
}
}
Expand Down Expand Up @@ -837,6 +846,18 @@ pub struct SemaphoreSubmitInfo {
/// There is no default value.
pub semaphore: Arc<Semaphore>,

/// If `semaphore.semaphore_type()` is [`SemaphoreType::Timeline`], specifies the value that
/// will be used for the semaphore operation:
/// - If it's a signal operation, then the semaphore's value will be set to this value
/// when it is signaled.
/// - If it's a wait operation, then the semaphore will wait until its value is greater than
/// or equal to this value.
///
/// If `semaphore.semaphore_type()` is [`SemaphoreType::Binary`], then this must be `0`.
///
/// The default value is `0`.
pub value: u64,

/// For a semaphore wait operation, specifies the pipeline stages in the second synchronization
/// scope: stages of queue operations following the wait operation that can start executing
/// after the semaphore is signalled.
Expand All @@ -862,6 +883,7 @@ impl SemaphoreSubmitInfo {
pub fn new(semaphore: Arc<Semaphore>) -> Self {
Self {
semaphore,
value: 0,
stages: PipelineStages::ALL_COMMANDS,
_ne: crate::NonExhaustive(()),
}
Expand All @@ -870,13 +892,28 @@ impl SemaphoreSubmitInfo {
pub(crate) fn validate(&self, device: &Device) -> Result<(), Box<ValidationError>> {
let &Self {
ref semaphore,
value,
stages,
_ne: _,
} = self;

// VUID?
assert_eq!(device, semaphore.device().as_ref());

match semaphore.semaphore_type() {
SemaphoreType::Binary => {
if value != 0 {
return Err(Box::new(ValidationError {
problem: "`semaphore.semaphore_type()` is `SemaphoreType::Binary`, but \
`value` is not `0`"
.into(),
..Default::default()
}));
}
}
SemaphoreType::Timeline => {}
}

stages.validate_device(device).map_err(|err| {
err.add_context("stages")
.set_vuids(&["VUID-VkSemaphoreSubmitInfo-stageMask-parameter"])
Expand Down
23 changes: 19 additions & 4 deletions vulkano/src/device/physical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use crate::{
},
sync::{
fence::{ExternalFenceInfo, ExternalFenceProperties},
semaphore::{ExternalSemaphoreInfo, ExternalSemaphoreProperties},
semaphore::{ExternalSemaphoreInfo, ExternalSemaphoreProperties, SemaphoreType},
Sharing,
},
DebugWrapper, ExtensionProperties, Requires, RequiresAllOf, RequiresOneOf, Validated,
Expand Down Expand Up @@ -1191,13 +1191,28 @@ impl PhysicalDevice {

let &ExternalSemaphoreInfo {
handle_type,
semaphore_type,
initial_value,
_ne: _,
} = info;

let external_semaphore_info = ash::vk::PhysicalDeviceExternalSemaphoreInfo {
let mut external_semaphore_info_vk = ash::vk::PhysicalDeviceExternalSemaphoreInfo {
handle_type: handle_type.into(),
..Default::default()
};
let mut semaphore_type_create_info_vk = None;

if semaphore_type != SemaphoreType::Binary {
let next =
semaphore_type_create_info_vk.insert(ash::vk::SemaphoreTypeCreateInfo {
semaphore_type: semaphore_type.into(),
initial_value,
..Default::default()
});

next.p_next = external_semaphore_info_vk.p_next;
external_semaphore_info_vk.p_next = next as *const _ as *const _;
}

/* Output */

Expand All @@ -1211,14 +1226,14 @@ impl PhysicalDevice {
if self.instance.api_version() >= Version::V1_1 {
(fns.v1_1.get_physical_device_external_semaphore_properties)(
self.handle,
&external_semaphore_info,
&external_semaphore_info_vk,
&mut external_semaphore_properties,
)
} else {
(fns.khr_external_semaphore_capabilities
.get_physical_device_external_semaphore_properties_khr)(
self.handle,
&external_semaphore_info,
&external_semaphore_info_vk,
&mut external_semaphore_properties,
);
}
Expand Down
Loading

0 comments on commit b54005b

Please # to comment.