Skip to content

Commit

Permalink
Merge branch 'master' into martin/placed-memory-ext
Browse files Browse the repository at this point in the history
  • Loading branch information
marc0246 committed Jun 4, 2024
2 parents 48f2920 + 978c922 commit 6b19a66
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 41 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- [raw-window-handle](https://crates.io/raw-window-handle) 0.6
- [winit](https://crates.io/crates/winit) 0.29
- [regex](https://crates.io/crates/regex) has been replaced with [nom](https://crates.io/crates/nom) 7.1
- Rust version: 1.72.0

### Public dependency updates

Expand Down Expand Up @@ -130,6 +131,7 @@ Changes to vulkano-util:
- Support for the `ext_conservative_rasterization` extension.
- Support for the `extended_dynamic_state3_conservative_rasterization_mode` device feature.
- Support for the `extended_dynamic_state3_extra_primitive_overestimation_size` device feature.
- Added `ResourceMemory::from_device_memory_unchecked`.
- Vulkano-shaders: Support for Vulkan 1.3 target environment.
- Vulkano-shaders: Added `generate_structs: true` option that may be used to disable rust structs from generating. Useful in e.g. rust-gpu contexts where such functionality is not needed.
- Vulkano-util: `VulkanoWindowsRenderer::swapchain_image_views` allows access to the swapchain images.
Expand Down
10 changes: 9 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ members = [
]
resolver = "2"

[workspace.package]
edition = "2021"
rust-version = "1.72.0"
license = "MIT OR Apache-2.0"
homepage = "https://vulkano.rs"
keywords = ["vulkan", "bindings", "graphics", "gpu", "rendering"]
categories = ["rendering::graphics-api"]

[workspace.dependencies.vulkano]
version = "0.34"
path = "vulkano"
Expand Down Expand Up @@ -49,7 +57,7 @@ quote = "1.0"
raw-window-handle = "0.6"
serde = "1.0"
serde_json = "1.0"
shaderc = "0.8"
shaderc = "0.8.3"
slabbin = "1.0"
smallvec = "1.8"
syn = "2.0"
Expand Down
11 changes: 6 additions & 5 deletions vulkano-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
[package]
name = "vulkano-macros"
version = "0.34.0"
edition = "2021"
authors = ["The vulkano contributors"]
repository = "https://github.com/vulkano-rs/vulkano/tree/master/vulkano-macros"
description = "Macros used by vulkano"
license = "MIT OR Apache-2.0"
documentation = "https://docs.rs/vulkano-macros"
homepage = "https://vulkano.rs"
keywords = ["vulkan", "bindings", "graphics", "gpu", "rendering"]
categories = ["rendering::graphics-api"]
readme = "../README.md"
edition = { workspace = true }
rust-version = { workspace = true }
license = { workspace = true }
homepage = { workspace = true }
keywords = { workspace = true }
categories = { workspace = true }

[lib]
proc-macro = true
Expand Down
11 changes: 6 additions & 5 deletions vulkano-shaders/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
[package]
name = "vulkano-shaders"
version = "0.34.0"
edition = "2021"
authors = ["Pierre Krieger <pierre.krieger1708@gmail.com>", "The vulkano contributors"]
repository = "https://github.com/vulkano-rs/vulkano/tree/master/vulkano-shaders"
description = "Macro for generating Rust code from shaders"
license = "MIT OR Apache-2.0"
documentation = "https://docs.rs/vulkano-shaders"
homepage = "https://vulkano.rs"
keywords = ["vulkan", "bindings", "graphics", "gpu", "rendering"]
categories = ["rendering::graphics-api"]
readme = "../README.md"
edition = { workspace = true }
rust-version = { workspace = true }
license = { workspace = true }
homepage = { workspace = true }
keywords = { workspace = true }
categories = { workspace = true }

[lib]
proc-macro = true
Expand Down
11 changes: 6 additions & 5 deletions vulkano-util/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
[package]
name = "vulkano-util"
version = "0.34.0"
edition = "2021"
authors = ["The vulkano contributors"]
repository = "https://github.com/vulkano-rs/vulkano/tree/master/vulkano-util"
description = "Utility functionality to make usage of vulkano easier"
license = "MIT OR Apache-2.0"
documentation = "https://docs.rs/vulkano-util"
homepage = "https://vulkano.rs"
keywords = ["vulkan", "bindings", "graphics", "gpu", "rendering"]
categories = ["rendering::graphics-api"]
readme = "../README.md"
edition = { workspace = true }
rust-version = { workspace = true }
license = { workspace = true }
homepage = { workspace = true }
keywords = { workspace = true }
categories = { workspace = true }

[dependencies]
ahash = { workspace = true }
Expand Down
11 changes: 6 additions & 5 deletions vulkano/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
[package]
name = "vulkano"
version = "0.34.0"
edition = "2021"
authors = ["Pierre Krieger <pierre.krieger1708@gmail.com>", "The vulkano contributors"]
repository = "https://github.com/vulkano-rs/vulkano/tree/master/vulkano"
description = "Safe wrapper for the Vulkan graphics API"
license = "MIT OR Apache-2.0"
documentation = "https://docs.rs/vulkano"
homepage = "https://vulkano.rs"
keywords = ["vulkan", "bindings", "graphics", "gpu", "rendering"]
categories = ["rendering::graphics-api"]
readme = "../README.md"
build = "build.rs"
edition = { workspace = true }
rust-version = { workspace = true }
license = { workspace = true }
homepage = { workspace = true }
keywords = { workspace = true }
categories = { workspace = true }

[dependencies]
ahash = { workspace = true }
Expand Down
15 changes: 10 additions & 5 deletions vulkano/autogen/properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,19 @@ fn properties_output(members: &[PropertiesMember]) -> TokenStream {
let len_field_name = Ident::new(len_field_name.as_str(), Span::call_site());

quote! {
properties_ffi.#ffi_member.map(|s|
unsafe {
properties_ffi.#ffi_member.and_then(|s| {
let ptr = s #ffi_member_field .#ffi_name .cast_const();
if ptr.is_null() {
return None;
};

Some(unsafe {
std::slice::from_raw_parts(
s #ffi_member_field .#ffi_name .cast_const(),
ptr,
s #ffi_member_field .#len_field_name as _,
)
}
)
})
})
}
} else {
quote! { properties_ffi.#ffi_member.map(|s| s #ffi_member_field .#ffi_name) }
Expand Down
4 changes: 2 additions & 2 deletions vulkano/src/command_buffer/commands/acceleration_structure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::{
DeviceSize, Requires, RequiresAllOf, RequiresOneOf, ValidationError, VulkanObject,
};
use smallvec::SmallVec;
use std::{mem::size_of, ptr, sync::Arc};
use std::{mem::size_of, sync::Arc};

/// # Commands to do operations on acceleration structures.
impl RecordingCommandBuffer {
Expand Down Expand Up @@ -1568,7 +1568,7 @@ impl RawRecordingCommandBuffer {
.collect();
let build_range_info_pointers_vk: SmallVec<[_; 8]> = build_range_info_elements_vk
.iter()
.map(ptr::from_ref)
.map(|p| -> *const _ { p })
.collect();

let fns = self.device().fns();
Expand Down
5 changes: 4 additions & 1 deletion vulkano/src/device/physical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,10 @@ impl PhysicalDevice {
.collect()
};

*self.display_plane_properties.write() = properties_raw.clone();
self.display_plane_properties
.write()
.clone_from(&properties_raw);

Ok(properties_raw)
}

Expand Down
38 changes: 35 additions & 3 deletions vulkano/src/memory/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,43 @@ impl ResourceMemory {
unsafe { Self::new_dedicated_unchecked(Arc::new(device_memory)) }
}

#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
/// Same as [`new_dedicated`], except that this allows creating aliasing resources.
///
/// # Safety
///
/// - Two resources must not alias each other, and if they do, you must ensure correct
/// synchronization yourself.
pub unsafe fn new_dedicated_unchecked(device_memory: Arc<DeviceMemory>) -> Self {
let size = device_memory.allocation_size();

unsafe { Self::from_device_memory_unchecked(device_memory, 0, size) }
}

/// Creates a new `ResourceMemory` from the given portion of the given device memory block. You
/// may use this when you need to portion an existing memory block in a specific way. Note that
/// when you don't have this requirement of placing resources at specific offsets, you should
/// use a memory allocator instead.
///
/// # Safety
///
/// - Two resources must not alias each other (as returned by [`Buffer::memory_requirements`]
/// or [`Image::memory_requirements`]), and if they do, you must ensure correct
/// synchronization yourself.
///
/// # Panics
///
/// - Panics if `offset + size` is greater than `device_memory.allocation_size()`.
pub unsafe fn from_device_memory_unchecked(
device_memory: Arc<DeviceMemory>,
offset: DeviceSize,
size: DeviceSize,
) -> Self {
assert!(offset <= device_memory.allocation_size());
assert!(size <= device_memory.allocation_size() - offset);

ResourceMemory {
offset: 0,
size: device_memory.allocation_size(),
offset,
size,
allocation_type: AllocationType::Unknown,
allocation_handle: AllocationHandle::null(),
suballocation_handle: None,
Expand Down
18 changes: 9 additions & 9 deletions vulkano/src/pipeline/graphics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -855,39 +855,39 @@ impl GraphicsPipeline {
p_stages: stages_vk.as_ptr(),
p_vertex_input_state: vertex_input_state_vk
.as_ref()
.map(ptr::from_ref)
.map(|p| -> *const _ { p })
.unwrap_or(ptr::null()),
p_input_assembly_state: input_assembly_state_vk
.as_ref()
.map(ptr::from_ref)
.map(|p| -> *const _ { p })
.unwrap_or(ptr::null()),
p_tessellation_state: tessellation_state_vk
.as_ref()
.map(ptr::from_ref)
.map(|p| -> *const _ { p })
.unwrap_or(ptr::null()),
p_viewport_state: viewport_state_vk
.as_ref()
.map(ptr::from_ref)
.map(|p| -> *const _ { p })
.unwrap_or(ptr::null()),
p_rasterization_state: rasterization_state_vk
.as_ref()
.map(ptr::from_ref)
.map(|p| -> *const _ { p })
.unwrap_or(ptr::null()),
p_multisample_state: multisample_state_vk
.as_ref()
.map(ptr::from_ref)
.map(|p| -> *const _ { p })
.unwrap_or(ptr::null()),
p_depth_stencil_state: depth_stencil_state_vk
.as_ref()
.map(ptr::from_ref)
.map(|p| -> *const _ { p })
.unwrap_or(ptr::null()),
p_color_blend_state: color_blend_state_vk
.as_ref()
.map(ptr::from_ref)
.map(|p| -> *const _ { p })
.unwrap_or(ptr::null()),
p_dynamic_state: dynamic_state_vk
.as_ref()
.map(ptr::from_ref)
.map(|p| -> *const _ { p })
.unwrap_or(ptr::null()),
layout: layout.handle(),
render_pass: render_pass_vk,
Expand Down

0 comments on commit 6b19a66

Please sign in to comment.