Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/vulkano-rs/vulkano into d…
Browse files Browse the repository at this point in the history
…evice-address
  • Loading branch information
Rua committed Oct 7, 2023
2 parents e78f793 + fb828a6 commit d279950
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 75 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ Changes to the `khr_display` extension:
- Added `ShaderModule::single_entry_point()` which may replace `entry_point("main")` calls in common setups.
- Added `ShaderModule::single_entry_point_with_execution`.
- Added `GenericMemoryAllocatorCreateInfo::memory_type_bits` and `AllocationCreateInfo::memory_type_bits`.
- Vulkano-shaders: support for specialization-constant-sized arrays in structs (they are generated with the size specified as fallback in the specialization constant initializer).

### Bugs fixed

Expand Down
7 changes: 2 additions & 5 deletions vulkano-macros/src/derive_buffer_contents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ pub fn derive_buffer_contents(mut ast: DeriveInput) -> Result<TokenStream> {
if !ast
.attrs
.iter()
.filter_map(|attr| {
attr.path
.is_ident("repr")
.then(|| attr.parse_meta().unwrap())
})
.filter(|&attr| attr.path.is_ident("repr"))
.map(|attr| attr.parse_meta().unwrap())
.any(|meta| match meta {
Meta::List(MetaList { nested, .. }) => {
nested.iter().any(|nested_meta| match nested_meta {
Expand Down
2 changes: 1 addition & 1 deletion vulkano-shaders/src/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ impl TypeArray {

let length = length_id
.map(|id| match shader.spirv.id(id).instruction() {
Instruction::Constant { value, .. } => {
Instruction::Constant { value, .. } | Instruction::SpecConstant { value, .. } => {
assert!(matches!(value.len(), 1 | 2));
let len = value.iter().rev().fold(0u64, |a, &b| (a << 32) | b as u64);

Expand Down
4 changes: 2 additions & 2 deletions vulkano-util/src/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub struct VulkanoWindowRenderer {
impl VulkanoWindowRenderer {
/// Creates a new [`VulkanoWindowRenderer`] which is used to orchestrate your rendering with
/// Vulkano. Pass [`WindowDescriptor`] and optionally a function modifying the
/// [`SwapchainCreateInfo`](vulkano::swapchain::SwapchainCreateInfo) parameters.
/// [`SwapchainCreateInfo`] parameters.
pub fn new(
vulkano_context: &VulkanoContext,
window: winit::window::Window,
Expand Down Expand Up @@ -254,7 +254,7 @@ impl VulkanoWindowRenderer {
}

/// Begin your rendering by calling `acquire`.
/// Returns a [`GpuFuture`](vulkano::sync::GpuFuture) representing the time after which the
/// Returns a [`GpuFuture`] representing the time after which the
/// swapchain image has been acquired and previous frame ended.
/// Execute your command buffers after calling this function and finish rendering by calling
/// [`VulkanoWindowRenderer::present`].
Expand Down
149 changes: 94 additions & 55 deletions vulkano/autogen/extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,26 @@ fn device_extensions_output(members: &[ExtensionsMember]) -> TokenStream {
}| {
let name_string = name.to_string();

let dependency_check_items = requires_all_of.iter().filter_map(
|RequiresOneOf {
api_version,
device_extensions,
instance_extensions,
features: _,
}| {
(device_extensions.is_empty()
&& (api_version.is_some() || !instance_extensions.is_empty()))
.then(|| {
let dependency_check_items = requires_all_of
.iter()
.filter(
|&RequiresOneOf {
api_version,
device_extensions,
instance_extensions,
features: _,
}| {
device_extensions.is_empty()
&& (api_version.is_some() || !instance_extensions.is_empty())
},
)
.map(
|RequiresOneOf {
api_version,
device_extensions: _,
instance_extensions,
features: _,
}| {
let condition_items = (api_version.iter().map(|version| {
let version = format_ident!("V{}_{}", version.0, version.1);
quote! { api_version >= crate::Version::#version }
Expand Down Expand Up @@ -141,9 +151,8 @@ fn device_extensions_output(members: &[ExtensionsMember]) -> TokenStream {
}));
}
}
})
},
);
},
);
let problem = format!(
"contains `{}`, but this extension is not supported by the physical device",
name_string,
Expand All @@ -164,21 +173,38 @@ fn device_extensions_output(members: &[ExtensionsMember]) -> TokenStream {
},
);

let enable_dependencies_items = members.iter().filter_map(
|ExtensionsMember {
name,
requires_all_of,
..
}| {
(!requires_all_of.is_empty()).then(|| {
let requires_all_of_items = requires_all_of.iter().filter_map(
|RequiresOneOf {
api_version,
device_extensions,
instance_extensions: _,
features: _,
}| {
(!device_extensions.is_empty()).then(|| {
let enable_dependencies_items = members
.iter()
.filter(
|&ExtensionsMember {
name: _,
requires_all_of,
..
}| (!requires_all_of.is_empty()),
)
.map(
|ExtensionsMember {
name,
requires_all_of,
..
}| {
let requires_all_of_items = requires_all_of
.iter()
.filter(
|&RequiresOneOf {
api_version: _,
device_extensions,
instance_extensions: _,
features: _,
}| (!device_extensions.is_empty()),
)
.map(
|RequiresOneOf {
api_version,
device_extensions,
instance_extensions: _,
features: _,
}| {
let condition_items = api_version
.iter()
.map(|(major, minor)| {
Expand Down Expand Up @@ -226,18 +252,16 @@ fn device_extensions_output(members: &[ExtensionsMember]) -> TokenStream {
}
}
}
})
},
);
},
);

quote! {
if self.#name {
#(#requires_all_of_items)*
}
}
})
},
);
},
);

quote! {
#common
Expand Down Expand Up @@ -325,21 +349,38 @@ fn instance_extensions_output(members: &[ExtensionsMember]) -> TokenStream {
},
);

let enable_dependencies_items = members.iter().filter_map(
|ExtensionsMember {
name,
requires_all_of,
..
}| {
(!requires_all_of.is_empty()).then(|| {
let requires_all_of_items = requires_all_of.iter().filter_map(
|RequiresOneOf {
api_version,
device_extensions: _,
instance_extensions,
features: _,
}| {
(!instance_extensions.is_empty()).then(|| {
let enable_dependencies_items = members
.iter()
.filter(
|&ExtensionsMember {
name: _,
requires_all_of,
..
}| (!requires_all_of.is_empty()),
)
.map(
|ExtensionsMember {
name,
requires_all_of,
..
}| {
let requires_all_of_items = requires_all_of
.iter()
.filter(
|&RequiresOneOf {
api_version: _,
device_extensions: _,
instance_extensions,
features: _,
}| (!instance_extensions.is_empty()),
)
.map(
|RequiresOneOf {
api_version,
device_extensions: _,
instance_extensions,
features: _,
}| {
let condition_items = api_version
.iter()
.map(|(major, minor)| {
Expand Down Expand Up @@ -387,18 +428,16 @@ fn instance_extensions_output(members: &[ExtensionsMember]) -> TokenStream {
}
}
}
})
},
);
},
);

quote! {
if self.#name {
#(#requires_all_of_items)*
}
}
})
},
);
},
);

quote! {
#common
Expand Down
25 changes: 15 additions & 10 deletions vulkano/autogen/formats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,18 +170,23 @@ fn formats_output(members: &[FormatMember]) -> TokenStream {
Some(quote! { Self::#name => &[#(Self::#planes),*], })
}
});
let texels_per_block_items = members.iter().filter_map(
|FormatMember {
name,
texels_per_block,
..
}| {
(*texels_per_block != 1).then(|| {
let texels_per_block_items = members
.iter()
.filter(
|&FormatMember {
texels_per_block, ..
}| (*texels_per_block != 1),
)
.map(
|FormatMember {
name,
texels_per_block,
..
}| {
let texels_per_block = Literal::u8_unsuffixed(*texels_per_block);
quote! { Self::#name => #texels_per_block, }
})
},
);
},
);
let numeric_format_color_items = members.iter().filter_map(
|FormatMember {
name,
Expand Down
2 changes: 1 addition & 1 deletion vulkano/src/library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ impl VulkanLibrary {
/// Returns the list of layers that are available when creating an instance.
///
/// On success, this function returns an iterator that produces
/// [`LayerProperties`](crate::instance::LayerProperties) objects. In order to enable a layer,
/// [`LayerProperties`] objects. In order to enable a layer,
/// you need to pass its name (returned by `LayerProperties::name()`) when creating the
/// [`Instance`](crate::instance::Instance).
///
Expand Down
2 changes: 1 addition & 1 deletion vulkano/src/memory/alignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ impl Hash for DeviceAlignment {
impl PartialOrd for DeviceAlignment {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
self.as_nonzero().partial_cmp(&other.as_nonzero())
Some(self.cmp(other))
}
}

Expand Down

0 comments on commit d279950

Please sign in to comment.