From e1da48d512957a3e7e819308919062b91fd27c3d Mon Sep 17 00:00:00 2001 From: Jasper Bekkers Date: Thu, 11 Feb 2021 13:44:57 +0100 Subject: [PATCH 1/3] Moved meta-data generation function into `dr` --- autogen/src/dr.rs | 222 +++- autogen/src/header.rs | 131 ++- autogen/src/main.rs | 3 +- autogen/src/structs.rs | 10 +- rspirv/dr/autogen_operand.rs | 1852 ++++++++++++++++++++++++++++++++++ rspirv/dr/build/mod.rs | 12 + rspirv/grammar/syntax.rs | 2 +- rspirv/tests/spirv_blobs.rs | 3 +- spirv/autogen_spirv.rs | 1503 +-------------------------- 9 files changed, 2237 insertions(+), 1501 deletions(-) diff --git a/autogen/src/dr.rs b/autogen/src/dr.rs index c929ed9e..f60f88ce 100644 --- a/autogen/src/dr.rs +++ b/autogen/src/dr.rs @@ -6,6 +6,7 @@ use crate::utils::*; use heck::SnakeCase; use proc_macro2::TokenStream; use quote::{format_ident, quote}; +use std::collections::BTreeMap; /// Returns true if the given operand kind can potentially have additional /// parameters. @@ -200,6 +201,17 @@ pub fn gen_dr_operand_kinds(grammar: &[structs::OperandKind]) -> TokenStream { .map(as_ident) .collect(); + let kind_to_enum: Vec<_> = grammar + .iter() + .map(|element| { + ( + element.kind.as_str(), + element.category, + element.enumerants.clone(), + ) + }) + .collect(); + let kind_and_ty = { let id_kinds = kinds .iter() @@ -264,6 +276,20 @@ pub fn gen_dr_operand_kinds(grammar: &[structs::OperandKind]) -> TokenStream { } }; + let translate_quant = |quant: crate::structs::Quantifier| { + match quant { + structs::Quantifier::One => { + quote! { crate::grammar::OperandQuantifier::One } + } + structs::Quantifier::ZeroOrOne => { + quote! { crate::grammar::OperandQuantifier::ZeroOrOne } + } + structs::Quantifier::ZeroOrMore => { + quote! { crate::grammar::OperandQuantifier::ZeroOrMore } + } + } + }; + let impl_code = { // impl fmt::Display for dr::Operand. let mut kinds = kinds; @@ -291,12 +317,12 @@ pub fn gen_dr_operand_kinds(grammar: &[structs::OperandKind]) -> TokenStream { } } }); - let unwraps = kind_and_ty.into_iter().map(|(kind, ty)| { + let unwraps = kind_and_ty.iter().map(|(kind, ty)| { let unwrap_kind = format_ident!("unwrap_{}", kind.to_string().to_snake_case()); let (ret_ty, self_prefix) = if ty.to_string() == "String" { (quote! {&str}, quote! {}) } else { - (ty, quote!(*)) + (ty.clone(), quote!(*)) }; let panic_arg = format!("Expected Operand::{}, got {{}} instead", kind); quote! { @@ -308,6 +334,174 @@ pub fn gen_dr_operand_kinds(grammar: &[structs::OperandKind]) -> TokenStream { } } }); + + let operand_metadata = kind_to_enum + .iter() + .filter_map(|(kind, category, enumerators)| { + if enumerators.is_empty() { + return None; + } + + let mut capability_clauses = BTreeMap::new(); + let mut extension_clauses = BTreeMap::new(); + let mut operand_clauses = BTreeMap::new(); + + let kind = as_ident(kind); + let mut seen_discriminator = BTreeMap::new(); + + for e in enumerators { + if seen_discriminator.get(&e.value).is_none() { + let name = match category { + structs::Category::BitEnum => { + use heck::ShoutySnakeCase; + + as_ident(&e.symbol.to_shouty_snake_case().replace("NA_N", "NAN")) + } + structs::Category::ValueEnum => { + let name_str = if kind == "Dim" { + let mut name = "Dim".to_string(); + name.push_str(&e.symbol); + name + } else { + e.symbol.to_string() + }; + + as_ident(&name_str) + } + _ => panic!("Unexpected operand type"), + }; + + seen_discriminator.insert(e.value, name.clone()); + + capability_clauses + .entry(&e.capabilities) + .or_insert_with(Vec::new) + .push(name.clone()); + + extension_clauses + .entry(&e.extensions) + .or_insert_with(Vec::new) + .push(name.clone()); + + if !e.parameters.is_empty() { + operand_clauses + .entry(&e.parameters) + .or_insert_with(Vec::new) + .push(name.clone()) + } + } + } + + let extensions = if category == &structs::Category::BitEnum { + quote! {} + } else { + let extensions = extension_clauses.into_iter().map(|(k, v)| { + let kinds = std::iter::repeat(quote! { s::#kind }); + quote! { + #( #kinds::#v )|* => &[#( #k ),*] + } + }); + + quote! { + Self::#kind(v) => match v { + #( #extensions ),* + }, + } + }; + + let capabilities = if category == &structs::Category::BitEnum { + quote! {} + } else { + let capabilities = capability_clauses.into_iter().map(|(k, v)| { + let kinds = std::iter::repeat(quote! { s::#kind }); + let capabilities = k.iter().map(|cap| as_ident(cap)); + quote! { + #( #kinds::#v )|* => &[#( spirv::Capability::#capabilities ),*] + } + }); + + quote! { + Self::#kind(v) => match v { + #( #capabilities ),* + }, + } + }; + + let operands = if operand_clauses.is_empty() { + quote! {} + }else { + if category == &structs::Category::BitEnum { + let operands = operand_clauses + .into_iter() + .map(|(k, v)| { + let operands = k.iter().map(|op| { + let kind = as_ident(&op.kind); + let quant = translate_quant(op.quantifier); + + quote! { + crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::#kind, + quantifier: #quant + } + } + }); + + let kinds = std::iter::repeat(quote! { s::#kind }); + + quote! { + result.extend([#(#kinds::#v,)*].iter().filter(|arg| { + v.contains(**arg) + }).flat_map(|_| { [#( #operands ),*].iter().cloned() })) + } + }); + + quote! { + Self::#kind(v) => { + let mut result = vec![]; + #( #operands );*; + result + } + } + } else { + let operands = operand_clauses + .into_iter() + .map(|(k, v)| { + let operands = k.iter().map(|op| { + let kind = as_ident(&op.kind); + let quant = translate_quant(op.quantifier); + + quote! { + crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::#kind, + quantifier: #quant + } + } + }); + + let kinds = std::iter::repeat(quote! { s::#kind }); + + quote! { + #( #kinds::#v )|* => vec![#( #operands ),*] + } + }); + + quote! { + Self::#kind(v) => match v { + #( #operands ),*, + _ => vec![] + }, + } + } + }; + + Some((extensions, capabilities, operands)) + }) + .collect::>(); + + let required_extensions = operand_metadata.iter().map(|e| &e.0); + let required_capabilities = operand_metadata.iter().map(|e| &e.1); + let additional_params = operand_metadata.iter().map(|e| &e.2); + quote! { impl fmt::Display for Operand { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -331,6 +525,30 @@ pub fn gen_dr_operand_kinds(grammar: &[structs::OperandKind]) -> TokenStream { _ => None, } } + + pub fn required_capabilities(&self) -> &'static [spirv::Capability] { + use spirv as s; + match self { + #(#required_capabilities)* + _ => &[] + } + } + + pub fn required_extensions(&self) -> &'static [&'static str] { + use spirv as s; + match self { + #(#required_extensions)* + _ => &[] + } + } + + pub fn additional_operands(&self) -> Vec { + use spirv as s; + match self { + #(#additional_params)* + _ => vec![] + } + } } } }; diff --git a/autogen/src/header.rs b/autogen/src/header.rs index a9d75438..41581ac2 100644 --- a/autogen/src/header.rs +++ b/autogen/src/header.rs @@ -62,7 +62,11 @@ fn from_primitive_impl(from_prim: &[TokenStream], kind: &proc_macro2::Ident) -> } fn gen_bit_enum_operand_kind(grammar: &structs::OperandKind) -> TokenStream { - let elements = grammar.enumerants.iter().map(|enumerant| { + let mut elements = vec![]; + let mut operands = vec![]; + let mut additional_operands_list = vec![]; + + for enumerant in grammar.enumerants.iter() { // Special treatment for "NaN" let symbol = as_ident( &enumerant @@ -71,14 +75,58 @@ fn gen_bit_enum_operand_kind(grammar: &structs::OperandKind) -> TokenStream { .replace("NA_N", "NAN"), ); let value = enumerant.value; - quote! { + + elements.push(quote! { const #symbol = #value; + }); + + let parameters = enumerant.parameters.iter().map(|op| { + let kind = as_ident(&op.kind); + + let quant = match op.quantifier { + structs::Quantifier::One => quote! { OperandQuantifier::One }, + structs::Quantifier::ZeroOrOne => quote! { OperandQuantifier::ZeroOrOne }, + structs::Quantifier::ZeroOrMore => quote! { OperandQuantifier::ZeroOrMore }, + }; + + quote! { + LogicalOperand { + kind: OperandKind::#kind, + quantifier: #quant + } + } + }); + + if !enumerant.parameters.is_empty() { + additional_operands_list.push(quote! { Self::#symbol }); + + operands.push(quote! { + Self::#symbol if self.contains(*v) => { + [#( #parameters ),*].iter() + } + }); } - }); + } + let comment = format!("SPIR-V operand kind: {}", get_spec_link(&grammar.kind)); let kind = as_ident(&grammar.kind); let attribute = bit_enum_attribute(); + let operands_matches = if additional_operands_list.is_empty() { + quote! { + core::iter::empty::<&'static &'static LogicalOperand>() + } + } else { + quote! { + [#(#additional_operands_list,)*].iter().flat_map(|v| { + match self { + #(#operands)* + _ => &[].iter() + } + }) + } + }; + quote! { bitflags! { #[doc = #comment] @@ -87,6 +135,24 @@ fn gen_bit_enum_operand_kind(grammar: &structs::OperandKind) -> TokenStream { #(#elements)* } } + + impl #kind { + // pub fn required_capabilities(self) -> &'static [Capability] { + // match self { + // #(#capabilities),* + // } + // } + + // pub fn required_extensions(self) -> &'static [&'static str] { + // match self { + // #(#extensions),* + // } + // } + + // pub fn additional_operands(self) -> impl Iterator { + // #operands_matches + // } + } } } @@ -101,6 +167,7 @@ fn gen_value_enum_operand_kind(grammar: &structs::OperandKind) -> TokenStream { let mut aliases = vec![]; let mut capability_clauses = BTreeMap::new(); let mut extension_clauses = BTreeMap::new(); + let mut operand_clauses = BTreeMap::new(); let mut from_str_impl = vec![]; for e in &grammar.enumerants { if let Some(discriminator) = seen_discriminator.get(&e.value) { @@ -135,7 +202,27 @@ fn gen_value_enum_operand_kind(grammar: &structs::OperandKind) -> TokenStream { extension_clauses .entry(&e.extensions) .or_insert_with(Vec::new) - .push(name); + .push(name.clone()); + + operand_clauses + .entry(name.clone()) + .or_insert_with(Vec::new) + .extend(e.parameters.iter().map(|op| { + let kind = as_ident(&op.kind); + + let quant = match op.quantifier { + structs::Quantifier::One => quote! { OperandQuantifier::One }, + structs::Quantifier::ZeroOrOne => quote! { OperandQuantifier::ZeroOrOne }, + structs::Quantifier::ZeroOrMore => quote! { OperandQuantifier::ZeroOrMore }, + }; + + quote! { + LogicalOperand { + kind: OperandKind::#kind, + quantifier: #quant + } + } + })); } } @@ -154,6 +241,13 @@ fn gen_value_enum_operand_kind(grammar: &structs::OperandKind) -> TokenStream { } }); + let operands = operand_clauses.into_iter().map(|(k, v)| { + let kinds = std::iter::repeat(&kind); + quote! { + #kind::#k => &[#( #v ),*] + } + }); + let comment = format!("/// SPIR-V operand kind: {}", get_spec_link(&grammar.kind)); let attribute = value_enum_attribute(); @@ -170,17 +264,23 @@ fn gen_value_enum_operand_kind(grammar: &structs::OperandKind) -> TokenStream { impl #kind { #(#aliases)* - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - #(#capabilities),* - } - } - - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - #(#extensions),* - } - } + // pub fn required_capabilities(self) -> &'static [Capability] { + // match self { + // #(#capabilities),* + // } + // } + + // pub fn required_extensions(self) -> &'static [&'static str] { + // match self { + // #(#extensions),* + // } + // } + + // pub fn additional_operands(self) -> &'static [&'static LogicalOperand] { + // match self { + // #(#operands),* + // } + // } } #from_prim_impl @@ -250,6 +350,7 @@ pub fn gen_spirv_header(grammar: &structs::Grammar) -> TokenStream { let from_prim_impl = from_primitive_impl(&from_prim_list, &as_ident("Op")); quote! { + //pub use crate::grammar::{OperandKind, OperandQuantifier, LogicalOperand}; pub type Word = u32; pub const MAGIC_NUMBER: u32 = #magic_number; pub const MAJOR_VERSION: u8 = #major_version; diff --git a/autogen/src/main.rs b/autogen/src/main.rs index 1f4cc310..9638427b 100644 --- a/autogen/src/main.rs +++ b/autogen/src/main.rs @@ -9,7 +9,8 @@ mod table; mod utils; use std::{ - env, fs, + env, + fs, io::{Read, Write}, path::PathBuf, process, diff --git a/autogen/src/structs.rs b/autogen/src/structs.rs index e8d25eef..138a895b 100644 --- a/autogen/src/structs.rs +++ b/autogen/src/structs.rs @@ -3,7 +3,7 @@ use serde::de; use serde_derive::*; use std::{convert::TryInto, fmt, result, str}; -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, Clone, Ord, PartialOrd, Eq, PartialEq)] pub struct Operand { pub kind: String, #[serde(default)] @@ -12,7 +12,7 @@ pub struct Operand { pub quantifier: Quantifier, } -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, Clone)] pub struct Instruction { pub class: Option, pub opname: String, @@ -25,7 +25,7 @@ pub struct Instruction { pub extensions: Vec, } -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, Clone)] pub struct Enumerant { #[serde(rename = "enumerant")] pub symbol: String, @@ -39,7 +39,7 @@ pub struct Enumerant { pub extensions: Vec, } -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, Clone)] pub struct OperandKind { pub category: Category, pub kind: String, @@ -93,7 +93,7 @@ fn num_or_hex<'de, D: de::Deserializer<'de>>(d: D) -> result::Result None, } } + pub fn required_capabilities(&self) -> &'static [spirv::Capability] { + use spirv as s; + match self { + Self::SourceLanguage(v) => match v { + s::SourceLanguage::Unknown + | s::SourceLanguage::ESSL + | s::SourceLanguage::GLSL + | s::SourceLanguage::OpenCL_C + | s::SourceLanguage::OpenCL_CPP + | s::SourceLanguage::HLSL => &[], + }, + Self::ExecutionModel(v) => match v { + s::ExecutionModel::Geometry => &[spirv::Capability::Geometry], + s::ExecutionModel::Kernel => &[spirv::Capability::Kernel], + s::ExecutionModel::TaskNV | s::ExecutionModel::MeshNV => { + &[spirv::Capability::MeshShadingNV] + } + s::ExecutionModel::RayGenerationNV + | s::ExecutionModel::IntersectionNV + | s::ExecutionModel::AnyHitNV + | s::ExecutionModel::ClosestHitNV + | s::ExecutionModel::MissNV + | s::ExecutionModel::CallableNV => &[ + spirv::Capability::RayTracingNV, + spirv::Capability::RayTracingKHR, + ], + s::ExecutionModel::Vertex + | s::ExecutionModel::Fragment + | s::ExecutionModel::GLCompute => &[spirv::Capability::Shader], + s::ExecutionModel::TessellationControl + | s::ExecutionModel::TessellationEvaluation => &[spirv::Capability::Tessellation], + }, + Self::AddressingModel(v) => match v { + s::AddressingModel::Logical => &[], + s::AddressingModel::Physical32 | s::AddressingModel::Physical64 => { + &[spirv::Capability::Addresses] + } + s::AddressingModel::PhysicalStorageBuffer64 => { + &[spirv::Capability::PhysicalStorageBufferAddresses] + } + }, + Self::MemoryModel(v) => match v { + s::MemoryModel::OpenCL => &[spirv::Capability::Kernel], + s::MemoryModel::Simple | s::MemoryModel::GLSL450 => &[spirv::Capability::Shader], + s::MemoryModel::Vulkan => &[spirv::Capability::VulkanMemoryModel], + }, + Self::ExecutionMode(v) => match v { + s::ExecutionMode::LocalSize | s::ExecutionMode::LocalSizeId => &[], + s::ExecutionMode::DerivativeGroupLinearNV => { + &[spirv::Capability::ComputeDerivativeGroupLinearNV] + } + s::ExecutionMode::DerivativeGroupQuadsNV => { + &[spirv::Capability::ComputeDerivativeGroupQuadsNV] + } + s::ExecutionMode::DenormFlushToZero => &[spirv::Capability::DenormFlushToZero], + s::ExecutionMode::DenormPreserve => &[spirv::Capability::DenormPreserve], + s::ExecutionMode::NumSIMDWorkitemsINTEL => { + &[spirv::Capability::FPGAKernelAttributesINTEL] + } + s::ExecutionMode::PixelInterlockOrderedEXT + | s::ExecutionMode::PixelInterlockUnorderedEXT => { + &[spirv::Capability::FragmentShaderPixelInterlockEXT] + } + s::ExecutionMode::SampleInterlockOrderedEXT + | s::ExecutionMode::SampleInterlockUnorderedEXT => { + &[spirv::Capability::FragmentShaderSampleInterlockEXT] + } + s::ExecutionMode::ShadingRateInterlockOrderedEXT + | s::ExecutionMode::ShadingRateInterlockUnorderedEXT => { + &[spirv::Capability::FragmentShaderShadingRateInterlockEXT] + } + s::ExecutionMode::Invocations + | s::ExecutionMode::InputPoints + | s::ExecutionMode::InputLines + | s::ExecutionMode::InputLinesAdjacency + | s::ExecutionMode::InputTrianglesAdjacency + | s::ExecutionMode::OutputLineStrip + | s::ExecutionMode::OutputTriangleStrip => &[spirv::Capability::Geometry], + s::ExecutionMode::OutputPoints => &[ + spirv::Capability::Geometry, + spirv::Capability::MeshShadingNV, + ], + s::ExecutionMode::Triangles => { + &[spirv::Capability::Geometry, spirv::Capability::Tessellation] + } + s::ExecutionMode::OutputVertices => &[ + spirv::Capability::Geometry, + spirv::Capability::Tessellation, + spirv::Capability::MeshShadingNV, + ], + s::ExecutionMode::LocalSizeHint + | s::ExecutionMode::VecTypeHint + | s::ExecutionMode::ContractionOff + | s::ExecutionMode::Initializer + | s::ExecutionMode::Finalizer + | s::ExecutionMode::LocalSizeHintId => &[spirv::Capability::Kernel], + s::ExecutionMode::MaxWorkgroupSizeINTEL + | s::ExecutionMode::MaxWorkDimINTEL + | s::ExecutionMode::NoGlobalOffsetINTEL => { + &[spirv::Capability::KernelAttributesINTEL] + } + s::ExecutionMode::OutputLinesNV + | s::ExecutionMode::OutputPrimitivesNV + | s::ExecutionMode::OutputTrianglesNV => &[spirv::Capability::MeshShadingNV], + s::ExecutionMode::RoundingModeRTE => &[spirv::Capability::RoundingModeRTE], + s::ExecutionMode::RoundingModeRTZ => &[spirv::Capability::RoundingModeRTZ], + s::ExecutionMode::PostDepthCoverage => { + &[spirv::Capability::SampleMaskPostDepthCoverage] + } + s::ExecutionMode::PixelCenterInteger + | s::ExecutionMode::OriginUpperLeft + | s::ExecutionMode::OriginLowerLeft + | s::ExecutionMode::EarlyFragmentTests + | s::ExecutionMode::DepthReplacing + | s::ExecutionMode::DepthGreater + | s::ExecutionMode::DepthLess + | s::ExecutionMode::DepthUnchanged => &[spirv::Capability::Shader], + s::ExecutionMode::SignedZeroInfNanPreserve => { + &[spirv::Capability::SignedZeroInfNanPreserve] + } + s::ExecutionMode::StencilRefReplacingEXT => &[spirv::Capability::StencilExportEXT], + s::ExecutionMode::SubgroupSize + | s::ExecutionMode::SubgroupsPerWorkgroup + | s::ExecutionMode::SubgroupsPerWorkgroupId => { + &[spirv::Capability::SubgroupDispatch] + } + s::ExecutionMode::SpacingEqual + | s::ExecutionMode::SpacingFractionalEven + | s::ExecutionMode::SpacingFractionalOdd + | s::ExecutionMode::VertexOrderCw + | s::ExecutionMode::VertexOrderCcw + | s::ExecutionMode::PointMode + | s::ExecutionMode::Quads + | s::ExecutionMode::Isolines => &[spirv::Capability::Tessellation], + s::ExecutionMode::Xfb => &[spirv::Capability::TransformFeedback], + }, + Self::StorageClass(v) => match v { + s::StorageClass::UniformConstant + | s::StorageClass::Input + | s::StorageClass::Workgroup + | s::StorageClass::CrossWorkgroup + | s::StorageClass::Function + | s::StorageClass::Image => &[], + s::StorageClass::AtomicCounter => &[spirv::Capability::AtomicStorage], + s::StorageClass::CodeSectionINTEL => &[spirv::Capability::FunctionPointersINTEL], + s::StorageClass::Generic => &[spirv::Capability::GenericPointer], + s::StorageClass::PhysicalStorageBuffer => { + &[spirv::Capability::PhysicalStorageBufferAddresses] + } + s::StorageClass::CallableDataNV + | s::StorageClass::IncomingCallableDataNV + | s::StorageClass::RayPayloadNV + | s::StorageClass::HitAttributeNV + | s::StorageClass::IncomingRayPayloadNV + | s::StorageClass::ShaderRecordBufferNV => &[ + spirv::Capability::RayTracingNV, + spirv::Capability::RayTracingKHR, + ], + s::StorageClass::Uniform + | s::StorageClass::Output + | s::StorageClass::Private + | s::StorageClass::PushConstant + | s::StorageClass::StorageBuffer => &[spirv::Capability::Shader], + }, + Self::Dim(v) => match v { + s::Dim::Dim3D => &[], + s::Dim::DimSubpassData => &[spirv::Capability::InputAttachment], + s::Dim::Dim1D => &[spirv::Capability::Sampled1D, spirv::Capability::Image1D], + s::Dim::DimBuffer => &[ + spirv::Capability::SampledBuffer, + spirv::Capability::ImageBuffer, + ], + s::Dim::DimRect => &[spirv::Capability::SampledRect, spirv::Capability::ImageRect], + s::Dim::DimCube => &[spirv::Capability::Shader, spirv::Capability::ImageCubeArray], + s::Dim::Dim2D => &[ + spirv::Capability::Shader, + spirv::Capability::Kernel, + spirv::Capability::ImageMSArray, + ], + }, + Self::SamplerAddressingMode(v) => match v { + s::SamplerAddressingMode::None + | s::SamplerAddressingMode::ClampToEdge + | s::SamplerAddressingMode::Clamp + | s::SamplerAddressingMode::Repeat + | s::SamplerAddressingMode::RepeatMirrored => &[spirv::Capability::Kernel], + }, + Self::SamplerFilterMode(v) => match v { + s::SamplerFilterMode::Nearest | s::SamplerFilterMode::Linear => { + &[spirv::Capability::Kernel] + } + }, + Self::ImageFormat(v) => match v { + s::ImageFormat::Unknown => &[], + s::ImageFormat::R64ui | s::ImageFormat::R64i => &[spirv::Capability::Int64ImageEXT], + s::ImageFormat::Rgba32f + | s::ImageFormat::Rgba16f + | s::ImageFormat::R32f + | s::ImageFormat::Rgba8 + | s::ImageFormat::Rgba8Snorm + | s::ImageFormat::Rgba32i + | s::ImageFormat::Rgba16i + | s::ImageFormat::Rgba8i + | s::ImageFormat::R32i + | s::ImageFormat::Rgba32ui + | s::ImageFormat::Rgba16ui + | s::ImageFormat::Rgba8ui + | s::ImageFormat::R32ui => &[spirv::Capability::Shader], + s::ImageFormat::Rg32f + | s::ImageFormat::Rg16f + | s::ImageFormat::R11fG11fB10f + | s::ImageFormat::R16f + | s::ImageFormat::Rgba16 + | s::ImageFormat::Rgb10A2 + | s::ImageFormat::Rg16 + | s::ImageFormat::Rg8 + | s::ImageFormat::R16 + | s::ImageFormat::R8 + | s::ImageFormat::Rgba16Snorm + | s::ImageFormat::Rg16Snorm + | s::ImageFormat::Rg8Snorm + | s::ImageFormat::R16Snorm + | s::ImageFormat::R8Snorm + | s::ImageFormat::Rg32i + | s::ImageFormat::Rg16i + | s::ImageFormat::Rg8i + | s::ImageFormat::R16i + | s::ImageFormat::R8i + | s::ImageFormat::Rgb10a2ui + | s::ImageFormat::Rg32ui + | s::ImageFormat::Rg16ui + | s::ImageFormat::Rg8ui + | s::ImageFormat::R16ui + | s::ImageFormat::R8ui => &[spirv::Capability::StorageImageExtendedFormats], + }, + Self::ImageChannelOrder(v) => match v { + s::ImageChannelOrder::R + | s::ImageChannelOrder::A + | s::ImageChannelOrder::RG + | s::ImageChannelOrder::RA + | s::ImageChannelOrder::RGB + | s::ImageChannelOrder::RGBA + | s::ImageChannelOrder::BGRA + | s::ImageChannelOrder::ARGB + | s::ImageChannelOrder::Intensity + | s::ImageChannelOrder::Luminance + | s::ImageChannelOrder::Rx + | s::ImageChannelOrder::RGx + | s::ImageChannelOrder::RGBx + | s::ImageChannelOrder::Depth + | s::ImageChannelOrder::DepthStencil + | s::ImageChannelOrder::sRGB + | s::ImageChannelOrder::sRGBx + | s::ImageChannelOrder::sRGBA + | s::ImageChannelOrder::sBGRA + | s::ImageChannelOrder::ABGR => &[spirv::Capability::Kernel], + }, + Self::ImageChannelDataType(v) => match v { + s::ImageChannelDataType::SnormInt8 + | s::ImageChannelDataType::SnormInt16 + | s::ImageChannelDataType::UnormInt8 + | s::ImageChannelDataType::UnormInt16 + | s::ImageChannelDataType::UnormShort565 + | s::ImageChannelDataType::UnormShort555 + | s::ImageChannelDataType::UnormInt101010 + | s::ImageChannelDataType::SignedInt8 + | s::ImageChannelDataType::SignedInt16 + | s::ImageChannelDataType::SignedInt32 + | s::ImageChannelDataType::UnsignedInt8 + | s::ImageChannelDataType::UnsignedInt16 + | s::ImageChannelDataType::UnsignedInt32 + | s::ImageChannelDataType::HalfFloat + | s::ImageChannelDataType::Float + | s::ImageChannelDataType::UnormInt24 + | s::ImageChannelDataType::UnormInt101010_2 => &[spirv::Capability::Kernel], + }, + Self::FPRoundingMode(v) => match v { + s::FPRoundingMode::RTE + | s::FPRoundingMode::RTZ + | s::FPRoundingMode::RTP + | s::FPRoundingMode::RTN => &[], + }, + Self::LinkageType(v) => match v { + s::LinkageType::Export | s::LinkageType::Import => &[spirv::Capability::Linkage], + }, + Self::AccessQualifier(v) => match v { + s::AccessQualifier::ReadOnly + | s::AccessQualifier::WriteOnly + | s::AccessQualifier::ReadWrite => &[spirv::Capability::Kernel], + }, + Self::FunctionParameterAttribute(v) => match v { + s::FunctionParameterAttribute::Zext + | s::FunctionParameterAttribute::Sext + | s::FunctionParameterAttribute::ByVal + | s::FunctionParameterAttribute::Sret + | s::FunctionParameterAttribute::NoAlias + | s::FunctionParameterAttribute::NoCapture + | s::FunctionParameterAttribute::NoWrite + | s::FunctionParameterAttribute::NoReadWrite => &[spirv::Capability::Kernel], + }, + Self::Decoration(v) => match v { + s::Decoration::BuiltIn + | s::Decoration::Restrict + | s::Decoration::Aliased + | s::Decoration::Volatile + | s::Decoration::Coherent + | s::Decoration::NonWritable + | s::Decoration::NonReadable + | s::Decoration::FPRoundingMode + | s::Decoration::NoSignedWrap + | s::Decoration::NoUnsignedWrap + | s::Decoration::ExplicitInterpAMD + | s::Decoration::CounterBuffer + | s::Decoration::UserSemantic + | s::Decoration::UserTypeGOOGLE => &[], + s::Decoration::MaxByteOffset | s::Decoration::MaxByteOffsetId => { + &[spirv::Capability::Addresses] + } + s::Decoration::RegisterINTEL + | s::Decoration::MemoryINTEL + | s::Decoration::NumbanksINTEL + | s::Decoration::BankwidthINTEL + | s::Decoration::MaxPrivateCopiesINTEL + | s::Decoration::SinglepumpINTEL + | s::Decoration::DoublepumpINTEL + | s::Decoration::MaxReplicatesINTEL + | s::Decoration::SimpleDualPortINTEL + | s::Decoration::MergeINTEL + | s::Decoration::BankBitsINTEL + | s::Decoration::ForcePow2DepthINTEL => { + &[spirv::Capability::FPGAMemoryAttributesINTEL] + } + s::Decoration::PerVertexNV => &[spirv::Capability::FragmentBarycentricNV], + s::Decoration::PassthroughNV => &[spirv::Capability::GeometryShaderPassthroughNV], + s::Decoration::Stream => &[spirv::Capability::GeometryStreams], + s::Decoration::ReferencedIndirectlyINTEL => { + &[spirv::Capability::IndirectReferencesINTEL] + } + s::Decoration::InputAttachmentIndex => &[spirv::Capability::InputAttachment], + s::Decoration::CPacked + | s::Decoration::Constant + | s::Decoration::SaturatedConversion + | s::Decoration::FuncParamAttr + | s::Decoration::FPFastMathMode + | s::Decoration::Alignment + | s::Decoration::AlignmentId => &[spirv::Capability::Kernel], + s::Decoration::LinkageAttributes => &[spirv::Capability::Linkage], + s::Decoration::RowMajor | s::Decoration::ColMajor | s::Decoration::MatrixStride => { + &[spirv::Capability::Matrix] + } + s::Decoration::PerPrimitiveNV + | s::Decoration::PerViewNV + | s::Decoration::PerTaskNV => &[spirv::Capability::MeshShadingNV], + s::Decoration::RestrictPointer | s::Decoration::AliasedPointer => { + &[spirv::Capability::PhysicalStorageBufferAddresses] + } + s::Decoration::OverrideCoverageNV => { + &[spirv::Capability::SampleMaskOverrideCoverageNV] + } + s::Decoration::Sample => &[spirv::Capability::SampleRateShading], + s::Decoration::RelaxedPrecision + | s::Decoration::Block + | s::Decoration::BufferBlock + | s::Decoration::ArrayStride + | s::Decoration::GLSLShared + | s::Decoration::GLSLPacked + | s::Decoration::NoPerspective + | s::Decoration::Flat + | s::Decoration::Centroid + | s::Decoration::Invariant + | s::Decoration::Uniform + | s::Decoration::UniformId + | s::Decoration::Location + | s::Decoration::Component + | s::Decoration::Index + | s::Decoration::Binding + | s::Decoration::DescriptorSet + | s::Decoration::Offset + | s::Decoration::NoContraction => &[spirv::Capability::Shader], + s::Decoration::SpecId => &[spirv::Capability::Shader, spirv::Capability::Kernel], + s::Decoration::NonUniform => &[spirv::Capability::ShaderNonUniform], + s::Decoration::SecondaryViewportRelativeNV => { + &[spirv::Capability::ShaderStereoViewNV] + } + s::Decoration::ViewportRelativeNV => &[spirv::Capability::ShaderViewportMaskNV], + s::Decoration::Patch => &[spirv::Capability::Tessellation], + s::Decoration::XfbBuffer | s::Decoration::XfbStride => { + &[spirv::Capability::TransformFeedback] + } + }, + Self::BuiltIn(v) => match v { + s::BuiltIn::NumWorkgroups + | s::BuiltIn::WorkgroupSize + | s::BuiltIn::WorkgroupId + | s::BuiltIn::LocalInvocationId + | s::BuiltIn::GlobalInvocationId + | s::BuiltIn::LocalInvocationIndex + | s::BuiltIn::BaryCoordNoPerspAMD + | s::BuiltIn::BaryCoordNoPerspCentroidAMD + | s::BuiltIn::BaryCoordNoPerspSampleAMD + | s::BuiltIn::BaryCoordSmoothAMD + | s::BuiltIn::BaryCoordSmoothCentroidAMD + | s::BuiltIn::BaryCoordSmoothSampleAMD + | s::BuiltIn::BaryCoordPullModelAMD => &[], + s::BuiltIn::ClipDistance => &[spirv::Capability::ClipDistance], + s::BuiltIn::CullDistance => &[spirv::Capability::CullDistance], + s::BuiltIn::DeviceIndex => &[spirv::Capability::DeviceGroup], + s::BuiltIn::BaseVertex | s::BuiltIn::BaseInstance => { + &[spirv::Capability::DrawParameters] + } + s::BuiltIn::DrawIndex => &[ + spirv::Capability::DrawParameters, + spirv::Capability::MeshShadingNV, + ], + s::BuiltIn::BaryCoordNV | s::BuiltIn::BaryCoordNoPerspNV => { + &[spirv::Capability::FragmentBarycentricNV] + } + s::BuiltIn::FragSizeEXT | s::BuiltIn::FragInvocationCountEXT => &[ + spirv::Capability::FragmentDensityEXT, + spirv::Capability::ShadingRateNV, + ], + s::BuiltIn::FullyCoveredEXT => &[spirv::Capability::FragmentFullyCoveredEXT], + s::BuiltIn::PrimitiveShadingRateKHR | s::BuiltIn::ShadingRateKHR => { + &[spirv::Capability::FragmentShadingRateKHR] + } + s::BuiltIn::Layer => &[ + spirv::Capability::Geometry, + spirv::Capability::ShaderLayer, + spirv::Capability::ShaderViewportIndexLayerEXT, + spirv::Capability::MeshShadingNV, + ], + s::BuiltIn::InvocationId => { + &[spirv::Capability::Geometry, spirv::Capability::Tessellation] + } + s::BuiltIn::PrimitiveId => &[ + spirv::Capability::Geometry, + spirv::Capability::Tessellation, + spirv::Capability::RayTracingNV, + spirv::Capability::RayTracingKHR, + spirv::Capability::MeshShadingNV, + ], + s::BuiltIn::WorkDim + | s::BuiltIn::GlobalSize + | s::BuiltIn::EnqueuedWorkgroupSize + | s::BuiltIn::GlobalOffset + | s::BuiltIn::GlobalLinearId + | s::BuiltIn::SubgroupMaxSize + | s::BuiltIn::NumEnqueuedSubgroups => &[spirv::Capability::Kernel], + s::BuiltIn::NumSubgroups | s::BuiltIn::SubgroupId => &[ + spirv::Capability::Kernel, + spirv::Capability::GroupNonUniform, + ], + s::BuiltIn::SubgroupSize | s::BuiltIn::SubgroupLocalInvocationId => &[ + spirv::Capability::Kernel, + spirv::Capability::GroupNonUniform, + spirv::Capability::SubgroupBallotKHR, + ], + s::BuiltIn::TaskCountNV + | s::BuiltIn::PrimitiveCountNV + | s::BuiltIn::PrimitiveIndicesNV + | s::BuiltIn::ClipDistancePerViewNV + | s::BuiltIn::CullDistancePerViewNV + | s::BuiltIn::LayerPerViewNV + | s::BuiltIn::MeshViewCountNV + | s::BuiltIn::MeshViewIndicesNV => &[spirv::Capability::MeshShadingNV], + s::BuiltIn::ViewIndex => &[spirv::Capability::MultiView], + s::BuiltIn::ViewportIndex => &[ + spirv::Capability::MultiViewport, + spirv::Capability::ShaderViewportIndex, + spirv::Capability::ShaderViewportIndexLayerEXT, + spirv::Capability::MeshShadingNV, + ], + s::BuiltIn::PositionPerViewNV | s::BuiltIn::ViewportMaskPerViewNV => &[ + spirv::Capability::PerViewAttributesNV, + spirv::Capability::MeshShadingNV, + ], + s::BuiltIn::RayGeometryIndexKHR => &[spirv::Capability::RayTracingKHR], + s::BuiltIn::HitTNV => &[spirv::Capability::RayTracingNV], + s::BuiltIn::LaunchIdNV + | s::BuiltIn::LaunchSizeNV + | s::BuiltIn::WorldRayOriginNV + | s::BuiltIn::WorldRayDirectionNV + | s::BuiltIn::ObjectRayOriginNV + | s::BuiltIn::ObjectRayDirectionNV + | s::BuiltIn::RayTminNV + | s::BuiltIn::RayTmaxNV + | s::BuiltIn::InstanceCustomIndexNV + | s::BuiltIn::ObjectToWorldNV + | s::BuiltIn::WorldToObjectNV + | s::BuiltIn::HitKindNV + | s::BuiltIn::IncomingRayFlagsNV => &[ + spirv::Capability::RayTracingNV, + spirv::Capability::RayTracingKHR, + ], + s::BuiltIn::SampleId | s::BuiltIn::SamplePosition => { + &[spirv::Capability::SampleRateShading] + } + s::BuiltIn::Position + | s::BuiltIn::PointSize + | s::BuiltIn::VertexId + | s::BuiltIn::InstanceId + | s::BuiltIn::FragCoord + | s::BuiltIn::PointCoord + | s::BuiltIn::FrontFacing + | s::BuiltIn::SampleMask + | s::BuiltIn::FragDepth + | s::BuiltIn::HelperInvocation + | s::BuiltIn::VertexIndex + | s::BuiltIn::InstanceIndex => &[spirv::Capability::Shader], + s::BuiltIn::WarpsPerSMNV + | s::BuiltIn::SMCountNV + | s::BuiltIn::WarpIDNV + | s::BuiltIn::SMIDNV => &[spirv::Capability::ShaderSMBuiltinsNV], + s::BuiltIn::SecondaryPositionNV | s::BuiltIn::SecondaryViewportMaskNV => { + &[spirv::Capability::ShaderStereoViewNV] + } + s::BuiltIn::ViewportMaskNV => &[ + spirv::Capability::ShaderViewportMaskNV, + spirv::Capability::MeshShadingNV, + ], + s::BuiltIn::FragStencilRefEXT => &[spirv::Capability::StencilExportEXT], + s::BuiltIn::SubgroupEqMask + | s::BuiltIn::SubgroupGeMask + | s::BuiltIn::SubgroupGtMask + | s::BuiltIn::SubgroupLeMask + | s::BuiltIn::SubgroupLtMask => &[ + spirv::Capability::SubgroupBallotKHR, + spirv::Capability::GroupNonUniformBallot, + ], + s::BuiltIn::TessLevelOuter + | s::BuiltIn::TessLevelInner + | s::BuiltIn::TessCoord + | s::BuiltIn::PatchVertices => &[spirv::Capability::Tessellation], + }, + Self::Scope(v) => match v { + s::Scope::CrossDevice + | s::Scope::Device + | s::Scope::Workgroup + | s::Scope::Subgroup + | s::Scope::Invocation => &[], + s::Scope::ShaderCallKHR => &[spirv::Capability::RayTracingKHR], + s::Scope::QueueFamily => &[spirv::Capability::VulkanMemoryModel], + }, + Self::GroupOperation(v) => match v { + s::GroupOperation::ClusteredReduce => { + &[spirv::Capability::GroupNonUniformClustered] + } + s::GroupOperation::PartitionedReduceNV + | s::GroupOperation::PartitionedInclusiveScanNV + | s::GroupOperation::PartitionedExclusiveScanNV => { + &[spirv::Capability::GroupNonUniformPartitionedNV] + } + s::GroupOperation::Reduce + | s::GroupOperation::InclusiveScan + | s::GroupOperation::ExclusiveScan => &[ + spirv::Capability::Kernel, + spirv::Capability::GroupNonUniformArithmetic, + spirv::Capability::GroupNonUniformBallot, + ], + }, + Self::KernelEnqueueFlags(v) => match v { + s::KernelEnqueueFlags::NoWait + | s::KernelEnqueueFlags::WaitKernel + | s::KernelEnqueueFlags::WaitWorkGroup => &[spirv::Capability::Kernel], + }, + Self::Capability(v) => match v { + s::Capability::Matrix + | s::Capability::Addresses + | s::Capability::Linkage + | s::Capability::Kernel + | s::Capability::Float16 + | s::Capability::Float64 + | s::Capability::Int64 + | s::Capability::Groups + | s::Capability::Int16 + | s::Capability::Int8 + | s::Capability::Sampled1D + | s::Capability::SampledBuffer + | s::Capability::GroupNonUniform + | s::Capability::ShaderLayer + | s::Capability::ShaderViewportIndex + | s::Capability::SubgroupBallotKHR + | s::Capability::SubgroupVoteKHR + | s::Capability::StorageBuffer16BitAccess + | s::Capability::StoragePushConstant16 + | s::Capability::StorageInputOutput16 + | s::Capability::DeviceGroup + | s::Capability::AtomicStorageOps + | s::Capability::SampleMaskPostDepthCoverage + | s::Capability::StorageBuffer8BitAccess + | s::Capability::StoragePushConstant8 + | s::Capability::DenormPreserve + | s::Capability::DenormFlushToZero + | s::Capability::SignedZeroInfNanPreserve + | s::Capability::RoundingModeRTE + | s::Capability::RoundingModeRTZ + | s::Capability::ImageFootprintNV + | s::Capability::FragmentBarycentricNV + | s::Capability::ComputeDerivativeGroupQuadsNV + | s::Capability::GroupNonUniformPartitionedNV + | s::Capability::VulkanMemoryModel + | s::Capability::VulkanMemoryModelDeviceScope + | s::Capability::ComputeDerivativeGroupLinearNV + | s::Capability::SubgroupShuffleINTEL + | s::Capability::SubgroupBufferBlockIOINTEL + | s::Capability::SubgroupImageBlockIOINTEL + | s::Capability::SubgroupImageMediaBlockIOINTEL + | s::Capability::FunctionPointersINTEL + | s::Capability::IndirectReferencesINTEL + | s::Capability::SubgroupAvcMotionEstimationINTEL + | s::Capability::SubgroupAvcMotionEstimationIntraINTEL + | s::Capability::SubgroupAvcMotionEstimationChromaINTEL + | s::Capability::FPGAMemoryAttributesINTEL + | s::Capability::UnstructuredLoopControlsINTEL + | s::Capability::FPGALoopControlsINTEL + | s::Capability::KernelAttributesINTEL + | s::Capability::FPGAKernelAttributesINTEL + | s::Capability::BlockingPipesINTEL + | s::Capability::FPGARegINTEL => &[], + s::Capability::GenericPointer => &[spirv::Capability::Addresses], + s::Capability::SubgroupDispatch => &[spirv::Capability::DeviceEnqueue], + s::Capability::GeometryPointSize + | s::Capability::GeometryStreams + | s::Capability::MultiViewport + | s::Capability::GeometryShaderPassthroughNV => &[spirv::Capability::Geometry], + s::Capability::GroupNonUniformVote + | s::Capability::GroupNonUniformArithmetic + | s::Capability::GroupNonUniformBallot + | s::Capability::GroupNonUniformShuffle + | s::Capability::GroupNonUniformShuffleRelative + | s::Capability::GroupNonUniformClustered + | s::Capability::GroupNonUniformQuad => &[spirv::Capability::GroupNonUniform], + s::Capability::ImageReadWrite | s::Capability::ImageMipmap => { + &[spirv::Capability::ImageBasic] + } + s::Capability::StorageTexelBufferArrayDynamicIndexing => { + &[spirv::Capability::ImageBuffer] + } + s::Capability::StorageTexelBufferArrayNonUniformIndexing => &[ + spirv::Capability::ImageBuffer, + spirv::Capability::ShaderNonUniform, + ], + s::Capability::InputAttachmentArrayDynamicIndexing => { + &[spirv::Capability::InputAttachment] + } + s::Capability::InputAttachmentArrayNonUniformIndexing => &[ + spirv::Capability::InputAttachment, + spirv::Capability::ShaderNonUniform, + ], + s::Capability::Int64Atomics => &[spirv::Capability::Int64], + s::Capability::Vector16 + | s::Capability::Float16Buffer + | s::Capability::ImageBasic + | s::Capability::Pipes + | s::Capability::DeviceEnqueue + | s::Capability::LiteralSampler + | s::Capability::NamedBarrier => &[spirv::Capability::Kernel], + s::Capability::Shader => &[spirv::Capability::Matrix], + s::Capability::PerViewAttributesNV => &[spirv::Capability::MultiView], + s::Capability::ShaderViewportIndexLayerEXT => &[spirv::Capability::MultiViewport], + s::Capability::PipeStorage => &[spirv::Capability::Pipes], + s::Capability::RayTraversalPrimitiveCullingKHR => &[ + spirv::Capability::RayQueryKHR, + spirv::Capability::RayTracingKHR, + ], + s::Capability::SampleMaskOverrideCoverageNV => { + &[spirv::Capability::SampleRateShading] + } + s::Capability::Image1D => &[spirv::Capability::Sampled1D], + s::Capability::ImageBuffer + | s::Capability::UniformTexelBufferArrayDynamicIndexing => { + &[spirv::Capability::SampledBuffer] + } + s::Capability::UniformTexelBufferArrayNonUniformIndexing => &[ + spirv::Capability::SampledBuffer, + spirv::Capability::ShaderNonUniform, + ], + s::Capability::ImageCubeArray => &[spirv::Capability::SampledCubeArray], + s::Capability::ImageRect => &[spirv::Capability::SampledRect], + s::Capability::Geometry + | s::Capability::Tessellation + | s::Capability::AtomicStorage + | s::Capability::ImageGatherExtended + | s::Capability::StorageImageMultisample + | s::Capability::UniformBufferArrayDynamicIndexing + | s::Capability::SampledImageArrayDynamicIndexing + | s::Capability::StorageBufferArrayDynamicIndexing + | s::Capability::StorageImageArrayDynamicIndexing + | s::Capability::ClipDistance + | s::Capability::CullDistance + | s::Capability::SampleRateShading + | s::Capability::SampledRect + | s::Capability::InputAttachment + | s::Capability::SparseResidency + | s::Capability::MinLod + | s::Capability::SampledCubeArray + | s::Capability::ImageMSArray + | s::Capability::StorageImageExtendedFormats + | s::Capability::ImageQuery + | s::Capability::DerivativeControl + | s::Capability::InterpolationFunction + | s::Capability::TransformFeedback + | s::Capability::StorageImageReadWithoutFormat + | s::Capability::StorageImageWriteWithoutFormat + | s::Capability::FragmentShadingRateKHR + | s::Capability::DrawParameters + | s::Capability::MultiView + | s::Capability::VariablePointersStorageBuffer + | s::Capability::RayQueryProvisionalKHR + | s::Capability::RayQueryKHR + | s::Capability::RayTracingKHR + | s::Capability::Float16ImageAMD + | s::Capability::ImageGatherBiasLodAMD + | s::Capability::FragmentMaskAMD + | s::Capability::StencilExportEXT + | s::Capability::ImageReadWriteLodAMD + | s::Capability::Int64ImageEXT + | s::Capability::ShaderClockKHR + | s::Capability::FragmentFullyCoveredEXT + | s::Capability::MeshShadingNV + | s::Capability::FragmentDensityEXT + | s::Capability::ShaderNonUniform + | s::Capability::RuntimeDescriptorArray + | s::Capability::RayTracingNV + | s::Capability::PhysicalStorageBufferAddresses + | s::Capability::RayTracingProvisionalKHR + | s::Capability::CooperativeMatrixNV + | s::Capability::FragmentShaderSampleInterlockEXT + | s::Capability::FragmentShaderShadingRateInterlockEXT + | s::Capability::ShaderSMBuiltinsNV + | s::Capability::FragmentShaderPixelInterlockEXT + | s::Capability::DemoteToHelperInvocationEXT + | s::Capability::IntegerFunctions2INTEL + | s::Capability::AtomicFloat32AddEXT + | s::Capability::AtomicFloat64AddEXT => &[spirv::Capability::Shader], + s::Capability::UniformBufferArrayNonUniformIndexing + | s::Capability::SampledImageArrayNonUniformIndexing + | s::Capability::StorageBufferArrayNonUniformIndexing + | s::Capability::StorageImageArrayNonUniformIndexing => { + &[spirv::Capability::ShaderNonUniform] + } + s::Capability::ShaderViewportMaskNV => { + &[spirv::Capability::ShaderViewportIndexLayerNV] + } + s::Capability::ShaderStereoViewNV => &[spirv::Capability::ShaderViewportMaskNV], + s::Capability::UniformAndStorageBuffer16BitAccess => &[ + spirv::Capability::StorageBuffer16BitAccess, + spirv::Capability::StorageUniformBufferBlock16, + ], + s::Capability::UniformAndStorageBuffer8BitAccess => { + &[spirv::Capability::StorageBuffer8BitAccess] + } + s::Capability::TessellationPointSize => &[spirv::Capability::Tessellation], + s::Capability::VariablePointers => { + &[spirv::Capability::VariablePointersStorageBuffer] + } + }, + Self::RayQueryIntersection(v) => match v { + s::RayQueryIntersection::RayQueryCandidateIntersectionKHR + | s::RayQueryIntersection::RayQueryCommittedIntersectionKHR => { + &[spirv::Capability::RayQueryKHR] + } + }, + Self::RayQueryCommittedIntersectionType(v) => match v { + s::RayQueryCommittedIntersectionType::RayQueryCommittedIntersectionNoneKHR + | s::RayQueryCommittedIntersectionType::RayQueryCommittedIntersectionTriangleKHR + | s::RayQueryCommittedIntersectionType::RayQueryCommittedIntersectionGeneratedKHR => { + &[spirv::Capability::RayQueryKHR] + } + }, + Self::RayQueryCandidateIntersectionType(v) => match v { + s::RayQueryCandidateIntersectionType::RayQueryCandidateIntersectionTriangleKHR + | s::RayQueryCandidateIntersectionType::RayQueryCandidateIntersectionAABBKHR => { + &[spirv::Capability::RayQueryKHR] + } + }, + _ => &[], + } + } + pub fn required_extensions(&self) -> &'static [&'static str] { + use spirv as s; + match self { + Self::SourceLanguage(v) => match v { + s::SourceLanguage::Unknown + | s::SourceLanguage::ESSL + | s::SourceLanguage::GLSL + | s::SourceLanguage::OpenCL_C + | s::SourceLanguage::OpenCL_CPP + | s::SourceLanguage::HLSL => &[], + }, + Self::ExecutionModel(v) => match v { + s::ExecutionModel::Vertex + | s::ExecutionModel::TessellationControl + | s::ExecutionModel::TessellationEvaluation + | s::ExecutionModel::Geometry + | s::ExecutionModel::Fragment + | s::ExecutionModel::GLCompute + | s::ExecutionModel::Kernel + | s::ExecutionModel::TaskNV + | s::ExecutionModel::MeshNV + | s::ExecutionModel::RayGenerationNV + | s::ExecutionModel::IntersectionNV + | s::ExecutionModel::AnyHitNV + | s::ExecutionModel::ClosestHitNV + | s::ExecutionModel::MissNV + | s::ExecutionModel::CallableNV => &[], + }, + Self::AddressingModel(v) => match v { + s::AddressingModel::Logical + | s::AddressingModel::Physical32 + | s::AddressingModel::Physical64 => &[], + s::AddressingModel::PhysicalStorageBuffer64 => &[ + "SPV_EXT_physical_storage_buffer", + "SPV_KHR_physical_storage_buffer", + ], + }, + Self::MemoryModel(v) => match v { + s::MemoryModel::Simple + | s::MemoryModel::GLSL450 + | s::MemoryModel::OpenCL + | s::MemoryModel::Vulkan => &[], + }, + Self::ExecutionMode(v) => match v { + s::ExecutionMode::Invocations + | s::ExecutionMode::SpacingEqual + | s::ExecutionMode::SpacingFractionalEven + | s::ExecutionMode::SpacingFractionalOdd + | s::ExecutionMode::VertexOrderCw + | s::ExecutionMode::VertexOrderCcw + | s::ExecutionMode::PixelCenterInteger + | s::ExecutionMode::OriginUpperLeft + | s::ExecutionMode::OriginLowerLeft + | s::ExecutionMode::EarlyFragmentTests + | s::ExecutionMode::PointMode + | s::ExecutionMode::Xfb + | s::ExecutionMode::DepthReplacing + | s::ExecutionMode::DepthGreater + | s::ExecutionMode::DepthLess + | s::ExecutionMode::DepthUnchanged + | s::ExecutionMode::LocalSize + | s::ExecutionMode::LocalSizeHint + | s::ExecutionMode::InputPoints + | s::ExecutionMode::InputLines + | s::ExecutionMode::InputLinesAdjacency + | s::ExecutionMode::Triangles + | s::ExecutionMode::InputTrianglesAdjacency + | s::ExecutionMode::Quads + | s::ExecutionMode::Isolines + | s::ExecutionMode::OutputVertices + | s::ExecutionMode::OutputPoints + | s::ExecutionMode::OutputLineStrip + | s::ExecutionMode::OutputTriangleStrip + | s::ExecutionMode::VecTypeHint + | s::ExecutionMode::ContractionOff + | s::ExecutionMode::Initializer + | s::ExecutionMode::Finalizer + | s::ExecutionMode::SubgroupSize + | s::ExecutionMode::SubgroupsPerWorkgroup + | s::ExecutionMode::SubgroupsPerWorkgroupId + | s::ExecutionMode::LocalSizeId + | s::ExecutionMode::LocalSizeHintId => &[], + s::ExecutionMode::PixelInterlockOrderedEXT + | s::ExecutionMode::PixelInterlockUnorderedEXT + | s::ExecutionMode::SampleInterlockOrderedEXT + | s::ExecutionMode::SampleInterlockUnorderedEXT + | s::ExecutionMode::ShadingRateInterlockOrderedEXT + | s::ExecutionMode::ShadingRateInterlockUnorderedEXT => { + &["SPV_EXT_fragment_shader_interlock"] + } + s::ExecutionMode::StencilRefReplacingEXT => &["SPV_EXT_shader_stencil_export"], + s::ExecutionMode::MaxWorkgroupSizeINTEL + | s::ExecutionMode::MaxWorkDimINTEL + | s::ExecutionMode::NoGlobalOffsetINTEL + | s::ExecutionMode::NumSIMDWorkitemsINTEL => &["SPV_INTEL_kernel_attributes"], + s::ExecutionMode::DenormPreserve + | s::ExecutionMode::DenormFlushToZero + | s::ExecutionMode::SignedZeroInfNanPreserve + | s::ExecutionMode::RoundingModeRTE + | s::ExecutionMode::RoundingModeRTZ => &["SPV_KHR_float_controls"], + s::ExecutionMode::PostDepthCoverage => &["SPV_KHR_post_depth_coverage"], + s::ExecutionMode::DerivativeGroupQuadsNV + | s::ExecutionMode::DerivativeGroupLinearNV => { + &["SPV_NV_compute_shader_derivatives"] + } + s::ExecutionMode::OutputLinesNV + | s::ExecutionMode::OutputPrimitivesNV + | s::ExecutionMode::OutputTrianglesNV => &["SPV_NV_mesh_shader"], + }, + Self::StorageClass(v) => match v { + s::StorageClass::UniformConstant + | s::StorageClass::Input + | s::StorageClass::Uniform + | s::StorageClass::Output + | s::StorageClass::Workgroup + | s::StorageClass::CrossWorkgroup + | s::StorageClass::Private + | s::StorageClass::Function + | s::StorageClass::Generic + | s::StorageClass::PushConstant + | s::StorageClass::AtomicCounter + | s::StorageClass::Image => &[], + s::StorageClass::PhysicalStorageBuffer => &[ + "SPV_EXT_physical_storage_buffer", + "SPV_KHR_physical_storage_buffer", + ], + s::StorageClass::CodeSectionINTEL => &["SPV_INTEL_function_pointers"], + s::StorageClass::StorageBuffer => &[ + "SPV_KHR_storage_buffer_storage_class", + "SPV_KHR_variable_pointers", + ], + s::StorageClass::CallableDataNV + | s::StorageClass::IncomingCallableDataNV + | s::StorageClass::RayPayloadNV + | s::StorageClass::HitAttributeNV + | s::StorageClass::IncomingRayPayloadNV + | s::StorageClass::ShaderRecordBufferNV => { + &["SPV_NV_ray_tracing", "SPV_KHR_ray_tracing"] + } + }, + Self::Dim(v) => match v { + s::Dim::Dim1D + | s::Dim::Dim2D + | s::Dim::Dim3D + | s::Dim::DimCube + | s::Dim::DimRect + | s::Dim::DimBuffer + | s::Dim::DimSubpassData => &[], + }, + Self::SamplerAddressingMode(v) => match v { + s::SamplerAddressingMode::None + | s::SamplerAddressingMode::ClampToEdge + | s::SamplerAddressingMode::Clamp + | s::SamplerAddressingMode::Repeat + | s::SamplerAddressingMode::RepeatMirrored => &[], + }, + Self::SamplerFilterMode(v) => match v { + s::SamplerFilterMode::Nearest | s::SamplerFilterMode::Linear => &[], + }, + Self::ImageFormat(v) => match v { + s::ImageFormat::Unknown + | s::ImageFormat::Rgba32f + | s::ImageFormat::Rgba16f + | s::ImageFormat::R32f + | s::ImageFormat::Rgba8 + | s::ImageFormat::Rgba8Snorm + | s::ImageFormat::Rg32f + | s::ImageFormat::Rg16f + | s::ImageFormat::R11fG11fB10f + | s::ImageFormat::R16f + | s::ImageFormat::Rgba16 + | s::ImageFormat::Rgb10A2 + | s::ImageFormat::Rg16 + | s::ImageFormat::Rg8 + | s::ImageFormat::R16 + | s::ImageFormat::R8 + | s::ImageFormat::Rgba16Snorm + | s::ImageFormat::Rg16Snorm + | s::ImageFormat::Rg8Snorm + | s::ImageFormat::R16Snorm + | s::ImageFormat::R8Snorm + | s::ImageFormat::Rgba32i + | s::ImageFormat::Rgba16i + | s::ImageFormat::Rgba8i + | s::ImageFormat::R32i + | s::ImageFormat::Rg32i + | s::ImageFormat::Rg16i + | s::ImageFormat::Rg8i + | s::ImageFormat::R16i + | s::ImageFormat::R8i + | s::ImageFormat::Rgba32ui + | s::ImageFormat::Rgba16ui + | s::ImageFormat::Rgba8ui + | s::ImageFormat::R32ui + | s::ImageFormat::Rgb10a2ui + | s::ImageFormat::Rg32ui + | s::ImageFormat::Rg16ui + | s::ImageFormat::Rg8ui + | s::ImageFormat::R16ui + | s::ImageFormat::R8ui + | s::ImageFormat::R64ui + | s::ImageFormat::R64i => &[], + }, + Self::ImageChannelOrder(v) => match v { + s::ImageChannelOrder::R + | s::ImageChannelOrder::A + | s::ImageChannelOrder::RG + | s::ImageChannelOrder::RA + | s::ImageChannelOrder::RGB + | s::ImageChannelOrder::RGBA + | s::ImageChannelOrder::BGRA + | s::ImageChannelOrder::ARGB + | s::ImageChannelOrder::Intensity + | s::ImageChannelOrder::Luminance + | s::ImageChannelOrder::Rx + | s::ImageChannelOrder::RGx + | s::ImageChannelOrder::RGBx + | s::ImageChannelOrder::Depth + | s::ImageChannelOrder::DepthStencil + | s::ImageChannelOrder::sRGB + | s::ImageChannelOrder::sRGBx + | s::ImageChannelOrder::sRGBA + | s::ImageChannelOrder::sBGRA + | s::ImageChannelOrder::ABGR => &[], + }, + Self::ImageChannelDataType(v) => match v { + s::ImageChannelDataType::SnormInt8 + | s::ImageChannelDataType::SnormInt16 + | s::ImageChannelDataType::UnormInt8 + | s::ImageChannelDataType::UnormInt16 + | s::ImageChannelDataType::UnormShort565 + | s::ImageChannelDataType::UnormShort555 + | s::ImageChannelDataType::UnormInt101010 + | s::ImageChannelDataType::SignedInt8 + | s::ImageChannelDataType::SignedInt16 + | s::ImageChannelDataType::SignedInt32 + | s::ImageChannelDataType::UnsignedInt8 + | s::ImageChannelDataType::UnsignedInt16 + | s::ImageChannelDataType::UnsignedInt32 + | s::ImageChannelDataType::HalfFloat + | s::ImageChannelDataType::Float + | s::ImageChannelDataType::UnormInt24 + | s::ImageChannelDataType::UnormInt101010_2 => &[], + }, + Self::FPRoundingMode(v) => match v { + s::FPRoundingMode::RTE + | s::FPRoundingMode::RTZ + | s::FPRoundingMode::RTP + | s::FPRoundingMode::RTN => &[], + }, + Self::LinkageType(v) => match v { + s::LinkageType::Export | s::LinkageType::Import => &[], + }, + Self::AccessQualifier(v) => match v { + s::AccessQualifier::ReadOnly + | s::AccessQualifier::WriteOnly + | s::AccessQualifier::ReadWrite => &[], + }, + Self::FunctionParameterAttribute(v) => match v { + s::FunctionParameterAttribute::Zext + | s::FunctionParameterAttribute::Sext + | s::FunctionParameterAttribute::ByVal + | s::FunctionParameterAttribute::Sret + | s::FunctionParameterAttribute::NoAlias + | s::FunctionParameterAttribute::NoCapture + | s::FunctionParameterAttribute::NoWrite + | s::FunctionParameterAttribute::NoReadWrite => &[], + }, + Self::Decoration(v) => match v { + s::Decoration::RelaxedPrecision + | s::Decoration::SpecId + | s::Decoration::Block + | s::Decoration::BufferBlock + | s::Decoration::RowMajor + | s::Decoration::ColMajor + | s::Decoration::ArrayStride + | s::Decoration::MatrixStride + | s::Decoration::GLSLShared + | s::Decoration::GLSLPacked + | s::Decoration::CPacked + | s::Decoration::BuiltIn + | s::Decoration::NoPerspective + | s::Decoration::Flat + | s::Decoration::Patch + | s::Decoration::Centroid + | s::Decoration::Sample + | s::Decoration::Invariant + | s::Decoration::Restrict + | s::Decoration::Aliased + | s::Decoration::Volatile + | s::Decoration::Constant + | s::Decoration::Coherent + | s::Decoration::NonWritable + | s::Decoration::NonReadable + | s::Decoration::Uniform + | s::Decoration::UniformId + | s::Decoration::SaturatedConversion + | s::Decoration::Stream + | s::Decoration::Location + | s::Decoration::Component + | s::Decoration::Index + | s::Decoration::Binding + | s::Decoration::DescriptorSet + | s::Decoration::Offset + | s::Decoration::XfbBuffer + | s::Decoration::XfbStride + | s::Decoration::FuncParamAttr + | s::Decoration::FPRoundingMode + | s::Decoration::FPFastMathMode + | s::Decoration::LinkageAttributes + | s::Decoration::NoContraction + | s::Decoration::InputAttachmentIndex + | s::Decoration::Alignment + | s::Decoration::MaxByteOffset + | s::Decoration::AlignmentId + | s::Decoration::MaxByteOffsetId + | s::Decoration::ViewportRelativeNV + | s::Decoration::NonUniform + | s::Decoration::CounterBuffer + | s::Decoration::UserSemantic => &[], + s::Decoration::ExplicitInterpAMD => &["SPV_AMD_shader_explicit_vertex_parameter"], + s::Decoration::RestrictPointer | s::Decoration::AliasedPointer => &[ + "SPV_EXT_physical_storage_buffer", + "SPV_KHR_physical_storage_buffer", + ], + s::Decoration::UserTypeGOOGLE => &["SPV_GOOGLE_user_type"], + s::Decoration::RegisterINTEL + | s::Decoration::MemoryINTEL + | s::Decoration::NumbanksINTEL + | s::Decoration::BankwidthINTEL + | s::Decoration::MaxPrivateCopiesINTEL + | s::Decoration::SinglepumpINTEL + | s::Decoration::DoublepumpINTEL + | s::Decoration::MaxReplicatesINTEL + | s::Decoration::SimpleDualPortINTEL + | s::Decoration::MergeINTEL + | s::Decoration::BankBitsINTEL + | s::Decoration::ForcePow2DepthINTEL => &["SPV_INTEL_fpga_memory_attributes"], + s::Decoration::ReferencedIndirectlyINTEL => &["SPV_INTEL_function_pointers"], + s::Decoration::NoSignedWrap | s::Decoration::NoUnsignedWrap => { + &["SPV_KHR_no_integer_wrap_decoration"] + } + s::Decoration::PerVertexNV => &["SPV_NV_fragment_shader_barycentric"], + s::Decoration::PassthroughNV => &["SPV_NV_geometry_shader_passthrough"], + s::Decoration::PerPrimitiveNV + | s::Decoration::PerViewNV + | s::Decoration::PerTaskNV => &["SPV_NV_mesh_shader"], + s::Decoration::OverrideCoverageNV => &["SPV_NV_sample_mask_override_coverage"], + s::Decoration::SecondaryViewportRelativeNV => &["SPV_NV_stereo_view_rendering"], + }, + Self::BuiltIn(v) => match v { + s::BuiltIn::Position + | s::BuiltIn::PointSize + | s::BuiltIn::ClipDistance + | s::BuiltIn::CullDistance + | s::BuiltIn::VertexId + | s::BuiltIn::InstanceId + | s::BuiltIn::PrimitiveId + | s::BuiltIn::InvocationId + | s::BuiltIn::Layer + | s::BuiltIn::ViewportIndex + | s::BuiltIn::TessLevelOuter + | s::BuiltIn::TessLevelInner + | s::BuiltIn::TessCoord + | s::BuiltIn::PatchVertices + | s::BuiltIn::FragCoord + | s::BuiltIn::PointCoord + | s::BuiltIn::FrontFacing + | s::BuiltIn::SampleId + | s::BuiltIn::SamplePosition + | s::BuiltIn::SampleMask + | s::BuiltIn::FragDepth + | s::BuiltIn::HelperInvocation + | s::BuiltIn::NumWorkgroups + | s::BuiltIn::WorkgroupSize + | s::BuiltIn::WorkgroupId + | s::BuiltIn::LocalInvocationId + | s::BuiltIn::GlobalInvocationId + | s::BuiltIn::LocalInvocationIndex + | s::BuiltIn::WorkDim + | s::BuiltIn::GlobalSize + | s::BuiltIn::EnqueuedWorkgroupSize + | s::BuiltIn::GlobalOffset + | s::BuiltIn::GlobalLinearId + | s::BuiltIn::SubgroupSize + | s::BuiltIn::SubgroupMaxSize + | s::BuiltIn::NumSubgroups + | s::BuiltIn::NumEnqueuedSubgroups + | s::BuiltIn::SubgroupId + | s::BuiltIn::SubgroupLocalInvocationId + | s::BuiltIn::VertexIndex + | s::BuiltIn::InstanceIndex + | s::BuiltIn::SubgroupEqMask + | s::BuiltIn::SubgroupGeMask + | s::BuiltIn::SubgroupGtMask + | s::BuiltIn::SubgroupLeMask + | s::BuiltIn::SubgroupLtMask => &[], + s::BuiltIn::BaryCoordNoPerspAMD + | s::BuiltIn::BaryCoordNoPerspCentroidAMD + | s::BuiltIn::BaryCoordNoPerspSampleAMD + | s::BuiltIn::BaryCoordSmoothAMD + | s::BuiltIn::BaryCoordSmoothCentroidAMD + | s::BuiltIn::BaryCoordSmoothSampleAMD + | s::BuiltIn::BaryCoordPullModelAMD => { + &["SPV_AMD_shader_explicit_vertex_parameter"] + } + s::BuiltIn::FullyCoveredEXT => &["SPV_EXT_fragment_fully_covered"], + s::BuiltIn::FragSizeEXT | s::BuiltIn::FragInvocationCountEXT => { + &["SPV_EXT_fragment_invocation_density", "SPV_NV_shading_rate"] + } + s::BuiltIn::FragStencilRefEXT => &["SPV_EXT_shader_stencil_export"], + s::BuiltIn::DeviceIndex => &["SPV_KHR_device_group"], + s::BuiltIn::PrimitiveShadingRateKHR | s::BuiltIn::ShadingRateKHR => { + &["SPV_KHR_fragment_shading_rate"] + } + s::BuiltIn::ViewIndex => &["SPV_KHR_multiview"], + s::BuiltIn::RayGeometryIndexKHR => &["SPV_KHR_ray_tracing"], + s::BuiltIn::BaseVertex | s::BuiltIn::BaseInstance => { + &["SPV_KHR_shader_draw_parameters"] + } + s::BuiltIn::DrawIndex => &["SPV_KHR_shader_draw_parameters", "SPV_NV_mesh_shader"], + s::BuiltIn::PositionPerViewNV | s::BuiltIn::ViewportMaskPerViewNV => &[ + "SPV_NVX_multiview_per_view_attributes", + "SPV_NV_mesh_shader", + ], + s::BuiltIn::BaryCoordNV | s::BuiltIn::BaryCoordNoPerspNV => { + &["SPV_NV_fragment_shader_barycentric"] + } + s::BuiltIn::TaskCountNV + | s::BuiltIn::PrimitiveCountNV + | s::BuiltIn::PrimitiveIndicesNV + | s::BuiltIn::ClipDistancePerViewNV + | s::BuiltIn::CullDistancePerViewNV + | s::BuiltIn::LayerPerViewNV + | s::BuiltIn::MeshViewCountNV + | s::BuiltIn::MeshViewIndicesNV => &["SPV_NV_mesh_shader"], + s::BuiltIn::HitTNV => &["SPV_NV_ray_tracing"], + s::BuiltIn::LaunchIdNV + | s::BuiltIn::LaunchSizeNV + | s::BuiltIn::WorldRayOriginNV + | s::BuiltIn::WorldRayDirectionNV + | s::BuiltIn::ObjectRayOriginNV + | s::BuiltIn::ObjectRayDirectionNV + | s::BuiltIn::RayTminNV + | s::BuiltIn::RayTmaxNV + | s::BuiltIn::InstanceCustomIndexNV + | s::BuiltIn::ObjectToWorldNV + | s::BuiltIn::WorldToObjectNV + | s::BuiltIn::HitKindNV + | s::BuiltIn::IncomingRayFlagsNV => &["SPV_NV_ray_tracing", "SPV_KHR_ray_tracing"], + s::BuiltIn::WarpsPerSMNV + | s::BuiltIn::SMCountNV + | s::BuiltIn::WarpIDNV + | s::BuiltIn::SMIDNV => &["SPV_NV_shader_sm_builtins"], + s::BuiltIn::SecondaryPositionNV | s::BuiltIn::SecondaryViewportMaskNV => { + &["SPV_NV_stereo_view_rendering"] + } + s::BuiltIn::ViewportMaskNV => &["SPV_NV_viewport_array2", "SPV_NV_mesh_shader"], + }, + Self::Scope(v) => match v { + s::Scope::CrossDevice + | s::Scope::Device + | s::Scope::Workgroup + | s::Scope::Subgroup + | s::Scope::Invocation + | s::Scope::QueueFamily + | s::Scope::ShaderCallKHR => &[], + }, + Self::GroupOperation(v) => match v { + s::GroupOperation::Reduce + | s::GroupOperation::InclusiveScan + | s::GroupOperation::ExclusiveScan + | s::GroupOperation::ClusteredReduce => &[], + s::GroupOperation::PartitionedReduceNV + | s::GroupOperation::PartitionedInclusiveScanNV + | s::GroupOperation::PartitionedExclusiveScanNV => { + &["SPV_NV_shader_subgroup_partitioned"] + } + }, + Self::KernelEnqueueFlags(v) => match v { + s::KernelEnqueueFlags::NoWait + | s::KernelEnqueueFlags::WaitKernel + | s::KernelEnqueueFlags::WaitWorkGroup => &[], + }, + Self::Capability(v) => match v { + s::Capability::Matrix + | s::Capability::Shader + | s::Capability::Geometry + | s::Capability::Tessellation + | s::Capability::Addresses + | s::Capability::Linkage + | s::Capability::Kernel + | s::Capability::Vector16 + | s::Capability::Float16Buffer + | s::Capability::Float16 + | s::Capability::Float64 + | s::Capability::Int64 + | s::Capability::Int64Atomics + | s::Capability::ImageBasic + | s::Capability::ImageReadWrite + | s::Capability::ImageMipmap + | s::Capability::Pipes + | s::Capability::DeviceEnqueue + | s::Capability::LiteralSampler + | s::Capability::AtomicStorage + | s::Capability::Int16 + | s::Capability::TessellationPointSize + | s::Capability::GeometryPointSize + | s::Capability::ImageGatherExtended + | s::Capability::StorageImageMultisample + | s::Capability::UniformBufferArrayDynamicIndexing + | s::Capability::SampledImageArrayDynamicIndexing + | s::Capability::StorageBufferArrayDynamicIndexing + | s::Capability::StorageImageArrayDynamicIndexing + | s::Capability::ClipDistance + | s::Capability::CullDistance + | s::Capability::ImageCubeArray + | s::Capability::SampleRateShading + | s::Capability::ImageRect + | s::Capability::SampledRect + | s::Capability::GenericPointer + | s::Capability::Int8 + | s::Capability::InputAttachment + | s::Capability::SparseResidency + | s::Capability::MinLod + | s::Capability::Sampled1D + | s::Capability::Image1D + | s::Capability::SampledCubeArray + | s::Capability::SampledBuffer + | s::Capability::ImageBuffer + | s::Capability::ImageMSArray + | s::Capability::StorageImageExtendedFormats + | s::Capability::ImageQuery + | s::Capability::DerivativeControl + | s::Capability::InterpolationFunction + | s::Capability::TransformFeedback + | s::Capability::GeometryStreams + | s::Capability::StorageImageReadWithoutFormat + | s::Capability::StorageImageWriteWithoutFormat + | s::Capability::MultiViewport + | s::Capability::SubgroupDispatch + | s::Capability::NamedBarrier + | s::Capability::PipeStorage + | s::Capability::GroupNonUniform + | s::Capability::GroupNonUniformVote + | s::Capability::GroupNonUniformArithmetic + | s::Capability::GroupNonUniformBallot + | s::Capability::GroupNonUniformShuffle + | s::Capability::GroupNonUniformShuffleRelative + | s::Capability::GroupNonUniformClustered + | s::Capability::GroupNonUniformQuad + | s::Capability::ShaderLayer + | s::Capability::ShaderViewportIndex + | s::Capability::ShaderNonUniform + | s::Capability::RuntimeDescriptorArray + | s::Capability::InputAttachmentArrayDynamicIndexing + | s::Capability::UniformTexelBufferArrayDynamicIndexing + | s::Capability::StorageTexelBufferArrayDynamicIndexing + | s::Capability::UniformBufferArrayNonUniformIndexing + | s::Capability::SampledImageArrayNonUniformIndexing + | s::Capability::StorageBufferArrayNonUniformIndexing + | s::Capability::StorageImageArrayNonUniformIndexing + | s::Capability::InputAttachmentArrayNonUniformIndexing + | s::Capability::UniformTexelBufferArrayNonUniformIndexing + | s::Capability::StorageTexelBufferArrayNonUniformIndexing + | s::Capability::VulkanMemoryModel + | s::Capability::VulkanMemoryModelDeviceScope => &[], + s::Capability::Float16ImageAMD => &["SPV_AMD_gpu_shader_half_float_fetch"], + s::Capability::Groups => &["SPV_AMD_shader_ballot"], + s::Capability::FragmentMaskAMD => &["SPV_AMD_shader_fragment_mask"], + s::Capability::ImageReadWriteLodAMD => &["SPV_AMD_shader_image_load_store_lod"], + s::Capability::ImageGatherBiasLodAMD => &["SPV_AMD_texture_gather_bias_lod"], + s::Capability::DemoteToHelperInvocationEXT => { + &["SPV_EXT_demote_to_helper_invocation"] + } + s::Capability::FragmentFullyCoveredEXT => &["SPV_EXT_fragment_fully_covered"], + s::Capability::FragmentDensityEXT => { + &["SPV_EXT_fragment_invocation_density", "SPV_NV_shading_rate"] + } + s::Capability::FragmentShaderSampleInterlockEXT + | s::Capability::FragmentShaderShadingRateInterlockEXT + | s::Capability::FragmentShaderPixelInterlockEXT => { + &["SPV_EXT_fragment_shader_interlock"] + } + s::Capability::PhysicalStorageBufferAddresses => &[ + "SPV_EXT_physical_storage_buffer", + "SPV_KHR_physical_storage_buffer", + ], + s::Capability::AtomicFloat32AddEXT | s::Capability::AtomicFloat64AddEXT => { + &["SPV_EXT_shader_atomic_float_add"] + } + s::Capability::Int64ImageEXT => &["SPV_EXT_shader_image_int64"], + s::Capability::StencilExportEXT => &["SPV_EXT_shader_stencil_export"], + s::Capability::ShaderViewportIndexLayerEXT => { + &["SPV_EXT_shader_viewport_index_layer"] + } + s::Capability::BlockingPipesINTEL => &["SPV_INTEL_blocking_pipes"], + s::Capability::SubgroupAvcMotionEstimationINTEL + | s::Capability::SubgroupAvcMotionEstimationIntraINTEL + | s::Capability::SubgroupAvcMotionEstimationChromaINTEL => { + &["SPV_INTEL_device_side_avc_motion_estimation"] + } + s::Capability::FPGALoopControlsINTEL => &["SPV_INTEL_fpga_loop_controls"], + s::Capability::FPGAMemoryAttributesINTEL => &["SPV_INTEL_fpga_memory_attributes"], + s::Capability::FPGARegINTEL => &["SPV_INTEL_fpga_reg"], + s::Capability::FunctionPointersINTEL | s::Capability::IndirectReferencesINTEL => { + &["SPV_INTEL_function_pointers"] + } + s::Capability::KernelAttributesINTEL | s::Capability::FPGAKernelAttributesINTEL => { + &["SPV_INTEL_kernel_attributes"] + } + s::Capability::SubgroupImageMediaBlockIOINTEL => &["SPV_INTEL_media_block_io"], + s::Capability::IntegerFunctions2INTEL => &["SPV_INTEL_shader_integer_functions2"], + s::Capability::SubgroupShuffleINTEL + | s::Capability::SubgroupBufferBlockIOINTEL + | s::Capability::SubgroupImageBlockIOINTEL => &["SPV_INTEL_subgroups"], + s::Capability::UnstructuredLoopControlsINTEL => { + &["SPV_INTEL_unstructured_loop_controls"] + } + s::Capability::StorageBuffer16BitAccess + | s::Capability::UniformAndStorageBuffer16BitAccess + | s::Capability::StoragePushConstant16 + | s::Capability::StorageInputOutput16 => &["SPV_KHR_16bit_storage"], + s::Capability::StorageBuffer8BitAccess + | s::Capability::UniformAndStorageBuffer8BitAccess + | s::Capability::StoragePushConstant8 => &["SPV_KHR_8bit_storage"], + s::Capability::DeviceGroup => &["SPV_KHR_device_group"], + s::Capability::DenormPreserve + | s::Capability::DenormFlushToZero + | s::Capability::SignedZeroInfNanPreserve + | s::Capability::RoundingModeRTE + | s::Capability::RoundingModeRTZ => &["SPV_KHR_float_controls"], + s::Capability::FragmentShadingRateKHR => &["SPV_KHR_fragment_shading_rate"], + s::Capability::MultiView => &["SPV_KHR_multiview"], + s::Capability::SampleMaskPostDepthCoverage => &["SPV_KHR_post_depth_coverage"], + s::Capability::RayQueryProvisionalKHR | s::Capability::RayQueryKHR => { + &["SPV_KHR_ray_query"] + } + s::Capability::RayTraversalPrimitiveCullingKHR => { + &["SPV_KHR_ray_query", "SPV_KHR_ray_tracing"] + } + s::Capability::RayTracingKHR | s::Capability::RayTracingProvisionalKHR => { + &["SPV_KHR_ray_tracing"] + } + s::Capability::AtomicStorageOps => &["SPV_KHR_shader_atomic_counter_ops"], + s::Capability::SubgroupBallotKHR => &["SPV_KHR_shader_ballot"], + s::Capability::ShaderClockKHR => &["SPV_KHR_shader_clock"], + s::Capability::DrawParameters => &["SPV_KHR_shader_draw_parameters"], + s::Capability::SubgroupVoteKHR => &["SPV_KHR_subgroup_vote"], + s::Capability::VariablePointersStorageBuffer | s::Capability::VariablePointers => { + &["SPV_KHR_variable_pointers"] + } + s::Capability::PerViewAttributesNV => &["SPV_NVX_multiview_per_view_attributes"], + s::Capability::ComputeDerivativeGroupQuadsNV + | s::Capability::ComputeDerivativeGroupLinearNV => { + &["SPV_NV_compute_shader_derivatives"] + } + s::Capability::CooperativeMatrixNV => &["SPV_NV_cooperative_matrix"], + s::Capability::FragmentBarycentricNV => &["SPV_NV_fragment_shader_barycentric"], + s::Capability::GeometryShaderPassthroughNV => { + &["SPV_NV_geometry_shader_passthrough"] + } + s::Capability::MeshShadingNV => &["SPV_NV_mesh_shader"], + s::Capability::RayTracingNV => &["SPV_NV_ray_tracing"], + s::Capability::SampleMaskOverrideCoverageNV => { + &["SPV_NV_sample_mask_override_coverage"] + } + s::Capability::ImageFootprintNV => &["SPV_NV_shader_image_footprint"], + s::Capability::ShaderSMBuiltinsNV => &["SPV_NV_shader_sm_builtins"], + s::Capability::GroupNonUniformPartitionedNV => { + &["SPV_NV_shader_subgroup_partitioned"] + } + s::Capability::ShaderStereoViewNV => &["SPV_NV_stereo_view_rendering"], + s::Capability::ShaderViewportMaskNV => &["SPV_NV_viewport_array2"], + }, + Self::RayQueryIntersection(v) => match v { + s::RayQueryIntersection::RayQueryCandidateIntersectionKHR + | s::RayQueryIntersection::RayQueryCommittedIntersectionKHR => &[], + }, + Self::RayQueryCommittedIntersectionType(v) => match v { + s::RayQueryCommittedIntersectionType::RayQueryCommittedIntersectionNoneKHR + | s::RayQueryCommittedIntersectionType::RayQueryCommittedIntersectionTriangleKHR + | s::RayQueryCommittedIntersectionType::RayQueryCommittedIntersectionGeneratedKHR => { + &[] + } + }, + Self::RayQueryCandidateIntersectionType(v) => match v { + s::RayQueryCandidateIntersectionType::RayQueryCandidateIntersectionTriangleKHR + | s::RayQueryCandidateIntersectionType::RayQueryCandidateIntersectionAABBKHR => &[], + }, + _ => &[], + } + } + pub fn additional_operands(&self) -> Vec { + use spirv as s; + match self { + Self::ImageOperands(v) => { + let mut result = vec![]; + result.extend( + [ + s::ImageOperands::BIAS, + s::ImageOperands::LOD, + s::ImageOperands::CONST_OFFSET, + s::ImageOperands::OFFSET, + s::ImageOperands::CONST_OFFSETS, + s::ImageOperands::SAMPLE, + s::ImageOperands::MIN_LOD, + ] + .iter() + .filter(|arg| v.contains(**arg)) + .flat_map(|_| { + [crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::IdRef, + quantifier: crate::grammar::OperandQuantifier::One, + }] + .iter() + .cloned() + }), + ); + result.extend( + [s::ImageOperands::GRAD] + .iter() + .filter(|arg| v.contains(**arg)) + .flat_map(|_| { + [ + crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::IdRef, + quantifier: crate::grammar::OperandQuantifier::One, + }, + crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::IdRef, + quantifier: crate::grammar::OperandQuantifier::One, + }, + ] + .iter() + .cloned() + }), + ); + result.extend( + [ + s::ImageOperands::MAKE_TEXEL_AVAILABLE, + s::ImageOperands::MAKE_TEXEL_VISIBLE, + ] + .iter() + .filter(|arg| v.contains(**arg)) + .flat_map(|_| { + [crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::IdScope, + quantifier: crate::grammar::OperandQuantifier::One, + }] + .iter() + .cloned() + }), + ); + result + } + Self::LoopControl(v) => { + let mut result = vec![]; + result.extend( + [ + s::LoopControl::DEPENDENCY_LENGTH, + s::LoopControl::MIN_ITERATIONS, + s::LoopControl::MAX_ITERATIONS, + s::LoopControl::ITERATION_MULTIPLE, + s::LoopControl::PEEL_COUNT, + s::LoopControl::PARTIAL_COUNT, + s::LoopControl::INITIATION_INTERVAL_INTEL, + s::LoopControl::MAX_CONCURRENCY_INTEL, + s::LoopControl::DEPENDENCY_ARRAY_INTEL, + s::LoopControl::PIPELINE_ENABLE_INTEL, + s::LoopControl::LOOP_COALESCE_INTEL, + s::LoopControl::MAX_INTERLEAVING_INTEL, + s::LoopControl::SPECULATED_ITERATIONS_INTEL, + ] + .iter() + .filter(|arg| v.contains(**arg)) + .flat_map(|_| { + [crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }] + .iter() + .cloned() + }), + ); + result + } + Self::MemoryAccess(v) => { + let mut result = vec![]; + result.extend( + [ + s::MemoryAccess::MAKE_POINTER_AVAILABLE, + s::MemoryAccess::MAKE_POINTER_VISIBLE, + ] + .iter() + .filter(|arg| v.contains(**arg)) + .flat_map(|_| { + [crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::IdScope, + quantifier: crate::grammar::OperandQuantifier::One, + }] + .iter() + .cloned() + }), + ); + result.extend( + [s::MemoryAccess::ALIGNED] + .iter() + .filter(|arg| v.contains(**arg)) + .flat_map(|_| { + [crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }] + .iter() + .cloned() + }), + ); + result + } + Self::ExecutionMode(v) => match v { + s::ExecutionMode::LocalSizeHintId => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::IdRef, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::ExecutionMode::SubgroupsPerWorkgroupId => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::IdRef, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::ExecutionMode::LocalSizeId => vec![ + crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::IdRef, + quantifier: crate::grammar::OperandQuantifier::One, + }, + crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::IdRef, + quantifier: crate::grammar::OperandQuantifier::One, + }, + crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::IdRef, + quantifier: crate::grammar::OperandQuantifier::One, + }, + ], + s::ExecutionMode::Invocations => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::ExecutionMode::OutputPrimitivesNV => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::ExecutionMode::SubgroupSize => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::ExecutionMode::SubgroupsPerWorkgroup => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::ExecutionMode::DenormPreserve + | s::ExecutionMode::DenormFlushToZero + | s::ExecutionMode::SignedZeroInfNanPreserve + | s::ExecutionMode::RoundingModeRTE + | s::ExecutionMode::RoundingModeRTZ => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::ExecutionMode::VecTypeHint => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::ExecutionMode::OutputVertices => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::ExecutionMode::MaxWorkDimINTEL => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::ExecutionMode::MaxWorkgroupSizeINTEL => vec![ + crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }, + crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }, + crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }, + ], + s::ExecutionMode::NumSIMDWorkitemsINTEL => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::ExecutionMode::LocalSize | s::ExecutionMode::LocalSizeHint => vec![ + crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }, + crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }, + crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }, + ], + _ => vec![], + }, + Self::Decoration(v) => match v { + s::Decoration::BuiltIn => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::BuiltIn, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::FPFastMathMode => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::FPFastMathMode, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::FPRoundingMode => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::FPRoundingMode, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::FuncParamAttr => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::FunctionParameterAttribute, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::AlignmentId => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::IdRef, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::CounterBuffer => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::IdRef, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::MaxByteOffsetId => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::IdRef, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::UniformId => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::IdScope, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::Alignment => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::ArrayStride => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::InputAttachmentIndex => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::BankBitsINTEL => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::ZeroOrMore, + }], + s::Decoration::BankwidthINTEL => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::NumbanksINTEL => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::Binding => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::Offset => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::Component => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::DescriptorSet => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::ForcePow2DepthINTEL => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::Index => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::Location => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::MatrixStride => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::MaxByteOffset => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::MaxPrivateCopiesINTEL => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::MaxReplicatesINTEL => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::SecondaryViewportRelativeNV => { + vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }] + } + s::Decoration::SpecId => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::Stream => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::XfbBuffer => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::XfbStride => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralInteger, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::MemoryINTEL => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralString, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::MergeINTEL => vec![ + crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralString, + quantifier: crate::grammar::OperandQuantifier::One, + }, + crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralString, + quantifier: crate::grammar::OperandQuantifier::One, + }, + ], + s::Decoration::LinkageAttributes => vec![ + crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralString, + quantifier: crate::grammar::OperandQuantifier::One, + }, + crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LinkageType, + quantifier: crate::grammar::OperandQuantifier::One, + }, + ], + s::Decoration::UserSemantic => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralString, + quantifier: crate::grammar::OperandQuantifier::One, + }], + s::Decoration::UserTypeGOOGLE => vec![crate::grammar::LogicalOperand { + kind: crate::grammar::OperandKind::LiteralString, + quantifier: crate::grammar::OperandQuantifier::One, + }], + _ => vec![], + }, + _ => vec![], + } + } } diff --git a/rspirv/dr/build/mod.rs b/rspirv/dr/build/mod.rs index 8b665b2e..76c60462 100644 --- a/rspirv/dr/build/mod.rs +++ b/rspirv/dr/build/mod.rs @@ -154,6 +154,18 @@ impl Builder { Ok(()) } + pub fn insert_types_global_values(&mut self, insert_point: InsertPoint, inst: dr::Instruction) { + match insert_point { + InsertPoint::End => self.module.types_global_values.push(inst), + InsertPoint::Begin => self.module.types_global_values.insert(0, inst), + InsertPoint::FromEnd(offset) => { + let end = self.module.types_global_values.len(); + self.module.types_global_values.insert(end - offset, inst) + } + InsertPoint::FromBegin(offset) => self.module.types_global_values.insert(offset, inst), + } + } + pub fn pop_instruction(&mut self) -> BuildResult { let (selected_function, selected_block) = match (self.selected_function, self.selected_block) { diff --git a/rspirv/grammar/syntax.rs b/rspirv/grammar/syntax.rs index 1bf7090b..eb3c7d10 100644 --- a/rspirv/grammar/syntax.rs +++ b/rspirv/grammar/syntax.rs @@ -32,7 +32,7 @@ pub struct ExtendedInstruction<'a> { } /// Grammar for a SPIR-V logical operand. -#[derive(Debug, PartialEq, Eq, Hash)] +#[derive(Debug, PartialEq, Eq, Hash, Clone)] pub struct LogicalOperand { /// The kind of this logical operand. pub kind: OperandKind, diff --git a/rspirv/tests/spirv_blobs.rs b/rspirv/tests/spirv_blobs.rs index f1f25647..40a13096 100644 --- a/rspirv/tests/spirv_blobs.rs +++ b/rspirv/tests/spirv_blobs.rs @@ -1,6 +1,7 @@ use rspirv::{ binary::{Assemble as _, Disassemble as _}, - dr, lift, + dr, + lift, }; use std::path::PathBuf; diff --git a/spirv/autogen_spirv.rs b/spirv/autogen_spirv.rs index 5fbb9858..cfb49031 100644 --- a/spirv/autogen_spirv.rs +++ b/spirv/autogen_spirv.rs @@ -8,15 +8,25 @@ pub const MAJOR_VERSION: u8 = 1u8; pub const MINOR_VERSION: u8 = 5u8; pub const REVISION: u8 = 4u8; bitflags! { # [doc = "SPIR-V operand kind: [ImageOperands](https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#_a_id_image_operands_a_image_operands)"] # [cfg_attr (feature = "serialize" , derive (serde :: Serialize))] # [cfg_attr (feature = "deserialize" , derive (serde :: Deserialize))] pub struct ImageOperands : u32 { const NONE = 0u32 ; const BIAS = 1u32 ; const LOD = 2u32 ; const GRAD = 4u32 ; const CONST_OFFSET = 8u32 ; const OFFSET = 16u32 ; const CONST_OFFSETS = 32u32 ; const SAMPLE = 64u32 ; const MIN_LOD = 128u32 ; const MAKE_TEXEL_AVAILABLE = 256u32 ; const MAKE_TEXEL_AVAILABLE_KHR = 256u32 ; const MAKE_TEXEL_VISIBLE = 512u32 ; const MAKE_TEXEL_VISIBLE_KHR = 512u32 ; const NON_PRIVATE_TEXEL = 1024u32 ; const NON_PRIVATE_TEXEL_KHR = 1024u32 ; const VOLATILE_TEXEL = 2048u32 ; const VOLATILE_TEXEL_KHR = 2048u32 ; const SIGN_EXTEND = 4096u32 ; const ZERO_EXTEND = 8192u32 ; } } +impl ImageOperands {} bitflags! { # [doc = "SPIR-V operand kind: [FPFastMathMode](https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#_a_id_fp_fast_math_mode_a_fp_fast_math_mode)"] # [cfg_attr (feature = "serialize" , derive (serde :: Serialize))] # [cfg_attr (feature = "deserialize" , derive (serde :: Deserialize))] pub struct FPFastMathMode : u32 { const NONE = 0u32 ; const NOT_NAN = 1u32 ; const NOT_INF = 2u32 ; const NSZ = 4u32 ; const ALLOW_RECIP = 8u32 ; const FAST = 16u32 ; } } +impl FPFastMathMode {} bitflags! { # [doc = "SPIR-V operand kind: [SelectionControl](https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#_a_id_selection_control_a_selection_control)"] # [cfg_attr (feature = "serialize" , derive (serde :: Serialize))] # [cfg_attr (feature = "deserialize" , derive (serde :: Deserialize))] pub struct SelectionControl : u32 { const NONE = 0u32 ; const FLATTEN = 1u32 ; const DONT_FLATTEN = 2u32 ; } } +impl SelectionControl {} bitflags! { # [doc = "SPIR-V operand kind: [LoopControl](https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#_a_id_loop_control_a_loop_control)"] # [cfg_attr (feature = "serialize" , derive (serde :: Serialize))] # [cfg_attr (feature = "deserialize" , derive (serde :: Deserialize))] pub struct LoopControl : u32 { const NONE = 0u32 ; const UNROLL = 1u32 ; const DONT_UNROLL = 2u32 ; const DEPENDENCY_INFINITE = 4u32 ; const DEPENDENCY_LENGTH = 8u32 ; const MIN_ITERATIONS = 16u32 ; const MAX_ITERATIONS = 32u32 ; const ITERATION_MULTIPLE = 64u32 ; const PEEL_COUNT = 128u32 ; const PARTIAL_COUNT = 256u32 ; const INITIATION_INTERVAL_INTEL = 65536u32 ; const MAX_CONCURRENCY_INTEL = 131072u32 ; const DEPENDENCY_ARRAY_INTEL = 262144u32 ; const PIPELINE_ENABLE_INTEL = 524288u32 ; const LOOP_COALESCE_INTEL = 1048576u32 ; const MAX_INTERLEAVING_INTEL = 2097152u32 ; const SPECULATED_ITERATIONS_INTEL = 4194304u32 ; } } +impl LoopControl {} bitflags! { # [doc = "SPIR-V operand kind: [FunctionControl](https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#_a_id_function_control_a_function_control)"] # [cfg_attr (feature = "serialize" , derive (serde :: Serialize))] # [cfg_attr (feature = "deserialize" , derive (serde :: Deserialize))] pub struct FunctionControl : u32 { const NONE = 0u32 ; const INLINE = 1u32 ; const DONT_INLINE = 2u32 ; const PURE = 4u32 ; const CONST = 8u32 ; } } +impl FunctionControl {} bitflags! { # [doc = "SPIR-V operand kind: [MemorySemantics](https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#_a_id_memory_semantics_a_memory_semantics)"] # [cfg_attr (feature = "serialize" , derive (serde :: Serialize))] # [cfg_attr (feature = "deserialize" , derive (serde :: Deserialize))] pub struct MemorySemantics : u32 { const RELAXED = 0u32 ; const NONE = 0u32 ; const ACQUIRE = 2u32 ; const RELEASE = 4u32 ; const ACQUIRE_RELEASE = 8u32 ; const SEQUENTIALLY_CONSISTENT = 16u32 ; const UNIFORM_MEMORY = 64u32 ; const SUBGROUP_MEMORY = 128u32 ; const WORKGROUP_MEMORY = 256u32 ; const CROSS_WORKGROUP_MEMORY = 512u32 ; const ATOMIC_COUNTER_MEMORY = 1024u32 ; const IMAGE_MEMORY = 2048u32 ; const OUTPUT_MEMORY = 4096u32 ; const OUTPUT_MEMORY_KHR = 4096u32 ; const MAKE_AVAILABLE = 8192u32 ; const MAKE_AVAILABLE_KHR = 8192u32 ; const MAKE_VISIBLE = 16384u32 ; const MAKE_VISIBLE_KHR = 16384u32 ; const VOLATILE = 32768u32 ; } } +impl MemorySemantics {} bitflags! { # [doc = "SPIR-V operand kind: [MemoryAccess](https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#_a_id_memory_access_a_memory_access)"] # [cfg_attr (feature = "serialize" , derive (serde :: Serialize))] # [cfg_attr (feature = "deserialize" , derive (serde :: Deserialize))] pub struct MemoryAccess : u32 { const NONE = 0u32 ; const VOLATILE = 1u32 ; const ALIGNED = 2u32 ; const NONTEMPORAL = 4u32 ; const MAKE_POINTER_AVAILABLE = 8u32 ; const MAKE_POINTER_AVAILABLE_KHR = 8u32 ; const MAKE_POINTER_VISIBLE = 16u32 ; const MAKE_POINTER_VISIBLE_KHR = 16u32 ; const NON_PRIVATE_POINTER = 32u32 ; const NON_PRIVATE_POINTER_KHR = 32u32 ; } } +impl MemoryAccess {} bitflags! { # [doc = "SPIR-V operand kind: [KernelProfilingInfo](https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#_a_id_kernel_profiling_info_a_kernel_profiling_info)"] # [cfg_attr (feature = "serialize" , derive (serde :: Serialize))] # [cfg_attr (feature = "deserialize" , derive (serde :: Deserialize))] pub struct KernelProfilingInfo : u32 { const NONE = 0u32 ; const CMD_EXEC_TIME = 1u32 ; } } +impl KernelProfilingInfo {} bitflags! { # [doc = "SPIR-V operand kind: [RayFlags](https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#_a_id_ray_flags_a_ray_flags)"] # [cfg_attr (feature = "serialize" , derive (serde :: Serialize))] # [cfg_attr (feature = "deserialize" , derive (serde :: Deserialize))] pub struct RayFlags : u32 { const NONE_KHR = 0u32 ; const OPAQUE_KHR = 1u32 ; const NO_OPAQUE_KHR = 2u32 ; const TERMINATE_ON_FIRST_HIT_KHR = 4u32 ; const SKIP_CLOSEST_HIT_SHADER_KHR = 8u32 ; const CULL_BACK_FACING_TRIANGLES_KHR = 16u32 ; const CULL_FRONT_FACING_TRIANGLES_KHR = 32u32 ; const CULL_OPAQUE_KHR = 64u32 ; const CULL_NO_OPAQUE_KHR = 128u32 ; const SKIP_TRIANGLES_KHR = 256u32 ; const SKIP_AAB_BS_KHR = 512u32 ; } } +impl RayFlags {} bitflags! { # [doc = "SPIR-V operand kind: [FragmentShadingRate](https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#_a_id_fragment_shading_rate_a_fragment_shading_rate)"] # [cfg_attr (feature = "serialize" , derive (serde :: Serialize))] # [cfg_attr (feature = "deserialize" , derive (serde :: Deserialize))] pub struct FragmentShadingRate : u32 { const VERTICAL2_PIXELS = 1u32 ; const VERTICAL4_PIXELS = 2u32 ; const HORIZONTAL2_PIXELS = 4u32 ; const HORIZONTAL4_PIXELS = 8u32 ; } } +impl FragmentShadingRate {} #[doc = "/// SPIR-V operand kind: [SourceLanguage](https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#_a_id_source_language_a_source_language)"] #[repr(u32)] #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] @@ -31,28 +41,7 @@ pub enum SourceLanguage { HLSL = 5u32, } #[allow(non_upper_case_globals)] -impl SourceLanguage { - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - SourceLanguage::Unknown - | SourceLanguage::ESSL - | SourceLanguage::GLSL - | SourceLanguage::OpenCL_C - | SourceLanguage::OpenCL_CPP - | SourceLanguage::HLSL => &[], - } - } - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - SourceLanguage::Unknown - | SourceLanguage::ESSL - | SourceLanguage::GLSL - | SourceLanguage::OpenCL_C - | SourceLanguage::OpenCL_CPP - | SourceLanguage::HLSL => &[], - } - } -} +impl SourceLanguage {} impl num_traits::FromPrimitive for SourceLanguage { #[allow(trivial_numeric_casts)] fn from_i64(n: i64) -> Option { @@ -114,44 +103,6 @@ impl ExecutionModel { pub const ClosestHitKHR: Self = Self::ClosestHitNV; pub const MissKHR: Self = Self::MissNV; pub const CallableKHR: Self = Self::CallableNV; - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - ExecutionModel::Geometry => &[Capability::Geometry], - ExecutionModel::Kernel => &[Capability::Kernel], - ExecutionModel::TaskNV | ExecutionModel::MeshNV => &[Capability::MeshShadingNV], - ExecutionModel::RayGenerationNV - | ExecutionModel::IntersectionNV - | ExecutionModel::AnyHitNV - | ExecutionModel::ClosestHitNV - | ExecutionModel::MissNV - | ExecutionModel::CallableNV => &[Capability::RayTracingNV, Capability::RayTracingKHR], - ExecutionModel::Vertex | ExecutionModel::Fragment | ExecutionModel::GLCompute => { - &[Capability::Shader] - } - ExecutionModel::TessellationControl | ExecutionModel::TessellationEvaluation => { - &[Capability::Tessellation] - } - } - } - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - ExecutionModel::Vertex - | ExecutionModel::TessellationControl - | ExecutionModel::TessellationEvaluation - | ExecutionModel::Geometry - | ExecutionModel::Fragment - | ExecutionModel::GLCompute - | ExecutionModel::Kernel - | ExecutionModel::TaskNV - | ExecutionModel::MeshNV - | ExecutionModel::RayGenerationNV - | ExecutionModel::IntersectionNV - | ExecutionModel::AnyHitNV - | ExecutionModel::ClosestHitNV - | ExecutionModel::MissNV - | ExecutionModel::CallableNV => &[], - } - } } impl num_traits::FromPrimitive for ExecutionModel { #[allow(trivial_numeric_casts)] @@ -222,26 +173,6 @@ pub enum AddressingModel { #[allow(non_upper_case_globals)] impl AddressingModel { pub const PhysicalStorageBuffer64EXT: Self = Self::PhysicalStorageBuffer64; - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - AddressingModel::Logical => &[], - AddressingModel::Physical32 | AddressingModel::Physical64 => &[Capability::Addresses], - AddressingModel::PhysicalStorageBuffer64 => { - &[Capability::PhysicalStorageBufferAddresses] - } - } - } - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - AddressingModel::Logical - | AddressingModel::Physical32 - | AddressingModel::Physical64 => &[], - AddressingModel::PhysicalStorageBuffer64 => &[ - "SPV_EXT_physical_storage_buffer", - "SPV_KHR_physical_storage_buffer", - ], - } - } } impl num_traits::FromPrimitive for AddressingModel { #[allow(trivial_numeric_casts)] @@ -285,21 +216,6 @@ pub enum MemoryModel { #[allow(non_upper_case_globals)] impl MemoryModel { pub const VulkanKHR: Self = Self::Vulkan; - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - MemoryModel::OpenCL => &[Capability::Kernel], - MemoryModel::Simple | MemoryModel::GLSL450 => &[Capability::Shader], - MemoryModel::Vulkan => &[Capability::VulkanMemoryModel], - } - } - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - MemoryModel::Simple - | MemoryModel::GLSL450 - | MemoryModel::OpenCL - | MemoryModel::Vulkan => &[], - } - } } impl num_traits::FromPrimitive for MemoryModel { #[allow(trivial_numeric_casts)] @@ -397,147 +313,7 @@ pub enum ExecutionMode { NumSIMDWorkitemsINTEL = 5896u32, } #[allow(non_upper_case_globals)] -impl ExecutionMode { - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - ExecutionMode::LocalSize | ExecutionMode::LocalSizeId => &[], - ExecutionMode::DerivativeGroupLinearNV => &[Capability::ComputeDerivativeGroupLinearNV], - ExecutionMode::DerivativeGroupQuadsNV => &[Capability::ComputeDerivativeGroupQuadsNV], - ExecutionMode::DenormFlushToZero => &[Capability::DenormFlushToZero], - ExecutionMode::DenormPreserve => &[Capability::DenormPreserve], - ExecutionMode::NumSIMDWorkitemsINTEL => &[Capability::FPGAKernelAttributesINTEL], - ExecutionMode::PixelInterlockOrderedEXT | ExecutionMode::PixelInterlockUnorderedEXT => { - &[Capability::FragmentShaderPixelInterlockEXT] - } - ExecutionMode::SampleInterlockOrderedEXT - | ExecutionMode::SampleInterlockUnorderedEXT => { - &[Capability::FragmentShaderSampleInterlockEXT] - } - ExecutionMode::ShadingRateInterlockOrderedEXT - | ExecutionMode::ShadingRateInterlockUnorderedEXT => { - &[Capability::FragmentShaderShadingRateInterlockEXT] - } - ExecutionMode::Invocations - | ExecutionMode::InputPoints - | ExecutionMode::InputLines - | ExecutionMode::InputLinesAdjacency - | ExecutionMode::InputTrianglesAdjacency - | ExecutionMode::OutputLineStrip - | ExecutionMode::OutputTriangleStrip => &[Capability::Geometry], - ExecutionMode::OutputPoints => &[Capability::Geometry, Capability::MeshShadingNV], - ExecutionMode::Triangles => &[Capability::Geometry, Capability::Tessellation], - ExecutionMode::OutputVertices => &[ - Capability::Geometry, - Capability::Tessellation, - Capability::MeshShadingNV, - ], - ExecutionMode::LocalSizeHint - | ExecutionMode::VecTypeHint - | ExecutionMode::ContractionOff - | ExecutionMode::Initializer - | ExecutionMode::Finalizer - | ExecutionMode::LocalSizeHintId => &[Capability::Kernel], - ExecutionMode::MaxWorkgroupSizeINTEL - | ExecutionMode::MaxWorkDimINTEL - | ExecutionMode::NoGlobalOffsetINTEL => &[Capability::KernelAttributesINTEL], - ExecutionMode::OutputLinesNV - | ExecutionMode::OutputPrimitivesNV - | ExecutionMode::OutputTrianglesNV => &[Capability::MeshShadingNV], - ExecutionMode::RoundingModeRTE => &[Capability::RoundingModeRTE], - ExecutionMode::RoundingModeRTZ => &[Capability::RoundingModeRTZ], - ExecutionMode::PostDepthCoverage => &[Capability::SampleMaskPostDepthCoverage], - ExecutionMode::PixelCenterInteger - | ExecutionMode::OriginUpperLeft - | ExecutionMode::OriginLowerLeft - | ExecutionMode::EarlyFragmentTests - | ExecutionMode::DepthReplacing - | ExecutionMode::DepthGreater - | ExecutionMode::DepthLess - | ExecutionMode::DepthUnchanged => &[Capability::Shader], - ExecutionMode::SignedZeroInfNanPreserve => &[Capability::SignedZeroInfNanPreserve], - ExecutionMode::StencilRefReplacingEXT => &[Capability::StencilExportEXT], - ExecutionMode::SubgroupSize - | ExecutionMode::SubgroupsPerWorkgroup - | ExecutionMode::SubgroupsPerWorkgroupId => &[Capability::SubgroupDispatch], - ExecutionMode::SpacingEqual - | ExecutionMode::SpacingFractionalEven - | ExecutionMode::SpacingFractionalOdd - | ExecutionMode::VertexOrderCw - | ExecutionMode::VertexOrderCcw - | ExecutionMode::PointMode - | ExecutionMode::Quads - | ExecutionMode::Isolines => &[Capability::Tessellation], - ExecutionMode::Xfb => &[Capability::TransformFeedback], - } - } - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - ExecutionMode::Invocations - | ExecutionMode::SpacingEqual - | ExecutionMode::SpacingFractionalEven - | ExecutionMode::SpacingFractionalOdd - | ExecutionMode::VertexOrderCw - | ExecutionMode::VertexOrderCcw - | ExecutionMode::PixelCenterInteger - | ExecutionMode::OriginUpperLeft - | ExecutionMode::OriginLowerLeft - | ExecutionMode::EarlyFragmentTests - | ExecutionMode::PointMode - | ExecutionMode::Xfb - | ExecutionMode::DepthReplacing - | ExecutionMode::DepthGreater - | ExecutionMode::DepthLess - | ExecutionMode::DepthUnchanged - | ExecutionMode::LocalSize - | ExecutionMode::LocalSizeHint - | ExecutionMode::InputPoints - | ExecutionMode::InputLines - | ExecutionMode::InputLinesAdjacency - | ExecutionMode::Triangles - | ExecutionMode::InputTrianglesAdjacency - | ExecutionMode::Quads - | ExecutionMode::Isolines - | ExecutionMode::OutputVertices - | ExecutionMode::OutputPoints - | ExecutionMode::OutputLineStrip - | ExecutionMode::OutputTriangleStrip - | ExecutionMode::VecTypeHint - | ExecutionMode::ContractionOff - | ExecutionMode::Initializer - | ExecutionMode::Finalizer - | ExecutionMode::SubgroupSize - | ExecutionMode::SubgroupsPerWorkgroup - | ExecutionMode::SubgroupsPerWorkgroupId - | ExecutionMode::LocalSizeId - | ExecutionMode::LocalSizeHintId => &[], - ExecutionMode::PixelInterlockOrderedEXT - | ExecutionMode::PixelInterlockUnorderedEXT - | ExecutionMode::SampleInterlockOrderedEXT - | ExecutionMode::SampleInterlockUnorderedEXT - | ExecutionMode::ShadingRateInterlockOrderedEXT - | ExecutionMode::ShadingRateInterlockUnorderedEXT => { - &["SPV_EXT_fragment_shader_interlock"] - } - ExecutionMode::StencilRefReplacingEXT => &["SPV_EXT_shader_stencil_export"], - ExecutionMode::MaxWorkgroupSizeINTEL - | ExecutionMode::MaxWorkDimINTEL - | ExecutionMode::NoGlobalOffsetINTEL - | ExecutionMode::NumSIMDWorkitemsINTEL => &["SPV_INTEL_kernel_attributes"], - ExecutionMode::DenormPreserve - | ExecutionMode::DenormFlushToZero - | ExecutionMode::SignedZeroInfNanPreserve - | ExecutionMode::RoundingModeRTE - | ExecutionMode::RoundingModeRTZ => &["SPV_KHR_float_controls"], - ExecutionMode::PostDepthCoverage => &["SPV_KHR_post_depth_coverage"], - ExecutionMode::DerivativeGroupQuadsNV | ExecutionMode::DerivativeGroupLinearNV => { - &["SPV_NV_compute_shader_derivatives"] - } - ExecutionMode::OutputLinesNV - | ExecutionMode::OutputPrimitivesNV - | ExecutionMode::OutputTrianglesNV => &["SPV_NV_mesh_shader"], - } - } -} +impl ExecutionMode {} impl num_traits::FromPrimitive for ExecutionMode { #[allow(trivial_numeric_casts)] fn from_i64(n: i64) -> Option { @@ -714,64 +490,6 @@ impl StorageClass { pub const IncomingRayPayloadKHR: Self = Self::IncomingRayPayloadNV; pub const ShaderRecordBufferKHR: Self = Self::ShaderRecordBufferNV; pub const PhysicalStorageBufferEXT: Self = Self::PhysicalStorageBuffer; - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - StorageClass::UniformConstant - | StorageClass::Input - | StorageClass::Workgroup - | StorageClass::CrossWorkgroup - | StorageClass::Function - | StorageClass::Image => &[], - StorageClass::AtomicCounter => &[Capability::AtomicStorage], - StorageClass::CodeSectionINTEL => &[Capability::FunctionPointersINTEL], - StorageClass::Generic => &[Capability::GenericPointer], - StorageClass::PhysicalStorageBuffer => &[Capability::PhysicalStorageBufferAddresses], - StorageClass::CallableDataNV - | StorageClass::IncomingCallableDataNV - | StorageClass::RayPayloadNV - | StorageClass::HitAttributeNV - | StorageClass::IncomingRayPayloadNV - | StorageClass::ShaderRecordBufferNV => { - &[Capability::RayTracingNV, Capability::RayTracingKHR] - } - StorageClass::Uniform - | StorageClass::Output - | StorageClass::Private - | StorageClass::PushConstant - | StorageClass::StorageBuffer => &[Capability::Shader], - } - } - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - StorageClass::UniformConstant - | StorageClass::Input - | StorageClass::Uniform - | StorageClass::Output - | StorageClass::Workgroup - | StorageClass::CrossWorkgroup - | StorageClass::Private - | StorageClass::Function - | StorageClass::Generic - | StorageClass::PushConstant - | StorageClass::AtomicCounter - | StorageClass::Image => &[], - StorageClass::PhysicalStorageBuffer => &[ - "SPV_EXT_physical_storage_buffer", - "SPV_KHR_physical_storage_buffer", - ], - StorageClass::CodeSectionINTEL => &["SPV_INTEL_function_pointers"], - StorageClass::StorageBuffer => &[ - "SPV_KHR_storage_buffer_storage_class", - "SPV_KHR_variable_pointers", - ], - StorageClass::CallableDataNV - | StorageClass::IncomingCallableDataNV - | StorageClass::RayPayloadNV - | StorageClass::HitAttributeNV - | StorageClass::IncomingRayPayloadNV - | StorageClass::ShaderRecordBufferNV => &["SPV_NV_ray_tracing", "SPV_KHR_ray_tracing"], - } - } } impl num_traits::FromPrimitive for StorageClass { #[allow(trivial_numeric_casts)] @@ -856,34 +574,7 @@ pub enum Dim { DimSubpassData = 6u32, } #[allow(non_upper_case_globals)] -impl Dim { - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - Dim::Dim3D => &[], - Dim::DimSubpassData => &[Capability::InputAttachment], - Dim::Dim1D => &[Capability::Sampled1D, Capability::Image1D], - Dim::DimBuffer => &[Capability::SampledBuffer, Capability::ImageBuffer], - Dim::DimRect => &[Capability::SampledRect, Capability::ImageRect], - Dim::DimCube => &[Capability::Shader, Capability::ImageCubeArray], - Dim::Dim2D => &[ - Capability::Shader, - Capability::Kernel, - Capability::ImageMSArray, - ], - } - } - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - Dim::Dim1D - | Dim::Dim2D - | Dim::Dim3D - | Dim::DimCube - | Dim::DimRect - | Dim::DimBuffer - | Dim::DimSubpassData => &[], - } - } -} +impl Dim {} impl num_traits::FromPrimitive for Dim { #[allow(trivial_numeric_casts)] fn from_i64(n: i64) -> Option { @@ -930,26 +621,7 @@ pub enum SamplerAddressingMode { RepeatMirrored = 4u32, } #[allow(non_upper_case_globals)] -impl SamplerAddressingMode { - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - SamplerAddressingMode::None - | SamplerAddressingMode::ClampToEdge - | SamplerAddressingMode::Clamp - | SamplerAddressingMode::Repeat - | SamplerAddressingMode::RepeatMirrored => &[Capability::Kernel], - } - } - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - SamplerAddressingMode::None - | SamplerAddressingMode::ClampToEdge - | SamplerAddressingMode::Clamp - | SamplerAddressingMode::Repeat - | SamplerAddressingMode::RepeatMirrored => &[], - } - } -} +impl SamplerAddressingMode {} impl num_traits::FromPrimitive for SamplerAddressingMode { #[allow(trivial_numeric_casts)] fn from_i64(n: i64) -> Option { @@ -989,18 +661,7 @@ pub enum SamplerFilterMode { Linear = 1u32, } #[allow(non_upper_case_globals)] -impl SamplerFilterMode { - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - SamplerFilterMode::Nearest | SamplerFilterMode::Linear => &[Capability::Kernel], - } - } - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - SamplerFilterMode::Nearest | SamplerFilterMode::Linear => &[], - } - } -} +impl SamplerFilterMode {} impl num_traits::FromPrimitive for SamplerFilterMode { #[allow(trivial_numeric_casts)] fn from_i64(n: i64) -> Option { @@ -1074,99 +735,7 @@ pub enum ImageFormat { R64i = 41u32, } #[allow(non_upper_case_globals)] -impl ImageFormat { - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - ImageFormat::Unknown => &[], - ImageFormat::R64ui | ImageFormat::R64i => &[Capability::Int64ImageEXT], - ImageFormat::Rgba32f - | ImageFormat::Rgba16f - | ImageFormat::R32f - | ImageFormat::Rgba8 - | ImageFormat::Rgba8Snorm - | ImageFormat::Rgba32i - | ImageFormat::Rgba16i - | ImageFormat::Rgba8i - | ImageFormat::R32i - | ImageFormat::Rgba32ui - | ImageFormat::Rgba16ui - | ImageFormat::Rgba8ui - | ImageFormat::R32ui => &[Capability::Shader], - ImageFormat::Rg32f - | ImageFormat::Rg16f - | ImageFormat::R11fG11fB10f - | ImageFormat::R16f - | ImageFormat::Rgba16 - | ImageFormat::Rgb10A2 - | ImageFormat::Rg16 - | ImageFormat::Rg8 - | ImageFormat::R16 - | ImageFormat::R8 - | ImageFormat::Rgba16Snorm - | ImageFormat::Rg16Snorm - | ImageFormat::Rg8Snorm - | ImageFormat::R16Snorm - | ImageFormat::R8Snorm - | ImageFormat::Rg32i - | ImageFormat::Rg16i - | ImageFormat::Rg8i - | ImageFormat::R16i - | ImageFormat::R8i - | ImageFormat::Rgb10a2ui - | ImageFormat::Rg32ui - | ImageFormat::Rg16ui - | ImageFormat::Rg8ui - | ImageFormat::R16ui - | ImageFormat::R8ui => &[Capability::StorageImageExtendedFormats], - } - } - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - ImageFormat::Unknown - | ImageFormat::Rgba32f - | ImageFormat::Rgba16f - | ImageFormat::R32f - | ImageFormat::Rgba8 - | ImageFormat::Rgba8Snorm - | ImageFormat::Rg32f - | ImageFormat::Rg16f - | ImageFormat::R11fG11fB10f - | ImageFormat::R16f - | ImageFormat::Rgba16 - | ImageFormat::Rgb10A2 - | ImageFormat::Rg16 - | ImageFormat::Rg8 - | ImageFormat::R16 - | ImageFormat::R8 - | ImageFormat::Rgba16Snorm - | ImageFormat::Rg16Snorm - | ImageFormat::Rg8Snorm - | ImageFormat::R16Snorm - | ImageFormat::R8Snorm - | ImageFormat::Rgba32i - | ImageFormat::Rgba16i - | ImageFormat::Rgba8i - | ImageFormat::R32i - | ImageFormat::Rg32i - | ImageFormat::Rg16i - | ImageFormat::Rg8i - | ImageFormat::R16i - | ImageFormat::R8i - | ImageFormat::Rgba32ui - | ImageFormat::Rgba16ui - | ImageFormat::Rgba8ui - | ImageFormat::R32ui - | ImageFormat::Rgb10a2ui - | ImageFormat::Rg32ui - | ImageFormat::Rg16ui - | ImageFormat::Rg8ui - | ImageFormat::R16ui - | ImageFormat::R8ui - | ImageFormat::R64ui - | ImageFormat::R64i => &[], - } - } -} +impl ImageFormat {} impl num_traits::FromPrimitive for ImageFormat { #[allow(trivial_numeric_casts)] fn from_i64(n: i64) -> Option { @@ -1298,56 +867,7 @@ pub enum ImageChannelOrder { ABGR = 19u32, } #[allow(non_upper_case_globals)] -impl ImageChannelOrder { - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - ImageChannelOrder::R - | ImageChannelOrder::A - | ImageChannelOrder::RG - | ImageChannelOrder::RA - | ImageChannelOrder::RGB - | ImageChannelOrder::RGBA - | ImageChannelOrder::BGRA - | ImageChannelOrder::ARGB - | ImageChannelOrder::Intensity - | ImageChannelOrder::Luminance - | ImageChannelOrder::Rx - | ImageChannelOrder::RGx - | ImageChannelOrder::RGBx - | ImageChannelOrder::Depth - | ImageChannelOrder::DepthStencil - | ImageChannelOrder::sRGB - | ImageChannelOrder::sRGBx - | ImageChannelOrder::sRGBA - | ImageChannelOrder::sBGRA - | ImageChannelOrder::ABGR => &[Capability::Kernel], - } - } - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - ImageChannelOrder::R - | ImageChannelOrder::A - | ImageChannelOrder::RG - | ImageChannelOrder::RA - | ImageChannelOrder::RGB - | ImageChannelOrder::RGBA - | ImageChannelOrder::BGRA - | ImageChannelOrder::ARGB - | ImageChannelOrder::Intensity - | ImageChannelOrder::Luminance - | ImageChannelOrder::Rx - | ImageChannelOrder::RGx - | ImageChannelOrder::RGBx - | ImageChannelOrder::Depth - | ImageChannelOrder::DepthStencil - | ImageChannelOrder::sRGB - | ImageChannelOrder::sRGBx - | ImageChannelOrder::sRGBA - | ImageChannelOrder::sBGRA - | ImageChannelOrder::ABGR => &[], - } - } -} +impl ImageChannelOrder {} impl num_traits::FromPrimitive for ImageChannelOrder { #[allow(trivial_numeric_casts)] fn from_i64(n: i64) -> Option { @@ -1432,50 +952,7 @@ pub enum ImageChannelDataType { UnormInt101010_2 = 16u32, } #[allow(non_upper_case_globals)] -impl ImageChannelDataType { - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - ImageChannelDataType::SnormInt8 - | ImageChannelDataType::SnormInt16 - | ImageChannelDataType::UnormInt8 - | ImageChannelDataType::UnormInt16 - | ImageChannelDataType::UnormShort565 - | ImageChannelDataType::UnormShort555 - | ImageChannelDataType::UnormInt101010 - | ImageChannelDataType::SignedInt8 - | ImageChannelDataType::SignedInt16 - | ImageChannelDataType::SignedInt32 - | ImageChannelDataType::UnsignedInt8 - | ImageChannelDataType::UnsignedInt16 - | ImageChannelDataType::UnsignedInt32 - | ImageChannelDataType::HalfFloat - | ImageChannelDataType::Float - | ImageChannelDataType::UnormInt24 - | ImageChannelDataType::UnormInt101010_2 => &[Capability::Kernel], - } - } - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - ImageChannelDataType::SnormInt8 - | ImageChannelDataType::SnormInt16 - | ImageChannelDataType::UnormInt8 - | ImageChannelDataType::UnormInt16 - | ImageChannelDataType::UnormShort565 - | ImageChannelDataType::UnormShort555 - | ImageChannelDataType::UnormInt101010 - | ImageChannelDataType::SignedInt8 - | ImageChannelDataType::SignedInt16 - | ImageChannelDataType::SignedInt32 - | ImageChannelDataType::UnsignedInt8 - | ImageChannelDataType::UnsignedInt16 - | ImageChannelDataType::UnsignedInt32 - | ImageChannelDataType::HalfFloat - | ImageChannelDataType::Float - | ImageChannelDataType::UnormInt24 - | ImageChannelDataType::UnormInt101010_2 => &[], - } - } -} +impl ImageChannelDataType {} impl num_traits::FromPrimitive for ImageChannelDataType { #[allow(trivial_numeric_casts)] fn from_i64(n: i64) -> Option { @@ -1541,24 +1018,7 @@ pub enum FPRoundingMode { RTN = 3u32, } #[allow(non_upper_case_globals)] -impl FPRoundingMode { - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - FPRoundingMode::RTE - | FPRoundingMode::RTZ - | FPRoundingMode::RTP - | FPRoundingMode::RTN => &[], - } - } - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - FPRoundingMode::RTE - | FPRoundingMode::RTZ - | FPRoundingMode::RTP - | FPRoundingMode::RTN => &[], - } - } -} +impl FPRoundingMode {} impl num_traits::FromPrimitive for FPRoundingMode { #[allow(trivial_numeric_casts)] fn from_i64(n: i64) -> Option { @@ -1596,18 +1056,7 @@ pub enum LinkageType { Import = 1u32, } #[allow(non_upper_case_globals)] -impl LinkageType { - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - LinkageType::Export | LinkageType::Import => &[Capability::Linkage], - } - } - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - LinkageType::Export | LinkageType::Import => &[], - } - } -} +impl LinkageType {} impl num_traits::FromPrimitive for LinkageType { #[allow(trivial_numeric_casts)] fn from_i64(n: i64) -> Option { @@ -1642,22 +1091,7 @@ pub enum AccessQualifier { ReadWrite = 2u32, } #[allow(non_upper_case_globals)] -impl AccessQualifier { - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - AccessQualifier::ReadOnly | AccessQualifier::WriteOnly | AccessQualifier::ReadWrite => { - &[Capability::Kernel] - } - } - } - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - AccessQualifier::ReadOnly | AccessQualifier::WriteOnly | AccessQualifier::ReadWrite => { - &[] - } - } - } -} +impl AccessQualifier {} impl num_traits::FromPrimitive for AccessQualifier { #[allow(trivial_numeric_casts)] fn from_i64(n: i64) -> Option { @@ -1699,32 +1133,7 @@ pub enum FunctionParameterAttribute { NoReadWrite = 7u32, } #[allow(non_upper_case_globals)] -impl FunctionParameterAttribute { - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - FunctionParameterAttribute::Zext - | FunctionParameterAttribute::Sext - | FunctionParameterAttribute::ByVal - | FunctionParameterAttribute::Sret - | FunctionParameterAttribute::NoAlias - | FunctionParameterAttribute::NoCapture - | FunctionParameterAttribute::NoWrite - | FunctionParameterAttribute::NoReadWrite => &[Capability::Kernel], - } - } - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - FunctionParameterAttribute::Zext - | FunctionParameterAttribute::Sext - | FunctionParameterAttribute::ByVal - | FunctionParameterAttribute::Sret - | FunctionParameterAttribute::NoAlias - | FunctionParameterAttribute::NoCapture - | FunctionParameterAttribute::NoWrite - | FunctionParameterAttribute::NoReadWrite => &[], - } - } -} +impl FunctionParameterAttribute {} impl num_traits::FromPrimitive for FunctionParameterAttribute { #[allow(trivial_numeric_casts)] fn from_i64(n: i64) -> Option { @@ -1851,170 +1260,6 @@ impl Decoration { pub const AliasedPointerEXT: Self = Self::AliasedPointer; pub const HlslCounterBufferGOOGLE: Self = Self::CounterBuffer; pub const HlslSemanticGOOGLE: Self = Self::UserSemantic; - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - Decoration::BuiltIn - | Decoration::Restrict - | Decoration::Aliased - | Decoration::Volatile - | Decoration::Coherent - | Decoration::NonWritable - | Decoration::NonReadable - | Decoration::FPRoundingMode - | Decoration::NoSignedWrap - | Decoration::NoUnsignedWrap - | Decoration::ExplicitInterpAMD - | Decoration::CounterBuffer - | Decoration::UserSemantic - | Decoration::UserTypeGOOGLE => &[], - Decoration::MaxByteOffset | Decoration::MaxByteOffsetId => &[Capability::Addresses], - Decoration::RegisterINTEL - | Decoration::MemoryINTEL - | Decoration::NumbanksINTEL - | Decoration::BankwidthINTEL - | Decoration::MaxPrivateCopiesINTEL - | Decoration::SinglepumpINTEL - | Decoration::DoublepumpINTEL - | Decoration::MaxReplicatesINTEL - | Decoration::SimpleDualPortINTEL - | Decoration::MergeINTEL - | Decoration::BankBitsINTEL - | Decoration::ForcePow2DepthINTEL => &[Capability::FPGAMemoryAttributesINTEL], - Decoration::PerVertexNV => &[Capability::FragmentBarycentricNV], - Decoration::PassthroughNV => &[Capability::GeometryShaderPassthroughNV], - Decoration::Stream => &[Capability::GeometryStreams], - Decoration::ReferencedIndirectlyINTEL => &[Capability::IndirectReferencesINTEL], - Decoration::InputAttachmentIndex => &[Capability::InputAttachment], - Decoration::CPacked - | Decoration::Constant - | Decoration::SaturatedConversion - | Decoration::FuncParamAttr - | Decoration::FPFastMathMode - | Decoration::Alignment - | Decoration::AlignmentId => &[Capability::Kernel], - Decoration::LinkageAttributes => &[Capability::Linkage], - Decoration::RowMajor | Decoration::ColMajor | Decoration::MatrixStride => { - &[Capability::Matrix] - } - Decoration::PerPrimitiveNV | Decoration::PerViewNV | Decoration::PerTaskNV => { - &[Capability::MeshShadingNV] - } - Decoration::RestrictPointer | Decoration::AliasedPointer => { - &[Capability::PhysicalStorageBufferAddresses] - } - Decoration::OverrideCoverageNV => &[Capability::SampleMaskOverrideCoverageNV], - Decoration::Sample => &[Capability::SampleRateShading], - Decoration::RelaxedPrecision - | Decoration::Block - | Decoration::BufferBlock - | Decoration::ArrayStride - | Decoration::GLSLShared - | Decoration::GLSLPacked - | Decoration::NoPerspective - | Decoration::Flat - | Decoration::Centroid - | Decoration::Invariant - | Decoration::Uniform - | Decoration::UniformId - | Decoration::Location - | Decoration::Component - | Decoration::Index - | Decoration::Binding - | Decoration::DescriptorSet - | Decoration::Offset - | Decoration::NoContraction => &[Capability::Shader], - Decoration::SpecId => &[Capability::Shader, Capability::Kernel], - Decoration::NonUniform => &[Capability::ShaderNonUniform], - Decoration::SecondaryViewportRelativeNV => &[Capability::ShaderStereoViewNV], - Decoration::ViewportRelativeNV => &[Capability::ShaderViewportMaskNV], - Decoration::Patch => &[Capability::Tessellation], - Decoration::XfbBuffer | Decoration::XfbStride => &[Capability::TransformFeedback], - } - } - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - Decoration::RelaxedPrecision - | Decoration::SpecId - | Decoration::Block - | Decoration::BufferBlock - | Decoration::RowMajor - | Decoration::ColMajor - | Decoration::ArrayStride - | Decoration::MatrixStride - | Decoration::GLSLShared - | Decoration::GLSLPacked - | Decoration::CPacked - | Decoration::BuiltIn - | Decoration::NoPerspective - | Decoration::Flat - | Decoration::Patch - | Decoration::Centroid - | Decoration::Sample - | Decoration::Invariant - | Decoration::Restrict - | Decoration::Aliased - | Decoration::Volatile - | Decoration::Constant - | Decoration::Coherent - | Decoration::NonWritable - | Decoration::NonReadable - | Decoration::Uniform - | Decoration::UniformId - | Decoration::SaturatedConversion - | Decoration::Stream - | Decoration::Location - | Decoration::Component - | Decoration::Index - | Decoration::Binding - | Decoration::DescriptorSet - | Decoration::Offset - | Decoration::XfbBuffer - | Decoration::XfbStride - | Decoration::FuncParamAttr - | Decoration::FPRoundingMode - | Decoration::FPFastMathMode - | Decoration::LinkageAttributes - | Decoration::NoContraction - | Decoration::InputAttachmentIndex - | Decoration::Alignment - | Decoration::MaxByteOffset - | Decoration::AlignmentId - | Decoration::MaxByteOffsetId - | Decoration::ViewportRelativeNV - | Decoration::NonUniform - | Decoration::CounterBuffer - | Decoration::UserSemantic => &[], - Decoration::ExplicitInterpAMD => &["SPV_AMD_shader_explicit_vertex_parameter"], - Decoration::RestrictPointer | Decoration::AliasedPointer => &[ - "SPV_EXT_physical_storage_buffer", - "SPV_KHR_physical_storage_buffer", - ], - Decoration::UserTypeGOOGLE => &["SPV_GOOGLE_user_type"], - Decoration::RegisterINTEL - | Decoration::MemoryINTEL - | Decoration::NumbanksINTEL - | Decoration::BankwidthINTEL - | Decoration::MaxPrivateCopiesINTEL - | Decoration::SinglepumpINTEL - | Decoration::DoublepumpINTEL - | Decoration::MaxReplicatesINTEL - | Decoration::SimpleDualPortINTEL - | Decoration::MergeINTEL - | Decoration::BankBitsINTEL - | Decoration::ForcePow2DepthINTEL => &["SPV_INTEL_fpga_memory_attributes"], - Decoration::ReferencedIndirectlyINTEL => &["SPV_INTEL_function_pointers"], - Decoration::NoSignedWrap | Decoration::NoUnsignedWrap => { - &["SPV_KHR_no_integer_wrap_decoration"] - } - Decoration::PerVertexNV => &["SPV_NV_fragment_shader_barycentric"], - Decoration::PassthroughNV => &["SPV_NV_geometry_shader_passthrough"], - Decoration::PerPrimitiveNV | Decoration::PerViewNV | Decoration::PerTaskNV => { - &["SPV_NV_mesh_shader"] - } - Decoration::OverrideCoverageNV => &["SPV_NV_sample_mask_override_coverage"], - Decoration::SecondaryViewportRelativeNV => &["SPV_NV_stereo_view_rendering"], - } - } } impl num_traits::FromPrimitive for Decoration { #[allow(trivial_numeric_casts)] @@ -2321,241 +1566,6 @@ impl BuiltIn { pub const WorldToObjectKHR: Self = Self::WorldToObjectNV; pub const HitKindKHR: Self = Self::HitKindNV; pub const IncomingRayFlagsKHR: Self = Self::IncomingRayFlagsNV; - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - BuiltIn::NumWorkgroups - | BuiltIn::WorkgroupSize - | BuiltIn::WorkgroupId - | BuiltIn::LocalInvocationId - | BuiltIn::GlobalInvocationId - | BuiltIn::LocalInvocationIndex - | BuiltIn::BaryCoordNoPerspAMD - | BuiltIn::BaryCoordNoPerspCentroidAMD - | BuiltIn::BaryCoordNoPerspSampleAMD - | BuiltIn::BaryCoordSmoothAMD - | BuiltIn::BaryCoordSmoothCentroidAMD - | BuiltIn::BaryCoordSmoothSampleAMD - | BuiltIn::BaryCoordPullModelAMD => &[], - BuiltIn::ClipDistance => &[Capability::ClipDistance], - BuiltIn::CullDistance => &[Capability::CullDistance], - BuiltIn::DeviceIndex => &[Capability::DeviceGroup], - BuiltIn::BaseVertex | BuiltIn::BaseInstance => &[Capability::DrawParameters], - BuiltIn::DrawIndex => &[Capability::DrawParameters, Capability::MeshShadingNV], - BuiltIn::BaryCoordNV | BuiltIn::BaryCoordNoPerspNV => { - &[Capability::FragmentBarycentricNV] - } - BuiltIn::FragSizeEXT | BuiltIn::FragInvocationCountEXT => { - &[Capability::FragmentDensityEXT, Capability::ShadingRateNV] - } - BuiltIn::FullyCoveredEXT => &[Capability::FragmentFullyCoveredEXT], - BuiltIn::PrimitiveShadingRateKHR | BuiltIn::ShadingRateKHR => { - &[Capability::FragmentShadingRateKHR] - } - BuiltIn::Layer => &[ - Capability::Geometry, - Capability::ShaderLayer, - Capability::ShaderViewportIndexLayerEXT, - Capability::MeshShadingNV, - ], - BuiltIn::InvocationId => &[Capability::Geometry, Capability::Tessellation], - BuiltIn::PrimitiveId => &[ - Capability::Geometry, - Capability::Tessellation, - Capability::RayTracingNV, - Capability::RayTracingKHR, - Capability::MeshShadingNV, - ], - BuiltIn::WorkDim - | BuiltIn::GlobalSize - | BuiltIn::EnqueuedWorkgroupSize - | BuiltIn::GlobalOffset - | BuiltIn::GlobalLinearId - | BuiltIn::SubgroupMaxSize - | BuiltIn::NumEnqueuedSubgroups => &[Capability::Kernel], - BuiltIn::NumSubgroups | BuiltIn::SubgroupId => { - &[Capability::Kernel, Capability::GroupNonUniform] - } - BuiltIn::SubgroupSize | BuiltIn::SubgroupLocalInvocationId => &[ - Capability::Kernel, - Capability::GroupNonUniform, - Capability::SubgroupBallotKHR, - ], - BuiltIn::TaskCountNV - | BuiltIn::PrimitiveCountNV - | BuiltIn::PrimitiveIndicesNV - | BuiltIn::ClipDistancePerViewNV - | BuiltIn::CullDistancePerViewNV - | BuiltIn::LayerPerViewNV - | BuiltIn::MeshViewCountNV - | BuiltIn::MeshViewIndicesNV => &[Capability::MeshShadingNV], - BuiltIn::ViewIndex => &[Capability::MultiView], - BuiltIn::ViewportIndex => &[ - Capability::MultiViewport, - Capability::ShaderViewportIndex, - Capability::ShaderViewportIndexLayerEXT, - Capability::MeshShadingNV, - ], - BuiltIn::PositionPerViewNV | BuiltIn::ViewportMaskPerViewNV => { - &[Capability::PerViewAttributesNV, Capability::MeshShadingNV] - } - BuiltIn::RayGeometryIndexKHR => &[Capability::RayTracingKHR], - BuiltIn::HitTNV => &[Capability::RayTracingNV], - BuiltIn::LaunchIdNV - | BuiltIn::LaunchSizeNV - | BuiltIn::WorldRayOriginNV - | BuiltIn::WorldRayDirectionNV - | BuiltIn::ObjectRayOriginNV - | BuiltIn::ObjectRayDirectionNV - | BuiltIn::RayTminNV - | BuiltIn::RayTmaxNV - | BuiltIn::InstanceCustomIndexNV - | BuiltIn::ObjectToWorldNV - | BuiltIn::WorldToObjectNV - | BuiltIn::HitKindNV - | BuiltIn::IncomingRayFlagsNV => &[Capability::RayTracingNV, Capability::RayTracingKHR], - BuiltIn::SampleId | BuiltIn::SamplePosition => &[Capability::SampleRateShading], - BuiltIn::Position - | BuiltIn::PointSize - | BuiltIn::VertexId - | BuiltIn::InstanceId - | BuiltIn::FragCoord - | BuiltIn::PointCoord - | BuiltIn::FrontFacing - | BuiltIn::SampleMask - | BuiltIn::FragDepth - | BuiltIn::HelperInvocation - | BuiltIn::VertexIndex - | BuiltIn::InstanceIndex => &[Capability::Shader], - BuiltIn::WarpsPerSMNV | BuiltIn::SMCountNV | BuiltIn::WarpIDNV | BuiltIn::SMIDNV => { - &[Capability::ShaderSMBuiltinsNV] - } - BuiltIn::SecondaryPositionNV | BuiltIn::SecondaryViewportMaskNV => { - &[Capability::ShaderStereoViewNV] - } - BuiltIn::ViewportMaskNV => { - &[Capability::ShaderViewportMaskNV, Capability::MeshShadingNV] - } - BuiltIn::FragStencilRefEXT => &[Capability::StencilExportEXT], - BuiltIn::SubgroupEqMask - | BuiltIn::SubgroupGeMask - | BuiltIn::SubgroupGtMask - | BuiltIn::SubgroupLeMask - | BuiltIn::SubgroupLtMask => &[ - Capability::SubgroupBallotKHR, - Capability::GroupNonUniformBallot, - ], - BuiltIn::TessLevelOuter - | BuiltIn::TessLevelInner - | BuiltIn::TessCoord - | BuiltIn::PatchVertices => &[Capability::Tessellation], - } - } - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - BuiltIn::Position - | BuiltIn::PointSize - | BuiltIn::ClipDistance - | BuiltIn::CullDistance - | BuiltIn::VertexId - | BuiltIn::InstanceId - | BuiltIn::PrimitiveId - | BuiltIn::InvocationId - | BuiltIn::Layer - | BuiltIn::ViewportIndex - | BuiltIn::TessLevelOuter - | BuiltIn::TessLevelInner - | BuiltIn::TessCoord - | BuiltIn::PatchVertices - | BuiltIn::FragCoord - | BuiltIn::PointCoord - | BuiltIn::FrontFacing - | BuiltIn::SampleId - | BuiltIn::SamplePosition - | BuiltIn::SampleMask - | BuiltIn::FragDepth - | BuiltIn::HelperInvocation - | BuiltIn::NumWorkgroups - | BuiltIn::WorkgroupSize - | BuiltIn::WorkgroupId - | BuiltIn::LocalInvocationId - | BuiltIn::GlobalInvocationId - | BuiltIn::LocalInvocationIndex - | BuiltIn::WorkDim - | BuiltIn::GlobalSize - | BuiltIn::EnqueuedWorkgroupSize - | BuiltIn::GlobalOffset - | BuiltIn::GlobalLinearId - | BuiltIn::SubgroupSize - | BuiltIn::SubgroupMaxSize - | BuiltIn::NumSubgroups - | BuiltIn::NumEnqueuedSubgroups - | BuiltIn::SubgroupId - | BuiltIn::SubgroupLocalInvocationId - | BuiltIn::VertexIndex - | BuiltIn::InstanceIndex - | BuiltIn::SubgroupEqMask - | BuiltIn::SubgroupGeMask - | BuiltIn::SubgroupGtMask - | BuiltIn::SubgroupLeMask - | BuiltIn::SubgroupLtMask => &[], - BuiltIn::BaryCoordNoPerspAMD - | BuiltIn::BaryCoordNoPerspCentroidAMD - | BuiltIn::BaryCoordNoPerspSampleAMD - | BuiltIn::BaryCoordSmoothAMD - | BuiltIn::BaryCoordSmoothCentroidAMD - | BuiltIn::BaryCoordSmoothSampleAMD - | BuiltIn::BaryCoordPullModelAMD => &["SPV_AMD_shader_explicit_vertex_parameter"], - BuiltIn::FullyCoveredEXT => &["SPV_EXT_fragment_fully_covered"], - BuiltIn::FragSizeEXT | BuiltIn::FragInvocationCountEXT => { - &["SPV_EXT_fragment_invocation_density", "SPV_NV_shading_rate"] - } - BuiltIn::FragStencilRefEXT => &["SPV_EXT_shader_stencil_export"], - BuiltIn::DeviceIndex => &["SPV_KHR_device_group"], - BuiltIn::PrimitiveShadingRateKHR | BuiltIn::ShadingRateKHR => { - &["SPV_KHR_fragment_shading_rate"] - } - BuiltIn::ViewIndex => &["SPV_KHR_multiview"], - BuiltIn::RayGeometryIndexKHR => &["SPV_KHR_ray_tracing"], - BuiltIn::BaseVertex | BuiltIn::BaseInstance => &["SPV_KHR_shader_draw_parameters"], - BuiltIn::DrawIndex => &["SPV_KHR_shader_draw_parameters", "SPV_NV_mesh_shader"], - BuiltIn::PositionPerViewNV | BuiltIn::ViewportMaskPerViewNV => &[ - "SPV_NVX_multiview_per_view_attributes", - "SPV_NV_mesh_shader", - ], - BuiltIn::BaryCoordNV | BuiltIn::BaryCoordNoPerspNV => { - &["SPV_NV_fragment_shader_barycentric"] - } - BuiltIn::TaskCountNV - | BuiltIn::PrimitiveCountNV - | BuiltIn::PrimitiveIndicesNV - | BuiltIn::ClipDistancePerViewNV - | BuiltIn::CullDistancePerViewNV - | BuiltIn::LayerPerViewNV - | BuiltIn::MeshViewCountNV - | BuiltIn::MeshViewIndicesNV => &["SPV_NV_mesh_shader"], - BuiltIn::HitTNV => &["SPV_NV_ray_tracing"], - BuiltIn::LaunchIdNV - | BuiltIn::LaunchSizeNV - | BuiltIn::WorldRayOriginNV - | BuiltIn::WorldRayDirectionNV - | BuiltIn::ObjectRayOriginNV - | BuiltIn::ObjectRayDirectionNV - | BuiltIn::RayTminNV - | BuiltIn::RayTmaxNV - | BuiltIn::InstanceCustomIndexNV - | BuiltIn::ObjectToWorldNV - | BuiltIn::WorldToObjectNV - | BuiltIn::HitKindNV - | BuiltIn::IncomingRayFlagsNV => &["SPV_NV_ray_tracing", "SPV_KHR_ray_tracing"], - BuiltIn::WarpsPerSMNV | BuiltIn::SMCountNV | BuiltIn::WarpIDNV | BuiltIn::SMIDNV => { - &["SPV_NV_shader_sm_builtins"] - } - BuiltIn::SecondaryPositionNV | BuiltIn::SecondaryViewportMaskNV => { - &["SPV_NV_stereo_view_rendering"] - } - BuiltIn::ViewportMaskNV => &["SPV_NV_viewport_array2", "SPV_NV_mesh_shader"], - } - } } impl num_traits::FromPrimitive for BuiltIn { #[allow(trivial_numeric_casts)] @@ -2809,28 +1819,6 @@ pub enum Scope { #[allow(non_upper_case_globals)] impl Scope { pub const QueueFamilyKHR: Self = Self::QueueFamily; - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - Scope::CrossDevice - | Scope::Device - | Scope::Workgroup - | Scope::Subgroup - | Scope::Invocation => &[], - Scope::ShaderCallKHR => &[Capability::RayTracingKHR], - Scope::QueueFamily => &[Capability::VulkanMemoryModel], - } - } - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - Scope::CrossDevice - | Scope::Device - | Scope::Workgroup - | Scope::Subgroup - | Scope::Invocation - | Scope::QueueFamily - | Scope::ShaderCallKHR => &[], - } - } } impl num_traits::FromPrimitive for Scope { #[allow(trivial_numeric_casts)] @@ -2881,36 +1869,7 @@ pub enum GroupOperation { PartitionedExclusiveScanNV = 8u32, } #[allow(non_upper_case_globals)] -impl GroupOperation { - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - GroupOperation::ClusteredReduce => &[Capability::GroupNonUniformClustered], - GroupOperation::PartitionedReduceNV - | GroupOperation::PartitionedInclusiveScanNV - | GroupOperation::PartitionedExclusiveScanNV => { - &[Capability::GroupNonUniformPartitionedNV] - } - GroupOperation::Reduce - | GroupOperation::InclusiveScan - | GroupOperation::ExclusiveScan => &[ - Capability::Kernel, - Capability::GroupNonUniformArithmetic, - Capability::GroupNonUniformBallot, - ], - } - } - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - GroupOperation::Reduce - | GroupOperation::InclusiveScan - | GroupOperation::ExclusiveScan - | GroupOperation::ClusteredReduce => &[], - GroupOperation::PartitionedReduceNV - | GroupOperation::PartitionedInclusiveScanNV - | GroupOperation::PartitionedExclusiveScanNV => &["SPV_NV_shader_subgroup_partitioned"], - } - } -} +impl GroupOperation {} impl num_traits::FromPrimitive for GroupOperation { #[allow(trivial_numeric_casts)] fn from_i64(n: i64) -> Option { @@ -2955,22 +1914,7 @@ pub enum KernelEnqueueFlags { WaitWorkGroup = 2u32, } #[allow(non_upper_case_globals)] -impl KernelEnqueueFlags { - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - KernelEnqueueFlags::NoWait - | KernelEnqueueFlags::WaitKernel - | KernelEnqueueFlags::WaitWorkGroup => &[Capability::Kernel], - } - } - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - KernelEnqueueFlags::NoWait - | KernelEnqueueFlags::WaitKernel - | KernelEnqueueFlags::WaitWorkGroup => &[], - } - } -} +impl KernelEnqueueFlags {} impl num_traits::FromPrimitive for KernelEnqueueFlags { #[allow(trivial_numeric_casts)] fn from_i64(n: i64) -> Option { @@ -3192,354 +2136,6 @@ impl Capability { pub const VulkanMemoryModelKHR: Self = Self::VulkanMemoryModel; pub const VulkanMemoryModelDeviceScopeKHR: Self = Self::VulkanMemoryModelDeviceScope; pub const PhysicalStorageBufferAddressesEXT: Self = Self::PhysicalStorageBufferAddresses; - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - Capability::Matrix - | Capability::Addresses - | Capability::Linkage - | Capability::Kernel - | Capability::Float16 - | Capability::Float64 - | Capability::Int64 - | Capability::Groups - | Capability::Int16 - | Capability::Int8 - | Capability::Sampled1D - | Capability::SampledBuffer - | Capability::GroupNonUniform - | Capability::ShaderLayer - | Capability::ShaderViewportIndex - | Capability::SubgroupBallotKHR - | Capability::SubgroupVoteKHR - | Capability::StorageBuffer16BitAccess - | Capability::StoragePushConstant16 - | Capability::StorageInputOutput16 - | Capability::DeviceGroup - | Capability::AtomicStorageOps - | Capability::SampleMaskPostDepthCoverage - | Capability::StorageBuffer8BitAccess - | Capability::StoragePushConstant8 - | Capability::DenormPreserve - | Capability::DenormFlushToZero - | Capability::SignedZeroInfNanPreserve - | Capability::RoundingModeRTE - | Capability::RoundingModeRTZ - | Capability::ImageFootprintNV - | Capability::FragmentBarycentricNV - | Capability::ComputeDerivativeGroupQuadsNV - | Capability::GroupNonUniformPartitionedNV - | Capability::VulkanMemoryModel - | Capability::VulkanMemoryModelDeviceScope - | Capability::ComputeDerivativeGroupLinearNV - | Capability::SubgroupShuffleINTEL - | Capability::SubgroupBufferBlockIOINTEL - | Capability::SubgroupImageBlockIOINTEL - | Capability::SubgroupImageMediaBlockIOINTEL - | Capability::FunctionPointersINTEL - | Capability::IndirectReferencesINTEL - | Capability::SubgroupAvcMotionEstimationINTEL - | Capability::SubgroupAvcMotionEstimationIntraINTEL - | Capability::SubgroupAvcMotionEstimationChromaINTEL - | Capability::FPGAMemoryAttributesINTEL - | Capability::UnstructuredLoopControlsINTEL - | Capability::FPGALoopControlsINTEL - | Capability::KernelAttributesINTEL - | Capability::FPGAKernelAttributesINTEL - | Capability::BlockingPipesINTEL - | Capability::FPGARegINTEL => &[], - Capability::GenericPointer => &[Capability::Addresses], - Capability::SubgroupDispatch => &[Capability::DeviceEnqueue], - Capability::GeometryPointSize - | Capability::GeometryStreams - | Capability::MultiViewport - | Capability::GeometryShaderPassthroughNV => &[Capability::Geometry], - Capability::GroupNonUniformVote - | Capability::GroupNonUniformArithmetic - | Capability::GroupNonUniformBallot - | Capability::GroupNonUniformShuffle - | Capability::GroupNonUniformShuffleRelative - | Capability::GroupNonUniformClustered - | Capability::GroupNonUniformQuad => &[Capability::GroupNonUniform], - Capability::ImageReadWrite | Capability::ImageMipmap => &[Capability::ImageBasic], - Capability::StorageTexelBufferArrayDynamicIndexing => &[Capability::ImageBuffer], - Capability::StorageTexelBufferArrayNonUniformIndexing => { - &[Capability::ImageBuffer, Capability::ShaderNonUniform] - } - Capability::InputAttachmentArrayDynamicIndexing => &[Capability::InputAttachment], - Capability::InputAttachmentArrayNonUniformIndexing => { - &[Capability::InputAttachment, Capability::ShaderNonUniform] - } - Capability::Int64Atomics => &[Capability::Int64], - Capability::Vector16 - | Capability::Float16Buffer - | Capability::ImageBasic - | Capability::Pipes - | Capability::DeviceEnqueue - | Capability::LiteralSampler - | Capability::NamedBarrier => &[Capability::Kernel], - Capability::Shader => &[Capability::Matrix], - Capability::PerViewAttributesNV => &[Capability::MultiView], - Capability::ShaderViewportIndexLayerEXT => &[Capability::MultiViewport], - Capability::PipeStorage => &[Capability::Pipes], - Capability::RayTraversalPrimitiveCullingKHR => { - &[Capability::RayQueryKHR, Capability::RayTracingKHR] - } - Capability::SampleMaskOverrideCoverageNV => &[Capability::SampleRateShading], - Capability::Image1D => &[Capability::Sampled1D], - Capability::ImageBuffer | Capability::UniformTexelBufferArrayDynamicIndexing => { - &[Capability::SampledBuffer] - } - Capability::UniformTexelBufferArrayNonUniformIndexing => { - &[Capability::SampledBuffer, Capability::ShaderNonUniform] - } - Capability::ImageCubeArray => &[Capability::SampledCubeArray], - Capability::ImageRect => &[Capability::SampledRect], - Capability::Geometry - | Capability::Tessellation - | Capability::AtomicStorage - | Capability::ImageGatherExtended - | Capability::StorageImageMultisample - | Capability::UniformBufferArrayDynamicIndexing - | Capability::SampledImageArrayDynamicIndexing - | Capability::StorageBufferArrayDynamicIndexing - | Capability::StorageImageArrayDynamicIndexing - | Capability::ClipDistance - | Capability::CullDistance - | Capability::SampleRateShading - | Capability::SampledRect - | Capability::InputAttachment - | Capability::SparseResidency - | Capability::MinLod - | Capability::SampledCubeArray - | Capability::ImageMSArray - | Capability::StorageImageExtendedFormats - | Capability::ImageQuery - | Capability::DerivativeControl - | Capability::InterpolationFunction - | Capability::TransformFeedback - | Capability::StorageImageReadWithoutFormat - | Capability::StorageImageWriteWithoutFormat - | Capability::FragmentShadingRateKHR - | Capability::DrawParameters - | Capability::MultiView - | Capability::VariablePointersStorageBuffer - | Capability::RayQueryProvisionalKHR - | Capability::RayQueryKHR - | Capability::RayTracingKHR - | Capability::Float16ImageAMD - | Capability::ImageGatherBiasLodAMD - | Capability::FragmentMaskAMD - | Capability::StencilExportEXT - | Capability::ImageReadWriteLodAMD - | Capability::Int64ImageEXT - | Capability::ShaderClockKHR - | Capability::FragmentFullyCoveredEXT - | Capability::MeshShadingNV - | Capability::FragmentDensityEXT - | Capability::ShaderNonUniform - | Capability::RuntimeDescriptorArray - | Capability::RayTracingNV - | Capability::PhysicalStorageBufferAddresses - | Capability::RayTracingProvisionalKHR - | Capability::CooperativeMatrixNV - | Capability::FragmentShaderSampleInterlockEXT - | Capability::FragmentShaderShadingRateInterlockEXT - | Capability::ShaderSMBuiltinsNV - | Capability::FragmentShaderPixelInterlockEXT - | Capability::DemoteToHelperInvocationEXT - | Capability::IntegerFunctions2INTEL - | Capability::AtomicFloat32AddEXT - | Capability::AtomicFloat64AddEXT => &[Capability::Shader], - Capability::UniformBufferArrayNonUniformIndexing - | Capability::SampledImageArrayNonUniformIndexing - | Capability::StorageBufferArrayNonUniformIndexing - | Capability::StorageImageArrayNonUniformIndexing => &[Capability::ShaderNonUniform], - Capability::ShaderViewportMaskNV => &[Capability::ShaderViewportIndexLayerNV], - Capability::ShaderStereoViewNV => &[Capability::ShaderViewportMaskNV], - Capability::UniformAndStorageBuffer16BitAccess => &[ - Capability::StorageBuffer16BitAccess, - Capability::StorageUniformBufferBlock16, - ], - Capability::UniformAndStorageBuffer8BitAccess => &[Capability::StorageBuffer8BitAccess], - Capability::TessellationPointSize => &[Capability::Tessellation], - Capability::VariablePointers => &[Capability::VariablePointersStorageBuffer], - } - } - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - Capability::Matrix - | Capability::Shader - | Capability::Geometry - | Capability::Tessellation - | Capability::Addresses - | Capability::Linkage - | Capability::Kernel - | Capability::Vector16 - | Capability::Float16Buffer - | Capability::Float16 - | Capability::Float64 - | Capability::Int64 - | Capability::Int64Atomics - | Capability::ImageBasic - | Capability::ImageReadWrite - | Capability::ImageMipmap - | Capability::Pipes - | Capability::DeviceEnqueue - | Capability::LiteralSampler - | Capability::AtomicStorage - | Capability::Int16 - | Capability::TessellationPointSize - | Capability::GeometryPointSize - | Capability::ImageGatherExtended - | Capability::StorageImageMultisample - | Capability::UniformBufferArrayDynamicIndexing - | Capability::SampledImageArrayDynamicIndexing - | Capability::StorageBufferArrayDynamicIndexing - | Capability::StorageImageArrayDynamicIndexing - | Capability::ClipDistance - | Capability::CullDistance - | Capability::ImageCubeArray - | Capability::SampleRateShading - | Capability::ImageRect - | Capability::SampledRect - | Capability::GenericPointer - | Capability::Int8 - | Capability::InputAttachment - | Capability::SparseResidency - | Capability::MinLod - | Capability::Sampled1D - | Capability::Image1D - | Capability::SampledCubeArray - | Capability::SampledBuffer - | Capability::ImageBuffer - | Capability::ImageMSArray - | Capability::StorageImageExtendedFormats - | Capability::ImageQuery - | Capability::DerivativeControl - | Capability::InterpolationFunction - | Capability::TransformFeedback - | Capability::GeometryStreams - | Capability::StorageImageReadWithoutFormat - | Capability::StorageImageWriteWithoutFormat - | Capability::MultiViewport - | Capability::SubgroupDispatch - | Capability::NamedBarrier - | Capability::PipeStorage - | Capability::GroupNonUniform - | Capability::GroupNonUniformVote - | Capability::GroupNonUniformArithmetic - | Capability::GroupNonUniformBallot - | Capability::GroupNonUniformShuffle - | Capability::GroupNonUniformShuffleRelative - | Capability::GroupNonUniformClustered - | Capability::GroupNonUniformQuad - | Capability::ShaderLayer - | Capability::ShaderViewportIndex - | Capability::ShaderNonUniform - | Capability::RuntimeDescriptorArray - | Capability::InputAttachmentArrayDynamicIndexing - | Capability::UniformTexelBufferArrayDynamicIndexing - | Capability::StorageTexelBufferArrayDynamicIndexing - | Capability::UniformBufferArrayNonUniformIndexing - | Capability::SampledImageArrayNonUniformIndexing - | Capability::StorageBufferArrayNonUniformIndexing - | Capability::StorageImageArrayNonUniformIndexing - | Capability::InputAttachmentArrayNonUniformIndexing - | Capability::UniformTexelBufferArrayNonUniformIndexing - | Capability::StorageTexelBufferArrayNonUniformIndexing - | Capability::VulkanMemoryModel - | Capability::VulkanMemoryModelDeviceScope => &[], - Capability::Float16ImageAMD => &["SPV_AMD_gpu_shader_half_float_fetch"], - Capability::Groups => &["SPV_AMD_shader_ballot"], - Capability::FragmentMaskAMD => &["SPV_AMD_shader_fragment_mask"], - Capability::ImageReadWriteLodAMD => &["SPV_AMD_shader_image_load_store_lod"], - Capability::ImageGatherBiasLodAMD => &["SPV_AMD_texture_gather_bias_lod"], - Capability::DemoteToHelperInvocationEXT => &["SPV_EXT_demote_to_helper_invocation"], - Capability::FragmentFullyCoveredEXT => &["SPV_EXT_fragment_fully_covered"], - Capability::FragmentDensityEXT => { - &["SPV_EXT_fragment_invocation_density", "SPV_NV_shading_rate"] - } - Capability::FragmentShaderSampleInterlockEXT - | Capability::FragmentShaderShadingRateInterlockEXT - | Capability::FragmentShaderPixelInterlockEXT => &["SPV_EXT_fragment_shader_interlock"], - Capability::PhysicalStorageBufferAddresses => &[ - "SPV_EXT_physical_storage_buffer", - "SPV_KHR_physical_storage_buffer", - ], - Capability::AtomicFloat32AddEXT | Capability::AtomicFloat64AddEXT => { - &["SPV_EXT_shader_atomic_float_add"] - } - Capability::Int64ImageEXT => &["SPV_EXT_shader_image_int64"], - Capability::StencilExportEXT => &["SPV_EXT_shader_stencil_export"], - Capability::ShaderViewportIndexLayerEXT => &["SPV_EXT_shader_viewport_index_layer"], - Capability::BlockingPipesINTEL => &["SPV_INTEL_blocking_pipes"], - Capability::SubgroupAvcMotionEstimationINTEL - | Capability::SubgroupAvcMotionEstimationIntraINTEL - | Capability::SubgroupAvcMotionEstimationChromaINTEL => { - &["SPV_INTEL_device_side_avc_motion_estimation"] - } - Capability::FPGALoopControlsINTEL => &["SPV_INTEL_fpga_loop_controls"], - Capability::FPGAMemoryAttributesINTEL => &["SPV_INTEL_fpga_memory_attributes"], - Capability::FPGARegINTEL => &["SPV_INTEL_fpga_reg"], - Capability::FunctionPointersINTEL | Capability::IndirectReferencesINTEL => { - &["SPV_INTEL_function_pointers"] - } - Capability::KernelAttributesINTEL | Capability::FPGAKernelAttributesINTEL => { - &["SPV_INTEL_kernel_attributes"] - } - Capability::SubgroupImageMediaBlockIOINTEL => &["SPV_INTEL_media_block_io"], - Capability::IntegerFunctions2INTEL => &["SPV_INTEL_shader_integer_functions2"], - Capability::SubgroupShuffleINTEL - | Capability::SubgroupBufferBlockIOINTEL - | Capability::SubgroupImageBlockIOINTEL => &["SPV_INTEL_subgroups"], - Capability::UnstructuredLoopControlsINTEL => &["SPV_INTEL_unstructured_loop_controls"], - Capability::StorageBuffer16BitAccess - | Capability::UniformAndStorageBuffer16BitAccess - | Capability::StoragePushConstant16 - | Capability::StorageInputOutput16 => &["SPV_KHR_16bit_storage"], - Capability::StorageBuffer8BitAccess - | Capability::UniformAndStorageBuffer8BitAccess - | Capability::StoragePushConstant8 => &["SPV_KHR_8bit_storage"], - Capability::DeviceGroup => &["SPV_KHR_device_group"], - Capability::DenormPreserve - | Capability::DenormFlushToZero - | Capability::SignedZeroInfNanPreserve - | Capability::RoundingModeRTE - | Capability::RoundingModeRTZ => &["SPV_KHR_float_controls"], - Capability::FragmentShadingRateKHR => &["SPV_KHR_fragment_shading_rate"], - Capability::MultiView => &["SPV_KHR_multiview"], - Capability::SampleMaskPostDepthCoverage => &["SPV_KHR_post_depth_coverage"], - Capability::RayQueryProvisionalKHR | Capability::RayQueryKHR => &["SPV_KHR_ray_query"], - Capability::RayTraversalPrimitiveCullingKHR => { - &["SPV_KHR_ray_query", "SPV_KHR_ray_tracing"] - } - Capability::RayTracingKHR | Capability::RayTracingProvisionalKHR => { - &["SPV_KHR_ray_tracing"] - } - Capability::AtomicStorageOps => &["SPV_KHR_shader_atomic_counter_ops"], - Capability::SubgroupBallotKHR => &["SPV_KHR_shader_ballot"], - Capability::ShaderClockKHR => &["SPV_KHR_shader_clock"], - Capability::DrawParameters => &["SPV_KHR_shader_draw_parameters"], - Capability::SubgroupVoteKHR => &["SPV_KHR_subgroup_vote"], - Capability::VariablePointersStorageBuffer | Capability::VariablePointers => { - &["SPV_KHR_variable_pointers"] - } - Capability::PerViewAttributesNV => &["SPV_NVX_multiview_per_view_attributes"], - Capability::ComputeDerivativeGroupQuadsNV - | Capability::ComputeDerivativeGroupLinearNV => &["SPV_NV_compute_shader_derivatives"], - Capability::CooperativeMatrixNV => &["SPV_NV_cooperative_matrix"], - Capability::FragmentBarycentricNV => &["SPV_NV_fragment_shader_barycentric"], - Capability::GeometryShaderPassthroughNV => &["SPV_NV_geometry_shader_passthrough"], - Capability::MeshShadingNV => &["SPV_NV_mesh_shader"], - Capability::RayTracingNV => &["SPV_NV_ray_tracing"], - Capability::SampleMaskOverrideCoverageNV => &["SPV_NV_sample_mask_override_coverage"], - Capability::ImageFootprintNV => &["SPV_NV_shader_image_footprint"], - Capability::ShaderSMBuiltinsNV => &["SPV_NV_shader_sm_builtins"], - Capability::GroupNonUniformPartitionedNV => &["SPV_NV_shader_subgroup_partitioned"], - Capability::ShaderStereoViewNV => &["SPV_NV_stereo_view_rendering"], - Capability::ShaderViewportMaskNV => &["SPV_NV_viewport_array2"], - } - } } impl num_traits::FromPrimitive for Capability { #[allow(trivial_numeric_casts)] @@ -3945,20 +2541,7 @@ pub enum RayQueryIntersection { RayQueryCommittedIntersectionKHR = 1u32, } #[allow(non_upper_case_globals)] -impl RayQueryIntersection { - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - RayQueryIntersection::RayQueryCandidateIntersectionKHR - | RayQueryIntersection::RayQueryCommittedIntersectionKHR => &[Capability::RayQueryKHR], - } - } - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - RayQueryIntersection::RayQueryCandidateIntersectionKHR - | RayQueryIntersection::RayQueryCommittedIntersectionKHR => &[], - } - } -} +impl RayQueryIntersection {} impl num_traits::FromPrimitive for RayQueryIntersection { #[allow(trivial_numeric_casts)] fn from_i64(n: i64) -> Option { @@ -3993,24 +2576,7 @@ pub enum RayQueryCommittedIntersectionType { RayQueryCommittedIntersectionGeneratedKHR = 2u32, } #[allow(non_upper_case_globals)] -impl RayQueryCommittedIntersectionType { - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - RayQueryCommittedIntersectionType::RayQueryCommittedIntersectionNoneKHR - | RayQueryCommittedIntersectionType::RayQueryCommittedIntersectionTriangleKHR - | RayQueryCommittedIntersectionType::RayQueryCommittedIntersectionGeneratedKHR => { - &[Capability::RayQueryKHR] - } - } - } - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - RayQueryCommittedIntersectionType::RayQueryCommittedIntersectionNoneKHR - | RayQueryCommittedIntersectionType::RayQueryCommittedIntersectionTriangleKHR - | RayQueryCommittedIntersectionType::RayQueryCommittedIntersectionGeneratedKHR => &[], - } - } -} +impl RayQueryCommittedIntersectionType {} impl num_traits::FromPrimitive for RayQueryCommittedIntersectionType { #[allow(trivial_numeric_casts)] fn from_i64(n: i64) -> Option { @@ -4052,22 +2618,7 @@ pub enum RayQueryCandidateIntersectionType { RayQueryCandidateIntersectionAABBKHR = 1u32, } #[allow(non_upper_case_globals)] -impl RayQueryCandidateIntersectionType { - pub fn required_capabilities(self) -> &'static [Capability] { - match self { - RayQueryCandidateIntersectionType::RayQueryCandidateIntersectionTriangleKHR - | RayQueryCandidateIntersectionType::RayQueryCandidateIntersectionAABBKHR => { - &[Capability::RayQueryKHR] - } - } - } - pub fn required_extensions(self) -> &'static [&'static str] { - match self { - RayQueryCandidateIntersectionType::RayQueryCandidateIntersectionTriangleKHR - | RayQueryCandidateIntersectionType::RayQueryCandidateIntersectionAABBKHR => &[], - } - } -} +impl RayQueryCandidateIntersectionType {} impl num_traits::FromPrimitive for RayQueryCandidateIntersectionType { #[allow(trivial_numeric_casts)] fn from_i64(n: i64) -> Option { From 71a2cba3646a05b2de7a10a3d8e532b997701334 Mon Sep 17 00:00:00 2001 From: Jasper Bekkers Date: Thu, 11 Feb 2021 14:48:29 +0100 Subject: [PATCH 2/3] Also added BitEnum support for Capablity & Extension computation --- autogen/src/dr.rs | 85 +++- autogen/src/header.rs | 73 ---- rspirv/dr/autogen_operand.rs | 734 +++++++++++++++++++++-------------- spirv/autogen_spirv.rs | 10 - 4 files changed, 516 insertions(+), 386 deletions(-) diff --git a/autogen/src/dr.rs b/autogen/src/dr.rs index f60f88ce..7c1e7ec5 100644 --- a/autogen/src/dr.rs +++ b/autogen/src/dr.rs @@ -276,17 +276,15 @@ pub fn gen_dr_operand_kinds(grammar: &[structs::OperandKind]) -> TokenStream { } }; - let translate_quant = |quant: crate::structs::Quantifier| { - match quant { - structs::Quantifier::One => { - quote! { crate::grammar::OperandQuantifier::One } - } - structs::Quantifier::ZeroOrOne => { - quote! { crate::grammar::OperandQuantifier::ZeroOrOne } - } - structs::Quantifier::ZeroOrMore => { - quote! { crate::grammar::OperandQuantifier::ZeroOrMore } - } + let translate_quant = |quant: crate::structs::Quantifier| match quant { + structs::Quantifier::One => { + quote! { crate::grammar::OperandQuantifier::One } + } + structs::Quantifier::ZeroOrOne => { + quote! { crate::grammar::OperandQuantifier::ZeroOrOne } + } + structs::Quantifier::ZeroOrMore => { + quote! { crate::grammar::OperandQuantifier::ZeroOrMore } } }; @@ -393,12 +391,35 @@ pub fn gen_dr_operand_kinds(grammar: &[structs::OperandKind]) -> TokenStream { } let extensions = if category == &structs::Category::BitEnum { - quote! {} + let extensions = extension_clauses + .into_iter() + .filter(|(k, _)| !k.is_empty()) + .map(|(k, v)| { + let kinds = std::iter::repeat(quote! { s::#kind }); + + quote! { + if v.intersects(#(#kinds::#v)|*) { + result.extend_from_slice(&[#( #k ),*]) + } + } + }).collect::>(); + + if extensions.is_empty() { + quote! {} + } else { + quote! { + Self::#kind(v) => { + let mut result = vec![]; + #( #extensions );*; + result + } + } + } } else { let extensions = extension_clauses.into_iter().map(|(k, v)| { let kinds = std::iter::repeat(quote! { s::#kind }); quote! { - #( #kinds::#v )|* => &[#( #k ),*] + #( #kinds::#v )|* => vec![#( #k ),*] } }); @@ -410,13 +431,37 @@ pub fn gen_dr_operand_kinds(grammar: &[structs::OperandKind]) -> TokenStream { }; let capabilities = if category == &structs::Category::BitEnum { - quote! {} + let capabilities = capability_clauses + .into_iter() + .filter(|(k, _)| !k.is_empty()) + .map(|(k, v)| { + let kinds = std::iter::repeat(quote! { s::#kind }); + let capabilities = k.iter().map(|cap| as_ident(cap)); + + quote! { + if v.intersects(#(#kinds::#v)|*) { + result.extend_from_slice(&[#( spirv::Capability::#capabilities ),*]) + } + } + }).collect::>(); + + if capabilities.is_empty() { + quote! {} + } else { + quote! { + Self::#kind(v) => { + let mut result = vec![]; + #( #capabilities );*; + result + } + } + } } else { let capabilities = capability_clauses.into_iter().map(|(k, v)| { let kinds = std::iter::repeat(quote! { s::#kind }); let capabilities = k.iter().map(|cap| as_ident(cap)); quote! { - #( #kinds::#v )|* => &[#( spirv::Capability::#capabilities ),*] + #( #kinds::#v )|* => vec![#( spirv::Capability::#capabilities ),*] } }); @@ -449,7 +494,7 @@ pub fn gen_dr_operand_kinds(grammar: &[structs::OperandKind]) -> TokenStream { let kinds = std::iter::repeat(quote! { s::#kind }); quote! { - result.extend([#(#kinds::#v,)*].iter().filter(|arg| { + result.extend([#(#kinds::#v,)*].iter().filter(|arg| { v.contains(**arg) }).flat_map(|_| { [#( #operands ),*].iter().cloned() })) } @@ -526,19 +571,19 @@ pub fn gen_dr_operand_kinds(grammar: &[structs::OperandKind]) -> TokenStream { } } - pub fn required_capabilities(&self) -> &'static [spirv::Capability] { + pub fn required_capabilities(&self) -> Vec { use spirv as s; match self { #(#required_capabilities)* - _ => &[] + _ => vec![] } } - pub fn required_extensions(&self) -> &'static [&'static str] { + pub fn required_extensions(&self) -> Vec<&'static str> { use spirv as s; match self { #(#required_extensions)* - _ => &[] + _ => vec![] } } diff --git a/autogen/src/header.rs b/autogen/src/header.rs index 41581ac2..37be17d1 100644 --- a/autogen/src/header.rs +++ b/autogen/src/header.rs @@ -112,21 +112,6 @@ fn gen_bit_enum_operand_kind(grammar: &structs::OperandKind) -> TokenStream { let kind = as_ident(&grammar.kind); let attribute = bit_enum_attribute(); - let operands_matches = if additional_operands_list.is_empty() { - quote! { - core::iter::empty::<&'static &'static LogicalOperand>() - } - } else { - quote! { - [#(#additional_operands_list,)*].iter().flat_map(|v| { - match self { - #(#operands)* - _ => &[].iter() - } - }) - } - }; - quote! { bitflags! { #[doc = #comment] @@ -135,24 +120,6 @@ fn gen_bit_enum_operand_kind(grammar: &structs::OperandKind) -> TokenStream { #(#elements)* } } - - impl #kind { - // pub fn required_capabilities(self) -> &'static [Capability] { - // match self { - // #(#capabilities),* - // } - // } - - // pub fn required_extensions(self) -> &'static [&'static str] { - // match self { - // #(#extensions),* - // } - // } - - // pub fn additional_operands(self) -> impl Iterator { - // #operands_matches - // } - } } } @@ -226,28 +193,6 @@ fn gen_value_enum_operand_kind(grammar: &structs::OperandKind) -> TokenStream { } } - let capabilities = capability_clauses.into_iter().map(|(k, v)| { - let kinds = std::iter::repeat(&kind); - let capabilities = k.iter().map(|cap| as_ident(cap)); - quote! { - #( #kinds::#v )|* => &[#( Capability::#capabilities ),*] - } - }); - - let extensions = extension_clauses.into_iter().map(|(k, v)| { - let kinds = std::iter::repeat(&kind); - quote! { - #( #kinds::#v )|* => &[#( #k ),*] - } - }); - - let operands = operand_clauses.into_iter().map(|(k, v)| { - let kinds = std::iter::repeat(&kind); - quote! { - #kind::#k => &[#( #v ),*] - } - }); - let comment = format!("/// SPIR-V operand kind: {}", get_spec_link(&grammar.kind)); let attribute = value_enum_attribute(); @@ -263,24 +208,6 @@ fn gen_value_enum_operand_kind(grammar: &structs::OperandKind) -> TokenStream { #[allow(non_upper_case_globals)] impl #kind { #(#aliases)* - - // pub fn required_capabilities(self) -> &'static [Capability] { - // match self { - // #(#capabilities),* - // } - // } - - // pub fn required_extensions(self) -> &'static [&'static str] { - // match self { - // #(#extensions),* - // } - // } - - // pub fn additional_operands(self) -> &'static [&'static LogicalOperand] { - // match self { - // #(#operands),* - // } - // } } #from_prim_impl diff --git a/rspirv/dr/autogen_operand.rs b/rspirv/dr/autogen_operand.rs index ee95eb24..808c0f5c 100644 --- a/rspirv/dr/autogen_operand.rs +++ b/rspirv/dr/autogen_operand.rs @@ -426,76 +426,198 @@ impl Operand { _ => None, } } - pub fn required_capabilities(&self) -> &'static [spirv::Capability] { + pub fn required_capabilities(&self) -> Vec { use spirv as s; match self { + Self::ImageOperands(v) => { + let mut result = vec![]; + if v.intersects(s::ImageOperands::OFFSET | s::ImageOperands::CONST_OFFSETS) { + result.extend_from_slice(&[spirv::Capability::ImageGatherExtended]) + }; + if v.intersects(s::ImageOperands::MIN_LOD) { + result.extend_from_slice(&[spirv::Capability::MinLod]) + }; + if v.intersects(s::ImageOperands::BIAS) { + result.extend_from_slice(&[spirv::Capability::Shader]) + }; + if v.intersects( + s::ImageOperands::MAKE_TEXEL_AVAILABLE + | s::ImageOperands::MAKE_TEXEL_VISIBLE + | s::ImageOperands::NON_PRIVATE_TEXEL + | s::ImageOperands::VOLATILE_TEXEL, + ) { + result.extend_from_slice(&[spirv::Capability::VulkanMemoryModel]) + }; + result + } + Self::FPFastMathMode(v) => { + let mut result = vec![]; + if v.intersects( + s::FPFastMathMode::NOT_NAN + | s::FPFastMathMode::NOT_INF + | s::FPFastMathMode::NSZ + | s::FPFastMathMode::ALLOW_RECIP + | s::FPFastMathMode::FAST, + ) { + result.extend_from_slice(&[spirv::Capability::Kernel]) + }; + result + } + Self::LoopControl(v) => { + let mut result = vec![]; + if v.intersects( + s::LoopControl::INITIATION_INTERVAL_INTEL + | s::LoopControl::MAX_CONCURRENCY_INTEL + | s::LoopControl::DEPENDENCY_ARRAY_INTEL + | s::LoopControl::PIPELINE_ENABLE_INTEL + | s::LoopControl::LOOP_COALESCE_INTEL + | s::LoopControl::MAX_INTERLEAVING_INTEL + | s::LoopControl::SPECULATED_ITERATIONS_INTEL, + ) { + result.extend_from_slice(&[spirv::Capability::FPGALoopControlsINTEL]) + }; + result + } + Self::MemorySemantics(v) => { + let mut result = vec![]; + if v.intersects(s::MemorySemantics::ATOMIC_COUNTER_MEMORY) { + result.extend_from_slice(&[spirv::Capability::AtomicStorage]) + }; + if v.intersects(s::MemorySemantics::UNIFORM_MEMORY) { + result.extend_from_slice(&[spirv::Capability::Shader]) + }; + if v.intersects( + s::MemorySemantics::OUTPUT_MEMORY + | s::MemorySemantics::MAKE_AVAILABLE + | s::MemorySemantics::MAKE_VISIBLE + | s::MemorySemantics::VOLATILE, + ) { + result.extend_from_slice(&[spirv::Capability::VulkanMemoryModel]) + }; + result + } + Self::MemoryAccess(v) => { + let mut result = vec![]; + if v.intersects( + s::MemoryAccess::MAKE_POINTER_AVAILABLE + | s::MemoryAccess::MAKE_POINTER_VISIBLE + | s::MemoryAccess::NON_PRIVATE_POINTER, + ) { + result.extend_from_slice(&[spirv::Capability::VulkanMemoryModel]) + }; + result + } + Self::KernelProfilingInfo(v) => { + let mut result = vec![]; + if v.intersects(s::KernelProfilingInfo::CMD_EXEC_TIME) { + result.extend_from_slice(&[spirv::Capability::Kernel]) + }; + result + } + Self::RayFlags(v) => { + let mut result = vec![]; + if v.intersects( + s::RayFlags::NONE_KHR + | s::RayFlags::OPAQUE_KHR + | s::RayFlags::NO_OPAQUE_KHR + | s::RayFlags::TERMINATE_ON_FIRST_HIT_KHR + | s::RayFlags::SKIP_CLOSEST_HIT_SHADER_KHR + | s::RayFlags::CULL_BACK_FACING_TRIANGLES_KHR + | s::RayFlags::CULL_FRONT_FACING_TRIANGLES_KHR + | s::RayFlags::CULL_OPAQUE_KHR + | s::RayFlags::CULL_NO_OPAQUE_KHR, + ) { + result.extend_from_slice(&[ + spirv::Capability::RayQueryKHR, + spirv::Capability::RayTracingKHR, + ]) + }; + if v.intersects(s::RayFlags::SKIP_TRIANGLES_KHR | s::RayFlags::SKIP_AAB_BS_KHR) { + result.extend_from_slice(&[spirv::Capability::RayTraversalPrimitiveCullingKHR]) + }; + result + } + Self::FragmentShadingRate(v) => { + let mut result = vec![]; + if v.intersects( + s::FragmentShadingRate::VERTICAL2_PIXELS + | s::FragmentShadingRate::VERTICAL4_PIXELS + | s::FragmentShadingRate::HORIZONTAL2_PIXELS + | s::FragmentShadingRate::HORIZONTAL4_PIXELS, + ) { + result.extend_from_slice(&[spirv::Capability::FragmentShadingRateKHR]) + }; + result + } Self::SourceLanguage(v) => match v { s::SourceLanguage::Unknown | s::SourceLanguage::ESSL | s::SourceLanguage::GLSL | s::SourceLanguage::OpenCL_C | s::SourceLanguage::OpenCL_CPP - | s::SourceLanguage::HLSL => &[], + | s::SourceLanguage::HLSL => vec![], }, Self::ExecutionModel(v) => match v { - s::ExecutionModel::Geometry => &[spirv::Capability::Geometry], - s::ExecutionModel::Kernel => &[spirv::Capability::Kernel], + s::ExecutionModel::Geometry => vec![spirv::Capability::Geometry], + s::ExecutionModel::Kernel => vec![spirv::Capability::Kernel], s::ExecutionModel::TaskNV | s::ExecutionModel::MeshNV => { - &[spirv::Capability::MeshShadingNV] + vec![spirv::Capability::MeshShadingNV] } s::ExecutionModel::RayGenerationNV | s::ExecutionModel::IntersectionNV | s::ExecutionModel::AnyHitNV | s::ExecutionModel::ClosestHitNV | s::ExecutionModel::MissNV - | s::ExecutionModel::CallableNV => &[ + | s::ExecutionModel::CallableNV => vec![ spirv::Capability::RayTracingNV, spirv::Capability::RayTracingKHR, ], s::ExecutionModel::Vertex | s::ExecutionModel::Fragment - | s::ExecutionModel::GLCompute => &[spirv::Capability::Shader], + | s::ExecutionModel::GLCompute => vec![spirv::Capability::Shader], s::ExecutionModel::TessellationControl - | s::ExecutionModel::TessellationEvaluation => &[spirv::Capability::Tessellation], + | s::ExecutionModel::TessellationEvaluation => { + vec![spirv::Capability::Tessellation] + } }, Self::AddressingModel(v) => match v { - s::AddressingModel::Logical => &[], + s::AddressingModel::Logical => vec![], s::AddressingModel::Physical32 | s::AddressingModel::Physical64 => { - &[spirv::Capability::Addresses] + vec![spirv::Capability::Addresses] } s::AddressingModel::PhysicalStorageBuffer64 => { - &[spirv::Capability::PhysicalStorageBufferAddresses] + vec![spirv::Capability::PhysicalStorageBufferAddresses] } }, Self::MemoryModel(v) => match v { - s::MemoryModel::OpenCL => &[spirv::Capability::Kernel], - s::MemoryModel::Simple | s::MemoryModel::GLSL450 => &[spirv::Capability::Shader], - s::MemoryModel::Vulkan => &[spirv::Capability::VulkanMemoryModel], + s::MemoryModel::OpenCL => vec![spirv::Capability::Kernel], + s::MemoryModel::Simple | s::MemoryModel::GLSL450 => vec![spirv::Capability::Shader], + s::MemoryModel::Vulkan => vec![spirv::Capability::VulkanMemoryModel], }, Self::ExecutionMode(v) => match v { - s::ExecutionMode::LocalSize | s::ExecutionMode::LocalSizeId => &[], + s::ExecutionMode::LocalSize | s::ExecutionMode::LocalSizeId => vec![], s::ExecutionMode::DerivativeGroupLinearNV => { - &[spirv::Capability::ComputeDerivativeGroupLinearNV] + vec![spirv::Capability::ComputeDerivativeGroupLinearNV] } s::ExecutionMode::DerivativeGroupQuadsNV => { - &[spirv::Capability::ComputeDerivativeGroupQuadsNV] + vec![spirv::Capability::ComputeDerivativeGroupQuadsNV] } - s::ExecutionMode::DenormFlushToZero => &[spirv::Capability::DenormFlushToZero], - s::ExecutionMode::DenormPreserve => &[spirv::Capability::DenormPreserve], + s::ExecutionMode::DenormFlushToZero => vec![spirv::Capability::DenormFlushToZero], + s::ExecutionMode::DenormPreserve => vec![spirv::Capability::DenormPreserve], s::ExecutionMode::NumSIMDWorkitemsINTEL => { - &[spirv::Capability::FPGAKernelAttributesINTEL] + vec![spirv::Capability::FPGAKernelAttributesINTEL] } s::ExecutionMode::PixelInterlockOrderedEXT | s::ExecutionMode::PixelInterlockUnorderedEXT => { - &[spirv::Capability::FragmentShaderPixelInterlockEXT] + vec![spirv::Capability::FragmentShaderPixelInterlockEXT] } s::ExecutionMode::SampleInterlockOrderedEXT | s::ExecutionMode::SampleInterlockUnorderedEXT => { - &[spirv::Capability::FragmentShaderSampleInterlockEXT] + vec![spirv::Capability::FragmentShaderSampleInterlockEXT] } s::ExecutionMode::ShadingRateInterlockOrderedEXT | s::ExecutionMode::ShadingRateInterlockUnorderedEXT => { - &[spirv::Capability::FragmentShaderShadingRateInterlockEXT] + vec![spirv::Capability::FragmentShaderShadingRateInterlockEXT] } s::ExecutionMode::Invocations | s::ExecutionMode::InputPoints @@ -503,15 +625,15 @@ impl Operand { | s::ExecutionMode::InputLinesAdjacency | s::ExecutionMode::InputTrianglesAdjacency | s::ExecutionMode::OutputLineStrip - | s::ExecutionMode::OutputTriangleStrip => &[spirv::Capability::Geometry], - s::ExecutionMode::OutputPoints => &[ + | s::ExecutionMode::OutputTriangleStrip => vec![spirv::Capability::Geometry], + s::ExecutionMode::OutputPoints => vec![ spirv::Capability::Geometry, spirv::Capability::MeshShadingNV, ], s::ExecutionMode::Triangles => { - &[spirv::Capability::Geometry, spirv::Capability::Tessellation] + vec![spirv::Capability::Geometry, spirv::Capability::Tessellation] } - s::ExecutionMode::OutputVertices => &[ + s::ExecutionMode::OutputVertices => vec![ spirv::Capability::Geometry, spirv::Capability::Tessellation, spirv::Capability::MeshShadingNV, @@ -521,19 +643,19 @@ impl Operand { | s::ExecutionMode::ContractionOff | s::ExecutionMode::Initializer | s::ExecutionMode::Finalizer - | s::ExecutionMode::LocalSizeHintId => &[spirv::Capability::Kernel], + | s::ExecutionMode::LocalSizeHintId => vec![spirv::Capability::Kernel], s::ExecutionMode::MaxWorkgroupSizeINTEL | s::ExecutionMode::MaxWorkDimINTEL | s::ExecutionMode::NoGlobalOffsetINTEL => { - &[spirv::Capability::KernelAttributesINTEL] + vec![spirv::Capability::KernelAttributesINTEL] } s::ExecutionMode::OutputLinesNV | s::ExecutionMode::OutputPrimitivesNV - | s::ExecutionMode::OutputTrianglesNV => &[spirv::Capability::MeshShadingNV], - s::ExecutionMode::RoundingModeRTE => &[spirv::Capability::RoundingModeRTE], - s::ExecutionMode::RoundingModeRTZ => &[spirv::Capability::RoundingModeRTZ], + | s::ExecutionMode::OutputTrianglesNV => vec![spirv::Capability::MeshShadingNV], + s::ExecutionMode::RoundingModeRTE => vec![spirv::Capability::RoundingModeRTE], + s::ExecutionMode::RoundingModeRTZ => vec![spirv::Capability::RoundingModeRTZ], s::ExecutionMode::PostDepthCoverage => { - &[spirv::Capability::SampleMaskPostDepthCoverage] + vec![spirv::Capability::SampleMaskPostDepthCoverage] } s::ExecutionMode::PixelCenterInteger | s::ExecutionMode::OriginUpperLeft @@ -542,15 +664,17 @@ impl Operand { | s::ExecutionMode::DepthReplacing | s::ExecutionMode::DepthGreater | s::ExecutionMode::DepthLess - | s::ExecutionMode::DepthUnchanged => &[spirv::Capability::Shader], + | s::ExecutionMode::DepthUnchanged => vec![spirv::Capability::Shader], s::ExecutionMode::SignedZeroInfNanPreserve => { - &[spirv::Capability::SignedZeroInfNanPreserve] + vec![spirv::Capability::SignedZeroInfNanPreserve] + } + s::ExecutionMode::StencilRefReplacingEXT => { + vec![spirv::Capability::StencilExportEXT] } - s::ExecutionMode::StencilRefReplacingEXT => &[spirv::Capability::StencilExportEXT], s::ExecutionMode::SubgroupSize | s::ExecutionMode::SubgroupsPerWorkgroup | s::ExecutionMode::SubgroupsPerWorkgroupId => { - &[spirv::Capability::SubgroupDispatch] + vec![spirv::Capability::SubgroupDispatch] } s::ExecutionMode::SpacingEqual | s::ExecutionMode::SpacingFractionalEven @@ -559,8 +683,8 @@ impl Operand { | s::ExecutionMode::VertexOrderCcw | s::ExecutionMode::PointMode | s::ExecutionMode::Quads - | s::ExecutionMode::Isolines => &[spirv::Capability::Tessellation], - s::ExecutionMode::Xfb => &[spirv::Capability::TransformFeedback], + | s::ExecutionMode::Isolines => vec![spirv::Capability::Tessellation], + s::ExecutionMode::Xfb => vec![spirv::Capability::TransformFeedback], }, Self::StorageClass(v) => match v { s::StorageClass::UniformConstant @@ -568,19 +692,19 @@ impl Operand { | s::StorageClass::Workgroup | s::StorageClass::CrossWorkgroup | s::StorageClass::Function - | s::StorageClass::Image => &[], - s::StorageClass::AtomicCounter => &[spirv::Capability::AtomicStorage], - s::StorageClass::CodeSectionINTEL => &[spirv::Capability::FunctionPointersINTEL], - s::StorageClass::Generic => &[spirv::Capability::GenericPointer], + | s::StorageClass::Image => vec![], + s::StorageClass::AtomicCounter => vec![spirv::Capability::AtomicStorage], + s::StorageClass::CodeSectionINTEL => vec![spirv::Capability::FunctionPointersINTEL], + s::StorageClass::Generic => vec![spirv::Capability::GenericPointer], s::StorageClass::PhysicalStorageBuffer => { - &[spirv::Capability::PhysicalStorageBufferAddresses] + vec![spirv::Capability::PhysicalStorageBufferAddresses] } s::StorageClass::CallableDataNV | s::StorageClass::IncomingCallableDataNV | s::StorageClass::RayPayloadNV | s::StorageClass::HitAttributeNV | s::StorageClass::IncomingRayPayloadNV - | s::StorageClass::ShaderRecordBufferNV => &[ + | s::StorageClass::ShaderRecordBufferNV => vec![ spirv::Capability::RayTracingNV, spirv::Capability::RayTracingKHR, ], @@ -588,19 +712,23 @@ impl Operand { | s::StorageClass::Output | s::StorageClass::Private | s::StorageClass::PushConstant - | s::StorageClass::StorageBuffer => &[spirv::Capability::Shader], + | s::StorageClass::StorageBuffer => vec![spirv::Capability::Shader], }, Self::Dim(v) => match v { - s::Dim::Dim3D => &[], - s::Dim::DimSubpassData => &[spirv::Capability::InputAttachment], - s::Dim::Dim1D => &[spirv::Capability::Sampled1D, spirv::Capability::Image1D], - s::Dim::DimBuffer => &[ + s::Dim::Dim3D => vec![], + s::Dim::DimSubpassData => vec![spirv::Capability::InputAttachment], + s::Dim::Dim1D => vec![spirv::Capability::Sampled1D, spirv::Capability::Image1D], + s::Dim::DimBuffer => vec![ spirv::Capability::SampledBuffer, spirv::Capability::ImageBuffer, ], - s::Dim::DimRect => &[spirv::Capability::SampledRect, spirv::Capability::ImageRect], - s::Dim::DimCube => &[spirv::Capability::Shader, spirv::Capability::ImageCubeArray], - s::Dim::Dim2D => &[ + s::Dim::DimRect => { + vec![spirv::Capability::SampledRect, spirv::Capability::ImageRect] + } + s::Dim::DimCube => { + vec![spirv::Capability::Shader, spirv::Capability::ImageCubeArray] + } + s::Dim::Dim2D => vec![ spirv::Capability::Shader, spirv::Capability::Kernel, spirv::Capability::ImageMSArray, @@ -611,16 +739,18 @@ impl Operand { | s::SamplerAddressingMode::ClampToEdge | s::SamplerAddressingMode::Clamp | s::SamplerAddressingMode::Repeat - | s::SamplerAddressingMode::RepeatMirrored => &[spirv::Capability::Kernel], + | s::SamplerAddressingMode::RepeatMirrored => vec![spirv::Capability::Kernel], }, Self::SamplerFilterMode(v) => match v { s::SamplerFilterMode::Nearest | s::SamplerFilterMode::Linear => { - &[spirv::Capability::Kernel] + vec![spirv::Capability::Kernel] } }, Self::ImageFormat(v) => match v { - s::ImageFormat::Unknown => &[], - s::ImageFormat::R64ui | s::ImageFormat::R64i => &[spirv::Capability::Int64ImageEXT], + s::ImageFormat::Unknown => vec![], + s::ImageFormat::R64ui | s::ImageFormat::R64i => { + vec![spirv::Capability::Int64ImageEXT] + } s::ImageFormat::Rgba32f | s::ImageFormat::Rgba16f | s::ImageFormat::R32f @@ -633,7 +763,7 @@ impl Operand { | s::ImageFormat::Rgba32ui | s::ImageFormat::Rgba16ui | s::ImageFormat::Rgba8ui - | s::ImageFormat::R32ui => &[spirv::Capability::Shader], + | s::ImageFormat::R32ui => vec![spirv::Capability::Shader], s::ImageFormat::Rg32f | s::ImageFormat::Rg16f | s::ImageFormat::R11fG11fB10f @@ -659,7 +789,7 @@ impl Operand { | s::ImageFormat::Rg16ui | s::ImageFormat::Rg8ui | s::ImageFormat::R16ui - | s::ImageFormat::R8ui => &[spirv::Capability::StorageImageExtendedFormats], + | s::ImageFormat::R8ui => vec![spirv::Capability::StorageImageExtendedFormats], }, Self::ImageChannelOrder(v) => match v { s::ImageChannelOrder::R @@ -681,7 +811,7 @@ impl Operand { | s::ImageChannelOrder::sRGBx | s::ImageChannelOrder::sRGBA | s::ImageChannelOrder::sBGRA - | s::ImageChannelOrder::ABGR => &[spirv::Capability::Kernel], + | s::ImageChannelOrder::ABGR => vec![spirv::Capability::Kernel], }, Self::ImageChannelDataType(v) => match v { s::ImageChannelDataType::SnormInt8 @@ -700,21 +830,21 @@ impl Operand { | s::ImageChannelDataType::HalfFloat | s::ImageChannelDataType::Float | s::ImageChannelDataType::UnormInt24 - | s::ImageChannelDataType::UnormInt101010_2 => &[spirv::Capability::Kernel], + | s::ImageChannelDataType::UnormInt101010_2 => vec![spirv::Capability::Kernel], }, Self::FPRoundingMode(v) => match v { s::FPRoundingMode::RTE | s::FPRoundingMode::RTZ | s::FPRoundingMode::RTP - | s::FPRoundingMode::RTN => &[], + | s::FPRoundingMode::RTN => vec![], }, Self::LinkageType(v) => match v { - s::LinkageType::Export | s::LinkageType::Import => &[spirv::Capability::Linkage], + s::LinkageType::Export | s::LinkageType::Import => vec![spirv::Capability::Linkage], }, Self::AccessQualifier(v) => match v { s::AccessQualifier::ReadOnly | s::AccessQualifier::WriteOnly - | s::AccessQualifier::ReadWrite => &[spirv::Capability::Kernel], + | s::AccessQualifier::ReadWrite => vec![spirv::Capability::Kernel], }, Self::FunctionParameterAttribute(v) => match v { s::FunctionParameterAttribute::Zext @@ -724,7 +854,7 @@ impl Operand { | s::FunctionParameterAttribute::NoAlias | s::FunctionParameterAttribute::NoCapture | s::FunctionParameterAttribute::NoWrite - | s::FunctionParameterAttribute::NoReadWrite => &[spirv::Capability::Kernel], + | s::FunctionParameterAttribute::NoReadWrite => vec![spirv::Capability::Kernel], }, Self::Decoration(v) => match v { s::Decoration::BuiltIn @@ -740,9 +870,9 @@ impl Operand { | s::Decoration::ExplicitInterpAMD | s::Decoration::CounterBuffer | s::Decoration::UserSemantic - | s::Decoration::UserTypeGOOGLE => &[], + | s::Decoration::UserTypeGOOGLE => vec![], s::Decoration::MaxByteOffset | s::Decoration::MaxByteOffsetId => { - &[spirv::Capability::Addresses] + vec![spirv::Capability::Addresses] } s::Decoration::RegisterINTEL | s::Decoration::MemoryINTEL @@ -756,36 +886,38 @@ impl Operand { | s::Decoration::MergeINTEL | s::Decoration::BankBitsINTEL | s::Decoration::ForcePow2DepthINTEL => { - &[spirv::Capability::FPGAMemoryAttributesINTEL] + vec![spirv::Capability::FPGAMemoryAttributesINTEL] + } + s::Decoration::PerVertexNV => vec![spirv::Capability::FragmentBarycentricNV], + s::Decoration::PassthroughNV => { + vec![spirv::Capability::GeometryShaderPassthroughNV] } - s::Decoration::PerVertexNV => &[spirv::Capability::FragmentBarycentricNV], - s::Decoration::PassthroughNV => &[spirv::Capability::GeometryShaderPassthroughNV], - s::Decoration::Stream => &[spirv::Capability::GeometryStreams], + s::Decoration::Stream => vec![spirv::Capability::GeometryStreams], s::Decoration::ReferencedIndirectlyINTEL => { - &[spirv::Capability::IndirectReferencesINTEL] + vec![spirv::Capability::IndirectReferencesINTEL] } - s::Decoration::InputAttachmentIndex => &[spirv::Capability::InputAttachment], + s::Decoration::InputAttachmentIndex => vec![spirv::Capability::InputAttachment], s::Decoration::CPacked | s::Decoration::Constant | s::Decoration::SaturatedConversion | s::Decoration::FuncParamAttr | s::Decoration::FPFastMathMode | s::Decoration::Alignment - | s::Decoration::AlignmentId => &[spirv::Capability::Kernel], - s::Decoration::LinkageAttributes => &[spirv::Capability::Linkage], + | s::Decoration::AlignmentId => vec![spirv::Capability::Kernel], + s::Decoration::LinkageAttributes => vec![spirv::Capability::Linkage], s::Decoration::RowMajor | s::Decoration::ColMajor | s::Decoration::MatrixStride => { - &[spirv::Capability::Matrix] + vec![spirv::Capability::Matrix] } s::Decoration::PerPrimitiveNV | s::Decoration::PerViewNV - | s::Decoration::PerTaskNV => &[spirv::Capability::MeshShadingNV], + | s::Decoration::PerTaskNV => vec![spirv::Capability::MeshShadingNV], s::Decoration::RestrictPointer | s::Decoration::AliasedPointer => { - &[spirv::Capability::PhysicalStorageBufferAddresses] + vec![spirv::Capability::PhysicalStorageBufferAddresses] } s::Decoration::OverrideCoverageNV => { - &[spirv::Capability::SampleMaskOverrideCoverageNV] + vec![spirv::Capability::SampleMaskOverrideCoverageNV] } - s::Decoration::Sample => &[spirv::Capability::SampleRateShading], + s::Decoration::Sample => vec![spirv::Capability::SampleRateShading], s::Decoration::RelaxedPrecision | s::Decoration::Block | s::Decoration::BufferBlock @@ -804,16 +936,16 @@ impl Operand { | s::Decoration::Binding | s::Decoration::DescriptorSet | s::Decoration::Offset - | s::Decoration::NoContraction => &[spirv::Capability::Shader], - s::Decoration::SpecId => &[spirv::Capability::Shader, spirv::Capability::Kernel], - s::Decoration::NonUniform => &[spirv::Capability::ShaderNonUniform], + | s::Decoration::NoContraction => vec![spirv::Capability::Shader], + s::Decoration::SpecId => vec![spirv::Capability::Shader, spirv::Capability::Kernel], + s::Decoration::NonUniform => vec![spirv::Capability::ShaderNonUniform], s::Decoration::SecondaryViewportRelativeNV => { - &[spirv::Capability::ShaderStereoViewNV] + vec![spirv::Capability::ShaderStereoViewNV] } - s::Decoration::ViewportRelativeNV => &[spirv::Capability::ShaderViewportMaskNV], - s::Decoration::Patch => &[spirv::Capability::Tessellation], + s::Decoration::ViewportRelativeNV => vec![spirv::Capability::ShaderViewportMaskNV], + s::Decoration::Patch => vec![spirv::Capability::Tessellation], s::Decoration::XfbBuffer | s::Decoration::XfbStride => { - &[spirv::Capability::TransformFeedback] + vec![spirv::Capability::TransformFeedback] } }, Self::BuiltIn(v) => match v { @@ -829,38 +961,38 @@ impl Operand { | s::BuiltIn::BaryCoordSmoothAMD | s::BuiltIn::BaryCoordSmoothCentroidAMD | s::BuiltIn::BaryCoordSmoothSampleAMD - | s::BuiltIn::BaryCoordPullModelAMD => &[], - s::BuiltIn::ClipDistance => &[spirv::Capability::ClipDistance], - s::BuiltIn::CullDistance => &[spirv::Capability::CullDistance], - s::BuiltIn::DeviceIndex => &[spirv::Capability::DeviceGroup], + | s::BuiltIn::BaryCoordPullModelAMD => vec![], + s::BuiltIn::ClipDistance => vec![spirv::Capability::ClipDistance], + s::BuiltIn::CullDistance => vec![spirv::Capability::CullDistance], + s::BuiltIn::DeviceIndex => vec![spirv::Capability::DeviceGroup], s::BuiltIn::BaseVertex | s::BuiltIn::BaseInstance => { - &[spirv::Capability::DrawParameters] + vec![spirv::Capability::DrawParameters] } - s::BuiltIn::DrawIndex => &[ + s::BuiltIn::DrawIndex => vec![ spirv::Capability::DrawParameters, spirv::Capability::MeshShadingNV, ], s::BuiltIn::BaryCoordNV | s::BuiltIn::BaryCoordNoPerspNV => { - &[spirv::Capability::FragmentBarycentricNV] + vec![spirv::Capability::FragmentBarycentricNV] } - s::BuiltIn::FragSizeEXT | s::BuiltIn::FragInvocationCountEXT => &[ + s::BuiltIn::FragSizeEXT | s::BuiltIn::FragInvocationCountEXT => vec![ spirv::Capability::FragmentDensityEXT, spirv::Capability::ShadingRateNV, ], - s::BuiltIn::FullyCoveredEXT => &[spirv::Capability::FragmentFullyCoveredEXT], + s::BuiltIn::FullyCoveredEXT => vec![spirv::Capability::FragmentFullyCoveredEXT], s::BuiltIn::PrimitiveShadingRateKHR | s::BuiltIn::ShadingRateKHR => { - &[spirv::Capability::FragmentShadingRateKHR] + vec![spirv::Capability::FragmentShadingRateKHR] } - s::BuiltIn::Layer => &[ + s::BuiltIn::Layer => vec![ spirv::Capability::Geometry, spirv::Capability::ShaderLayer, spirv::Capability::ShaderViewportIndexLayerEXT, spirv::Capability::MeshShadingNV, ], s::BuiltIn::InvocationId => { - &[spirv::Capability::Geometry, spirv::Capability::Tessellation] + vec![spirv::Capability::Geometry, spirv::Capability::Tessellation] } - s::BuiltIn::PrimitiveId => &[ + s::BuiltIn::PrimitiveId => vec![ spirv::Capability::Geometry, spirv::Capability::Tessellation, spirv::Capability::RayTracingNV, @@ -873,12 +1005,12 @@ impl Operand { | s::BuiltIn::GlobalOffset | s::BuiltIn::GlobalLinearId | s::BuiltIn::SubgroupMaxSize - | s::BuiltIn::NumEnqueuedSubgroups => &[spirv::Capability::Kernel], - s::BuiltIn::NumSubgroups | s::BuiltIn::SubgroupId => &[ + | s::BuiltIn::NumEnqueuedSubgroups => vec![spirv::Capability::Kernel], + s::BuiltIn::NumSubgroups | s::BuiltIn::SubgroupId => vec![ spirv::Capability::Kernel, spirv::Capability::GroupNonUniform, ], - s::BuiltIn::SubgroupSize | s::BuiltIn::SubgroupLocalInvocationId => &[ + s::BuiltIn::SubgroupSize | s::BuiltIn::SubgroupLocalInvocationId => vec![ spirv::Capability::Kernel, spirv::Capability::GroupNonUniform, spirv::Capability::SubgroupBallotKHR, @@ -890,20 +1022,20 @@ impl Operand { | s::BuiltIn::CullDistancePerViewNV | s::BuiltIn::LayerPerViewNV | s::BuiltIn::MeshViewCountNV - | s::BuiltIn::MeshViewIndicesNV => &[spirv::Capability::MeshShadingNV], - s::BuiltIn::ViewIndex => &[spirv::Capability::MultiView], - s::BuiltIn::ViewportIndex => &[ + | s::BuiltIn::MeshViewIndicesNV => vec![spirv::Capability::MeshShadingNV], + s::BuiltIn::ViewIndex => vec![spirv::Capability::MultiView], + s::BuiltIn::ViewportIndex => vec![ spirv::Capability::MultiViewport, spirv::Capability::ShaderViewportIndex, spirv::Capability::ShaderViewportIndexLayerEXT, spirv::Capability::MeshShadingNV, ], - s::BuiltIn::PositionPerViewNV | s::BuiltIn::ViewportMaskPerViewNV => &[ + s::BuiltIn::PositionPerViewNV | s::BuiltIn::ViewportMaskPerViewNV => vec![ spirv::Capability::PerViewAttributesNV, spirv::Capability::MeshShadingNV, ], - s::BuiltIn::RayGeometryIndexKHR => &[spirv::Capability::RayTracingKHR], - s::BuiltIn::HitTNV => &[spirv::Capability::RayTracingNV], + s::BuiltIn::RayGeometryIndexKHR => vec![spirv::Capability::RayTracingKHR], + s::BuiltIn::HitTNV => vec![spirv::Capability::RayTracingNV], s::BuiltIn::LaunchIdNV | s::BuiltIn::LaunchSizeNV | s::BuiltIn::WorldRayOriginNV @@ -916,12 +1048,12 @@ impl Operand { | s::BuiltIn::ObjectToWorldNV | s::BuiltIn::WorldToObjectNV | s::BuiltIn::HitKindNV - | s::BuiltIn::IncomingRayFlagsNV => &[ + | s::BuiltIn::IncomingRayFlagsNV => vec![ spirv::Capability::RayTracingNV, spirv::Capability::RayTracingKHR, ], s::BuiltIn::SampleId | s::BuiltIn::SamplePosition => { - &[spirv::Capability::SampleRateShading] + vec![spirv::Capability::SampleRateShading] } s::BuiltIn::Position | s::BuiltIn::PointSize @@ -934,53 +1066,53 @@ impl Operand { | s::BuiltIn::FragDepth | s::BuiltIn::HelperInvocation | s::BuiltIn::VertexIndex - | s::BuiltIn::InstanceIndex => &[spirv::Capability::Shader], + | s::BuiltIn::InstanceIndex => vec![spirv::Capability::Shader], s::BuiltIn::WarpsPerSMNV | s::BuiltIn::SMCountNV | s::BuiltIn::WarpIDNV - | s::BuiltIn::SMIDNV => &[spirv::Capability::ShaderSMBuiltinsNV], + | s::BuiltIn::SMIDNV => vec![spirv::Capability::ShaderSMBuiltinsNV], s::BuiltIn::SecondaryPositionNV | s::BuiltIn::SecondaryViewportMaskNV => { - &[spirv::Capability::ShaderStereoViewNV] + vec![spirv::Capability::ShaderStereoViewNV] } - s::BuiltIn::ViewportMaskNV => &[ + s::BuiltIn::ViewportMaskNV => vec![ spirv::Capability::ShaderViewportMaskNV, spirv::Capability::MeshShadingNV, ], - s::BuiltIn::FragStencilRefEXT => &[spirv::Capability::StencilExportEXT], + s::BuiltIn::FragStencilRefEXT => vec![spirv::Capability::StencilExportEXT], s::BuiltIn::SubgroupEqMask | s::BuiltIn::SubgroupGeMask | s::BuiltIn::SubgroupGtMask | s::BuiltIn::SubgroupLeMask - | s::BuiltIn::SubgroupLtMask => &[ + | s::BuiltIn::SubgroupLtMask => vec![ spirv::Capability::SubgroupBallotKHR, spirv::Capability::GroupNonUniformBallot, ], s::BuiltIn::TessLevelOuter | s::BuiltIn::TessLevelInner | s::BuiltIn::TessCoord - | s::BuiltIn::PatchVertices => &[spirv::Capability::Tessellation], + | s::BuiltIn::PatchVertices => vec![spirv::Capability::Tessellation], }, Self::Scope(v) => match v { s::Scope::CrossDevice | s::Scope::Device | s::Scope::Workgroup | s::Scope::Subgroup - | s::Scope::Invocation => &[], - s::Scope::ShaderCallKHR => &[spirv::Capability::RayTracingKHR], - s::Scope::QueueFamily => &[spirv::Capability::VulkanMemoryModel], + | s::Scope::Invocation => vec![], + s::Scope::ShaderCallKHR => vec![spirv::Capability::RayTracingKHR], + s::Scope::QueueFamily => vec![spirv::Capability::VulkanMemoryModel], }, Self::GroupOperation(v) => match v { s::GroupOperation::ClusteredReduce => { - &[spirv::Capability::GroupNonUniformClustered] + vec![spirv::Capability::GroupNonUniformClustered] } s::GroupOperation::PartitionedReduceNV | s::GroupOperation::PartitionedInclusiveScanNV | s::GroupOperation::PartitionedExclusiveScanNV => { - &[spirv::Capability::GroupNonUniformPartitionedNV] + vec![spirv::Capability::GroupNonUniformPartitionedNV] } s::GroupOperation::Reduce | s::GroupOperation::InclusiveScan - | s::GroupOperation::ExclusiveScan => &[ + | s::GroupOperation::ExclusiveScan => vec![ spirv::Capability::Kernel, spirv::Capability::GroupNonUniformArithmetic, spirv::Capability::GroupNonUniformBallot, @@ -989,7 +1121,7 @@ impl Operand { Self::KernelEnqueueFlags(v) => match v { s::KernelEnqueueFlags::NoWait | s::KernelEnqueueFlags::WaitKernel - | s::KernelEnqueueFlags::WaitWorkGroup => &[spirv::Capability::Kernel], + | s::KernelEnqueueFlags::WaitWorkGroup => vec![spirv::Capability::Kernel], }, Self::Capability(v) => match v { s::Capability::Matrix @@ -1044,67 +1176,69 @@ impl Operand { | s::Capability::KernelAttributesINTEL | s::Capability::FPGAKernelAttributesINTEL | s::Capability::BlockingPipesINTEL - | s::Capability::FPGARegINTEL => &[], - s::Capability::GenericPointer => &[spirv::Capability::Addresses], - s::Capability::SubgroupDispatch => &[spirv::Capability::DeviceEnqueue], + | s::Capability::FPGARegINTEL => vec![], + s::Capability::GenericPointer => vec![spirv::Capability::Addresses], + s::Capability::SubgroupDispatch => vec![spirv::Capability::DeviceEnqueue], s::Capability::GeometryPointSize | s::Capability::GeometryStreams | s::Capability::MultiViewport - | s::Capability::GeometryShaderPassthroughNV => &[spirv::Capability::Geometry], + | s::Capability::GeometryShaderPassthroughNV => vec![spirv::Capability::Geometry], s::Capability::GroupNonUniformVote | s::Capability::GroupNonUniformArithmetic | s::Capability::GroupNonUniformBallot | s::Capability::GroupNonUniformShuffle | s::Capability::GroupNonUniformShuffleRelative | s::Capability::GroupNonUniformClustered - | s::Capability::GroupNonUniformQuad => &[spirv::Capability::GroupNonUniform], + | s::Capability::GroupNonUniformQuad => vec![spirv::Capability::GroupNonUniform], s::Capability::ImageReadWrite | s::Capability::ImageMipmap => { - &[spirv::Capability::ImageBasic] + vec![spirv::Capability::ImageBasic] } s::Capability::StorageTexelBufferArrayDynamicIndexing => { - &[spirv::Capability::ImageBuffer] + vec![spirv::Capability::ImageBuffer] } - s::Capability::StorageTexelBufferArrayNonUniformIndexing => &[ + s::Capability::StorageTexelBufferArrayNonUniformIndexing => vec![ spirv::Capability::ImageBuffer, spirv::Capability::ShaderNonUniform, ], s::Capability::InputAttachmentArrayDynamicIndexing => { - &[spirv::Capability::InputAttachment] + vec![spirv::Capability::InputAttachment] } - s::Capability::InputAttachmentArrayNonUniformIndexing => &[ + s::Capability::InputAttachmentArrayNonUniformIndexing => vec![ spirv::Capability::InputAttachment, spirv::Capability::ShaderNonUniform, ], - s::Capability::Int64Atomics => &[spirv::Capability::Int64], + s::Capability::Int64Atomics => vec![spirv::Capability::Int64], s::Capability::Vector16 | s::Capability::Float16Buffer | s::Capability::ImageBasic | s::Capability::Pipes | s::Capability::DeviceEnqueue | s::Capability::LiteralSampler - | s::Capability::NamedBarrier => &[spirv::Capability::Kernel], - s::Capability::Shader => &[spirv::Capability::Matrix], - s::Capability::PerViewAttributesNV => &[spirv::Capability::MultiView], - s::Capability::ShaderViewportIndexLayerEXT => &[spirv::Capability::MultiViewport], - s::Capability::PipeStorage => &[spirv::Capability::Pipes], - s::Capability::RayTraversalPrimitiveCullingKHR => &[ + | s::Capability::NamedBarrier => vec![spirv::Capability::Kernel], + s::Capability::Shader => vec![spirv::Capability::Matrix], + s::Capability::PerViewAttributesNV => vec![spirv::Capability::MultiView], + s::Capability::ShaderViewportIndexLayerEXT => { + vec![spirv::Capability::MultiViewport] + } + s::Capability::PipeStorage => vec![spirv::Capability::Pipes], + s::Capability::RayTraversalPrimitiveCullingKHR => vec![ spirv::Capability::RayQueryKHR, spirv::Capability::RayTracingKHR, ], s::Capability::SampleMaskOverrideCoverageNV => { - &[spirv::Capability::SampleRateShading] + vec![spirv::Capability::SampleRateShading] } - s::Capability::Image1D => &[spirv::Capability::Sampled1D], + s::Capability::Image1D => vec![spirv::Capability::Sampled1D], s::Capability::ImageBuffer | s::Capability::UniformTexelBufferArrayDynamicIndexing => { - &[spirv::Capability::SampledBuffer] + vec![spirv::Capability::SampledBuffer] } - s::Capability::UniformTexelBufferArrayNonUniformIndexing => &[ + s::Capability::UniformTexelBufferArrayNonUniformIndexing => vec![ spirv::Capability::SampledBuffer, spirv::Capability::ShaderNonUniform, ], - s::Capability::ImageCubeArray => &[spirv::Capability::SampledCubeArray], - s::Capability::ImageRect => &[spirv::Capability::SampledRect], + s::Capability::ImageCubeArray => vec![spirv::Capability::SampledCubeArray], + s::Capability::ImageRect => vec![spirv::Capability::SampledRect], s::Capability::Geometry | s::Capability::Tessellation | s::Capability::AtomicStorage @@ -1160,61 +1294,83 @@ impl Operand { | s::Capability::DemoteToHelperInvocationEXT | s::Capability::IntegerFunctions2INTEL | s::Capability::AtomicFloat32AddEXT - | s::Capability::AtomicFloat64AddEXT => &[spirv::Capability::Shader], + | s::Capability::AtomicFloat64AddEXT => vec![spirv::Capability::Shader], s::Capability::UniformBufferArrayNonUniformIndexing | s::Capability::SampledImageArrayNonUniformIndexing | s::Capability::StorageBufferArrayNonUniformIndexing | s::Capability::StorageImageArrayNonUniformIndexing => { - &[spirv::Capability::ShaderNonUniform] + vec![spirv::Capability::ShaderNonUniform] } s::Capability::ShaderViewportMaskNV => { - &[spirv::Capability::ShaderViewportIndexLayerNV] + vec![spirv::Capability::ShaderViewportIndexLayerNV] } - s::Capability::ShaderStereoViewNV => &[spirv::Capability::ShaderViewportMaskNV], - s::Capability::UniformAndStorageBuffer16BitAccess => &[ + s::Capability::ShaderStereoViewNV => vec![spirv::Capability::ShaderViewportMaskNV], + s::Capability::UniformAndStorageBuffer16BitAccess => vec![ spirv::Capability::StorageBuffer16BitAccess, spirv::Capability::StorageUniformBufferBlock16, ], s::Capability::UniformAndStorageBuffer8BitAccess => { - &[spirv::Capability::StorageBuffer8BitAccess] + vec![spirv::Capability::StorageBuffer8BitAccess] } - s::Capability::TessellationPointSize => &[spirv::Capability::Tessellation], + s::Capability::TessellationPointSize => vec![spirv::Capability::Tessellation], s::Capability::VariablePointers => { - &[spirv::Capability::VariablePointersStorageBuffer] + vec![spirv::Capability::VariablePointersStorageBuffer] } }, Self::RayQueryIntersection(v) => match v { s::RayQueryIntersection::RayQueryCandidateIntersectionKHR | s::RayQueryIntersection::RayQueryCommittedIntersectionKHR => { - &[spirv::Capability::RayQueryKHR] + vec![spirv::Capability::RayQueryKHR] } }, Self::RayQueryCommittedIntersectionType(v) => match v { s::RayQueryCommittedIntersectionType::RayQueryCommittedIntersectionNoneKHR | s::RayQueryCommittedIntersectionType::RayQueryCommittedIntersectionTriangleKHR | s::RayQueryCommittedIntersectionType::RayQueryCommittedIntersectionGeneratedKHR => { - &[spirv::Capability::RayQueryKHR] + vec![spirv::Capability::RayQueryKHR] } }, Self::RayQueryCandidateIntersectionType(v) => match v { s::RayQueryCandidateIntersectionType::RayQueryCandidateIntersectionTriangleKHR | s::RayQueryCandidateIntersectionType::RayQueryCandidateIntersectionAABBKHR => { - &[spirv::Capability::RayQueryKHR] + vec![spirv::Capability::RayQueryKHR] } }, - _ => &[], + _ => vec![], } } - pub fn required_extensions(&self) -> &'static [&'static str] { + pub fn required_extensions(&self) -> Vec<&'static str> { use spirv as s; match self { + Self::LoopControl(v) => { + let mut result = vec![]; + if v.intersects( + s::LoopControl::INITIATION_INTERVAL_INTEL + | s::LoopControl::MAX_CONCURRENCY_INTEL + | s::LoopControl::DEPENDENCY_ARRAY_INTEL + | s::LoopControl::PIPELINE_ENABLE_INTEL + | s::LoopControl::LOOP_COALESCE_INTEL + | s::LoopControl::MAX_INTERLEAVING_INTEL + | s::LoopControl::SPECULATED_ITERATIONS_INTEL, + ) { + result.extend_from_slice(&["SPV_INTEL_fpga_loop_controls"]) + }; + result + } + Self::MemorySemantics(v) => { + let mut result = vec![]; + if v.intersects(s::MemorySemantics::VOLATILE) { + result.extend_from_slice(&["SPV_KHR_vulkan_memory_model"]) + }; + result + } Self::SourceLanguage(v) => match v { s::SourceLanguage::Unknown | s::SourceLanguage::ESSL | s::SourceLanguage::GLSL | s::SourceLanguage::OpenCL_C | s::SourceLanguage::OpenCL_CPP - | s::SourceLanguage::HLSL => &[], + | s::SourceLanguage::HLSL => vec![], }, Self::ExecutionModel(v) => match v { s::ExecutionModel::Vertex @@ -1231,13 +1387,13 @@ impl Operand { | s::ExecutionModel::AnyHitNV | s::ExecutionModel::ClosestHitNV | s::ExecutionModel::MissNV - | s::ExecutionModel::CallableNV => &[], + | s::ExecutionModel::CallableNV => vec![], }, Self::AddressingModel(v) => match v { s::AddressingModel::Logical | s::AddressingModel::Physical32 - | s::AddressingModel::Physical64 => &[], - s::AddressingModel::PhysicalStorageBuffer64 => &[ + | s::AddressingModel::Physical64 => vec![], + s::AddressingModel::PhysicalStorageBuffer64 => vec![ "SPV_EXT_physical_storage_buffer", "SPV_KHR_physical_storage_buffer", ], @@ -1246,7 +1402,7 @@ impl Operand { s::MemoryModel::Simple | s::MemoryModel::GLSL450 | s::MemoryModel::OpenCL - | s::MemoryModel::Vulkan => &[], + | s::MemoryModel::Vulkan => vec![], }, Self::ExecutionMode(v) => match v { s::ExecutionMode::Invocations @@ -1286,33 +1442,33 @@ impl Operand { | s::ExecutionMode::SubgroupsPerWorkgroup | s::ExecutionMode::SubgroupsPerWorkgroupId | s::ExecutionMode::LocalSizeId - | s::ExecutionMode::LocalSizeHintId => &[], + | s::ExecutionMode::LocalSizeHintId => vec![], s::ExecutionMode::PixelInterlockOrderedEXT | s::ExecutionMode::PixelInterlockUnorderedEXT | s::ExecutionMode::SampleInterlockOrderedEXT | s::ExecutionMode::SampleInterlockUnorderedEXT | s::ExecutionMode::ShadingRateInterlockOrderedEXT | s::ExecutionMode::ShadingRateInterlockUnorderedEXT => { - &["SPV_EXT_fragment_shader_interlock"] + vec!["SPV_EXT_fragment_shader_interlock"] } - s::ExecutionMode::StencilRefReplacingEXT => &["SPV_EXT_shader_stencil_export"], + s::ExecutionMode::StencilRefReplacingEXT => vec!["SPV_EXT_shader_stencil_export"], s::ExecutionMode::MaxWorkgroupSizeINTEL | s::ExecutionMode::MaxWorkDimINTEL | s::ExecutionMode::NoGlobalOffsetINTEL - | s::ExecutionMode::NumSIMDWorkitemsINTEL => &["SPV_INTEL_kernel_attributes"], + | s::ExecutionMode::NumSIMDWorkitemsINTEL => vec!["SPV_INTEL_kernel_attributes"], s::ExecutionMode::DenormPreserve | s::ExecutionMode::DenormFlushToZero | s::ExecutionMode::SignedZeroInfNanPreserve | s::ExecutionMode::RoundingModeRTE - | s::ExecutionMode::RoundingModeRTZ => &["SPV_KHR_float_controls"], - s::ExecutionMode::PostDepthCoverage => &["SPV_KHR_post_depth_coverage"], + | s::ExecutionMode::RoundingModeRTZ => vec!["SPV_KHR_float_controls"], + s::ExecutionMode::PostDepthCoverage => vec!["SPV_KHR_post_depth_coverage"], s::ExecutionMode::DerivativeGroupQuadsNV | s::ExecutionMode::DerivativeGroupLinearNV => { - &["SPV_NV_compute_shader_derivatives"] + vec!["SPV_NV_compute_shader_derivatives"] } s::ExecutionMode::OutputLinesNV | s::ExecutionMode::OutputPrimitivesNV - | s::ExecutionMode::OutputTrianglesNV => &["SPV_NV_mesh_shader"], + | s::ExecutionMode::OutputTrianglesNV => vec!["SPV_NV_mesh_shader"], }, Self::StorageClass(v) => match v { s::StorageClass::UniformConstant @@ -1326,13 +1482,13 @@ impl Operand { | s::StorageClass::Generic | s::StorageClass::PushConstant | s::StorageClass::AtomicCounter - | s::StorageClass::Image => &[], - s::StorageClass::PhysicalStorageBuffer => &[ + | s::StorageClass::Image => vec![], + s::StorageClass::PhysicalStorageBuffer => vec![ "SPV_EXT_physical_storage_buffer", "SPV_KHR_physical_storage_buffer", ], - s::StorageClass::CodeSectionINTEL => &["SPV_INTEL_function_pointers"], - s::StorageClass::StorageBuffer => &[ + s::StorageClass::CodeSectionINTEL => vec!["SPV_INTEL_function_pointers"], + s::StorageClass::StorageBuffer => vec![ "SPV_KHR_storage_buffer_storage_class", "SPV_KHR_variable_pointers", ], @@ -1342,7 +1498,7 @@ impl Operand { | s::StorageClass::HitAttributeNV | s::StorageClass::IncomingRayPayloadNV | s::StorageClass::ShaderRecordBufferNV => { - &["SPV_NV_ray_tracing", "SPV_KHR_ray_tracing"] + vec!["SPV_NV_ray_tracing", "SPV_KHR_ray_tracing"] } }, Self::Dim(v) => match v { @@ -1352,17 +1508,17 @@ impl Operand { | s::Dim::DimCube | s::Dim::DimRect | s::Dim::DimBuffer - | s::Dim::DimSubpassData => &[], + | s::Dim::DimSubpassData => vec![], }, Self::SamplerAddressingMode(v) => match v { s::SamplerAddressingMode::None | s::SamplerAddressingMode::ClampToEdge | s::SamplerAddressingMode::Clamp | s::SamplerAddressingMode::Repeat - | s::SamplerAddressingMode::RepeatMirrored => &[], + | s::SamplerAddressingMode::RepeatMirrored => vec![], }, Self::SamplerFilterMode(v) => match v { - s::SamplerFilterMode::Nearest | s::SamplerFilterMode::Linear => &[], + s::SamplerFilterMode::Nearest | s::SamplerFilterMode::Linear => vec![], }, Self::ImageFormat(v) => match v { s::ImageFormat::Unknown @@ -1406,7 +1562,7 @@ impl Operand { | s::ImageFormat::R16ui | s::ImageFormat::R8ui | s::ImageFormat::R64ui - | s::ImageFormat::R64i => &[], + | s::ImageFormat::R64i => vec![], }, Self::ImageChannelOrder(v) => match v { s::ImageChannelOrder::R @@ -1428,7 +1584,7 @@ impl Operand { | s::ImageChannelOrder::sRGBx | s::ImageChannelOrder::sRGBA | s::ImageChannelOrder::sBGRA - | s::ImageChannelOrder::ABGR => &[], + | s::ImageChannelOrder::ABGR => vec![], }, Self::ImageChannelDataType(v) => match v { s::ImageChannelDataType::SnormInt8 @@ -1447,21 +1603,21 @@ impl Operand { | s::ImageChannelDataType::HalfFloat | s::ImageChannelDataType::Float | s::ImageChannelDataType::UnormInt24 - | s::ImageChannelDataType::UnormInt101010_2 => &[], + | s::ImageChannelDataType::UnormInt101010_2 => vec![], }, Self::FPRoundingMode(v) => match v { s::FPRoundingMode::RTE | s::FPRoundingMode::RTZ | s::FPRoundingMode::RTP - | s::FPRoundingMode::RTN => &[], + | s::FPRoundingMode::RTN => vec![], }, Self::LinkageType(v) => match v { - s::LinkageType::Export | s::LinkageType::Import => &[], + s::LinkageType::Export | s::LinkageType::Import => vec![], }, Self::AccessQualifier(v) => match v { s::AccessQualifier::ReadOnly | s::AccessQualifier::WriteOnly - | s::AccessQualifier::ReadWrite => &[], + | s::AccessQualifier::ReadWrite => vec![], }, Self::FunctionParameterAttribute(v) => match v { s::FunctionParameterAttribute::Zext @@ -1471,7 +1627,7 @@ impl Operand { | s::FunctionParameterAttribute::NoAlias | s::FunctionParameterAttribute::NoCapture | s::FunctionParameterAttribute::NoWrite - | s::FunctionParameterAttribute::NoReadWrite => &[], + | s::FunctionParameterAttribute::NoReadWrite => vec![], }, Self::Decoration(v) => match v { s::Decoration::RelaxedPrecision @@ -1524,13 +1680,15 @@ impl Operand { | s::Decoration::ViewportRelativeNV | s::Decoration::NonUniform | s::Decoration::CounterBuffer - | s::Decoration::UserSemantic => &[], - s::Decoration::ExplicitInterpAMD => &["SPV_AMD_shader_explicit_vertex_parameter"], - s::Decoration::RestrictPointer | s::Decoration::AliasedPointer => &[ + | s::Decoration::UserSemantic => vec![], + s::Decoration::ExplicitInterpAMD => { + vec!["SPV_AMD_shader_explicit_vertex_parameter"] + } + s::Decoration::RestrictPointer | s::Decoration::AliasedPointer => vec![ "SPV_EXT_physical_storage_buffer", "SPV_KHR_physical_storage_buffer", ], - s::Decoration::UserTypeGOOGLE => &["SPV_GOOGLE_user_type"], + s::Decoration::UserTypeGOOGLE => vec!["SPV_GOOGLE_user_type"], s::Decoration::RegisterINTEL | s::Decoration::MemoryINTEL | s::Decoration::NumbanksINTEL @@ -1542,18 +1700,18 @@ impl Operand { | s::Decoration::SimpleDualPortINTEL | s::Decoration::MergeINTEL | s::Decoration::BankBitsINTEL - | s::Decoration::ForcePow2DepthINTEL => &["SPV_INTEL_fpga_memory_attributes"], - s::Decoration::ReferencedIndirectlyINTEL => &["SPV_INTEL_function_pointers"], + | s::Decoration::ForcePow2DepthINTEL => vec!["SPV_INTEL_fpga_memory_attributes"], + s::Decoration::ReferencedIndirectlyINTEL => vec!["SPV_INTEL_function_pointers"], s::Decoration::NoSignedWrap | s::Decoration::NoUnsignedWrap => { - &["SPV_KHR_no_integer_wrap_decoration"] + vec!["SPV_KHR_no_integer_wrap_decoration"] } - s::Decoration::PerVertexNV => &["SPV_NV_fragment_shader_barycentric"], - s::Decoration::PassthroughNV => &["SPV_NV_geometry_shader_passthrough"], + s::Decoration::PerVertexNV => vec!["SPV_NV_fragment_shader_barycentric"], + s::Decoration::PassthroughNV => vec!["SPV_NV_geometry_shader_passthrough"], s::Decoration::PerPrimitiveNV | s::Decoration::PerViewNV - | s::Decoration::PerTaskNV => &["SPV_NV_mesh_shader"], - s::Decoration::OverrideCoverageNV => &["SPV_NV_sample_mask_override_coverage"], - s::Decoration::SecondaryViewportRelativeNV => &["SPV_NV_stereo_view_rendering"], + | s::Decoration::PerTaskNV => vec!["SPV_NV_mesh_shader"], + s::Decoration::OverrideCoverageNV => vec!["SPV_NV_sample_mask_override_coverage"], + s::Decoration::SecondaryViewportRelativeNV => vec!["SPV_NV_stereo_view_rendering"], }, Self::BuiltIn(v) => match v { s::BuiltIn::Position @@ -1601,7 +1759,7 @@ impl Operand { | s::BuiltIn::SubgroupGeMask | s::BuiltIn::SubgroupGtMask | s::BuiltIn::SubgroupLeMask - | s::BuiltIn::SubgroupLtMask => &[], + | s::BuiltIn::SubgroupLtMask => vec![], s::BuiltIn::BaryCoordNoPerspAMD | s::BuiltIn::BaryCoordNoPerspCentroidAMD | s::BuiltIn::BaryCoordNoPerspSampleAMD @@ -1609,29 +1767,31 @@ impl Operand { | s::BuiltIn::BaryCoordSmoothCentroidAMD | s::BuiltIn::BaryCoordSmoothSampleAMD | s::BuiltIn::BaryCoordPullModelAMD => { - &["SPV_AMD_shader_explicit_vertex_parameter"] + vec!["SPV_AMD_shader_explicit_vertex_parameter"] } - s::BuiltIn::FullyCoveredEXT => &["SPV_EXT_fragment_fully_covered"], + s::BuiltIn::FullyCoveredEXT => vec!["SPV_EXT_fragment_fully_covered"], s::BuiltIn::FragSizeEXT | s::BuiltIn::FragInvocationCountEXT => { - &["SPV_EXT_fragment_invocation_density", "SPV_NV_shading_rate"] + vec!["SPV_EXT_fragment_invocation_density", "SPV_NV_shading_rate"] } - s::BuiltIn::FragStencilRefEXT => &["SPV_EXT_shader_stencil_export"], - s::BuiltIn::DeviceIndex => &["SPV_KHR_device_group"], + s::BuiltIn::FragStencilRefEXT => vec!["SPV_EXT_shader_stencil_export"], + s::BuiltIn::DeviceIndex => vec!["SPV_KHR_device_group"], s::BuiltIn::PrimitiveShadingRateKHR | s::BuiltIn::ShadingRateKHR => { - &["SPV_KHR_fragment_shading_rate"] + vec!["SPV_KHR_fragment_shading_rate"] } - s::BuiltIn::ViewIndex => &["SPV_KHR_multiview"], - s::BuiltIn::RayGeometryIndexKHR => &["SPV_KHR_ray_tracing"], + s::BuiltIn::ViewIndex => vec!["SPV_KHR_multiview"], + s::BuiltIn::RayGeometryIndexKHR => vec!["SPV_KHR_ray_tracing"], s::BuiltIn::BaseVertex | s::BuiltIn::BaseInstance => { - &["SPV_KHR_shader_draw_parameters"] + vec!["SPV_KHR_shader_draw_parameters"] + } + s::BuiltIn::DrawIndex => { + vec!["SPV_KHR_shader_draw_parameters", "SPV_NV_mesh_shader"] } - s::BuiltIn::DrawIndex => &["SPV_KHR_shader_draw_parameters", "SPV_NV_mesh_shader"], - s::BuiltIn::PositionPerViewNV | s::BuiltIn::ViewportMaskPerViewNV => &[ + s::BuiltIn::PositionPerViewNV | s::BuiltIn::ViewportMaskPerViewNV => vec![ "SPV_NVX_multiview_per_view_attributes", "SPV_NV_mesh_shader", ], s::BuiltIn::BaryCoordNV | s::BuiltIn::BaryCoordNoPerspNV => { - &["SPV_NV_fragment_shader_barycentric"] + vec!["SPV_NV_fragment_shader_barycentric"] } s::BuiltIn::TaskCountNV | s::BuiltIn::PrimitiveCountNV @@ -1640,8 +1800,8 @@ impl Operand { | s::BuiltIn::CullDistancePerViewNV | s::BuiltIn::LayerPerViewNV | s::BuiltIn::MeshViewCountNV - | s::BuiltIn::MeshViewIndicesNV => &["SPV_NV_mesh_shader"], - s::BuiltIn::HitTNV => &["SPV_NV_ray_tracing"], + | s::BuiltIn::MeshViewIndicesNV => vec!["SPV_NV_mesh_shader"], + s::BuiltIn::HitTNV => vec!["SPV_NV_ray_tracing"], s::BuiltIn::LaunchIdNV | s::BuiltIn::LaunchSizeNV | s::BuiltIn::WorldRayOriginNV @@ -1654,15 +1814,17 @@ impl Operand { | s::BuiltIn::ObjectToWorldNV | s::BuiltIn::WorldToObjectNV | s::BuiltIn::HitKindNV - | s::BuiltIn::IncomingRayFlagsNV => &["SPV_NV_ray_tracing", "SPV_KHR_ray_tracing"], + | s::BuiltIn::IncomingRayFlagsNV => { + vec!["SPV_NV_ray_tracing", "SPV_KHR_ray_tracing"] + } s::BuiltIn::WarpsPerSMNV | s::BuiltIn::SMCountNV | s::BuiltIn::WarpIDNV - | s::BuiltIn::SMIDNV => &["SPV_NV_shader_sm_builtins"], + | s::BuiltIn::SMIDNV => vec!["SPV_NV_shader_sm_builtins"], s::BuiltIn::SecondaryPositionNV | s::BuiltIn::SecondaryViewportMaskNV => { - &["SPV_NV_stereo_view_rendering"] + vec!["SPV_NV_stereo_view_rendering"] } - s::BuiltIn::ViewportMaskNV => &["SPV_NV_viewport_array2", "SPV_NV_mesh_shader"], + s::BuiltIn::ViewportMaskNV => vec!["SPV_NV_viewport_array2", "SPV_NV_mesh_shader"], }, Self::Scope(v) => match v { s::Scope::CrossDevice @@ -1671,23 +1833,23 @@ impl Operand { | s::Scope::Subgroup | s::Scope::Invocation | s::Scope::QueueFamily - | s::Scope::ShaderCallKHR => &[], + | s::Scope::ShaderCallKHR => vec![], }, Self::GroupOperation(v) => match v { s::GroupOperation::Reduce | s::GroupOperation::InclusiveScan | s::GroupOperation::ExclusiveScan - | s::GroupOperation::ClusteredReduce => &[], + | s::GroupOperation::ClusteredReduce => vec![], s::GroupOperation::PartitionedReduceNV | s::GroupOperation::PartitionedInclusiveScanNV | s::GroupOperation::PartitionedExclusiveScanNV => { - &["SPV_NV_shader_subgroup_partitioned"] + vec!["SPV_NV_shader_subgroup_partitioned"] } }, Self::KernelEnqueueFlags(v) => match v { s::KernelEnqueueFlags::NoWait | s::KernelEnqueueFlags::WaitKernel - | s::KernelEnqueueFlags::WaitWorkGroup => &[], + | s::KernelEnqueueFlags::WaitWorkGroup => vec![], }, Self::Capability(v) => match v { s::Capability::Matrix @@ -1771,131 +1933,137 @@ impl Operand { | s::Capability::UniformTexelBufferArrayNonUniformIndexing | s::Capability::StorageTexelBufferArrayNonUniformIndexing | s::Capability::VulkanMemoryModel - | s::Capability::VulkanMemoryModelDeviceScope => &[], - s::Capability::Float16ImageAMD => &["SPV_AMD_gpu_shader_half_float_fetch"], - s::Capability::Groups => &["SPV_AMD_shader_ballot"], - s::Capability::FragmentMaskAMD => &["SPV_AMD_shader_fragment_mask"], - s::Capability::ImageReadWriteLodAMD => &["SPV_AMD_shader_image_load_store_lod"], - s::Capability::ImageGatherBiasLodAMD => &["SPV_AMD_texture_gather_bias_lod"], + | s::Capability::VulkanMemoryModelDeviceScope => vec![], + s::Capability::Float16ImageAMD => vec!["SPV_AMD_gpu_shader_half_float_fetch"], + s::Capability::Groups => vec!["SPV_AMD_shader_ballot"], + s::Capability::FragmentMaskAMD => vec!["SPV_AMD_shader_fragment_mask"], + s::Capability::ImageReadWriteLodAMD => vec!["SPV_AMD_shader_image_load_store_lod"], + s::Capability::ImageGatherBiasLodAMD => vec!["SPV_AMD_texture_gather_bias_lod"], s::Capability::DemoteToHelperInvocationEXT => { - &["SPV_EXT_demote_to_helper_invocation"] + vec!["SPV_EXT_demote_to_helper_invocation"] } - s::Capability::FragmentFullyCoveredEXT => &["SPV_EXT_fragment_fully_covered"], + s::Capability::FragmentFullyCoveredEXT => vec!["SPV_EXT_fragment_fully_covered"], s::Capability::FragmentDensityEXT => { - &["SPV_EXT_fragment_invocation_density", "SPV_NV_shading_rate"] + vec!["SPV_EXT_fragment_invocation_density", "SPV_NV_shading_rate"] } s::Capability::FragmentShaderSampleInterlockEXT | s::Capability::FragmentShaderShadingRateInterlockEXT | s::Capability::FragmentShaderPixelInterlockEXT => { - &["SPV_EXT_fragment_shader_interlock"] + vec!["SPV_EXT_fragment_shader_interlock"] } - s::Capability::PhysicalStorageBufferAddresses => &[ + s::Capability::PhysicalStorageBufferAddresses => vec![ "SPV_EXT_physical_storage_buffer", "SPV_KHR_physical_storage_buffer", ], s::Capability::AtomicFloat32AddEXT | s::Capability::AtomicFloat64AddEXT => { - &["SPV_EXT_shader_atomic_float_add"] + vec!["SPV_EXT_shader_atomic_float_add"] } - s::Capability::Int64ImageEXT => &["SPV_EXT_shader_image_int64"], - s::Capability::StencilExportEXT => &["SPV_EXT_shader_stencil_export"], + s::Capability::Int64ImageEXT => vec!["SPV_EXT_shader_image_int64"], + s::Capability::StencilExportEXT => vec!["SPV_EXT_shader_stencil_export"], s::Capability::ShaderViewportIndexLayerEXT => { - &["SPV_EXT_shader_viewport_index_layer"] + vec!["SPV_EXT_shader_viewport_index_layer"] } - s::Capability::BlockingPipesINTEL => &["SPV_INTEL_blocking_pipes"], + s::Capability::BlockingPipesINTEL => vec!["SPV_INTEL_blocking_pipes"], s::Capability::SubgroupAvcMotionEstimationINTEL | s::Capability::SubgroupAvcMotionEstimationIntraINTEL | s::Capability::SubgroupAvcMotionEstimationChromaINTEL => { - &["SPV_INTEL_device_side_avc_motion_estimation"] + vec!["SPV_INTEL_device_side_avc_motion_estimation"] + } + s::Capability::FPGALoopControlsINTEL => vec!["SPV_INTEL_fpga_loop_controls"], + s::Capability::FPGAMemoryAttributesINTEL => { + vec!["SPV_INTEL_fpga_memory_attributes"] } - s::Capability::FPGALoopControlsINTEL => &["SPV_INTEL_fpga_loop_controls"], - s::Capability::FPGAMemoryAttributesINTEL => &["SPV_INTEL_fpga_memory_attributes"], - s::Capability::FPGARegINTEL => &["SPV_INTEL_fpga_reg"], + s::Capability::FPGARegINTEL => vec!["SPV_INTEL_fpga_reg"], s::Capability::FunctionPointersINTEL | s::Capability::IndirectReferencesINTEL => { - &["SPV_INTEL_function_pointers"] + vec!["SPV_INTEL_function_pointers"] } s::Capability::KernelAttributesINTEL | s::Capability::FPGAKernelAttributesINTEL => { - &["SPV_INTEL_kernel_attributes"] + vec!["SPV_INTEL_kernel_attributes"] + } + s::Capability::SubgroupImageMediaBlockIOINTEL => vec!["SPV_INTEL_media_block_io"], + s::Capability::IntegerFunctions2INTEL => { + vec!["SPV_INTEL_shader_integer_functions2"] } - s::Capability::SubgroupImageMediaBlockIOINTEL => &["SPV_INTEL_media_block_io"], - s::Capability::IntegerFunctions2INTEL => &["SPV_INTEL_shader_integer_functions2"], s::Capability::SubgroupShuffleINTEL | s::Capability::SubgroupBufferBlockIOINTEL - | s::Capability::SubgroupImageBlockIOINTEL => &["SPV_INTEL_subgroups"], + | s::Capability::SubgroupImageBlockIOINTEL => vec!["SPV_INTEL_subgroups"], s::Capability::UnstructuredLoopControlsINTEL => { - &["SPV_INTEL_unstructured_loop_controls"] + vec!["SPV_INTEL_unstructured_loop_controls"] } s::Capability::StorageBuffer16BitAccess | s::Capability::UniformAndStorageBuffer16BitAccess | s::Capability::StoragePushConstant16 - | s::Capability::StorageInputOutput16 => &["SPV_KHR_16bit_storage"], + | s::Capability::StorageInputOutput16 => vec!["SPV_KHR_16bit_storage"], s::Capability::StorageBuffer8BitAccess | s::Capability::UniformAndStorageBuffer8BitAccess - | s::Capability::StoragePushConstant8 => &["SPV_KHR_8bit_storage"], - s::Capability::DeviceGroup => &["SPV_KHR_device_group"], + | s::Capability::StoragePushConstant8 => vec!["SPV_KHR_8bit_storage"], + s::Capability::DeviceGroup => vec!["SPV_KHR_device_group"], s::Capability::DenormPreserve | s::Capability::DenormFlushToZero | s::Capability::SignedZeroInfNanPreserve | s::Capability::RoundingModeRTE - | s::Capability::RoundingModeRTZ => &["SPV_KHR_float_controls"], - s::Capability::FragmentShadingRateKHR => &["SPV_KHR_fragment_shading_rate"], - s::Capability::MultiView => &["SPV_KHR_multiview"], - s::Capability::SampleMaskPostDepthCoverage => &["SPV_KHR_post_depth_coverage"], + | s::Capability::RoundingModeRTZ => vec!["SPV_KHR_float_controls"], + s::Capability::FragmentShadingRateKHR => vec!["SPV_KHR_fragment_shading_rate"], + s::Capability::MultiView => vec!["SPV_KHR_multiview"], + s::Capability::SampleMaskPostDepthCoverage => vec!["SPV_KHR_post_depth_coverage"], s::Capability::RayQueryProvisionalKHR | s::Capability::RayQueryKHR => { - &["SPV_KHR_ray_query"] + vec!["SPV_KHR_ray_query"] } s::Capability::RayTraversalPrimitiveCullingKHR => { - &["SPV_KHR_ray_query", "SPV_KHR_ray_tracing"] + vec!["SPV_KHR_ray_query", "SPV_KHR_ray_tracing"] } s::Capability::RayTracingKHR | s::Capability::RayTracingProvisionalKHR => { - &["SPV_KHR_ray_tracing"] + vec!["SPV_KHR_ray_tracing"] } - s::Capability::AtomicStorageOps => &["SPV_KHR_shader_atomic_counter_ops"], - s::Capability::SubgroupBallotKHR => &["SPV_KHR_shader_ballot"], - s::Capability::ShaderClockKHR => &["SPV_KHR_shader_clock"], - s::Capability::DrawParameters => &["SPV_KHR_shader_draw_parameters"], - s::Capability::SubgroupVoteKHR => &["SPV_KHR_subgroup_vote"], + s::Capability::AtomicStorageOps => vec!["SPV_KHR_shader_atomic_counter_ops"], + s::Capability::SubgroupBallotKHR => vec!["SPV_KHR_shader_ballot"], + s::Capability::ShaderClockKHR => vec!["SPV_KHR_shader_clock"], + s::Capability::DrawParameters => vec!["SPV_KHR_shader_draw_parameters"], + s::Capability::SubgroupVoteKHR => vec!["SPV_KHR_subgroup_vote"], s::Capability::VariablePointersStorageBuffer | s::Capability::VariablePointers => { - &["SPV_KHR_variable_pointers"] + vec!["SPV_KHR_variable_pointers"] } - s::Capability::PerViewAttributesNV => &["SPV_NVX_multiview_per_view_attributes"], + s::Capability::PerViewAttributesNV => vec!["SPV_NVX_multiview_per_view_attributes"], s::Capability::ComputeDerivativeGroupQuadsNV | s::Capability::ComputeDerivativeGroupLinearNV => { - &["SPV_NV_compute_shader_derivatives"] + vec!["SPV_NV_compute_shader_derivatives"] } - s::Capability::CooperativeMatrixNV => &["SPV_NV_cooperative_matrix"], - s::Capability::FragmentBarycentricNV => &["SPV_NV_fragment_shader_barycentric"], + s::Capability::CooperativeMatrixNV => vec!["SPV_NV_cooperative_matrix"], + s::Capability::FragmentBarycentricNV => vec!["SPV_NV_fragment_shader_barycentric"], s::Capability::GeometryShaderPassthroughNV => { - &["SPV_NV_geometry_shader_passthrough"] + vec!["SPV_NV_geometry_shader_passthrough"] } - s::Capability::MeshShadingNV => &["SPV_NV_mesh_shader"], - s::Capability::RayTracingNV => &["SPV_NV_ray_tracing"], + s::Capability::MeshShadingNV => vec!["SPV_NV_mesh_shader"], + s::Capability::RayTracingNV => vec!["SPV_NV_ray_tracing"], s::Capability::SampleMaskOverrideCoverageNV => { - &["SPV_NV_sample_mask_override_coverage"] + vec!["SPV_NV_sample_mask_override_coverage"] } - s::Capability::ImageFootprintNV => &["SPV_NV_shader_image_footprint"], - s::Capability::ShaderSMBuiltinsNV => &["SPV_NV_shader_sm_builtins"], + s::Capability::ImageFootprintNV => vec!["SPV_NV_shader_image_footprint"], + s::Capability::ShaderSMBuiltinsNV => vec!["SPV_NV_shader_sm_builtins"], s::Capability::GroupNonUniformPartitionedNV => { - &["SPV_NV_shader_subgroup_partitioned"] + vec!["SPV_NV_shader_subgroup_partitioned"] } - s::Capability::ShaderStereoViewNV => &["SPV_NV_stereo_view_rendering"], - s::Capability::ShaderViewportMaskNV => &["SPV_NV_viewport_array2"], + s::Capability::ShaderStereoViewNV => vec!["SPV_NV_stereo_view_rendering"], + s::Capability::ShaderViewportMaskNV => vec!["SPV_NV_viewport_array2"], }, Self::RayQueryIntersection(v) => match v { s::RayQueryIntersection::RayQueryCandidateIntersectionKHR - | s::RayQueryIntersection::RayQueryCommittedIntersectionKHR => &[], + | s::RayQueryIntersection::RayQueryCommittedIntersectionKHR => vec![], }, Self::RayQueryCommittedIntersectionType(v) => match v { s::RayQueryCommittedIntersectionType::RayQueryCommittedIntersectionNoneKHR | s::RayQueryCommittedIntersectionType::RayQueryCommittedIntersectionTriangleKHR | s::RayQueryCommittedIntersectionType::RayQueryCommittedIntersectionGeneratedKHR => { - &[] + vec![] } }, Self::RayQueryCandidateIntersectionType(v) => match v { s::RayQueryCandidateIntersectionType::RayQueryCandidateIntersectionTriangleKHR - | s::RayQueryCandidateIntersectionType::RayQueryCandidateIntersectionAABBKHR => &[], + | s::RayQueryCandidateIntersectionType::RayQueryCandidateIntersectionAABBKHR => { + vec![] + } }, - _ => &[], + _ => vec![], } } pub fn additional_operands(&self) -> Vec { diff --git a/spirv/autogen_spirv.rs b/spirv/autogen_spirv.rs index cfb49031..0a008792 100644 --- a/spirv/autogen_spirv.rs +++ b/spirv/autogen_spirv.rs @@ -8,25 +8,15 @@ pub const MAJOR_VERSION: u8 = 1u8; pub const MINOR_VERSION: u8 = 5u8; pub const REVISION: u8 = 4u8; bitflags! { # [doc = "SPIR-V operand kind: [ImageOperands](https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#_a_id_image_operands_a_image_operands)"] # [cfg_attr (feature = "serialize" , derive (serde :: Serialize))] # [cfg_attr (feature = "deserialize" , derive (serde :: Deserialize))] pub struct ImageOperands : u32 { const NONE = 0u32 ; const BIAS = 1u32 ; const LOD = 2u32 ; const GRAD = 4u32 ; const CONST_OFFSET = 8u32 ; const OFFSET = 16u32 ; const CONST_OFFSETS = 32u32 ; const SAMPLE = 64u32 ; const MIN_LOD = 128u32 ; const MAKE_TEXEL_AVAILABLE = 256u32 ; const MAKE_TEXEL_AVAILABLE_KHR = 256u32 ; const MAKE_TEXEL_VISIBLE = 512u32 ; const MAKE_TEXEL_VISIBLE_KHR = 512u32 ; const NON_PRIVATE_TEXEL = 1024u32 ; const NON_PRIVATE_TEXEL_KHR = 1024u32 ; const VOLATILE_TEXEL = 2048u32 ; const VOLATILE_TEXEL_KHR = 2048u32 ; const SIGN_EXTEND = 4096u32 ; const ZERO_EXTEND = 8192u32 ; } } -impl ImageOperands {} bitflags! { # [doc = "SPIR-V operand kind: [FPFastMathMode](https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#_a_id_fp_fast_math_mode_a_fp_fast_math_mode)"] # [cfg_attr (feature = "serialize" , derive (serde :: Serialize))] # [cfg_attr (feature = "deserialize" , derive (serde :: Deserialize))] pub struct FPFastMathMode : u32 { const NONE = 0u32 ; const NOT_NAN = 1u32 ; const NOT_INF = 2u32 ; const NSZ = 4u32 ; const ALLOW_RECIP = 8u32 ; const FAST = 16u32 ; } } -impl FPFastMathMode {} bitflags! { # [doc = "SPIR-V operand kind: [SelectionControl](https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#_a_id_selection_control_a_selection_control)"] # [cfg_attr (feature = "serialize" , derive (serde :: Serialize))] # [cfg_attr (feature = "deserialize" , derive (serde :: Deserialize))] pub struct SelectionControl : u32 { const NONE = 0u32 ; const FLATTEN = 1u32 ; const DONT_FLATTEN = 2u32 ; } } -impl SelectionControl {} bitflags! { # [doc = "SPIR-V operand kind: [LoopControl](https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#_a_id_loop_control_a_loop_control)"] # [cfg_attr (feature = "serialize" , derive (serde :: Serialize))] # [cfg_attr (feature = "deserialize" , derive (serde :: Deserialize))] pub struct LoopControl : u32 { const NONE = 0u32 ; const UNROLL = 1u32 ; const DONT_UNROLL = 2u32 ; const DEPENDENCY_INFINITE = 4u32 ; const DEPENDENCY_LENGTH = 8u32 ; const MIN_ITERATIONS = 16u32 ; const MAX_ITERATIONS = 32u32 ; const ITERATION_MULTIPLE = 64u32 ; const PEEL_COUNT = 128u32 ; const PARTIAL_COUNT = 256u32 ; const INITIATION_INTERVAL_INTEL = 65536u32 ; const MAX_CONCURRENCY_INTEL = 131072u32 ; const DEPENDENCY_ARRAY_INTEL = 262144u32 ; const PIPELINE_ENABLE_INTEL = 524288u32 ; const LOOP_COALESCE_INTEL = 1048576u32 ; const MAX_INTERLEAVING_INTEL = 2097152u32 ; const SPECULATED_ITERATIONS_INTEL = 4194304u32 ; } } -impl LoopControl {} bitflags! { # [doc = "SPIR-V operand kind: [FunctionControl](https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#_a_id_function_control_a_function_control)"] # [cfg_attr (feature = "serialize" , derive (serde :: Serialize))] # [cfg_attr (feature = "deserialize" , derive (serde :: Deserialize))] pub struct FunctionControl : u32 { const NONE = 0u32 ; const INLINE = 1u32 ; const DONT_INLINE = 2u32 ; const PURE = 4u32 ; const CONST = 8u32 ; } } -impl FunctionControl {} bitflags! { # [doc = "SPIR-V operand kind: [MemorySemantics](https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#_a_id_memory_semantics_a_memory_semantics)"] # [cfg_attr (feature = "serialize" , derive (serde :: Serialize))] # [cfg_attr (feature = "deserialize" , derive (serde :: Deserialize))] pub struct MemorySemantics : u32 { const RELAXED = 0u32 ; const NONE = 0u32 ; const ACQUIRE = 2u32 ; const RELEASE = 4u32 ; const ACQUIRE_RELEASE = 8u32 ; const SEQUENTIALLY_CONSISTENT = 16u32 ; const UNIFORM_MEMORY = 64u32 ; const SUBGROUP_MEMORY = 128u32 ; const WORKGROUP_MEMORY = 256u32 ; const CROSS_WORKGROUP_MEMORY = 512u32 ; const ATOMIC_COUNTER_MEMORY = 1024u32 ; const IMAGE_MEMORY = 2048u32 ; const OUTPUT_MEMORY = 4096u32 ; const OUTPUT_MEMORY_KHR = 4096u32 ; const MAKE_AVAILABLE = 8192u32 ; const MAKE_AVAILABLE_KHR = 8192u32 ; const MAKE_VISIBLE = 16384u32 ; const MAKE_VISIBLE_KHR = 16384u32 ; const VOLATILE = 32768u32 ; } } -impl MemorySemantics {} bitflags! { # [doc = "SPIR-V operand kind: [MemoryAccess](https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#_a_id_memory_access_a_memory_access)"] # [cfg_attr (feature = "serialize" , derive (serde :: Serialize))] # [cfg_attr (feature = "deserialize" , derive (serde :: Deserialize))] pub struct MemoryAccess : u32 { const NONE = 0u32 ; const VOLATILE = 1u32 ; const ALIGNED = 2u32 ; const NONTEMPORAL = 4u32 ; const MAKE_POINTER_AVAILABLE = 8u32 ; const MAKE_POINTER_AVAILABLE_KHR = 8u32 ; const MAKE_POINTER_VISIBLE = 16u32 ; const MAKE_POINTER_VISIBLE_KHR = 16u32 ; const NON_PRIVATE_POINTER = 32u32 ; const NON_PRIVATE_POINTER_KHR = 32u32 ; } } -impl MemoryAccess {} bitflags! { # [doc = "SPIR-V operand kind: [KernelProfilingInfo](https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#_a_id_kernel_profiling_info_a_kernel_profiling_info)"] # [cfg_attr (feature = "serialize" , derive (serde :: Serialize))] # [cfg_attr (feature = "deserialize" , derive (serde :: Deserialize))] pub struct KernelProfilingInfo : u32 { const NONE = 0u32 ; const CMD_EXEC_TIME = 1u32 ; } } -impl KernelProfilingInfo {} bitflags! { # [doc = "SPIR-V operand kind: [RayFlags](https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#_a_id_ray_flags_a_ray_flags)"] # [cfg_attr (feature = "serialize" , derive (serde :: Serialize))] # [cfg_attr (feature = "deserialize" , derive (serde :: Deserialize))] pub struct RayFlags : u32 { const NONE_KHR = 0u32 ; const OPAQUE_KHR = 1u32 ; const NO_OPAQUE_KHR = 2u32 ; const TERMINATE_ON_FIRST_HIT_KHR = 4u32 ; const SKIP_CLOSEST_HIT_SHADER_KHR = 8u32 ; const CULL_BACK_FACING_TRIANGLES_KHR = 16u32 ; const CULL_FRONT_FACING_TRIANGLES_KHR = 32u32 ; const CULL_OPAQUE_KHR = 64u32 ; const CULL_NO_OPAQUE_KHR = 128u32 ; const SKIP_TRIANGLES_KHR = 256u32 ; const SKIP_AAB_BS_KHR = 512u32 ; } } -impl RayFlags {} bitflags! { # [doc = "SPIR-V operand kind: [FragmentShadingRate](https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#_a_id_fragment_shading_rate_a_fragment_shading_rate)"] # [cfg_attr (feature = "serialize" , derive (serde :: Serialize))] # [cfg_attr (feature = "deserialize" , derive (serde :: Deserialize))] pub struct FragmentShadingRate : u32 { const VERTICAL2_PIXELS = 1u32 ; const VERTICAL4_PIXELS = 2u32 ; const HORIZONTAL2_PIXELS = 4u32 ; const HORIZONTAL4_PIXELS = 8u32 ; } } -impl FragmentShadingRate {} #[doc = "/// SPIR-V operand kind: [SourceLanguage](https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#_a_id_source_language_a_source_language)"] #[repr(u32)] #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] From 1683fd93d958d71b1ec03952f4bad506e09488c7 Mon Sep 17 00:00:00 2001 From: Jasper Bekkers Date: Thu, 11 Feb 2021 15:00:32 +0100 Subject: [PATCH 3/3] fmt with 1.49 instead --- autogen/src/main.rs | 3 +-- rspirv/tests/spirv_blobs.rs | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/autogen/src/main.rs b/autogen/src/main.rs index 9638427b..1f4cc310 100644 --- a/autogen/src/main.rs +++ b/autogen/src/main.rs @@ -9,8 +9,7 @@ mod table; mod utils; use std::{ - env, - fs, + env, fs, io::{Read, Write}, path::PathBuf, process, diff --git a/rspirv/tests/spirv_blobs.rs b/rspirv/tests/spirv_blobs.rs index 40a13096..f1f25647 100644 --- a/rspirv/tests/spirv_blobs.rs +++ b/rspirv/tests/spirv_blobs.rs @@ -1,7 +1,6 @@ use rspirv::{ binary::{Assemble as _, Disassemble as _}, - dr, - lift, + dr, lift, }; use std::path::PathBuf;