Vulkan 1.3 support, updated dependencies (#1836)

This commit is contained in:
Rua 2022-02-25 23:58:09 +01:00 committed by GitHub
parent 704796b0f3
commit db51e15e5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 2260 additions and 1153 deletions

View File

@ -19,7 +19,7 @@ fnv = "1.0"
heck = "0.4"
proc-macro2 = "1.0"
quote = "1.0"
shaderc = "0.7"
shaderc = "0.7.4"
syn = { version = "1.0", features = ["full", "extra-traits"] }
vulkano = { version = "0.28.0", path = "../vulkano" }

View File

@ -589,6 +589,7 @@ impl Parse for MacroInput {
"1.3" => SpirvVersion::V1_3,
"1.4" => SpirvVersion::V1_4,
"1.5" => SpirvVersion::V1_5,
"1.6" => SpirvVersion::V1_6,
_ => panic!("Unknown SPIR-V version: {}", version.value()),
});
}

View File

@ -16,15 +16,15 @@ build = "build.rs"
[dependencies]
# When updating Ash, also update vk.xml to the same Vulkan patch version that Ash uses.
# All versions of vk.xml can be found at https://github.com/KhronosGroup/Vulkan-Headers/commits/main/registry/vk.xml.
ash = "0.35.0"
ash = "0.36"
crossbeam-queue = "0.3"
fnv = "1.0"
half = "1.8"
lazy_static = "1.4"
nalgebra = { version = "0.30.0", optional = true }
parking_lot = { version = "0.11", features = ["send_guard"] }
parking_lot = { version = "0.12", features = ["send_guard"] }
shared_library = "0.1"
smallvec = "1.7"
smallvec = "1.8"
[build-dependencies]
heck = "0.4"

View File

@ -70,7 +70,10 @@ enum ExtensionStatus {
fn write_device_extensions(vk_data: &VkRegistryData) {
write_file(
"device_extensions.rs",
format!("vk.xml header version {}", vk_data.header_version),
format!(
"vk.xml header version {}.{}.{}",
vk_data.header_version.0, vk_data.header_version.1, vk_data.header_version.2
),
device_extensions_output(&extensions_members("device", &vk_data.extensions)),
);
}
@ -78,7 +81,10 @@ fn write_device_extensions(vk_data: &VkRegistryData) {
fn write_instance_extensions(vk_data: &VkRegistryData) {
write_file(
"instance_extensions.rs",
format!("vk.xml header version {}", vk_data.header_version),
format!(
"vk.xml header version {}.{}.{}",
vk_data.header_version.0, vk_data.header_version.1, vk_data.header_version.2
),
instance_extensions_output(&extensions_members("instance", &vk_data.extensions)),
);
}
@ -574,7 +580,7 @@ fn extensions_members(ty: &str, extensions: &IndexMap<&str, &Extension>) -> Vec<
fn make_doc(ext: &mut ExtensionsMember) {
let writer = &mut ext.doc;
write!(writer, "- [Vulkan documentation](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/{}.html)", ext.raw).unwrap();
write!(writer, "- [Vulkan documentation](https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/{}.html)", ext.raw).unwrap();
if ext.required_if_supported {
write!(

View File

@ -68,7 +68,10 @@ pub fn write(vk_data: &VkRegistryData) {
features_ffi_output(&features_ffi_members(&vk_data.types, &vk_data.extensions));
write_file(
"features.rs",
format!("vk.xml header version {}", vk_data.header_version),
format!(
"vk.xml header version {}.{}.{}",
vk_data.header_version.0, vk_data.header_version.1, vk_data.header_version.2
),
quote! {
#features_output
#features_ffi_output
@ -444,7 +447,7 @@ fn features_members(types: &HashMap<&str, (&Type, Vec<&str>)>) -> Vec<FeaturesMe
fn make_doc(feat: &mut FeaturesMember, vulkan_ty_name: &str) {
let writer = &mut feat.doc;
write!(writer, "- [Vulkan documentation](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/{}.html#features-{})", vulkan_ty_name, feat.name).unwrap();
write!(writer, "- [Vulkan documentation](https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/{}.html#features-{})", vulkan_ty_name, feat.name).unwrap();
if !feat.requires_features.is_empty() {
let links: Vec<_> = feat

View File

@ -32,7 +32,10 @@ pub fn write(vk_data: &VkRegistryData) {
);
write_file(
"fns.rs",
format!("vk.xml header version {}", vk_data.header_version),
format!(
"vk.xml header version {}.{}.{}",
vk_data.header_version.0, vk_data.header_version.1, vk_data.header_version.2
),
quote! {
#entry_fns_output
#instance_fns_output
@ -49,7 +52,7 @@ struct FnsMember {
fn fns_output(extension_members: &[FnsMember], fns_level: &str, doc: &str) -> TokenStream {
let struct_name = format_ident!("{}Functions", fns_level);
let members = ["1_0", "1_1", "1_2"]
let members = ["1_0", "1_1", "1_2", "1_3"]
.into_iter()
.map(|version| FnsMember {
name: format_ident!("v{}", version),

View File

@ -17,7 +17,10 @@ use vk_parse::{Format, FormatChild};
pub fn write(vk_data: &VkRegistryData) {
write_file(
"formats.rs",
format!("vk.xml header version {}", vk_data.header_version),
format!(
"vk.xml header version {}.{}.{}",
vk_data.header_version.0, vk_data.header_version.1, vk_data.header_version.2
),
formats_output(&formats_members(&vk_data.formats)),
);
}
@ -452,11 +455,11 @@ fn formats_output(members: &[FormatMember]) -> TokenStream {
}
}
lazy_static! {
static ref BLOCK_EXTENT_REGEX: Regex = Regex::new(r"^(\d+),(\d+),(\d+)$").unwrap();
}
fn formats_members(formats: &[&Format]) -> Vec<FormatMember> {
lazy_static! {
static ref BLOCK_EXTENT_REGEX: Regex = Regex::new(r"^(\d+),(\d+),(\d+)$").unwrap();
}
formats
.iter()
.map(|format| {

View File

@ -22,7 +22,7 @@ use std::{
};
use vk_parse::{
Extension, ExtensionChild, Feature, Format, InterfaceItem, Registry, RegistryChild,
SpirvExtOrCap, Type, TypeCodeMarkup, TypeSpec, TypesChild,
SpirvExtOrCap, Type, TypeSpec, TypesChild,
};
mod extensions;
@ -33,6 +33,7 @@ mod properties;
mod spirv_grammar;
mod spirv_parse;
mod spirv_reqs;
mod version;
pub fn autogen() {
let registry = get_vk_registry("vk.xml");
@ -46,6 +47,7 @@ pub fn autogen() {
properties::write(&vk_data);
spirv_parse::write(&spirv_grammar);
spirv_reqs::write(&vk_data, &spirv_grammar);
version::write(&vk_data);
}
fn write_file(file: impl AsRef<Path>, source: impl AsRef<str>, content: impl Display) {
@ -82,7 +84,7 @@ fn get_vk_registry<P: AsRef<Path> + ?Sized>(path: &P) -> Registry {
}
pub struct VkRegistryData<'r> {
pub header_version: u16,
pub header_version: (u16, u16, u16),
pub extensions: IndexMap<&'r str, &'r Extension>,
pub features: IndexMap<&'r str, &'r Feature>,
pub formats: Vec<&'r Format>,
@ -113,24 +115,38 @@ impl<'r> VkRegistryData<'r> {
}
}
fn get_header_version(registry: &Registry) -> u16 {
registry.0.iter()
.find_map(|child| -> Option<u16> {
if let RegistryChild::Types(types) = child {
return types.children.iter().find_map(|ty| -> Option<u16> {
if let TypesChild::Type(ty) = ty {
if let TypeSpec::Code(code) = &ty.spec {
if code.markup.iter().any(|mkup| matches!(mkup, TypeCodeMarkup::Name(name) if name == "VK_HEADER_VERSION")) {
return Some(code.code.rsplit_once(' ').unwrap().1.parse().unwrap());
}
fn get_header_version(registry: &Registry) -> (u16, u16, u16) {
lazy_static! {
static ref VK_HEADER_VERSION: Regex =
Regex::new(r"#define\s+VK_HEADER_VERSION\s+(\d+)\s*$").unwrap();
static ref VK_HEADER_VERSION_COMPLETE: Regex =
Regex::new(r"#define\s+VK_HEADER_VERSION_COMPLETE\s+VK_MAKE_API_VERSION\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*VK_HEADER_VERSION\s*\)").unwrap();
}
let mut major = None;
let mut minor = None;
let mut patch = None;
for child in registry.0.iter() {
if let RegistryChild::Types(types) = child {
for ty in types.children.iter() {
if let TypesChild::Type(ty) = ty {
if let TypeSpec::Code(code) = &ty.spec {
if let Some(captures) = VK_HEADER_VERSION.captures(&code.code) {
patch = Some(captures.get(1).unwrap().as_str().parse().unwrap());
} else if let Some(captures) =
VK_HEADER_VERSION_COMPLETE.captures(&code.code)
{
major = Some(captures.get(2).unwrap().as_str().parse().unwrap());
minor = Some(captures.get(3).unwrap().as_str().parse().unwrap());
}
}
None
});
}
}
None
})
.unwrap()
}
}
(major.unwrap(), minor.unwrap(), patch.unwrap())
}
fn get_aliases(registry: &Registry) -> HashMap<&str, &str> {
@ -350,11 +366,11 @@ pub fn get_spirv_grammar<P: AsRef<Path> + ?Sized>(path: &P) -> SpirvGrammar {
grammar
}
lazy_static! {
static ref VENDOR_SUFFIXES: Regex = Regex::new(r"(?:AMD|GOOGLE|INTEL|NV)$").unwrap();
}
fn suffix_key(name: &str) -> u32 {
lazy_static! {
static ref VENDOR_SUFFIXES: Regex = Regex::new(r"(?:AMD|GOOGLE|INTEL|NV)$").unwrap();
}
if VENDOR_SUFFIXES.is_match(name) {
3
} else if name.ends_with("EXT") {

View File

@ -25,7 +25,10 @@ pub fn write(vk_data: &VkRegistryData) {
properties_ffi_output(&properties_ffi_members(&vk_data.types, &vk_data.extensions));
write_file(
"properties.rs",
format!("vk.xml header version {}", vk_data.header_version),
format!(
"vk.xml header version {}.{}.{}",
vk_data.header_version.0, vk_data.header_version.1, vk_data.header_version.2
),
quote! {
#properties_output
#properties_ffi_output
@ -215,7 +218,7 @@ fn properties_members(types: &HashMap<&str, (&Type, Vec<&str>)>) -> Vec<Properti
fn make_doc(prop: &mut PropertiesMember, vulkan_ty_name: &str) {
let writer = &mut prop.doc;
write!(writer, "- [Vulkan documentation](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/{}.html#limits-{})", vulkan_ty_name, prop.name).unwrap();
write!(writer, "- [Vulkan documentation](https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/{}.html#limits-{})", vulkan_ty_name, prop.name).unwrap();
}
#[derive(Clone, Debug)]

View File

@ -35,7 +35,10 @@ pub fn write(vk_data: &VkRegistryData, grammar: &SpirvGrammar) {
spirv_reqs_output(&spirv_extensions_members(&vk_data.spirv_extensions), true);
write_file(
"spirv_reqs.rs",
format!("vk.xml header version {}", vk_data.header_version),
format!(
"vk.xml header version {}.{}.{}",
vk_data.header_version.0, vk_data.header_version.1, vk_data.header_version.2
),
quote! {
#spirv_capabilities_output
#spirv_extensions_output
@ -202,19 +205,22 @@ fn spirv_extensions_members(extensions: &[&SpirvExtOrCap]) -> Vec<SpirvReqsMembe
.collect()
}
lazy_static! {
static ref BIT: Regex = Regex::new(r"_BIT(?:_NV)?$").unwrap();
}
fn make_enable(enable: &vk_parse::Enable) -> Option<(Enable, String)> {
lazy_static! {
static ref VK_API_VERSION: Regex =
Regex::new(r"^VK_(?:API_)?VERSION_(\d+)_(\d+)$").unwrap();
static ref BIT: Regex = Regex::new(r"_BIT(?:_NV)?$").unwrap();
}
if matches!(enable, vk_parse::Enable::Version(version) if version == "VK_VERSION_1_0") {
return None;
}
Some(match enable {
vk_parse::Enable::Version(version) => {
let version = version.strip_prefix("VK_VERSION_").unwrap();
let (major, minor) = version.split_once('_').unwrap();
let captures = VK_API_VERSION.captures(version).unwrap();
let major = captures.get(1).unwrap().as_str();
let minor = captures.get(1).unwrap().as_str();
(
Enable::Core((major.parse().unwrap(), minor.parse().unwrap())),

View File

@ -0,0 +1,52 @@
// Copyright (c) 2022 The Vulkano developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>,
// at your option. All files in the project carrying such
// notice may not be copied, modified, or distributed except
// according to those terms.
use super::{write_file, VkRegistryData};
use proc_macro2::{Literal, TokenStream};
use quote::quote;
pub fn write(vk_data: &VkRegistryData) {
let version_output = version_output(vk_data.header_version);
write_file(
"version.rs",
format!(
"vk.xml header version {}.{}.{}",
vk_data.header_version.0, vk_data.header_version.1, vk_data.header_version.2
),
quote! {
#version_output
},
);
}
fn version_output((major, minor, patch): (u16, u16, u16)) -> TokenStream {
let major = Literal::u16_unsuffixed(major);
let minor = Literal::u16_unsuffixed(minor);
let patch = Literal::u16_unsuffixed(patch);
quote! {
impl Version {
/// The highest Vulkan API version currently supported by Vulkano.
///
/// It is allowed for applications that use Vulkano to make use of features from higher
/// versions than this. However, Vulkano itself will not make use of those features and
/// will not expose their APIs, so they must be accessed by other means.
///
/// The `max_api_version` of an [`Instance`](crate::instance::Instance) equals
/// `HEADER_VERSION` by default, which locks out features from newer versions. In order
/// to enable the use of higher versions, the `max_api_version` must be overridden when
/// creating an instance.
pub const HEADER_VERSION: Version = Version {
major: #major,
minor: #minor,
patch: #patch,
};
}
}
}

View File

@ -26,8 +26,8 @@
],
"magic_number" : "0x07230203",
"major_version" : 1,
"minor_version" : 5,
"revision" : 4,
"minor_version" : 6,
"revision" : 1,
"instruction_printing_class" : [
{
"tag" : "@exclude"
@ -1735,7 +1735,8 @@
{ "kind" : "IdRef", "name" : "'x'" },
{ "kind" : "IdRef", "name" : "'y'" }
],
"capabilities" : [ "Kernel" ]
"capabilities" : [ "Kernel" ],
"lastVersion" : "1.5"
},
{
"opname" : "OpOrdered",
@ -4109,7 +4110,7 @@
"SPV_KHR_terminate_invocation"
],
"capabilities" : [ "Shader" ],
"version" : "None"
"version" : "1.6"
},
{
"opname" : "OpSubgroupBallotKHR",
@ -4260,6 +4261,20 @@
"extensions" : [ "SPV_KHR_ray_tracing" ],
"version" : "None"
},
{
"opname" : "OpSDot",
"class" : "Arithmetic",
"opcode" : 4450,
"operands" : [
{ "kind" : "IdResultType" },
{ "kind" : "IdResult" },
{ "kind" : "IdRef", "name" : "'Vector 1'" },
{ "kind" : "IdRef", "name" : "'Vector 2'" },
{ "kind" : "PackedVectorFormat", "name" : "'Packed Vector Format'", "quantifier" : "?" }
],
"capabilities" : [ "DotProduct" ],
"version" : "1.6"
},
{
"opname" : "OpSDotKHR",
"class" : "Arithmetic",
@ -4272,7 +4287,22 @@
{ "kind" : "PackedVectorFormat", "name" : "'Packed Vector Format'", "quantifier" : "?" }
],
"capabilities" : [ "DotProductKHR" ],
"version" : "None"
"extensions" : [ "SPV_KHR_integer_dot_product" ],
"version" : "1.6"
},
{
"opname" : "OpUDot",
"class" : "Arithmetic",
"opcode" : 4451,
"operands" : [
{ "kind" : "IdResultType" },
{ "kind" : "IdResult" },
{ "kind" : "IdRef", "name" : "'Vector 1'" },
{ "kind" : "IdRef", "name" : "'Vector 2'" },
{ "kind" : "PackedVectorFormat", "name" : "'Packed Vector Format'", "quantifier" : "?" }
],
"capabilities" : [ "DotProduct" ],
"version" : "1.6"
},
{
"opname" : "OpUDotKHR",
@ -4286,7 +4316,22 @@
{ "kind" : "PackedVectorFormat", "name" : "'Packed Vector Format'", "quantifier" : "?" }
],
"capabilities" : [ "DotProductKHR" ],
"version" : "None"
"extensions" : [ "SPV_KHR_integer_dot_product" ],
"version" : "1.6"
},
{
"opname" : "OpSUDot",
"class" : "Arithmetic",
"opcode" : 4452,
"operands" : [
{ "kind" : "IdResultType" },
{ "kind" : "IdResult" },
{ "kind" : "IdRef", "name" : "'Vector 1'" },
{ "kind" : "IdRef", "name" : "'Vector 2'" },
{ "kind" : "PackedVectorFormat", "name" : "'Packed Vector Format'", "quantifier" : "?" }
],
"capabilities" : [ "DotProduct" ],
"version" : "1.6"
},
{
"opname" : "OpSUDotKHR",
@ -4300,7 +4345,23 @@
{ "kind" : "PackedVectorFormat", "name" : "'Packed Vector Format'", "quantifier" : "?" }
],
"capabilities" : [ "DotProductKHR" ],
"version" : "None"
"extensions" : [ "SPV_KHR_integer_dot_product" ],
"version" : "1.6"
},
{
"opname" : "OpSDotAccSat",
"class" : "Arithmetic",
"opcode" : 4453,
"operands" : [
{ "kind" : "IdResultType" },
{ "kind" : "IdResult" },
{ "kind" : "IdRef", "name" : "'Vector 1'" },
{ "kind" : "IdRef", "name" : "'Vector 2'" },
{ "kind" : "IdRef", "name" : "'Accumulator'" },
{ "kind" : "PackedVectorFormat", "name" : "'Packed Vector Format'", "quantifier" : "?" }
],
"capabilities" : [ "DotProduct" ],
"version" : "1.6"
},
{
"opname" : "OpSDotAccSatKHR",
@ -4315,7 +4376,23 @@
{ "kind" : "PackedVectorFormat", "name" : "'Packed Vector Format'", "quantifier" : "?" }
],
"capabilities" : [ "DotProductKHR" ],
"version" : "None"
"extensions" : [ "SPV_KHR_integer_dot_product" ],
"version" : "1.6"
},
{
"opname" : "OpUDotAccSat",
"class" : "Arithmetic",
"opcode" : 4454,
"operands" : [
{ "kind" : "IdResultType" },
{ "kind" : "IdResult" },
{ "kind" : "IdRef", "name" : "'Vector 1'" },
{ "kind" : "IdRef", "name" : "'Vector 2'" },
{ "kind" : "IdRef", "name" : "'Accumulator'" },
{ "kind" : "PackedVectorFormat", "name" : "'Packed Vector Format'", "quantifier" : "?" }
],
"capabilities" : [ "DotProduct" ],
"version" : "1.6"
},
{
"opname" : "OpUDotAccSatKHR",
@ -4330,7 +4407,23 @@
{ "kind" : "PackedVectorFormat", "name" : "'Packed Vector Format'", "quantifier" : "?" }
],
"capabilities" : [ "DotProductKHR" ],
"version" : "None"
"extensions" : [ "SPV_KHR_integer_dot_product" ],
"version" : "1.6"
},
{
"opname" : "OpSUDotAccSat",
"class" : "Arithmetic",
"opcode" : 4455,
"operands" : [
{ "kind" : "IdResultType" },
{ "kind" : "IdResult" },
{ "kind" : "IdRef", "name" : "'Vector 1'" },
{ "kind" : "IdRef", "name" : "'Vector 2'" },
{ "kind" : "IdRef", "name" : "'Accumulator'" },
{ "kind" : "PackedVectorFormat", "name" : "'Packed Vector Format'", "quantifier" : "?" }
],
"capabilities" : [ "DotProduct" ],
"version" : "1.6"
},
{
"opname" : "OpSUDotAccSatKHR",
@ -4345,7 +4438,8 @@
{ "kind" : "PackedVectorFormat", "name" : "'Packed Vector Format'", "quantifier" : "?" }
],
"capabilities" : [ "DotProductKHR" ],
"version" : "None"
"extensions" : [ "SPV_KHR_integer_dot_product" ],
"version" : "1.6"
},
{
"opname" : "OpTypeRayQueryKHR",
@ -4925,12 +5019,18 @@
"version" : "None"
},
{
"opname" : "OpDemoteToHelperInvocationEXT",
"class" : "Reserved",
"opname" : "OpDemoteToHelperInvocation",
"class" : "Control-Flow",
"opcode" : 5380,
"capabilities" : [ "DemoteToHelperInvocationEXT" ],
"extensions" : [ "SPV_EXT_demote_to_helper_invocation" ],
"version" : "None"
"capabilities" : [ "DemoteToHelperInvocation" ],
"version" : "1.6"
},
{
"opname" : "OpDemoteToHelperInvocationEXT",
"class" : "Control-Flow",
"opcode" : 5380,
"capabilities" : [ "DemoteToHelperInvocation" ],
"version" : "1.6"
},
{
"opname" : "OpIsHelperInvocationEXT",
@ -5338,7 +5438,7 @@
"version" : "None"
},
{
"opname" : "OpConstFunctionPointerINTEL",
"opname" : "OpConstantFunctionPointerINTEL",
"class" : "@exclude",
"opcode" : 5600,
"operands" : [
@ -8558,6 +8658,11 @@
"value" : "0x2000",
"version" : "1.4"
},
{
"enumerant" : "Nontemporal",
"value" : "0x4000",
"version" : "1.6"
},
{
"enumerant" : "Offsets",
"value" : "0x10000",
@ -10877,12 +10982,12 @@
{
"enumerant" : "Uniform",
"value" : 26,
"capabilities" : [ "Shader" ]
"capabilities" : [ "Shader", "UniformDecoration" ]
},
{
"enumerant" : "UniformId",
"value" : 27,
"capabilities" : [ "Shader" ],
"capabilities" : [ "Shader", "UniformDecoration" ],
"parameters" : [
{ "kind" : "IdScope", "name" : "'Execution'" }
],
@ -11114,11 +11219,18 @@
"extensions" : [ "SPV_NV_mesh_shader" ],
"version" : "None"
},
{
"enumerant" : "PerVertexKHR",
"value" : 5285,
"capabilities" : [ "FragmentBarycentricNV", "FragmentBarycentricKHR" ],
"extensions" : [ "SPV_NV_fragment_shader_barycentric", "SPV_KHR_fragment_shader_barycentric" ],
"version" : "None"
},
{
"enumerant" : "PerVertexNV",
"value" : 5285,
"capabilities" : [ "FragmentBarycentricNV" ],
"extensions" : [ "SPV_NV_fragment_shader_barycentric" ],
"capabilities" : [ "FragmentBarycentricNV", "FragmentBarycentricKHR" ],
"extensions" : [ "SPV_NV_fragment_shader_barycentric", "SPV_KHR_fragment_shader_barycentric" ],
"version" : "None"
},
{
@ -11506,6 +11618,12 @@
"value" : 6087,
"capabilities" : [ "VectorComputeINTEL" ],
"version" : "None"
},
{
"enumerant" : "MediaBlockIOINTEL",
"value" : 6140,
"capabilities" : [ "VectorComputeINTEL" ],
"version" : "None"
}
]
},
@ -11973,18 +12091,32 @@
"extensions" : [ "SPV_NV_mesh_shader" ],
"version" : "None"
},
{
"enumerant" : "BaryCoordKHR",
"value" : 5286,
"capabilities" : [ "FragmentBarycentricNV", "FragmentBarycentricKHR" ],
"extensions" : [ "SPV_NV_fragment_shader_barycentric", "SPV_KHR_fragment_shader_barycentric" ],
"version" : "None"
},
{
"enumerant" : "BaryCoordNV",
"value" : 5286,
"capabilities" : [ "FragmentBarycentricNV" ],
"extensions" : [ "SPV_NV_fragment_shader_barycentric" ],
"capabilities" : [ "FragmentBarycentricNV", "FragmentBarycentricKHR" ],
"extensions" : [ "SPV_NV_fragment_shader_barycentric", "SPV_KHR_fragment_shader_barycentric" ],
"version" : "None"
},
{
"enumerant" : "BaryCoordNoPerspKHR",
"value" : 5287,
"capabilities" : [ "FragmentBarycentricNV", "FragmentBarycentricKHR" ],
"extensions" : [ "SPV_NV_fragment_shader_barycentric", "SPV_KHR_fragment_shader_barycentric" ],
"version" : "None"
},
{
"enumerant" : "BaryCoordNoPerspNV",
"value" : 5287,
"capabilities" : [ "FragmentBarycentricNV" ],
"extensions" : [ "SPV_NV_fragment_shader_barycentric" ],
"capabilities" : [ "FragmentBarycentricNV", "FragmentBarycentricKHR" ],
"extensions" : [ "SPV_NV_fragment_shader_barycentric", "SPV_KHR_fragment_shader_barycentric" ],
"version" : "None"
},
{
@ -12709,6 +12841,11 @@
"value" : 70,
"version" : "1.5"
},
{
"enumerant" : "UniformDecoration",
"value" : 71,
"version" : "1.6"
},
{
"enumerant" : "FragmentShadingRateKHR",
"value" : 4422,
@ -13034,10 +13171,16 @@
"extensions" : [ "SPV_NV_shader_image_footprint" ],
"version" : "None"
},
{
"enumerant" : "FragmentBarycentricKHR",
"value" : 5284,
"extensions" : [ "SPV_NV_fragment_shader_barycentric", "SPV_KHR_fragment_shader_barycentric" ],
"version" : "None"
},
{
"enumerant" : "FragmentBarycentricNV",
"value" : 5284,
"extensions" : [ "SPV_NV_fragment_shader_barycentric" ],
"extensions" : [ "SPV_NV_fragment_shader_barycentric", "SPV_KHR_fragment_shader_barycentric" ],
"version" : "None"
},
{
@ -13320,12 +13463,18 @@
"extensions" : [ "SPV_EXT_fragment_shader_interlock" ],
"version" : "None"
},
{
"enumerant" : "DemoteToHelperInvocation",
"value" : 5379,
"capabilities" : [ "Shader" ],
"version" : "1.6"
},
{
"enumerant" : "DemoteToHelperInvocationEXT",
"value" : 5379,
"capabilities" : [ "Shader" ],
"extensions" : [ "SPV_EXT_demote_to_helper_invocation" ],
"version" : "None"
"version" : "1.6"
},
{
"enumerant" : "BindlessTextureNV",
@ -13564,30 +13713,51 @@
"extensions" : [ "SPV_INTEL_fpga_reg" ],
"version" : "None"
},
{
"enumerant" : "DotProductInputAll",
"value" : 6016,
"version" : "1.6"
},
{
"enumerant" : "DotProductInputAllKHR",
"value" : 6016,
"extensions" : [ "SPV_KHR_integer_dot_product" ],
"version" : "None"
"version" : "1.6"
},
{
"enumerant" : "DotProductInput4x8Bit",
"value" : 6017,
"capabilities" : [ "Int8" ],
"version" : "1.6"
},
{
"enumerant" : "DotProductInput4x8BitKHR",
"value" : 6017,
"capabilities" : [ "Int8" ],
"extensions" : [ "SPV_KHR_integer_dot_product" ],
"version" : "None"
"version" : "1.6"
},
{
"enumerant" : "DotProductInput4x8BitPacked",
"value" : 6018,
"version" : "1.6"
},
{
"enumerant" : "DotProductInput4x8BitPackedKHR",
"value" : 6018,
"extensions" : [ "SPV_KHR_integer_dot_product" ],
"version" : "None"
"version" : "1.6"
},
{
"enumerant" : "DotProduct",
"value" : 6019,
"version" : "1.6"
},
{
"enumerant" : "DotProductKHR",
"value" : 6019,
"extensions" : [ "SPV_KHR_integer_dot_product" ],
"version" : "None"
"version" : "1.6"
},
{
"enumerant" : "BitInstructions",
@ -13598,14 +13768,12 @@
{
"enumerant" : "AtomicFloat32AddEXT",
"value" : 6033,
"capabilities" : [ "Shader" ],
"extensions" : [ "SPV_EXT_shader_atomic_float_add" ],
"version" : "None"
},
{
"enumerant" : "AtomicFloat64AddEXT",
"value" : 6034,
"capabilities" : [ "Shader" ],
"extensions" : [ "SPV_EXT_shader_atomic_float_add" ],
"version" : "None"
},
@ -13624,7 +13792,6 @@
{
"enumerant" : "AtomicFloat16AddEXT",
"value" : 6095,
"capabilities" : [ "Shader" ],
"extensions" : [ "SPV_EXT_shader_atomic_float16_add" ],
"version" : "None"
},
@ -13700,11 +13867,16 @@
"category" : "ValueEnum",
"kind" : "PackedVectorFormat",
"enumerants" : [
{
"enumerant" : "PackedVectorFormat4x8Bit",
"value" : 0,
"version" : "1.6"
},
{
"enumerant" : "PackedVectorFormat4x8BitKHR",
"value" : 0,
"extensions" : [ "SPV_KHR_integer_dot_product" ],
"version" : "None"
"version" : "1.6"
}
]
},

View File

@ -43,7 +43,6 @@
//! ```
use crate::buffer::{BufferAccess, BufferAccessObject, BufferInner};
use crate::check_errors;
use crate::device::physical::FormatFeatures;
use crate::device::Device;
use crate::device::DeviceOwned;
@ -52,6 +51,7 @@ use crate::DeviceSize;
use crate::Error;
use crate::OomError;
use crate::VulkanObject;
use crate::{check_errors, Version};
use std::error;
use std::fmt;
use std::hash::{Hash, Hasher};
@ -134,7 +134,8 @@ where
return Err(BufferViewCreationError::MaxTexelBufferElementsExceeded);
}
if device.enabled_features().texel_buffer_alignment {
if device.api_version() >= Version::V1_3 || device.enabled_features().texel_buffer_alignment
{
let element_size = if block_size % 3 == 0 {
block_size / 3
} else {

View File

@ -86,6 +86,7 @@ use crate::sync::PipelineMemoryAccess;
use crate::sync::PipelineStage;
use crate::sync::PipelineStages;
use crate::DeviceSize;
use crate::Version;
use crate::VulkanObject;
use crate::{OomError, SafeDeref};
use fnv::FnvHashMap;
@ -2025,8 +2026,9 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
/// # Panics
///
/// - Panics if the queue family of the command buffer does not support graphics operations.
/// - Panics if the [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state)
/// feature is not enabled on the device.
/// - Panics if the device API version is less than 1.3 and the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature is
/// not enabled on the device.
/// - Panics if the currently bound graphics pipeline already contains this state internally.
#[inline]
pub fn set_cull_mode(&mut self, cull_mode: CullMode) -> &mut Self {
@ -2035,7 +2037,8 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
"the queue family of the command buffer must support graphics operations"
);
assert!(
self.device().enabled_features().extended_dynamic_state,
self.device().api_version() >= Version::V1_3
|| self.device().enabled_features().extended_dynamic_state,
"the extended_dynamic_state feature must be enabled on the device"
);
assert!(
@ -2091,8 +2094,9 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
/// # Panics
///
/// - Panics if the queue family of the command buffer does not support graphics operations.
/// - Panics if the [`extended_dynamic_state2`](crate::device::Features::extended_dynamic_state2)
/// feature is not enabled on the device.
/// - Panics if the device API version is less than 1.3 and the
/// [`extended_dynamic_state2`](crate::device::Features::extended_dynamic_state2) feature is
/// not enabled on the device.
/// - Panics if the currently bound graphics pipeline already contains this state internally.
#[inline]
pub fn set_depth_bias_enable(&mut self, enable: bool) -> &mut Self {
@ -2101,7 +2105,8 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
"the queue family of the command buffer must support graphics operations"
);
assert!(
self.device().enabled_features().extended_dynamic_state2,
self.device().api_version() >= Version::V1_3
|| self.device().enabled_features().extended_dynamic_state2,
"the extended_dynamic_state2 feature must be enabled on the device"
);
assert!(
@ -2158,8 +2163,9 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
/// # Panics
///
/// - Panics if the queue family of the command buffer does not support graphics operations.
/// - Panics if the [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state)
/// feature is not enabled on the device.
/// - Panics if the device API version is less than 1.3 and the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature is
/// not enabled on the device.
/// - Panics if the currently bound graphics pipeline already contains this state internally.
#[inline]
pub fn set_depth_bounds_test_enable(&mut self, enable: bool) -> &mut Self {
@ -2168,7 +2174,8 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
"the queue family of the command buffer must support graphics operations"
);
assert!(
self.device().enabled_features().extended_dynamic_state,
self.device().api_version() >= Version::V1_3
|| self.device().enabled_features().extended_dynamic_state,
"the extended_dynamic_state feature must be enabled on the device"
);
assert!(
@ -2188,8 +2195,9 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
/// # Panics
///
/// - Panics if the queue family of the command buffer does not support graphics operations.
/// - Panics if the [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state)
/// feature is not enabled on the device.
/// - Panics if the device API version is less than 1.3 and the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature is
/// not enabled on the device.
/// - Panics if the currently bound graphics pipeline already contains this state internally.
#[inline]
pub fn set_depth_compare_op(&mut self, compare_op: CompareOp) -> &mut Self {
@ -2198,7 +2206,8 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
"the queue family of the command buffer must support graphics operations"
);
assert!(
self.device().enabled_features().extended_dynamic_state,
self.device().api_version() >= Version::V1_3
|| self.device().enabled_features().extended_dynamic_state,
"the extended_dynamic_state feature must be enabled on the device"
);
assert!(
@ -2218,8 +2227,9 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
/// # Panics
///
/// - Panics if the queue family of the command buffer does not support graphics operations.
/// - Panics if the [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state)
/// feature is not enabled on the device.
/// - Panics if the device API version is less than 1.3 and the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature is
/// not enabled on the device.
/// - Panics if the currently bound graphics pipeline already contains this state internally.
#[inline]
pub fn set_depth_test_enable(&mut self, enable: bool) -> &mut Self {
@ -2228,7 +2238,8 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
"the queue family of the command buffer must support graphics operations"
);
assert!(
self.device().enabled_features().extended_dynamic_state,
self.device().api_version() >= Version::V1_3
|| self.device().enabled_features().extended_dynamic_state,
"the extended_dynamic_state feature must be enabled on the device"
);
assert!(
@ -2248,8 +2259,9 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
/// # Panics
///
/// - Panics if the queue family of the command buffer does not support graphics operations.
/// - Panics if the [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state)
/// feature is not enabled on the device.
/// - Panics if the device API version is less than 1.3 and the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature is
/// not enabled on the device.
/// - Panics if the currently bound graphics pipeline already contains this state internally.
#[inline]
pub fn set_depth_write_enable(&mut self, enable: bool) -> &mut Self {
@ -2258,7 +2270,8 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
"the queue family of the command buffer must support graphics operations"
);
assert!(
self.device().enabled_features().extended_dynamic_state,
self.device().api_version() >= Version::V1_3
|| self.device().enabled_features().extended_dynamic_state,
"the extended_dynamic_state feature must be enabled on the device"
);
assert!(
@ -2327,8 +2340,9 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
/// # Panics
///
/// - Panics if the queue family of the command buffer does not support graphics operations.
/// - Panics if the [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state)
/// feature is not enabled on the device.
/// - Panics if the device API version is less than 1.3 and the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature is
/// not enabled on the device.
/// - Panics if the currently bound graphics pipeline already contains this state internally.
#[inline]
pub fn set_front_face(&mut self, face: FrontFace) -> &mut Self {
@ -2337,7 +2351,8 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
"the queue family of the command buffer must support graphics operations"
);
assert!(
self.device().enabled_features().extended_dynamic_state,
self.device().api_version() >= Version::V1_3
|| self.device().enabled_features().extended_dynamic_state,
"the extended_dynamic_state feature must be enabled on the device"
);
assert!(
@ -2501,8 +2516,9 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
/// # Panics
///
/// - Panics if the queue family of the command buffer does not support graphics operations.
/// - Panics if the [`extended_dynamic_state2`](crate::device::Features::extended_dynamic_state2)
/// feature is not enabled on the device.
/// - Panics if the device API version is less than 1.3 and the
/// [`extended_dynamic_state2`](crate::device::Features::extended_dynamic_state2) feature is
/// not enabled on the device.
/// - Panics if the currently bound graphics pipeline already contains this state internally.
#[inline]
pub fn set_primitive_restart_enable(&mut self, enable: bool) -> &mut Self {
@ -2511,7 +2527,8 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
"the queue family of the command buffer must support graphics operations"
);
assert!(
self.device().enabled_features().extended_dynamic_state2,
self.device().api_version() >= Version::V1_3
|| self.device().enabled_features().extended_dynamic_state2,
"the extended_dynamic_state2 feature must be enabled on the device"
);
assert!(
@ -2531,9 +2548,9 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
/// # Panics
///
/// - Panics if the queue family of the command buffer does not support graphics operations.
/// - Panics if the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state)
/// feature is not enabled on the device.
/// - Panics if the device API version is less than 1.3 and the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature is
/// not enabled on the device.
/// - Panics if the currently bound graphics pipeline already contains this state internally.
/// - If the [`geometry_shader`](crate::device::Features::geometry_shader) feature is not
/// enabled, panics if `topology` is a `WithAdjacency` topology.
@ -2546,7 +2563,8 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
"the queue family of the command buffer must support graphics operations"
);
assert!(
self.device().enabled_features().extended_dynamic_state,
self.device().api_version() >= Version::V1_3
|| self.device().enabled_features().extended_dynamic_state,
"the extended_dynamic_state feature must be enabled on the device"
);
assert!(
@ -2580,8 +2598,9 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
/// # Panics
///
/// - Panics if the queue family of the command buffer does not support graphics operations.
/// - Panics if the [`extended_dynamic_state2`](crate::device::Features::extended_dynamic_state2)
/// feature is not enabled on the device.
/// - Panics if the device API version is less than 1.3 and the
/// [`extended_dynamic_state2`](crate::device::Features::extended_dynamic_state2) feature is
/// not enabled on the device.
/// - Panics if the currently bound graphics pipeline already contains this state internally.
#[inline]
pub fn set_rasterizer_discard_enable(&mut self, enable: bool) -> &mut Self {
@ -2590,7 +2609,8 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
"the queue family of the command buffer must support graphics operations"
);
assert!(
self.device().enabled_features().extended_dynamic_state2,
self.device().api_version() >= Version::V1_3
|| self.device().enabled_features().extended_dynamic_state2,
"the extended_dynamic_state2 feature must be enabled on the device"
);
assert!(
@ -2664,9 +2684,9 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
/// # Panics
///
/// - Panics if the queue family of the command buffer does not support graphics operations.
/// - Panics if the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state)
/// feature is not enabled on the device.
/// - Panics if the device API version is less than 1.3 and the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature is
/// not enabled on the device.
/// - Panics if the currently bound graphics pipeline already contains this state internally.
/// - Panics if the highest scissor slot being set is greater than the
/// [`max_viewports`](crate::device::Properties::max_viewports) device property.
@ -2682,7 +2702,8 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
"the queue family of the command buffer must support graphics operations"
);
assert!(
self.device().enabled_features().extended_dynamic_state,
self.device().api_version() >= Version::V1_3
|| self.device().enabled_features().extended_dynamic_state,
"the extended_dynamic_state feature must be enabled on the device"
);
assert!(
@ -2747,9 +2768,9 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
/// # Panics
///
/// - Panics if the queue family of the command buffer does not support graphics operations.
/// - Panics if the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state)
/// feature is not enabled on the device.
/// - Panics if the device API version is less than 1.3 and the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature is
/// not enabled on the device.
/// - Panics if the currently bound graphics pipeline already contains this state internally.
#[inline]
pub fn set_stencil_op(
@ -2765,7 +2786,8 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
"the queue family of the command buffer must support graphics operations"
);
assert!(
self.device().enabled_features().extended_dynamic_state,
self.device().api_version() >= Version::V1_3
|| self.device().enabled_features().extended_dynamic_state,
"the extended_dynamic_state feature must be enabled on the device"
);
assert!(
@ -2809,8 +2831,9 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
/// # Panics
///
/// - Panics if the queue family of the command buffer does not support graphics operations.
/// - Panics if the [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state)
/// feature is not enabled on the device.
/// - Panics if the device API version is less than 1.3 and the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature is
/// not enabled on the device.
/// - Panics if the currently bound graphics pipeline already contains this state internally.
#[inline]
pub fn set_stencil_test_enable(&mut self, enable: bool) -> &mut Self {
@ -2819,7 +2842,8 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
"the queue family of the command buffer must support graphics operations"
);
assert!(
self.device().enabled_features().extended_dynamic_state,
self.device().api_version() >= Version::V1_3
|| self.device().enabled_features().extended_dynamic_state,
"the extended_dynamic_state feature must be enabled on the device"
);
assert!(
@ -2915,9 +2939,9 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
/// # Panics
///
/// - Panics if the queue family of the command buffer does not support graphics operations.
/// - Panics if the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state)
/// feature is not enabled on the device.
/// - Panics if the device API version is less than 1.3 and the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature is
/// not enabled on the device.
/// - Panics if the currently bound graphics pipeline already contains this state internally.
/// - Panics if the highest viewport slot being set is greater than the
/// [`max_viewports`](crate::device::Properties::max_viewports) device property.
@ -2933,7 +2957,8 @@ impl<L, P> AutoCommandBufferBuilder<L, P> {
"the queue family of the command buffer must support graphics operations"
);
assert!(
self.device().enabled_features().extended_dynamic_state,
self.device().api_version() >= Version::V1_3
|| self.device().enabled_features().extended_dynamic_state,
"the extended_dynamic_state feature must be enabled on the device"
);
assert!(

View File

@ -58,6 +58,7 @@ use crate::sync::PipelineStage;
use crate::sync::PipelineStages;
use crate::DeviceSize;
use crate::OomError;
use crate::Version;
use crate::VulkanObject;
use ash::vk::Handle;
use smallvec::SmallVec;
@ -1504,16 +1505,21 @@ impl UnsafeCommandBufferBuilder {
/// Calls `vkCmdSetCullModeEXT` on the builder.
#[inline]
pub unsafe fn set_cull_mode(&mut self, cull_mode: CullMode) {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state
);
debug_assert!(self.device().enabled_features().extended_dynamic_state);
let fns = self.device().fns();
let cmd = self.internal_object();
fns.ext_extended_dynamic_state
.cmd_set_cull_mode_ext(cmd, cull_mode.into());
if self.device().api_version() >= Version::V1_3 {
fns.v1_3.cmd_set_cull_mode(cmd, cull_mode.into());
} else {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state
);
debug_assert!(self.device().enabled_features().extended_dynamic_state);
fns.ext_extended_dynamic_state
.cmd_set_cull_mode_ext(cmd, cull_mode.into());
}
}
/// Calls `vkCmdSetDepthBias` on the builder.
@ -1529,16 +1535,21 @@ impl UnsafeCommandBufferBuilder {
/// Calls `vkCmdSetDepthBiasEnableEXT` on the builder.
#[inline]
pub unsafe fn set_depth_bias_enable(&mut self, enable: bool) {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state2
);
debug_assert!(self.device().enabled_features().extended_dynamic_state2);
let fns = self.device().fns();
let cmd = self.internal_object();
fns.ext_extended_dynamic_state2
.cmd_set_depth_bias_enable_ext(cmd, enable.into());
if self.device().api_version() >= Version::V1_3 {
fns.v1_3.cmd_set_depth_bias_enable(cmd, enable.into());
} else {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state2
);
debug_assert!(self.device().enabled_features().extended_dynamic_state2);
fns.ext_extended_dynamic_state2
.cmd_set_depth_bias_enable_ext(cmd, enable.into());
}
}
/// Calls `vkCmdSetDepthBounds` on the builder.
@ -1554,61 +1565,82 @@ impl UnsafeCommandBufferBuilder {
/// Calls `vkCmdSetDepthBoundsTestEnableEXT` on the builder.
#[inline]
pub unsafe fn set_depth_bounds_test_enable(&mut self, enable: bool) {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state
);
debug_assert!(self.device().enabled_features().extended_dynamic_state);
let fns = self.device().fns();
let cmd = self.internal_object();
fns.ext_extended_dynamic_state
.cmd_set_depth_bounds_test_enable_ext(cmd, enable.into());
if self.device().api_version() >= Version::V1_3 {
fns.v1_3
.cmd_set_depth_bounds_test_enable(cmd, enable.into());
} else {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state
);
debug_assert!(self.device().enabled_features().extended_dynamic_state);
fns.ext_extended_dynamic_state
.cmd_set_depth_bounds_test_enable_ext(cmd, enable.into());
}
}
/// Calls `vkCmdSetDepthCompareOpEXT` on the builder.
#[inline]
pub unsafe fn set_depth_compare_op(&mut self, compare_op: CompareOp) {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state
);
debug_assert!(self.device().enabled_features().extended_dynamic_state);
let fns = self.device().fns();
let cmd = self.internal_object();
fns.ext_extended_dynamic_state
.cmd_set_depth_compare_op_ext(cmd, compare_op.into());
if self.device().api_version() >= Version::V1_3 {
fns.v1_3.cmd_set_depth_compare_op(cmd, compare_op.into());
} else {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state
);
debug_assert!(self.device().enabled_features().extended_dynamic_state);
fns.ext_extended_dynamic_state
.cmd_set_depth_compare_op_ext(cmd, compare_op.into());
}
}
/// Calls `vkCmdSetDepthTestEnableEXT` on the builder.
#[inline]
pub unsafe fn set_depth_test_enable(&mut self, enable: bool) {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state
);
debug_assert!(self.device().enabled_features().extended_dynamic_state);
let fns = self.device().fns();
let cmd = self.internal_object();
fns.ext_extended_dynamic_state
.cmd_set_depth_test_enable_ext(cmd, enable.into());
if self.device().api_version() >= Version::V1_3 {
fns.v1_3.cmd_set_depth_test_enable(cmd, enable.into());
} else {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state
);
debug_assert!(self.device().enabled_features().extended_dynamic_state);
fns.ext_extended_dynamic_state
.cmd_set_depth_test_enable_ext(cmd, enable.into());
}
}
/// Calls `vkCmdSetDepthWriteEnableEXT` on the builder.
#[inline]
pub unsafe fn set_depth_write_enable(&mut self, enable: bool) {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state
);
debug_assert!(self.device().enabled_features().extended_dynamic_state);
let fns = self.device().fns();
let cmd = self.internal_object();
fns.ext_extended_dynamic_state
.cmd_set_depth_write_enable_ext(cmd, enable.into());
if self.device().api_version() >= Version::V1_3 {
fns.v1_3.cmd_set_depth_write_enable(cmd, enable.into());
} else {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state
);
debug_assert!(self.device().enabled_features().extended_dynamic_state);
fns.ext_extended_dynamic_state
.cmd_set_depth_write_enable_ext(cmd, enable.into());
}
}
/// Calls `vkCmdSetDiscardRectangleEXT` on the builder.
@ -1663,16 +1695,21 @@ impl UnsafeCommandBufferBuilder {
/// Calls `vkCmdSetFrontFaceEXT` on the builder.
#[inline]
pub unsafe fn set_front_face(&mut self, face: FrontFace) {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state
);
debug_assert!(self.device().enabled_features().extended_dynamic_state);
let fns = self.device().fns();
let cmd = self.internal_object();
fns.ext_extended_dynamic_state
.cmd_set_front_face_ext(cmd, face.into());
if self.device().api_version() >= Version::V1_3 {
fns.v1_3.cmd_set_front_face(cmd, face.into());
} else {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state
);
debug_assert!(self.device().enabled_features().extended_dynamic_state);
fns.ext_extended_dynamic_state
.cmd_set_front_face_ext(cmd, face.into());
}
}
/// Calls `vkCmdSetLineStippleEXT` on the builder.
@ -1710,6 +1747,7 @@ impl UnsafeCommandBufferBuilder {
);
let fns = self.device().fns();
let cmd = self.internal_object();
fns.ext_extended_dynamic_state2
.cmd_set_logic_op_ext(cmd, logic_op.into());
}
@ -1745,46 +1783,63 @@ impl UnsafeCommandBufferBuilder {
/// Calls `vkCmdSetPrimitiveRestartEnableEXT` on the builder.
#[inline]
pub unsafe fn set_primitive_restart_enable(&mut self, enable: bool) {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state2
);
debug_assert!(self.device().enabled_features().extended_dynamic_state2);
let fns = self.device().fns();
let cmd = self.internal_object();
fns.ext_extended_dynamic_state2
.cmd_set_primitive_restart_enable_ext(cmd, enable.into());
if self.device().api_version() >= Version::V1_3 {
fns.v1_3
.cmd_set_primitive_restart_enable(cmd, enable.into());
} else {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state2
);
debug_assert!(self.device().enabled_features().extended_dynamic_state2);
fns.ext_extended_dynamic_state2
.cmd_set_primitive_restart_enable_ext(cmd, enable.into());
}
}
/// Calls `vkCmdSetPrimitiveTopologyEXT` on the builder.
#[inline]
pub unsafe fn set_primitive_topology(&mut self, topology: PrimitiveTopology) {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state
);
debug_assert!(self.device().enabled_features().extended_dynamic_state);
let fns = self.device().fns();
let cmd = self.internal_object();
fns.ext_extended_dynamic_state
.cmd_set_primitive_topology_ext(cmd, topology.into());
if self.device().api_version() >= Version::V1_3 {
fns.v1_3.cmd_set_primitive_topology(cmd, topology.into());
} else {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state
);
debug_assert!(self.device().enabled_features().extended_dynamic_state);
fns.ext_extended_dynamic_state
.cmd_set_primitive_topology_ext(cmd, topology.into());
}
}
/// Calls `vkCmdSetRasterizerDiscardEnableEXT` on the builder.
#[inline]
pub unsafe fn set_rasterizer_discard_enable(&mut self, enable: bool) {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state2
);
debug_assert!(self.device().enabled_features().extended_dynamic_state2);
let fns = self.device().fns();
let cmd = self.internal_object();
fns.ext_extended_dynamic_state2
.cmd_set_rasterizer_discard_enable_ext(cmd, enable.into());
if self.device().api_version() >= Version::V1_3 {
fns.v1_3
.cmd_set_rasterizer_discard_enable(cmd, enable.into());
} else {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state2
);
debug_assert!(self.device().enabled_features().extended_dynamic_state2);
fns.ext_extended_dynamic_state2
.cmd_set_rasterizer_discard_enable_ext(cmd, enable.into());
}
}
/// Calls `vkCmdSetStencilCompareMask` on the builder.
@ -1806,22 +1861,34 @@ impl UnsafeCommandBufferBuilder {
depth_fail_op: StencilOp,
compare_op: CompareOp,
) {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state
);
debug_assert!(self.device().enabled_features().extended_dynamic_state);
let fns = self.device().fns();
let cmd = self.internal_object();
fns.ext_extended_dynamic_state.cmd_set_stencil_op_ext(
cmd,
face_mask.into(),
fail_op.into(),
pass_op.into(),
depth_fail_op.into(),
compare_op.into(),
);
if self.device().api_version() >= Version::V1_3 {
fns.v1_3.cmd_set_stencil_op(
cmd,
face_mask.into(),
fail_op.into(),
pass_op.into(),
depth_fail_op.into(),
compare_op.into(),
);
} else {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state
);
debug_assert!(self.device().enabled_features().extended_dynamic_state);
fns.ext_extended_dynamic_state.cmd_set_stencil_op_ext(
cmd,
face_mask.into(),
fail_op.into(),
pass_op.into(),
depth_fail_op.into(),
compare_op.into(),
);
}
}
/// Calls `vkCmdSetStencilReference` on the builder.
@ -1836,16 +1903,21 @@ impl UnsafeCommandBufferBuilder {
/// Calls `vkCmdSetStencilTestEnableEXT` on the builder.
#[inline]
pub unsafe fn set_stencil_test_enable(&mut self, enable: bool) {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state
);
debug_assert!(self.device().enabled_features().extended_dynamic_state);
let fns = self.device().fns();
let cmd = self.internal_object();
fns.ext_extended_dynamic_state
.cmd_set_stencil_test_enable_ext(cmd, enable.into());
if self.device().api_version() >= Version::V1_3 {
fns.v1_3.cmd_set_stencil_test_enable(cmd, enable.into());
} else {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state
);
debug_assert!(self.device().enabled_features().extended_dynamic_state);
fns.ext_extended_dynamic_state
.cmd_set_stencil_test_enable_ext(cmd, enable.into());
}
}
/// Calls `vkCmdSetStencilWriteMask` on the builder.
@ -1903,13 +1975,6 @@ impl UnsafeCommandBufferBuilder {
where
I: IntoIterator<Item = Scissor>,
{
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state
);
debug_assert!(self.device().enabled_features().extended_dynamic_state);
let scissors = scissors
.into_iter()
.map(|v| ash::vk::Rect2D::from(v.clone()))
@ -1932,8 +1997,20 @@ impl UnsafeCommandBufferBuilder {
let fns = self.device().fns();
let cmd = self.internal_object();
fns.ext_extended_dynamic_state
.cmd_set_scissor_with_count_ext(cmd, scissors.len() as u32, scissors.as_ptr());
if self.device().api_version() >= Version::V1_3 {
fns.v1_3
.cmd_set_scissor_with_count(cmd, scissors.len() as u32, scissors.as_ptr());
} else {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state
);
debug_assert!(self.device().enabled_features().extended_dynamic_state);
fns.ext_extended_dynamic_state
.cmd_set_scissor_with_count_ext(cmd, scissors.len() as u32, scissors.as_ptr());
}
}
/// Calls `vkCmdSetViewport` on the builder.
@ -1979,13 +2056,6 @@ impl UnsafeCommandBufferBuilder {
where
I: IntoIterator<Item = Viewport>,
{
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state
);
debug_assert!(self.device().enabled_features().extended_dynamic_state);
let viewports = viewports
.into_iter()
.map(|v| v.clone().into())
@ -2001,8 +2071,20 @@ impl UnsafeCommandBufferBuilder {
let fns = self.device().fns();
let cmd = self.internal_object();
fns.ext_extended_dynamic_state
.cmd_set_viewport_with_count_ext(cmd, viewports.len() as u32, viewports.as_ptr());
if self.device().api_version() >= Version::V1_3 {
fns.v1_3
.cmd_set_viewport_with_count(cmd, viewports.len() as u32, viewports.as_ptr());
} else {
debug_assert!(
self.device()
.enabled_extensions()
.ext_extended_dynamic_state
);
debug_assert!(self.device().enabled_features().extended_dynamic_state);
fns.ext_extended_dynamic_state
.cmd_set_viewport_with_count_ext(cmd, viewports.len() as u32, viewports.as_ptr());
}
}
/// Calls `vkCmdUpdateBuffer` on the builder.

View File

@ -105,7 +105,7 @@ pub(in super::super) fn check_descriptor_sets_validity<'a, P: Pipeline>(
/*
Instruction/Sampler/Image View Validation
https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/chap16.html#textures-input-validation
https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/chap16.html#textures-input-validation
*/
// The SPIR-V Image Format is not compatible with the image views format.
@ -192,7 +192,7 @@ pub(in super::super) fn check_descriptor_sets_validity<'a, P: Pipeline>(
/*
Instruction/Sampler/Image View Validation
https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/chap16.html#textures-input-validation
https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/chap16.html#textures-input-validation
*/
// - The SPIR-V instruction is one of the OpImage*Dref* instructions and the sampler

View File

@ -430,7 +430,9 @@ impl<'a> PhysicalDevice<'a> {
/// Retrieves the properties of a format when used by this physical device.
pub fn format_properties(&self, format: Format) -> FormatProperties {
let mut format_properties2 = ash::vk::FormatProperties2::default();
let mut format_properties3 = if self.supported_extensions().khr_format_feature_flags2 {
let mut format_properties3 = if self.api_version() >= Version::V1_3
|| self.supported_extensions().khr_format_feature_flags2
{
Some(ash::vk::FormatProperties3KHR::default())
} else {
None
@ -1783,8 +1785,8 @@ impl From<ash::vk::FormatFeatureFlags> for FormatFeatures {
sampled_image: val.intersects(ash::vk::FormatFeatureFlags::SAMPLED_IMAGE),
storage_image: val.intersects(ash::vk::FormatFeatureFlags::STORAGE_IMAGE),
storage_image_atomic: val.intersects(ash::vk::FormatFeatureFlags::STORAGE_IMAGE_ATOMIC),
storage_read_without_format: false, // FormatFeatureFlags2KHR only
storage_write_without_format: false, // FormatFeatureFlags2KHR only
storage_read_without_format: false, // FormatFeatureFlags2 only
storage_write_without_format: false, // FormatFeatureFlags2 only
color_attachment: val.intersects(ash::vk::FormatFeatureFlags::COLOR_ATTACHMENT),
color_attachment_blend: val.intersects(ash::vk::FormatFeatureFlags::COLOR_ATTACHMENT_BLEND),
depth_stencil_attachment: val.intersects(ash::vk::FormatFeatureFlags::DEPTH_STENCIL_ATTACHMENT),
@ -1804,7 +1806,7 @@ impl From<ash::vk::FormatFeatureFlags> for FormatFeatures {
sampled_image_ycbcr_conversion_separate_reconstruction_filter: val.intersects(ash::vk::FormatFeatureFlags::SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER),
sampled_image_ycbcr_conversion_chroma_reconstruction_explicit: val.intersects(ash::vk::FormatFeatureFlags::SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT),
sampled_image_ycbcr_conversion_chroma_reconstruction_explicit_forceable: val.intersects(ash::vk::FormatFeatureFlags::SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE),
sampled_image_depth_comparison: false, // FormatFeatureFlags2KHR only
sampled_image_depth_comparison: false, // FormatFeatureFlags2 only
video_decode_output: val.intersects(ash::vk::FormatFeatureFlags::VIDEO_DECODE_OUTPUT_KHR),
video_decode_dpb: val.intersects(ash::vk::FormatFeatureFlags::VIDEO_DECODE_DPB_KHR),
@ -1824,49 +1826,49 @@ impl From<ash::vk::FormatFeatureFlags> for FormatFeatures {
}
}
impl From<ash::vk::FormatFeatureFlags2KHR> for FormatFeatures {
impl From<ash::vk::FormatFeatureFlags2> for FormatFeatures {
#[inline]
#[rustfmt::skip]
fn from(val: ash::vk::FormatFeatureFlags2KHR) -> FormatFeatures {
fn from(val: ash::vk::FormatFeatureFlags2) -> FormatFeatures {
FormatFeatures {
sampled_image: val.intersects(ash::vk::FormatFeatureFlags2KHR::SAMPLED_IMAGE),
storage_image: val.intersects(ash::vk::FormatFeatureFlags2KHR::STORAGE_IMAGE),
storage_image_atomic: val.intersects(ash::vk::FormatFeatureFlags2KHR::STORAGE_IMAGE_ATOMIC),
storage_read_without_format: val.intersects(ash::vk::FormatFeatureFlags2KHR::STORAGE_READ_WITHOUT_FORMAT),
storage_write_without_format: val.intersects(ash::vk::FormatFeatureFlags2KHR::STORAGE_WRITE_WITHOUT_FORMAT),
color_attachment: val.intersects(ash::vk::FormatFeatureFlags2KHR::COLOR_ATTACHMENT),
color_attachment_blend: val.intersects(ash::vk::FormatFeatureFlags2KHR::COLOR_ATTACHMENT_BLEND),
depth_stencil_attachment: val.intersects(ash::vk::FormatFeatureFlags2KHR::DEPTH_STENCIL_ATTACHMENT),
fragment_density_map: val.intersects(ash::vk::FormatFeatureFlags2KHR::FRAGMENT_DENSITY_MAP_EXT),
fragment_shading_rate_attachment: val.intersects(ash::vk::FormatFeatureFlags2KHR::FRAGMENT_SHADING_RATE_ATTACHMENT),
transfer_src: val.intersects(ash::vk::FormatFeatureFlags2KHR::TRANSFER_SRC),
transfer_dst: val.intersects(ash::vk::FormatFeatureFlags2KHR::TRANSFER_DST),
blit_src: val.intersects(ash::vk::FormatFeatureFlags2KHR::BLIT_SRC),
blit_dst: val.intersects(ash::vk::FormatFeatureFlags2KHR::BLIT_DST),
sampled_image: val.intersects(ash::vk::FormatFeatureFlags2::SAMPLED_IMAGE),
storage_image: val.intersects(ash::vk::FormatFeatureFlags2::STORAGE_IMAGE),
storage_image_atomic: val.intersects(ash::vk::FormatFeatureFlags2::STORAGE_IMAGE_ATOMIC),
storage_read_without_format: val.intersects(ash::vk::FormatFeatureFlags2::STORAGE_READ_WITHOUT_FORMAT),
storage_write_without_format: val.intersects(ash::vk::FormatFeatureFlags2::STORAGE_WRITE_WITHOUT_FORMAT),
color_attachment: val.intersects(ash::vk::FormatFeatureFlags2::COLOR_ATTACHMENT),
color_attachment_blend: val.intersects(ash::vk::FormatFeatureFlags2::COLOR_ATTACHMENT_BLEND),
depth_stencil_attachment: val.intersects(ash::vk::FormatFeatureFlags2::DEPTH_STENCIL_ATTACHMENT),
fragment_density_map: val.intersects(ash::vk::FormatFeatureFlags2::FRAGMENT_DENSITY_MAP_EXT),
fragment_shading_rate_attachment: val.intersects(ash::vk::FormatFeatureFlags2::FRAGMENT_SHADING_RATE_ATTACHMENT_KHR),
transfer_src: val.intersects(ash::vk::FormatFeatureFlags2::TRANSFER_SRC),
transfer_dst: val.intersects(ash::vk::FormatFeatureFlags2::TRANSFER_DST),
blit_src: val.intersects(ash::vk::FormatFeatureFlags2::BLIT_SRC),
blit_dst: val.intersects(ash::vk::FormatFeatureFlags2::BLIT_DST),
sampled_image_filter_linear: val.intersects(ash::vk::FormatFeatureFlags2KHR::SAMPLED_IMAGE_FILTER_LINEAR),
sampled_image_filter_cubic: val.intersects(ash::vk::FormatFeatureFlags2KHR::SAMPLED_IMAGE_FILTER_CUBIC_EXT),
sampled_image_filter_minmax: val.intersects(ash::vk::FormatFeatureFlags2KHR::SAMPLED_IMAGE_FILTER_MINMAX),
midpoint_chroma_samples: val.intersects(ash::vk::FormatFeatureFlags2KHR::MIDPOINT_CHROMA_SAMPLES),
cosited_chroma_samples: val.intersects(ash::vk::FormatFeatureFlags2KHR::COSITED_CHROMA_SAMPLES),
sampled_image_ycbcr_conversion_linear_filter: val.intersects(ash::vk::FormatFeatureFlags2KHR::SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER),
sampled_image_ycbcr_conversion_separate_reconstruction_filter: val.intersects(ash::vk::FormatFeatureFlags2KHR::SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER),
sampled_image_ycbcr_conversion_chroma_reconstruction_explicit: val.intersects(ash::vk::FormatFeatureFlags2KHR::SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT),
sampled_image_ycbcr_conversion_chroma_reconstruction_explicit_forceable: val.intersects(ash::vk::FormatFeatureFlags2KHR::SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE),
sampled_image_depth_comparison: val.intersects(ash::vk::FormatFeatureFlags2KHR::SAMPLED_IMAGE_DEPTH_COMPARISON),
sampled_image_filter_linear: val.intersects(ash::vk::FormatFeatureFlags2::SAMPLED_IMAGE_FILTER_LINEAR),
sampled_image_filter_cubic: val.intersects(ash::vk::FormatFeatureFlags2::SAMPLED_IMAGE_FILTER_CUBIC_EXT),
sampled_image_filter_minmax: val.intersects(ash::vk::FormatFeatureFlags2::SAMPLED_IMAGE_FILTER_MINMAX),
midpoint_chroma_samples: val.intersects(ash::vk::FormatFeatureFlags2::MIDPOINT_CHROMA_SAMPLES),
cosited_chroma_samples: val.intersects(ash::vk::FormatFeatureFlags2::COSITED_CHROMA_SAMPLES),
sampled_image_ycbcr_conversion_linear_filter: val.intersects(ash::vk::FormatFeatureFlags2::SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER),
sampled_image_ycbcr_conversion_separate_reconstruction_filter: val.intersects(ash::vk::FormatFeatureFlags2::SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER),
sampled_image_ycbcr_conversion_chroma_reconstruction_explicit: val.intersects(ash::vk::FormatFeatureFlags2::SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT),
sampled_image_ycbcr_conversion_chroma_reconstruction_explicit_forceable: val.intersects(ash::vk::FormatFeatureFlags2::SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE),
sampled_image_depth_comparison: val.intersects(ash::vk::FormatFeatureFlags2::SAMPLED_IMAGE_DEPTH_COMPARISON),
video_decode_output: val.intersects(ash::vk::FormatFeatureFlags2KHR::VIDEO_DECODE_OUTPUT),
video_decode_dpb: val.intersects(ash::vk::FormatFeatureFlags2KHR::VIDEO_DECODE_DPB),
video_encode_input: val.intersects(ash::vk::FormatFeatureFlags2KHR::VIDEO_ENCODE_INPUT),
video_encode_dpb: val.intersects(ash::vk::FormatFeatureFlags2KHR::VIDEO_ENCODE_DPB),
video_decode_output: val.intersects(ash::vk::FormatFeatureFlags2::VIDEO_DECODE_OUTPUT_KHR),
video_decode_dpb: val.intersects(ash::vk::FormatFeatureFlags2::VIDEO_DECODE_DPB_KHR),
video_encode_input: val.intersects(ash::vk::FormatFeatureFlags2::VIDEO_ENCODE_INPUT_KHR),
video_encode_dpb: val.intersects(ash::vk::FormatFeatureFlags2::VIDEO_ENCODE_DPB_KHR),
disjoint: val.intersects(ash::vk::FormatFeatureFlags2KHR::DISJOINT),
disjoint: val.intersects(ash::vk::FormatFeatureFlags2::DISJOINT),
uniform_texel_buffer: val.intersects(ash::vk::FormatFeatureFlags2KHR::UNIFORM_TEXEL_BUFFER),
storage_texel_buffer: val.intersects(ash::vk::FormatFeatureFlags2KHR::STORAGE_TEXEL_BUFFER),
storage_texel_buffer_atomic: val.intersects(ash::vk::FormatFeatureFlags2KHR::STORAGE_TEXEL_BUFFER_ATOMIC),
vertex_buffer: val.intersects(ash::vk::FormatFeatureFlags2KHR::VERTEX_BUFFER),
acceleration_structure_vertex_buffer: val.intersects(ash::vk::FormatFeatureFlags2KHR::ACCELERATION_STRUCTURE_VERTEX_BUFFER),
uniform_texel_buffer: val.intersects(ash::vk::FormatFeatureFlags2::UNIFORM_TEXEL_BUFFER),
storage_texel_buffer: val.intersects(ash::vk::FormatFeatureFlags2::STORAGE_TEXEL_BUFFER),
storage_texel_buffer_atomic: val.intersects(ash::vk::FormatFeatureFlags2::STORAGE_TEXEL_BUFFER_ATOMIC),
vertex_buffer: val.intersects(ash::vk::FormatFeatureFlags2::VERTEX_BUFFER),
acceleration_structure_vertex_buffer: val.intersects(ash::vk::FormatFeatureFlags2::ACCELERATION_STRUCTURE_VERTEX_BUFFER_KHR),
_ne: crate::NonExhaustive(()),
}

View File

@ -19,7 +19,7 @@
//! you can query a device beforehand for its support by calling `format_properties` on the physical
//! device. You can use this to select a usable format from one or more suitable alternatives.
//! Some formats are required to be always supported for a particular usage. These are listed in the
//! [tables in the Vulkan specification](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/chap43.html#features-required-format-support).
//! [tables in the Vulkan specification](https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/chap43.html#features-required-format-support).
//!
//! # Special format types
//!
@ -207,7 +207,7 @@ impl From<Format> for ash::vk::Format {
}
}
// https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/chap46.html#spirvenv-image-formats
// https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/chap46.html#spirvenv-image-formats
impl From<ImageFormat> for Option<Format> {
fn from(val: ImageFormat) -> Self {
match val {

View File

@ -764,11 +764,11 @@ impl UnsafeImageBuilder {
/*
Some device limits can be exceeded, but only for particular image configurations, which
must be queried with `image_format_properties`. See:
https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/chap44.html#capabilities-image
https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/chap44.html#capabilities-image
First, we check if this is the case, then query the device if so.
*/
// https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/chap44.html#features-extentperimagetype
// https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/chap44.html#features-extentperimagetype
let extent_must_query = || match image_type {
ImageType::Dim1d => {
let limit = device.physical_device().properties().max_image_dimension1_d;
@ -790,7 +790,7 @@ impl UnsafeImageBuilder {
extent[0] > limit || extent[1] > limit || extent[2] > limit
}
};
// https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkImageFormatProperties.html
// https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkImageFormatProperties.html
let mip_levels_must_query = || {
if mip_levels > 1 {
// TODO: for external memory, the spec says:
@ -801,7 +801,7 @@ impl UnsafeImageBuilder {
false
}
};
// https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkImageFormatProperties.html
// https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkImageFormatProperties.html
let array_layers_must_query = || {
if array_layers > device.physical_device().properties().max_image_array_layers {
true
@ -811,7 +811,7 @@ impl UnsafeImageBuilder {
false
}
};
// https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/chap44.html#features-supported-sample-counts
// https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/chap44.html#features-supported-sample-counts
let samples_must_query = || {
if samples == SampleCount::Sample1 {
return false;
@ -904,7 +904,7 @@ impl UnsafeImageBuilder {
false
};
// https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkImageCreateInfo.html#_description
// https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkImageCreateInfo.html#_description
let linear_must_query = || {
if tiling == ImageTiling::Linear {
!(image_type == ImageType::Dim2d

View File

@ -241,7 +241,7 @@ where
*image_inner.format_features()
};
// Per https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/chap12.html#resources-image-view-format-features
// Per https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/chap12.html#resources-image-view-format-features
if image_inner
.device()
.enabled_extensions()
@ -284,7 +284,7 @@ where
// Get usage
// Can be different from image usage, see
// https://khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkImageViewCreateInfo.html#_description
// https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkImageViewCreateInfo.html#_description
let usage = *image_inner.usage();
// Check for compatibility with the image

View File

@ -268,7 +268,7 @@ impl Instance {
} else if api_version < Version::V1_1 {
api_version
} else {
Version::V1_2 // TODO: Can this be extracted from vk.xml somehow?
Version::HEADER_VERSION
};
(std::cmp::min(max_api_version, api_version), max_api_version)
@ -475,7 +475,7 @@ pub struct InstanceCreateInfo {
///
/// Usually, you will want to leave this at the default.
///
/// The default value is the highest version currently supported by Vulkano, but if the
/// The default value is [`Version::HEADER_VERSION`], but if the
/// supported instance version is 1.0, then it will be 1.0.
pub max_api_version: Option<Version>,

View File

@ -35,7 +35,7 @@ pub struct ColorBlendState {
///
/// If set to `Some`, the [`logic_op`](crate::device::Features::logic_op) feature must be
/// enabled on the device. If set to `Some(Dynamic)`, then the
/// [`extended_dynamic_state2`](crate::device::Features::extended_dynamic_state2_logic_op)
/// [`extended_dynamic_state2_logic_op`](crate::device::Features::extended_dynamic_state2_logic_op)
/// feature must also be enabled on the device.
pub logic_op: Option<StateMode<LogicOp>>,

View File

@ -24,6 +24,7 @@ use crate::device::Device;
use crate::pipeline::graphics::GraphicsPipelineCreationError;
use crate::pipeline::{DynamicState, StateMode};
use crate::render_pass::Subpass;
use crate::Version;
use fnv::FnvHashMap;
use std::ops::RangeInclusive;
use std::u32;
@ -89,7 +90,9 @@ impl DepthStencilState {
}
if depth_state.enable_dynamic {
if !device.enabled_features().extended_dynamic_state {
if !(device.api_version() >= Version::V1_3
|| device.enabled_features().extended_dynamic_state)
{
return Err(GraphicsPipelineCreationError::FeatureNotEnabled {
feature: "extended_dynamic_state",
reason: "DepthState::enable_dynamic was true",
@ -109,7 +112,9 @@ impl DepthStencilState {
write_enable as ash::vk::Bool32
}
StateMode::Dynamic => {
if !device.enabled_features().extended_dynamic_state {
if !(device.api_version() >= Version::V1_3
|| device.enabled_features().extended_dynamic_state)
{
return Err(GraphicsPipelineCreationError::FeatureNotEnabled {
feature: "extended_dynamic_state",
reason: "DepthState::write_enable was set to Dynamic",
@ -126,7 +131,9 @@ impl DepthStencilState {
compare_op.into()
}
StateMode::Dynamic => {
if !device.enabled_features().extended_dynamic_state {
if !(device.api_version() >= Version::V1_3
|| device.enabled_features().extended_dynamic_state)
{
return Err(GraphicsPipelineCreationError::FeatureNotEnabled {
feature: "extended_dynamic_state",
reason: "DepthState::compare_op was set to Dynamic",
@ -155,7 +162,9 @@ impl DepthStencilState {
}
if depth_bounds_state.enable_dynamic {
if !device.enabled_features().extended_dynamic_state {
if !(device.api_version() >= Version::V1_3
|| device.enabled_features().extended_dynamic_state)
{
return Err(GraphicsPipelineCreationError::FeatureNotEnabled {
feature: "extended_dynamic_state",
reason: "DepthBoundsState::enable_dynamic was true",
@ -199,7 +208,9 @@ impl DepthStencilState {
// TODO: if stencil buffer can potentially be written, check if it is writable
if stencil_state.enable_dynamic {
if !device.enabled_features().extended_dynamic_state {
if !(device.api_version() >= Version::V1_3
|| device.enabled_features().extended_dynamic_state)
{
return Err(GraphicsPipelineCreationError::FeatureNotEnabled {
feature: "extended_dynamic_state",
reason: "StencilState::enable_dynamic was true",
@ -215,7 +226,9 @@ impl DepthStencilState {
dynamic_state_modes.insert(DynamicState::StencilOp, false);
}
(StateMode::Dynamic, StateMode::Dynamic) => {
if !device.enabled_features().extended_dynamic_state {
if !(device.api_version() >= Version::V1_3
|| device.enabled_features().extended_dynamic_state)
{
return Err(GraphicsPipelineCreationError::FeatureNotEnabled {
feature: "extended_dynamic_state",
reason: "StencilState::ops was set to Dynamic",
@ -326,14 +339,14 @@ pub struct DepthState {
/// Sets whether depth testing should be enabled and disabled dynamically. If set to `false`,
/// depth testing is always enabled.
///
/// If set to `true`, the
/// If set to `true`, the device API version must be at least 1.3, or the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature must be
/// enabled on the device.
pub enable_dynamic: bool,
/// Sets whether the value in the depth buffer will be updated when the depth test succeeds.
///
/// If set to `Dynamic`, the
/// If set to `Dynamic`, the device API version must be at least 1.3, or the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature must be
/// enabled on the device.
pub write_enable: StateMode<bool>,
@ -341,7 +354,7 @@ pub struct DepthState {
/// Comparison operation to use between the depth value of each incoming fragment and the depth
/// value currently in the depth buffer.
///
/// If set to `Dynamic`, the
/// If set to `Dynamic`, the device API version must be at least 1.3, or the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature must be
/// enabled on the device.
pub compare_op: StateMode<CompareOp>,
@ -367,7 +380,7 @@ pub struct DepthBoundsState {
/// Sets whether depth bounds testing should be enabled and disabled dynamically. If set to
/// `false`, depth bounds testing is always enabled.
///
/// If set to `true`, the
/// If set to `true`, the device API version must be at least 1.3, or the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature must be
/// enabled on the device.
pub enable_dynamic: bool,
@ -375,7 +388,7 @@ pub struct DepthBoundsState {
/// The minimum and maximum depth values to use for the test. Fragments with values outside this
/// range are discarded.
///
/// If set to `Dynamic`, the
/// If set to `Dynamic`, the device API version must be at least 1.3, or the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature must be
/// enabled on the device.
pub bounds: StateMode<RangeInclusive<f32>>,
@ -402,7 +415,7 @@ pub struct StencilState {
/// Sets whether stencil testing should be enabled and disabled dynamically. If set to
/// `false`, stencil testing is always enabled.
///
/// If set to `true`, the
/// If set to `true`, the device API version must be at least 1.3, or the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature must be
/// enabled on the device.
pub enable_dynamic: bool,
@ -420,7 +433,7 @@ pub struct StencilState {
pub struct StencilOpState {
/// The stencil operations to perform.
///
/// If set to `Dynamic`, the
/// If set to `Dynamic`, the device API version must be at least 1.3, or the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature must be
/// enabled on the device.
pub ops: StateMode<StencilOps>,

View File

@ -12,7 +12,7 @@
use crate::device::Device;
use crate::pipeline::graphics::GraphicsPipelineCreationError;
use crate::pipeline::{DynamicState, PartialStateMode, StateMode};
use crate::DeviceSize;
use crate::{DeviceSize, Version};
use fnv::FnvHashMap;
/// The state in a graphics pipeline describing how the input assembly stage should behave.
@ -22,7 +22,7 @@ pub struct InputAssemblyState {
///
/// Note that some topologies require a feature to be enabled on the device.
///
/// If set to `Dynamic`, the
/// If set to `Dynamic`, the device API version must be at least 1.3, or the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature must be
/// enabled on the device.
pub topology: PartialStateMode<PrimitiveTopology, PrimitiveTopologyClass>,
@ -35,9 +35,9 @@ pub struct InputAssemblyState {
/// topologies require a feature to be enabled on the device when combined with primitive
/// restart.
///
/// If set to `Dynamic`, the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature must be
/// enabled on the device.
/// If set to `Dynamic`, the device API version must be at least 1.3, or the
/// [`extended_dynamic_state2`](crate::device::Features::extended_dynamic_state2) feature must
/// be enabled on the device.
pub primitive_restart_enable: StateMode<bool>,
}
@ -113,7 +113,9 @@ impl InputAssemblyState {
topology.into()
}
PartialStateMode::Dynamic(topology_class) => {
if !device.enabled_features().extended_dynamic_state {
if !(device.api_version() >= Version::V1_3
|| device.enabled_features().extended_dynamic_state)
{
return Err(GraphicsPipelineCreationError::FeatureNotEnabled {
feature: "extended_dynamic_state",
reason: "InputAssemblyState::topology was set to Dynamic",
@ -160,7 +162,9 @@ impl InputAssemblyState {
primitive_restart_enable as ash::vk::Bool32
}
StateMode::Dynamic => {
if !device.enabled_features().extended_dynamic_state2 {
if !(device.api_version() >= Version::V1_3
|| device.enabled_features().extended_dynamic_state2)
{
return Err(GraphicsPipelineCreationError::FeatureNotEnabled {
feature: "extended_dynamic_state2",
reason: "InputAssemblyState::primitive_restart_enable was set to Dynamic",

View File

@ -12,6 +12,7 @@
use crate::device::Device;
use crate::pipeline::graphics::GraphicsPipelineCreationError;
use crate::pipeline::{DynamicState, StateMode};
use crate::Version;
use fnv::FnvHashMap;
/// The state in a graphics pipeline describing how the rasterization stage should behave.
@ -28,7 +29,7 @@ pub struct RasterizationState {
/// is usually used when your vertex shader has some side effects and you don't need to run the
/// fragment shader.
///
/// If set to `Dynamic`, the
/// If set to `Dynamic`, the device API version must be at least 1.3, or the
/// [`extended_dynamic_state2`](crate::device::Features::extended_dynamic_state2) feature must
/// be enabled on the device.
pub rasterizer_discard_enable: StateMode<bool>,
@ -43,14 +44,14 @@ pub struct RasterizationState {
/// Specifies whether front faces or back faces should be discarded, or none, or both.
///
/// If set to `Dynamic`, the
/// If set to `Dynamic`, the device API version must be at least 1.3, or the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature must be
/// enabled on the device.
pub cull_mode: StateMode<CullMode>,
/// Specifies which triangle orientation is considered to be the front of the triangle.
///
/// If set to `Dynamic`, the
/// If set to `Dynamic`, the device API version must be at least 1.3, or the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature must be
/// enabled on the device.
pub front_face: StateMode<FrontFace>,
@ -289,7 +290,9 @@ impl RasterizationState {
rasterizer_discard_enable as ash::vk::Bool32
}
StateMode::Dynamic => {
if !device.enabled_features().extended_dynamic_state2 {
if !(device.api_version() >= Version::V1_3
|| device.enabled_features().extended_dynamic_state2)
{
return Err(GraphicsPipelineCreationError::FeatureNotEnabled {
feature: "extended_dynamic_state2",
reason: "RasterizationState::rasterizer_discard_enable was set to Dynamic",
@ -314,7 +317,9 @@ impl RasterizationState {
cull_mode.into()
}
StateMode::Dynamic => {
if !device.enabled_features().extended_dynamic_state {
if !(device.api_version() >= Version::V1_3
|| device.enabled_features().extended_dynamic_state)
{
return Err(GraphicsPipelineCreationError::FeatureNotEnabled {
feature: "extended_dynamic_state",
reason: "RasterizationState::cull_mode was set to Dynamic",
@ -331,7 +336,9 @@ impl RasterizationState {
front_face.into()
}
StateMode::Dynamic => {
if !device.enabled_features().extended_dynamic_state {
if !(device.api_version() >= Version::V1_3
|| device.enabled_features().extended_dynamic_state)
{
return Err(GraphicsPipelineCreationError::FeatureNotEnabled {
feature: "extended_dynamic_state",
reason: "RasterizationState::front_face was set to Dynamic",

View File

@ -48,9 +48,9 @@
//! In all cases the number of viewports and scissor boxes must be the same.
//!
use crate::device::Device;
use crate::pipeline::graphics::GraphicsPipelineCreationError;
use crate::pipeline::DynamicState;
use crate::{device::Device, Version};
use fnv::FnvHashMap;
use smallvec::SmallVec;
use std::{ops::Range, ptr};
@ -74,7 +74,7 @@ pub enum ViewportState {
/// Sets whether the scissor count is also dynamic, or only the scissors themselves.
///
/// If set to `true`, the
/// If set to `true`, the device API version must be at least 1.3, or the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature must
/// be enabled on the device.
scissor_count_dynamic: bool,
@ -88,7 +88,7 @@ pub enum ViewportState {
/// Sets whether the viewport count is also dynamic, or only the viewports themselves.
///
/// If set to `true`, the
/// If set to `true`, the device API version must be at least 1.3, or the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature must
/// be enabled on the device.
viewport_count_dynamic: bool,
@ -103,14 +103,14 @@ pub enum ViewportState {
/// Sets whether the viewport count is also dynamic, or only the viewports themselves.
///
/// If set to `true`, the
/// If set to `true`, the device API version must be at least 1.3, or the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature must
/// be enabled on the device.
viewport_count_dynamic: bool,
/// Sets whether the scissor count is also dynamic, or only the scissors themselves.
///
/// If set to `true`, the
/// If set to `true`, the device API version must be at least 1.3, or the
/// [`extended_dynamic_state`](crate::device::Features::extended_dynamic_state) feature must
/// be enabled on the device.
scissor_count_dynamic: bool,
@ -240,7 +240,9 @@ impl ViewportState {
dynamic_state_modes.insert(DynamicState::ViewportWithCount, false);
let scissor_count = if *scissor_count_dynamic {
if !device.enabled_features().extended_dynamic_state {
if !(device.api_version() >= Version::V1_3
|| device.enabled_features().extended_dynamic_state)
{
return Err(GraphicsPipelineCreationError::FeatureNotEnabled {
feature: "extended_dynamic_state",
reason: "ViewportState::FixedViewport::scissor_count_dynamic was set to true",
@ -271,7 +273,9 @@ impl ViewportState {
dynamic_state_modes.insert(DynamicState::ScissorWithCount, false);
let viewport_count = if *viewport_count_dynamic {
if !device.enabled_features().extended_dynamic_state {
if !(device.api_version() >= Version::V1_3
|| device.enabled_features().extended_dynamic_state)
{
return Err(GraphicsPipelineCreationError::FeatureNotEnabled {
feature: "extended_dynamic_state",
reason: "ViewportState::FixedScissor::viewport_count_dynamic was set to true",
@ -298,7 +302,9 @@ impl ViewportState {
}
let viewport_count = if *viewport_count_dynamic {
if !device.enabled_features().extended_dynamic_state {
if !(device.api_version() >= Version::V1_3
|| device.enabled_features().extended_dynamic_state)
{
return Err(GraphicsPipelineCreationError::FeatureNotEnabled {
feature: "extended_dynamic_state",
reason:
@ -315,7 +321,9 @@ impl ViewportState {
};
let scissor_count = if *scissor_count_dynamic {
if !device.enabled_features().extended_dynamic_state {
if !(device.api_version() >= Version::V1_3
|| device.enabled_features().extended_dynamic_state)
{
return Err(GraphicsPipelineCreationError::FeatureNotEnabled {
feature: "extended_dynamic_state",
reason: "ViewportState::Dynamic::scissor_count_dynamic was set to true",

View File

@ -167,7 +167,7 @@ impl Sampler {
/*
Note: Most of these checks come from the Instruction/Sampler/Image View Validation
section, and are not strictly VUIDs.
https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/chap16.html#textures-input-validation
https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/chap16.html#textures-input-validation
*/
if self.compare.is_some() {
@ -283,7 +283,7 @@ impl Sampler {
// The sampler unnormalizedCoordinates is VK_TRUE and any of the limitations of
// unnormalized coordinates are violated.
// https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/chap13.html#samplers-unnormalizedCoordinates
// https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/chap13.html#samplers-unnormalizedCoordinates
if self.unnormalized_coordinates {
// The viewType must be either VK_IMAGE_VIEW_TYPE_1D or
// VK_IMAGE_VIEW_TYPE_2D.

View File

@ -467,7 +467,7 @@ impl SamplerYcbcrConversionBuilder {
/// Forces explicit reconstruction if the implementation does not use it by default. The format
/// must support it. See
/// [the spec](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/chap16.html#textures-chroma-reconstruction)
/// [the spec](https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/chap16.html#textures-chroma-reconstruction)
/// for more information.
///
/// The default value is `false`.

View File

@ -966,7 +966,7 @@ pub enum ShaderScalarType {
Uint,
}
// https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/chap43.html#formats-numericformat
// https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/chap43.html#formats-numericformat
impl From<NumericType> for ShaderScalarType {
fn from(val: NumericType) -> Self {
match val {
@ -1457,6 +1457,13 @@ fn check_spirv_version(device: &Device, mut version: Version) -> Result<(), Shad
]));
}
}
Version::V1_6 => {
if !(device.api_version() >= Version::V1_3) {
return Err(ShaderSupportError::RequirementsNotMet(&[
"Vulkan API version 1.3",
]));
}
}
_ => return Err(ShaderSupportError::NotSupportedByVulkan),
}
Ok(())

View File

@ -363,6 +363,10 @@ mod tests {
let physical = PhysicalDevice::enumerate(&instance).next().unwrap();
if !physical.supported_extensions().khr_external_semaphore_fd {
return;
}
let queue_family = physical.queue_families().next().unwrap();
let device_ext = DeviceExtensions {

View File

@ -24,47 +24,55 @@ macro_rules! instance {
/// Creates a device and a queue for graphics operations.
macro_rules! gfx_dev_and_queue {
($($feature:ident),*) => ({
use crate::device::physical::PhysicalDevice;
use crate::device::physical::{PhysicalDevice, PhysicalDeviceType};
use crate::device::{Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo};
use crate::device::Features;
let instance = instance!();
let physical = match PhysicalDevice::enumerate(&instance).next() {
Some(p) => p,
None => return
};
let queue_family = match physical.queue_families().find(|q| q.supports_graphics()) {
Some(q) => q,
None => return
};
let extensions = DeviceExtensions::none();
let features = Features {
let enabled_extensions = DeviceExtensions::none();
let enabled_features = Features {
$(
$feature: true,
)*
.. Features::none()
};
// If the physical device doesn't support the requested features, just return.
if !physical.supported_features().is_superset_of(&features) {
return;
}
let select = PhysicalDevice::enumerate(&instance)
.filter(|&p| {
p.supported_extensions().is_superset_of(&enabled_extensions) &&
p.supported_features().is_superset_of(&enabled_features)
})
.filter_map(|p| {
p.queue_families()
.find(|&q| q.supports_graphics())
.map(|q| (p, q))
})
.min_by_key(|(p, _)| {
match p.properties().device_type {
PhysicalDeviceType::DiscreteGpu => 0,
PhysicalDeviceType::IntegratedGpu => 1,
PhysicalDeviceType::VirtualGpu => 2,
PhysicalDeviceType::Cpu => 3,
PhysicalDeviceType::Other => 4,
}
});
let (physical_device, queue_family) = match select {
Some(x) => x,
None => return,
};
let (device, mut queues) = match Device::new(
physical,
physical_device,
DeviceCreateInfo {
queue_create_infos: vec![QueueCreateInfo::family(queue_family)],
enabled_extensions: extensions,
enabled_features: features,
enabled_extensions,
enabled_features,
..Default::default()
}
) {
Ok(r) => r,
Err(_) => return
Err(_) => return,
};
(device, queues.next().unwrap())

View File

@ -11,6 +11,9 @@
use std::{fmt, num::ParseIntError, str::FromStr};
// Generated by build.rs
include!(concat!(env!("OUT_DIR"), "/version.rs"));
/// Represents an API version of Vulkan.
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct Version {
@ -29,6 +32,7 @@ impl Version {
pub const V1_3: Version = Version::major_minor(1, 3);
pub const V1_4: Version = Version::major_minor(1, 4);
pub const V1_5: Version = Version::major_minor(1, 5);
pub const V1_6: Version = Version::major_minor(1, 6);
/// Constructs a `Version` from the given major and minor version numbers.
#[inline]

File diff suppressed because it is too large Load Diff