Skip to content

Commit

Permalink
Integrate latest vk.xml changes (#2513)
Browse files Browse the repository at this point in the history
* update ash

* update autogen for vk.xml updates

* add fields

* fix new clippy warning

* define enum and bitfield

didn't look at the actual type before

* comment
  • Loading branch information
0xcaff authored Apr 8, 2024
1 parent fe74e0a commit 0918ac8
Show file tree
Hide file tree
Showing 5 changed files with 3,587 additions and 939 deletions.
10 changes: 9 additions & 1 deletion vulkano/autogen/properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ fn properties_output(members: &[PropertiesMember]) -> TokenStream {
properties_ffi.#ffi_member.map(|s|
unsafe {
std::slice::from_raw_parts(
s #ffi_member_field .#ffi_name as _,
s #ffi_member_field .#ffi_name .cast_const(),
s #ffi_member_field .#len_field_name as _,
)
}
Expand Down Expand Up @@ -622,6 +622,14 @@ fn vulkano_type(ty: &str, len: Option<LenKind<'_>>) -> TokenStream {
"VkShaderFloatControlsIndependence" => quote! { ShaderFloatControlsIndependence },
"VkShaderStageFlags" => quote! { ShaderStages },
"VkSubgroupFeatureFlags" => quote! { SubgroupFeatures },
"VkImageLayout" => quote! { ImageLayout },
"VkImageUsageFlags" => quote! { ImageUsage },
"VkBufferUsageFlags" => quote! { BufferUsage },
"VkChromaLocation" => quote! { ChromaLocation },
"VkLayeredDriverUnderlyingApiMSFT" => quote! { LayeredDriverUnderlyingApi },
"VkPhysicalDeviceSchedulingControlsFlagsARM" => {
quote! { PhysicalDeviceSchedulingControlsFlags }
}
_ => unimplemented!("{}", ty),
},
}
Expand Down
21 changes: 21 additions & 0 deletions vulkano/src/device/physical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3623,6 +3623,27 @@ impl From<ash::vk::ShaderCorePropertiesFlagsAMD> for ShaderCoreProperties {
}
}

vulkan_enum! {
#[non_exhaustive]

LayeredDriverUnderlyingApi = LayeredDriverUnderlyingApiMSFT(i32);

// TODO: document
None = NONE,

// TODO: document
D3D12 = D3D12,
}

vulkan_bitflags! {
#[non_exhaustive]

PhysicalDeviceSchedulingControlsFlags = PhysicalDeviceSchedulingControlsFlagsARM(u64);

// TODO: document
SHADER_CORE_COUNT = SHADER_CORE_COUNT,
}

vulkan_bitflags! {
#[non_exhaustive]

Expand Down
52 changes: 50 additions & 2 deletions vulkano/src/device/properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ use super::physical::{
ShaderFloatControlsIndependence, SubgroupFeatures,
};
use crate::{
device::{DeviceExtensions, QueueFlags},
image::{SampleCount, SampleCounts},
buffer::BufferUsage,
device::{
physical::{LayeredDriverUnderlyingApi, PhysicalDeviceSchedulingControlsFlags},
DeviceExtensions, QueueFlags,
},
image::{sampler::ycbcr::ChromaLocation, ImageLayout, ImageUsage, SampleCount, SampleCounts},
instance::InstanceExtensions,
memory::DeviceAlignment,
render_pass::ResolveModes,
Expand Down Expand Up @@ -259,6 +263,50 @@ impl FromVulkan<ash::vk::SubgroupFeatureFlags> for SubgroupFeatures {
}
}

impl FromVulkan<ash::vk::BufferUsageFlags> for BufferUsage {
#[inline]
fn from_vulkan(val: ash::vk::BufferUsageFlags) -> Option<Self> {
Some(val.into())
}
}

impl FromVulkan<ash::vk::ImageUsageFlags> for ImageUsage {
#[inline]
fn from_vulkan(val: ash::vk::ImageUsageFlags) -> Option<Self> {
Some(val.into())
}
}

impl FromVulkan<ash::vk::ChromaLocation> for ChromaLocation {
#[inline]
fn from_vulkan(val: ash::vk::ChromaLocation) -> Option<Self> {
val.try_into().ok()
}
}

impl FromVulkan<ash::vk::PhysicalDeviceSchedulingControlsFlagsARM>
for PhysicalDeviceSchedulingControlsFlags
{
#[inline]
fn from_vulkan(val: ash::vk::PhysicalDeviceSchedulingControlsFlagsARM) -> Option<Self> {
Some(val.into())
}
}

impl FromVulkan<ash::vk::LayeredDriverUnderlyingApiMSFT> for LayeredDriverUnderlyingApi {
#[inline]
fn from_vulkan(val: ash::vk::LayeredDriverUnderlyingApiMSFT) -> Option<Self> {
val.try_into().ok()
}
}

impl FromVulkan<ash::vk::ImageLayout> for ImageLayout {
#[inline]
fn from_vulkan(val: ash::vk::ImageLayout) -> Option<Self> {
val.try_into().ok()
}
}

impl<U: for<'a> FromVulkan<&'a T>, T> FromVulkan<&[T]> for Vec<U> {
#[inline]
fn from_vulkan(val: &[T]) -> Option<Vec<U>> {
Expand Down
1 change: 1 addition & 0 deletions vulkano/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ pub(crate) enum FormatCompatibilityInner {
Class_10bit_2plane_444,
Class_12bit_2plane_444,
Class_16bit_2plane_444,
Class_8bit_alpha,
}

/// Describes a uniform value that will be used to fill an image.
Expand Down
Loading

0 comments on commit 0918ac8

Please sign in to comment.