mirror of
https://github.com/italicsjenga/portability.git
synced 2024-11-22 23:11:30 +11:00
Add basic support for VK_KHR_portability_subset
This commit is contained in:
parent
bb40160a6a
commit
7034f366b3
|
@ -250,10 +250,11 @@ pub unsafe extern "C" fn gfxGetPhysicalDeviceFeatures2KHR(
|
|||
data.features = conv::features_from_hal(features);
|
||||
data.pNext
|
||||
}
|
||||
VkStructureType::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PORTABILITY_SUBSET_FEATURES_EXTX => {
|
||||
let data = (ptr as *mut VkPhysicalDevicePortabilitySubsetFeaturesEXTX)
|
||||
VkStructureType::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PORTABILITY_SUBSET_FEATURES_KHR => {
|
||||
let data = (ptr as *mut VkPhysicalDevicePortabilitySubsetFeaturesKHR)
|
||||
.as_mut()
|
||||
.unwrap();
|
||||
data.events = VK_TRUE;
|
||||
if features.contains(hal::Features::TRIANGLE_FAN) {
|
||||
data.triangleFans = VK_TRUE;
|
||||
}
|
||||
|
@ -263,9 +264,13 @@ pub unsafe extern "C" fn gfxGetPhysicalDeviceFeatures2KHR(
|
|||
if features.contains(hal::Features::SAMPLER_MIP_LOD_BIAS) {
|
||||
data.samplerMipLodBias = VK_TRUE;
|
||||
}
|
||||
//TODO: turn this into a feature flag
|
||||
if !cfg!(feature = "gfx-backend-metal") {
|
||||
data.standardImageViews = VK_TRUE;
|
||||
//TODO: turn these into a feature flags
|
||||
if cfg!(feature = "gfx-backend-metal") {
|
||||
data.constantAlphaColorBlendFactors = VK_TRUE;
|
||||
data.imageViewFormatReinterpretation = VK_TRUE;
|
||||
}
|
||||
if cfg!(feature = "gfx-backend-dx12") {
|
||||
data.vertexAttributeAccessBeyondStride = VK_TRUE;
|
||||
}
|
||||
data.pNext
|
||||
}
|
||||
|
@ -353,21 +358,6 @@ pub unsafe extern "C" fn gfxGetPhysicalDeviceImageFormatProperties2KHR(
|
|||
properties = get_physical_device_image_format_properties(adapter, data);
|
||||
data.pNext
|
||||
}
|
||||
VkStructureType::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_SUPPORT_EXTX => {
|
||||
let data = (ptr as *const VkPhysicalDeviceImageViewSupportEXTX)
|
||||
.as_ref()
|
||||
.unwrap();
|
||||
#[cfg(feature = "gfx-backend-metal")]
|
||||
{
|
||||
if !adapter.physical_device.supports_swizzle(
|
||||
conv::map_format(data.format).unwrap(),
|
||||
conv::map_swizzle(data.components),
|
||||
) {
|
||||
return VkResult::VK_ERROR_FORMAT_NOT_SUPPORTED;
|
||||
}
|
||||
}
|
||||
data.pNext
|
||||
}
|
||||
other => {
|
||||
warn!("Unrecognized {:?}, skipping", other);
|
||||
(ptr as *const VkBaseStruct).as_ref().unwrap().pNext
|
||||
|
@ -438,9 +428,9 @@ pub unsafe extern "C" fn gfxGetPhysicalDeviceProperties2KHR(
|
|||
gfxGetPhysicalDeviceProperties(adapter, &mut data.properties);
|
||||
data.pNext
|
||||
}
|
||||
VkStructureType::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PORTABILITY_SUBSET_PROPERTIES_EXTX => {
|
||||
VkStructureType::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PORTABILITY_SUBSET_PROPERTIES_KHR => {
|
||||
let data =
|
||||
(ptr as *mut VkPhysicalDevicePortabilitySubsetPropertiesEXTX).as_mut().unwrap()
|
||||
(ptr as *mut VkPhysicalDevicePortabilitySubsetPropertiesKHR).as_mut().unwrap()
|
||||
;
|
||||
let limits = adapter.physical_device.limits();
|
||||
data.minVertexInputBindingStrideAlignment = limits.min_vertex_input_binding_stride_alignment as u32;
|
||||
|
@ -988,7 +978,7 @@ lazy_static! {
|
|||
vec![
|
||||
VK_KHR_SWAPCHAIN_EXTENSION_NAME,
|
||||
VK_KHR_MAINTENANCE1_EXTENSION_NAME,
|
||||
VK_EXTX_PORTABILITY_SUBSET_EXTENSION_NAME,
|
||||
VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME,
|
||||
]
|
||||
};
|
||||
|
||||
|
@ -1003,8 +993,8 @@ lazy_static! {
|
|||
specVersion: VK_KHR_MAINTENANCE1_SPEC_VERSION,
|
||||
},
|
||||
VkExtensionProperties {
|
||||
extensionName: [0; 256], // VK_EXTX_PORTABILITY_SUBSET_EXTENSION_NAME
|
||||
specVersion: VK_EXTX_PORTABILITY_SUBSET_SPEC_VERSION,
|
||||
extensionName: [0; 256], // VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME
|
||||
specVersion: VK_KHR_PORTABILITY_SUBSET_SPEC_VERSION,
|
||||
},
|
||||
];
|
||||
|
||||
|
|
|
@ -523,10 +523,10 @@ pub const VK_EXT_discard_rectangles: ::std::os::raw::c_uint = 1;
|
|||
pub const VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION: ::std::os::raw::c_uint = 1;
|
||||
pub const VK_EXT_DISCARD_RECTANGLES_EXTENSION_NAME: &'static [u8; 26usize] =
|
||||
b"VK_EXT_discard_rectangles\x00";
|
||||
pub const VK_EXTX_portability_subset: ::std::os::raw::c_uint = 1;
|
||||
pub const VK_EXTX_PORTABILITY_SUBSET_SPEC_VERSION: ::std::os::raw::c_uint = 1;
|
||||
pub const VK_EXTX_PORTABILITY_SUBSET_EXTENSION_NAME: &'static [u8; 27usize] =
|
||||
b"VK_EXTX_portability_subset\x00";
|
||||
pub const VK_KHR_portability_subset: ::std::os::raw::c_uint = 1;
|
||||
pub const VK_KHR_PORTABILITY_SUBSET_SPEC_VERSION: ::std::os::raw::c_uint = 1;
|
||||
pub const VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME: &'static [u8; 26usize] =
|
||||
b"VK_KHR_portability_subset\x00";
|
||||
|
||||
pub type wchar_t = ::std::os::raw::c_int;
|
||||
#[repr(C)]
|
||||
|
@ -832,8 +832,8 @@ pub enum VkStructureType {
|
|||
VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK = 1000122000,
|
||||
VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = 1000123000,
|
||||
VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT = 1000248000,
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PORTABILITY_SUBSET_FEATURES_EXTX = 1000163000,
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PORTABILITY_SUBSET_PROPERTIES_EXTX = 1000163001,
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PORTABILITY_SUBSET_FEATURES_KHR = 1000164000,
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PORTABILITY_SUBSET_PROPERTIES_KHR = 1000164001,
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_SUPPORT_EXTX = 100163002,
|
||||
VK_STRUCTURE_TYPE_MAX_ENUM = 2147483647,
|
||||
}
|
||||
|
@ -7536,28 +7536,38 @@ pub type PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR = ::std::option::Opt
|
|||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct VkPhysicalDevicePortabilitySubsetFeaturesEXTX {
|
||||
pub struct VkPhysicalDevicePortabilitySubsetFeaturesKHR {
|
||||
pub sType: VkStructureType,
|
||||
pub pNext: *const ::std::os::raw::c_void,
|
||||
pub triangleFans: VkBool32,
|
||||
pub separateStencilMaskRef: VkBool32,
|
||||
pub constantAlphaColorBlendFactors: VkBool32,
|
||||
pub events: VkBool32,
|
||||
pub standardImageViews: VkBool32,
|
||||
pub imageViewFormatReinterpretation: VkBool32,
|
||||
pub imageViewFormatSwizzle: VkBool32,
|
||||
pub imageView2DOn3DImage: VkBool32,
|
||||
pub multisampleArrayImage: VkBool32,
|
||||
pub mutableComparisonSamplers: VkBool32,
|
||||
pub pointPolygons: VkBool32,
|
||||
pub samplerMipLodBias: VkBool32,
|
||||
pub separateStencilMaskRef: VkBool32,
|
||||
pub shaderSampleRateInterpolationFunctions: VkBool32,
|
||||
pub tessellationIsolines: VkBool32,
|
||||
pub tessellationPointMode: VkBool32,
|
||||
pub triangleFans: VkBool32,
|
||||
pub vertexAttributeAccessBeyondStride: VkBool32,
|
||||
}
|
||||
impl Clone for VkPhysicalDevicePortabilitySubsetFeaturesEXTX {
|
||||
impl Clone for VkPhysicalDevicePortabilitySubsetFeaturesKHR {
|
||||
fn clone(&self) -> Self {
|
||||
*self
|
||||
}
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct VkPhysicalDevicePortabilitySubsetPropertiesEXTX {
|
||||
pub struct VkPhysicalDevicePortabilitySubsetPropertiesKHR {
|
||||
pub sType: VkStructureType,
|
||||
pub pNext: *const ::std::os::raw::c_void,
|
||||
pub minVertexInputBindingStrideAlignment: u32,
|
||||
}
|
||||
impl Clone for VkPhysicalDevicePortabilitySubsetPropertiesEXTX {
|
||||
impl Clone for VkPhysicalDevicePortabilitySubsetPropertiesKHR {
|
||||
fn clone(&self) -> Self {
|
||||
*self
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue