From 2671cd1ab9ce9a650f3c2542a1e6c6be390f2e9d Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Mon, 26 Nov 2018 01:09:30 -0800 Subject: [PATCH] format source --- shader-compiler-backend-llvm-7/build.rs | 3 +- shader-compiler-backend-llvm-7/src/backend.rs | 6 +- shader-compiler-backend-llvm-7/src/lib.rs | 5 +- shader-compiler-backend/src/lib.rs | 6 +- shader-compiler/src/parsed_shader_create.rs | 3 +- spirv-parser-generator/src/generate.rs | 254 +++++++++--------- vulkan-driver/src/api_impl.rs | 70 ++--- vulkan-driver/src/device_memory.rs | 4 +- vulkan-driver/src/pipeline.rs | 8 +- vulkan-driver/src/xcb_swapchain.rs | 6 +- 10 files changed, 184 insertions(+), 181 deletions(-) diff --git a/shader-compiler-backend-llvm-7/build.rs b/shader-compiler-backend-llvm-7/build.rs index 66f0eac..6d2c3c3 100644 --- a/shader-compiler-backend-llvm-7/build.rs +++ b/shader-compiler-backend-llvm-7/build.rs @@ -248,7 +248,8 @@ void LLVM_InitializeNativeDisassembler(void); "#; let header_path = out_dir.join("llvm_bindings.h"); fs::write(&header_path, header).unwrap(); - let llvm_bindings_source = format!("#include {:?}\n", header_path) + r#" + let llvm_bindings_source = format!("#include {:?}\n", header_path) + + r#" void LLVM_InitializeNativeTarget(void) { LLVM_NATIVE_TARGETINFO(); diff --git a/shader-compiler-backend-llvm-7/src/backend.rs b/shader-compiler-backend-llvm-7/src/backend.rs index a20070c..8aca5d5 100644 --- a/shader-compiler-backend-llvm-7/src/backend.rs +++ b/shader-compiler-backend-llvm-7/src/backend.rs @@ -635,7 +635,8 @@ impl backend::Compiler for LLVM7Compiler { module.take(), Some(symbol_resolver_fn), null_mut(), - ) { + ) + { return Err(U::create_error("compilation failed".into())); } let mut functions: HashMap<_, _> = HashMap::new(); @@ -647,7 +648,8 @@ impl backend::Compiler for LLVM7Compiler { &mut address, module_handle, name.as_ptr(), - ) { + ) + { return Err(U::create_error(format!( "function not found in compiled module: {:?}", name diff --git a/shader-compiler-backend-llvm-7/src/lib.rs b/shader-compiler-backend-llvm-7/src/lib.rs index c840645..31300b8 100644 --- a/shader-compiler-backend-llvm-7/src/lib.rs +++ b/shader-compiler-backend-llvm-7/src/lib.rs @@ -2,10 +2,7 @@ // Copyright 2018 Jacob Lifshay extern crate shader_compiler_backend; -#[cfg_attr( - feature = "cargo-clippy", - allow(clippy::const_static_lifetime) -)] +#[cfg_attr(feature = "cargo-clippy", allow(clippy::const_static_lifetime))] #[allow(dead_code)] #[allow(non_upper_case_globals)] #[allow(non_camel_case_types)] diff --git a/shader-compiler-backend/src/lib.rs b/shader-compiler-backend/src/lib.rs index 09dcbe8..8ad2ab6 100644 --- a/shader-compiler-backend/src/lib.rs +++ b/shader-compiler-backend/src/lib.rs @@ -260,18 +260,18 @@ pub trait Compiler: Copy + Send + Sync + 'static { mod test { #![allow(dead_code)] - buildable_struct!{ + buildable_struct! { struct S1 { } } - buildable_struct!{ + buildable_struct! { pub struct S2 { v: u32, } } - buildable_struct!{ + buildable_struct! { struct S3 { p: *mut S2, v: ::types::VecNx4, diff --git a/shader-compiler/src/parsed_shader_create.rs b/shader-compiler/src/parsed_shader_create.rs index 3fef930..8f6720c 100644 --- a/shader-compiler/src/parsed_shader_create.rs +++ b/shader-compiler/src/parsed_shader_create.rs @@ -306,7 +306,8 @@ pub(super) fn create<'a, C: shader_compiler_backend::Context<'a>>( .find_map(|decoration| match *decoration { Decoration::BuiltIn { built_in } => Some(built_in), _ => None, - }) { + }) + { let built_in_variable = match built_in { BuiltIn::GlobalInvocationId => { for decoration in &ids[id_result.0].decorations { diff --git a/spirv-parser-generator/src/generate.rs b/spirv-parser-generator/src/generate.rs index 4f70960..38446d5 100644 --- a/spirv-parser-generator/src/generate.rs +++ b/spirv-parser-generator/src/generate.rs @@ -417,7 +417,7 @@ pub(crate) fn generate( writeln!( &mut out, "{}", - quote!{ + quote! { pub const MAGIC_NUMBER: u32 = #magic_number; pub const MAJOR_VERSION: u32 = #major_version; pub const MINOR_VERSION: u32 = #minor_version; @@ -448,12 +448,12 @@ pub(crate) fn generate( new_combined_id(&[kind.as_ref(), &enumerant.enumerant], CamelCase); let enumerant_parse_operation; if enumerant.parameters.is_empty() { - enumerant_items.push(quote!{ + enumerant_items.push(quote! { #[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Hash)] pub struct #type_name; }); - enumerant_parse_operation = quote!{(Some(#type_name), words)}; - enumerant_display_mask_operations.push(quote!{ + enumerant_parse_operation = quote! {(Some(#type_name), words)}; + enumerant_display_mask_operations.push(quote! { if self.#member_name.is_some() { if any_members { write!(f, "|{}", #enumerant_name)?; @@ -463,7 +463,7 @@ pub(crate) fn generate( } } }); - enumerant_display_operations.push(quote!{}); + enumerant_display_operations.push(quote! {}); } else { let mut enumerant_parameter_declarations = Vec::new(); let mut enumerant_parameter_names = Vec::new(); @@ -472,29 +472,29 @@ pub(crate) fn generate( for (index, parameter) in enumerant.parameters.iter().enumerate() { let name = new_id(format!("parameter_{}", index), SnakeCase); let kind = new_id(¶meter.kind, CamelCase); - enumerant_parameter_declarations.push(quote!{ + enumerant_parameter_declarations.push(quote! { pub #kind, }); - enumerant_parameter_names.push(quote!{ + enumerant_parameter_names.push(quote! { #name, }); - parse_enumerant_members.push(quote!{ + parse_enumerant_members.push(quote! { let (#name, words) = #kind::spirv_parse(words, parse_state)?; }); - display_enumerant_members.push(quote!{ + display_enumerant_members.push(quote! { #name.spirv_display(f)?; }); } - enumerant_items.push(quote!{ + enumerant_items.push(quote! { #[derive(Clone, Debug, Default, Eq, PartialEq, Hash)] pub struct #type_name(#(#enumerant_parameter_declarations)*); }); let enumerant_parameter_names = &enumerant_parameter_names; - enumerant_parse_operation = quote!{ + enumerant_parse_operation = quote! { #(#parse_enumerant_members)* (Some(#type_name(#(#enumerant_parameter_names)*)), words) }; - enumerant_display_mask_operations.push(quote!{ + enumerant_display_mask_operations.push(quote! { if self.#member_name.is_some() { if any_members { write!(f, "|{}", #enumerant_name)?; @@ -510,11 +510,11 @@ pub(crate) fn generate( } }); }; - enumerant_members.push(quote!{ + enumerant_members.push(quote! { pub #member_name: Option<#type_name> }); let enumerant_value = enumerant.value; - enumerant_parse_operations.push(quote!{ + enumerant_parse_operations.push(quote! { let (#member_name, words) = if (mask & #enumerant_value) != 0 { mask &= !#enumerant_value; #enumerant_parse_operation @@ -526,7 +526,7 @@ pub(crate) fn generate( writeln!( &mut out, "{}", - quote!{ + quote! { #[derive(Clone, Debug, Default, Eq, PartialEq, Hash)] pub struct #kind_id { #(#enumerant_members),* @@ -534,7 +534,7 @@ pub(crate) fn generate( #(#enumerant_items)* } )?; - let parse_body = quote!{ + let parse_body = quote! { let (mut mask, words) = u32::spirv_parse(words, parse_state)?; #(#enumerant_parse_operations)* if mask != 0 { @@ -548,7 +548,7 @@ pub(crate) fn generate( writeln!( &mut out, "{}", - quote!{ + quote! { impl SPIRVParse for #kind_id { fn spirv_parse<'a>( words: &'a [u32], @@ -562,7 +562,7 @@ pub(crate) fn generate( writeln!( &mut out, "{}", - quote!{ + quote! { impl SPIRVDisplay for #kind_id { fn spirv_display(&self, f: &mut fmt::Formatter) -> fmt::Result { let mut any_members = false; @@ -593,11 +593,11 @@ pub(crate) fn generate( let enumerant_value = enumerant.value; let display_name = &enumerant.enumerant; if enumerant.parameters.is_empty() { - generated_enumerants.push(quote!{#name}); - enumerant_parse_cases.push(quote!{ + generated_enumerants.push(quote! {#name}); + enumerant_parse_cases.push(quote! { #enumerant_value => Ok((#kind_id::#name, words)), }); - enumerant_display_cases.push(quote!{ + enumerant_display_cases.push(quote! { #kind_id::#name => write!(f, " {}", #display_name), }); } else { @@ -608,26 +608,26 @@ pub(crate) fn generate( for parameter in enumerant.parameters.iter() { let name = new_id(parameter.name.as_ref().unwrap(), SnakeCase); let kind = new_id(¶meter.kind, CamelCase); - enumerant_member_declarations.push(quote!{ + enumerant_member_declarations.push(quote! { #name: #kind, }); - enumerant_member_names.push(quote!{ + enumerant_member_names.push(quote! { #name, }); - parse_enumerant_members.push(quote!{ + parse_enumerant_members.push(quote! { let (#name, words) = #kind::spirv_parse(words, parse_state)?; }); - display_enumerant_members.push(quote!{ + display_enumerant_members.push(quote! { #name.spirv_display(f)?; }); } - generated_enumerants.push(quote!{ + generated_enumerants.push(quote! { #name { #(#enumerant_member_declarations)* } }); let enumerant_member_names = &enumerant_member_names; - enumerant_parse_cases.push(quote!{ + enumerant_parse_cases.push(quote! { #enumerant_value => { #(#parse_enumerant_members)* Ok((#kind_id::#name { @@ -635,7 +635,7 @@ pub(crate) fn generate( }, words)) }, }); - enumerant_display_cases.push(quote!{ + enumerant_display_cases.push(quote! { #kind_id::#name { #(#enumerant_member_names)* } => { @@ -647,19 +647,19 @@ pub(crate) fn generate( } } let mut derives = vec![ - quote!{Clone}, - quote!{Debug}, - quote!{Eq}, - quote!{PartialEq}, - quote!{Hash}, + quote! {Clone}, + quote! {Debug}, + quote! {Eq}, + quote! {PartialEq}, + quote! {Hash}, ]; if !has_any_parameters { - derives.push(quote!{Copy}); + derives.push(quote! {Copy}); } writeln!( &mut out, "{}", - quote!{ + quote! { #[derive(#(#derives),*)] pub enum #kind_id { #(#generated_enumerants,)* @@ -669,7 +669,7 @@ pub(crate) fn generate( writeln!( &mut out, "{}", - quote!{ + quote! { impl SPIRVParse for #kind_id { fn spirv_parse<'a>( words: &'a [u32], @@ -687,7 +687,7 @@ pub(crate) fn generate( writeln!( &mut out, "{}", - quote!{ + quote! { impl SPIRVDisplay for #kind_id { fn spirv_display(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { @@ -700,15 +700,15 @@ pub(crate) fn generate( } ast::OperandKind::Id { kind, .. } => { let base = if *kind == ast::Kind::IdRef { - quote!{u32} + quote! {u32} } else { - quote!{IdRef} + quote! {IdRef} }; let kind_id = new_id(kind, CamelCase); writeln!( &mut out, "{}", - quote!{ + quote! { #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug, Default)] #[repr(transparent)] pub struct #kind_id(pub #base); @@ -718,7 +718,7 @@ pub(crate) fn generate( writeln!( &mut out, "{}", - quote!{ + quote! { impl SPIRVParse for #kind_id { fn spirv_parse<'a>( words: &'a [u32], @@ -732,7 +732,7 @@ pub(crate) fn generate( writeln!( &mut out, "{}", - quote!{ + quote! { impl fmt::Display for #kind_id { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Display::fmt(&self.0, f) @@ -743,7 +743,7 @@ pub(crate) fn generate( writeln!( &mut out, "{}", - quote!{ + quote! { impl SPIRVDisplay for #kind_id { fn spirv_display(&self, f: &mut fmt::Formatter) -> fmt::Result { self.0.spirv_display(f) @@ -763,15 +763,15 @@ pub(crate) fn generate( | ast::LiteralKind::LiteralContextDependentNumber => unreachable!(), ast::LiteralKind::LiteralInteger32 | ast::LiteralKind::LiteralContextDependentNumber32 => { - quote!{pub type #kind_id = u32;} + quote! {pub type #kind_id = u32;} } ast::LiteralKind::LiteralInteger64 | ast::LiteralKind::LiteralContextDependentNumber64 => { - quote!{pub type #kind_id = u64;} + quote! {pub type #kind_id = u64;} } - ast::LiteralKind::LiteralString => quote!{pub type #kind_id = String;}, + ast::LiteralKind::LiteralString => quote! {pub type #kind_id = String;}, ast::LiteralKind::LiteralExtInstInteger => { - quote!{pub type #kind_id = u32;} + quote! {pub type #kind_id = u32;} } ast::LiteralKind::LiteralSpecConstantOpInteger => continue, } @@ -780,7 +780,7 @@ pub(crate) fn generate( ast::OperandKind::Composite { kind, bases } => { let kind = new_id(kind, CamelCase); let bases = bases.iter().map(|base| new_id(base, CamelCase)); - writeln!(&mut out, "{}", quote!{pub type #kind = (#(#bases),*);})?; + writeln!(&mut out, "{}", quote! {pub type #kind = (#(#bases),*);})?; } } } @@ -810,13 +810,13 @@ pub(crate) fn generate( let kind = new_id(&operand.kind, CamelCase); let name = new_id(operand.name.as_ref().unwrap(), SnakeCase); let kind = match &operand.quantifier { - None => quote!{#kind}, - Some(ast::Quantifier::Optional) => quote!{Option<#kind>}, - Some(ast::Quantifier::Variadic) => quote!{Vec<#kind>}, + None => quote! {#kind}, + Some(ast::Quantifier::Optional) => quote! {Option<#kind>}, + Some(ast::Quantifier::Variadic) => quote! {Vec<#kind>}, }; - fields.push(quote!{#name: #kind}); + fields.push(quote! {#name: #kind}); } - let instruction_extension_enumerant = quote!{ + let instruction_extension_enumerant = quote! { #instruction_enumerant_name { id_result_type: IdResultType, id_result: IdResult, @@ -832,20 +832,20 @@ pub(crate) fn generate( let kind = new_id(&operand.kind, CamelCase); let name = new_id(operand.name.as_ref().unwrap(), SnakeCase); let kind = match operand.quantifier { - None => quote!{#kind}, - Some(ast::Quantifier::Optional) => quote!{Option::<#kind>}, - Some(ast::Quantifier::Variadic) => quote!{Vec::<#kind>}, + None => quote! {#kind}, + Some(ast::Quantifier::Optional) => quote! {Option::<#kind>}, + Some(ast::Quantifier::Variadic) => quote! {Vec::<#kind>}, }; - parse_operations.push(quote!{ + parse_operations.push(quote! { let (#name, words) = #kind::spirv_parse(words, parse_state)?; }); - display_operations.push(quote!{ + display_operations.push(quote! { #name.spirv_display(f)?; }); operand_names.push(name); } let operand_names = &operand_names; - let body = quote!{ + let body = quote! { #(#parse_operations)* if words.is_empty() { Ok(Instruction::#instruction_enumerant_name { @@ -858,14 +858,14 @@ pub(crate) fn generate( Err(Error::InstructionTooLong) } }; - let instruction_extension_parse_case = quote!{ + let instruction_extension_parse_case = quote! { (ExtensionInstructionSet::#extension_instruction_set, #opcode) => { #body } }; instruction_extension_parse_cases.push(instruction_extension_parse_case); let display_opname = &instruction.opname; - let instruction_extension_display_case = quote!{ + let instruction_extension_display_case = quote! { Instruction::#instruction_enumerant_name { id_result_type, id_result, @@ -897,7 +897,7 @@ pub(crate) fn generate( let instruction_display_case; match &instruction.opname { ast::InstructionName::OpExtInstImport => { - let body = quote!{ + let body = quote! { parse_state.define_id( id_result, IdState::ExtensionInstructionSet(ExtensionInstructionSet::from(&*name)), @@ -908,19 +908,19 @@ pub(crate) fn generate( Err(Error::InstructionTooLong) } }; - instruction_parse_case = quote!{#opcode => { + instruction_parse_case = quote! {#opcode => { let (id_result, words) = IdResult::spirv_parse(words, parse_state)?; let (name, words) = LiteralString::spirv_parse(words, parse_state)?; #body }}; - instruction_display_case = quote!{ + instruction_display_case = quote! { Instruction::ExtInstImport { id_result, name } => { writeln!(f, "{}{} {:?}", InstructionIndentAndResult(Some(*id_result)), #display_opname, name) } }; } ast::InstructionName::OpExtInst => { - let body = quote!{ + let body = quote! { let extension_instruction_set; match parse_state.id_states[set.0 as usize].clone() { IdState::ExtensionInstructionSet(ExtensionInstructionSet::Other(_)) => { @@ -947,7 +947,7 @@ pub(crate) fn generate( (extension_instruction_set, instruction) => Err(Error::UnknownExtensionOpcode(extension_instruction_set, instruction)), } }; - instruction_parse_case = quote!{ + instruction_parse_case = quote! { #opcode => { let (id_result_type, words) = IdResultType::spirv_parse(words, parse_state)?; let (id_result, words) = IdResult::spirv_parse(words, parse_state)?; @@ -957,7 +957,7 @@ pub(crate) fn generate( #body } }; - instruction_display_case = quote!{ + instruction_display_case = quote! { Instruction::ExtInst { id_result_type, id_result, @@ -975,7 +975,7 @@ pub(crate) fn generate( }; } ast::InstructionName::OpTypeInt => { - let body = quote!{ + let body = quote! { let (signedness, words) = LiteralInteger32::spirv_parse(words, parse_state)?; let id_state = match width { 8 | 16 | 32 => IdState::Type(IdStateType(BitWidth::Width32OrLess)), @@ -993,14 +993,14 @@ pub(crate) fn generate( Err(Error::InstructionTooLong) } }; - instruction_parse_case = quote!{ + instruction_parse_case = quote! { #opcode => { let (id_result, words) = IdResult::spirv_parse(words, parse_state)?; let (width, words) = LiteralInteger32::spirv_parse(words, parse_state)?; #body } }; - instruction_display_case = quote!{ + instruction_display_case = quote! { Instruction::TypeInt { id_result, width, @@ -1019,7 +1019,7 @@ pub(crate) fn generate( }; } ast::InstructionName::OpTypeFloat => { - instruction_parse_case = quote!{ + instruction_parse_case = quote! { #opcode => { let (id_result, words) = IdResult::spirv_parse(words, parse_state)?; let (width, words) = LiteralInteger32::spirv_parse(words, parse_state)?; @@ -1039,7 +1039,7 @@ pub(crate) fn generate( } } }; - instruction_display_case = quote!{ + instruction_display_case = quote! { Instruction::TypeFloat { id_result, width } => { write!( f, @@ -1053,7 +1053,7 @@ pub(crate) fn generate( }; } ast::InstructionName::OpSwitch32 => { - let body32 = quote!{ + let body32 = quote! { IdState::Value(IdStateValue(BitWidth::Width32OrLess)) => { let (target, words) = Vec::::spirv_parse(words, parse_state)?; if words.is_empty() { @@ -1067,7 +1067,7 @@ pub(crate) fn generate( } } }; - let body64 = quote!{ + let body64 = quote! { IdState::Value(IdStateValue(BitWidth::Width64)) => { let (target, words) = Vec::::spirv_parse(words, parse_state)?; if words.is_empty() { @@ -1081,7 +1081,7 @@ pub(crate) fn generate( } } }; - instruction_parse_case = quote!{ + instruction_parse_case = quote! { #opcode => { let (selector, words) = IdRef::spirv_parse(words, parse_state)?; let (default, words) = IdRef::spirv_parse(words, parse_state)?; @@ -1092,7 +1092,7 @@ pub(crate) fn generate( } } }; - instruction_display_case = quote!{ + instruction_display_case = quote! { Instruction::Switch32 { selector, default, @@ -1128,11 +1128,11 @@ pub(crate) fn generate( }; } ast::InstructionName::OpSwitch64 => { - instruction_parse_case = quote!{}; - instruction_display_case = quote!{}; + instruction_parse_case = quote! {}; + instruction_display_case = quote! {}; } ast::InstructionName::OpConstant32 => { - let body32 = quote!{ + let body32 = quote! { IdStateType(BitWidth::Width32OrLess) => { let (value, words) = LiteralContextDependentNumber32::spirv_parse(words, parse_state)?; if words.is_empty() { @@ -1146,7 +1146,7 @@ pub(crate) fn generate( } } }; - let body64 = quote!{ + let body64 = quote! { IdStateType(BitWidth::Width64) => { let (value, words) = LiteralContextDependentNumber64::spirv_parse(words, parse_state)?; if words.is_empty() { @@ -1160,7 +1160,7 @@ pub(crate) fn generate( } } }; - instruction_parse_case = quote!{ + instruction_parse_case = quote! { #opcode => { let (id_result_type, words) = IdResultType::spirv_parse(words, parse_state)?; let (id_result, words) = IdResult::spirv_parse(words, parse_state)?; @@ -1171,7 +1171,7 @@ pub(crate) fn generate( } } }; - instruction_display_case = quote!{ + instruction_display_case = quote! { Instruction::Constant32 { id_result_type, id_result, @@ -1203,11 +1203,11 @@ pub(crate) fn generate( }; } ast::InstructionName::OpConstant64 => { - instruction_parse_case = quote!{}; - instruction_display_case = quote!{}; + instruction_parse_case = quote! {}; + instruction_display_case = quote! {}; } ast::InstructionName::OpSpecConstant32 => { - let body32 = quote!{ + let body32 = quote! { IdStateType(BitWidth::Width32OrLess) => { let (value, words) = LiteralContextDependentNumber32::spirv_parse(words, parse_state)?; if words.is_empty() { @@ -1221,7 +1221,7 @@ pub(crate) fn generate( } } }; - let body64 = quote!{ + let body64 = quote! { IdStateType(BitWidth::Width64) => { let (value, words) = LiteralContextDependentNumber64::spirv_parse(words, parse_state)?; if words.is_empty() { @@ -1235,7 +1235,7 @@ pub(crate) fn generate( } } }; - instruction_parse_case = quote!{ + instruction_parse_case = quote! { #opcode => { let (id_result_type, words) = IdResultType::spirv_parse(words, parse_state)?; let (id_result, words) = IdResult::spirv_parse(words, parse_state)?; @@ -1246,7 +1246,7 @@ pub(crate) fn generate( } } }; - instruction_display_case = quote!{ + instruction_display_case = quote! { Instruction::SpecConstant32 { id_result_type, id_result, @@ -1278,11 +1278,11 @@ pub(crate) fn generate( }; } ast::InstructionName::OpSpecConstant64 => { - instruction_parse_case = quote!{}; - instruction_display_case = quote!{}; + instruction_parse_case = quote! {}; + instruction_display_case = quote! {}; } ast::InstructionName::OpSpecConstantOp => { - instruction_parse_case = quote!{#opcode => { + instruction_parse_case = quote! {#opcode => { let (operation, words) = OpSpecConstantOp::spirv_parse(words, parse_state)?; if words.is_empty() { Ok(Instruction::#opname { operation }) @@ -1290,7 +1290,7 @@ pub(crate) fn generate( Err(Error::InstructionTooLong) } }}; - instruction_display_case = quote!{ + instruction_display_case = quote! { Instruction::#opname { operation } => fmt::Display::fmt(operation, f), }; } @@ -1303,11 +1303,11 @@ pub(crate) fn generate( let kind = new_id(&operand.kind, CamelCase); let name = new_id(operand.name.as_ref().unwrap(), SnakeCase); let kind = match operand.quantifier { - None => quote!{#kind}, - Some(ast::Quantifier::Optional) => quote!{Option::<#kind>}, - Some(ast::Quantifier::Variadic) => quote!{Vec::<#kind>}, + None => quote! {#kind}, + Some(ast::Quantifier::Optional) => quote! {Option::<#kind>}, + Some(ast::Quantifier::Variadic) => quote! {Vec::<#kind>}, }; - parse_operations.push(quote!{ + parse_operations.push(quote! { let (#name, words) = #kind::spirv_parse(words, parse_state)?; }); operand_names.push(name.clone()); @@ -1315,7 +1315,7 @@ pub(crate) fn generate( assert_eq!(result_name, None); result_name = Some(name); } else { - display_operations.push(quote!{ + display_operations.push(quote! { #name.spirv_display(f)?; }); } @@ -1326,13 +1326,13 @@ pub(crate) fn generate( { let operand1_name = new_id(operand1.name.as_ref().unwrap(), SnakeCase); let operand2_name = new_id(operand2.name.as_ref().unwrap(), SnakeCase); - parse_operations.push(quote!{ + parse_operations.push(quote! { parse_state.define_value(#operand1_name, #operand2_name)?; }); } } let operand_names = &operand_names; - instruction_parse_case = quote!{#opcode => { + instruction_parse_case = quote! {#opcode => { #(#parse_operations)* if words.is_empty() { Ok(Instruction::#opname { @@ -1343,10 +1343,10 @@ pub(crate) fn generate( } }}; let result_value = match result_name { - None => quote!{None}, - Some(result_name) => quote!{Some(*#result_name)}, + None => quote! {None}, + Some(result_name) => quote! {Some(*#result_name)}, }; - instruction_display_case = quote!{ + instruction_display_case = quote! { Instruction::#opname { #(#operand_names,)* } => { write!(f, "{}{}", InstructionIndentAndResult(#result_value), #display_opname)?; #(#display_operations)* @@ -1359,26 +1359,26 @@ pub(crate) fn generate( instruction_display_cases.push(instruction_display_case); let instruction_enumerant = if instruction.opname == ast::InstructionName::OpSpecConstantOp { - quote!{ + quote! { #opname { operation: OpSpecConstantOp, } } } else if instruction.operands.is_empty() { - quote!{#opname} + quote! {#opname} } else { let mut fields = Vec::new(); for operand in instruction.operands.iter() { let kind = new_id(&operand.kind, CamelCase); let name = new_id(operand.name.as_ref().unwrap(), SnakeCase); let kind = match &operand.quantifier { - None => quote!{#kind}, - Some(ast::Quantifier::Optional) => quote!{Option<#kind>}, - Some(ast::Quantifier::Variadic) => quote!{Vec<#kind>}, + None => quote! {#kind}, + Some(ast::Quantifier::Optional) => quote! {Option<#kind>}, + Some(ast::Quantifier::Variadic) => quote! {Vec<#kind>}, }; - fields.push(quote!{#name: #kind}); + fields.push(quote! {#name: #kind}); } - quote!{ + quote! { #opname { #(#fields,)* } @@ -1396,14 +1396,14 @@ pub(crate) fn generate( let kind = new_id(&operand.kind, CamelCase); let name = new_id(operand.name.as_ref().unwrap(), SnakeCase); let kind = match operand.quantifier { - None => quote!{#kind}, - Some(ast::Quantifier::Optional) => quote!{Option::<#kind>}, - Some(ast::Quantifier::Variadic) => quote!{Vec::<#kind>}, + None => quote! {#kind}, + Some(ast::Quantifier::Optional) => quote! {Option::<#kind>}, + Some(ast::Quantifier::Variadic) => quote! {Vec::<#kind>}, }; - parse_operations.push(quote!{ + parse_operations.push(quote! { let (#name, words) = #kind::spirv_parse(words, parse_state)?; }); - display_operations.push(quote!{ + display_operations.push(quote! { #name.spirv_display(f)?; }); operand_names.push(name); @@ -1413,7 +1413,7 @@ pub(crate) fn generate( assert_eq!(operand2.kind, ast::Kind::IdResult); let operand1_name = new_id(operand1.name.as_ref().unwrap(), SnakeCase); let operand2_name = new_id(operand2.name.as_ref().unwrap(), SnakeCase); - parse_operations.push(quote!{ + parse_operations.push(quote! { parse_state.define_value(#operand1_name, #operand2_name)?; }); } else { @@ -1423,7 +1423,7 @@ pub(crate) fn generate( ); } let operand_names = &operand_names; - instruction_spec_constant_parse_cases.push(quote!{#opcode => { + instruction_spec_constant_parse_cases.push(quote! {#opcode => { #(#parse_operations)* if words.is_empty() { Ok((OpSpecConstantOp::#opname { @@ -1450,7 +1450,7 @@ pub(crate) fn generate( writeln!( &mut out, "{}", - quote!{ + quote! { #[derive(Clone, Debug)] pub enum OpSpecConstantOp { #(#spec_constant_op_instruction_enumerants,)* @@ -1460,7 +1460,7 @@ pub(crate) fn generate( writeln!( &mut out, "{}", - quote!{ + quote! { impl fmt::Display for OpSpecConstantOp { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { @@ -1473,7 +1473,7 @@ pub(crate) fn generate( writeln!( &mut out, "{}", - quote!{ + quote! { #[derive(Clone, Debug)] pub enum Instruction { #(#instruction_enumerants,)* @@ -1724,7 +1724,7 @@ pub(crate) fn generate( writeln!( &mut out, "{}", - quote!{ + quote! { fn parse_instruction(opcode: u16, words: &[u32], parse_state: &mut ParseState) -> Result { match opcode { #(#instruction_parse_cases)* @@ -1736,7 +1736,7 @@ pub(crate) fn generate( writeln!( &mut out, "{}", - quote!{ + quote! { impl fmt::Display for Instruction { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { @@ -1747,7 +1747,7 @@ pub(crate) fn generate( } } )?; - let body = quote!{ + let body = quote! { let (id_result_type, words) = IdResultType::spirv_parse(words, parse_state)?; let (id_result, words) = IdResult::spirv_parse(words, parse_state)?; let (opcode, words) = u32::spirv_parse(words, parse_state)?; @@ -1759,7 +1759,7 @@ pub(crate) fn generate( writeln!( &mut out, "{}", - quote!{ + quote! { impl SPIRVParse for OpSpecConstantOp { fn spirv_parse<'a>( words: &'a [u32], @@ -1802,7 +1802,7 @@ pub(crate) fn generate( writeln!( &mut out, "{}", - quote!{ + quote! { pub const #version_name: u32 = #version; pub const #revision_name: u32 = #revision; } @@ -1811,7 +1811,7 @@ pub(crate) fn generate( writeln!( &mut out, "{}", - quote!{ + quote! { #[derive(Clone, Eq, PartialEq, Hash, Debug)] pub enum ExtensionInstructionSet { #(#extension_instruction_set_enumerants,)* @@ -1822,7 +1822,7 @@ pub(crate) fn generate( writeln!( &mut out, "{}", - quote!{ + quote! { impl<'a> From> for ExtensionInstructionSet { fn from(s: Cow<'a, str>) -> ExtensionInstructionSet { match s.as_ref() { @@ -1837,7 +1837,7 @@ pub(crate) fn generate( writeln!( &mut out, "{}", - quote!{ + quote! { impl Deref for ExtensionInstructionSet { type Target = str; fn deref(&self) -> &str { diff --git a/vulkan-driver/src/api_impl.rs b/vulkan-driver/src/api_impl.rs index 8068c34..6a4929e 100644 --- a/vulkan-driver/src/api_impl.rs +++ b/vulkan-driver/src/api_impl.rs @@ -143,7 +143,7 @@ impl Extension { } pub fn get_recursively_required_extensions(self) -> Extensions { let mut retval = self.get_required_extensions(); - let mut worklist: EnumMap = enum_map!{_ => self}; + let mut worklist: EnumMap = enum_map! {_ => self}; let worklist = worklist.as_mut_slice(); let mut worklist_size = 1; while worklist_size > 0 { @@ -306,7 +306,7 @@ pub struct Extensions(EnumMap); impl Extensions { pub fn create_empty() -> Self { - Extensions(enum_map!{_ => false}) + Extensions(enum_map! {_ => false}) } pub fn is_empty(&self) -> bool { self.iter().all(|(_, &v)| !v) @@ -1310,7 +1310,7 @@ impl Device { physical_device: SharedHandle, create_info: *const api::VkDeviceCreateInfo, ) -> Result, api::VkResult> { - parse_next_chain_const!{ + parse_next_chain_const! { create_info, root = api::VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, device_group_device_create_info: api::VkDeviceGroupDeviceCreateInfo = api::VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO, @@ -1413,7 +1413,7 @@ impl Device { let mut total_queue_count = 0; let mut queue_counts: Vec<_> = Vec::new(); for queue_create_info in queue_create_infos { - parse_next_chain_const!{ + parse_next_chain_const! { queue_create_info, root = api::VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, } @@ -2928,7 +2928,7 @@ impl Instance { pub unsafe fn new( create_info: *const api::VkInstanceCreateInfo, ) -> Result { - parse_next_chain_const!{ + parse_next_chain_const! { create_info, root = api::VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, } @@ -3233,7 +3233,7 @@ unsafe fn get_physical_device_queue_family_properties( queue_family_properties: &mut api::VkQueueFamilyProperties2, queue_count: u32, ) { - parse_next_chain_mut!{ + parse_next_chain_mut! { queue_family_properties, root = api::VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2, } @@ -3424,7 +3424,7 @@ pub unsafe extern "system" fn vkAllocateMemory( _allocator: *const api::VkAllocationCallbacks, memory: *mut api::VkDeviceMemory, ) -> api::VkResult { - parse_next_chain_const!{ + parse_next_chain_const! { allocate_info, root = api::VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, export_memory_allocate_info: api::VkExportMemoryAllocateInfo = api::VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO, @@ -3785,7 +3785,7 @@ pub unsafe extern "system" fn vkCreateBuffer( _allocator: *const api::VkAllocationCallbacks, buffer: *mut api::VkBuffer, ) -> api::VkResult { - parse_next_chain_const!{ + parse_next_chain_const! { create_info, root = api::VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, external_memory_buffer: api::VkExternalMemoryBufferCreateInfo = api::VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO, @@ -3841,7 +3841,7 @@ pub unsafe extern "system" fn vkCreateImage( _allocator: *const api::VkAllocationCallbacks, image: *mut api::VkImage, ) -> api::VkResult { - parse_next_chain_const!{ + parse_next_chain_const! { create_info, root = api::VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, external_memory_image_create_info: api::VkExternalMemoryImageCreateInfo = api::VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO, @@ -3904,7 +3904,7 @@ pub unsafe extern "system" fn vkCreateImageView( _allocator: *const api::VkAllocationCallbacks, view: *mut api::VkImageView, ) -> api::VkResult { - parse_next_chain_const!{ + parse_next_chain_const! { create_info, root = api::VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, } @@ -3936,7 +3936,7 @@ pub unsafe extern "system" fn vkCreateShaderModule( _allocator: *const api::VkAllocationCallbacks, shader_module: *mut api::VkShaderModule, ) -> api::VkResult { - parse_next_chain_const!{ + parse_next_chain_const! { create_info, root = api::VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO, } @@ -4051,7 +4051,7 @@ pub unsafe extern "system" fn vkCreatePipelineLayout( _allocator: *const api::VkAllocationCallbacks, pipeline_layout: *mut api::VkPipelineLayout, ) -> api::VkResult { - parse_next_chain_const!{ + parse_next_chain_const! { create_info, root = api::VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, } @@ -4155,7 +4155,7 @@ pub unsafe extern "system" fn vkCreateSampler( _allocator: *const api::VkAllocationCallbacks, sampler: *mut api::VkSampler, ) -> api::VkResult { - parse_next_chain_const!{ + parse_next_chain_const! { create_info, root = api::VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO, } @@ -4208,7 +4208,7 @@ pub unsafe extern "system" fn vkCreateDescriptorSetLayout( _allocator: *const api::VkAllocationCallbacks, set_layout: *mut api::VkDescriptorSetLayout, ) -> api::VkResult { - parse_next_chain_const!{ + parse_next_chain_const! { create_info, root = api::VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO, } @@ -4248,7 +4248,7 @@ pub unsafe extern "system" fn vkCreateDescriptorPool( _allocator: *const api::VkAllocationCallbacks, descriptor_pool: *mut api::VkDescriptorPool, ) -> api::VkResult { - parse_next_chain_const!{ + parse_next_chain_const! { create_info, root = api::VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO, } @@ -4281,7 +4281,7 @@ pub unsafe extern "system" fn vkAllocateDescriptorSets( allocate_info: *const api::VkDescriptorSetAllocateInfo, descriptor_sets: *mut api::VkDescriptorSet, ) -> api::VkResult { - parse_next_chain_const!{ + parse_next_chain_const! { allocate_info, root = api::VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO, } @@ -4333,7 +4333,7 @@ pub unsafe extern "system" fn vkUpdateDescriptorSets( let descriptor_writes = util::to_slice(descriptor_writes, descriptor_write_count as usize); let descriptor_copies = util::to_slice(descriptor_copies, descriptor_copy_count as usize); for descriptor_write in descriptor_writes { - parse_next_chain_const!{ + parse_next_chain_const! { descriptor_write, root = api::VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, } @@ -4358,7 +4358,7 @@ pub unsafe extern "system" fn vkUpdateDescriptorSets( } } for descriptor_copy in descriptor_copies { - parse_next_chain_const!{ + parse_next_chain_const! { descriptor_copy, root = api::VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET, } @@ -4392,7 +4392,7 @@ pub unsafe extern "system" fn vkCreateRenderPass( _allocator: *const api::VkAllocationCallbacks, render_pass: *mut api::VkRenderPass, ) -> api::VkResult { - parse_next_chain_const!{ + parse_next_chain_const! { create_info, root = api::VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, } @@ -4967,7 +4967,7 @@ pub unsafe extern "system" fn vkBindBufferMemory2( assert_ne!(bind_info_count, 0); let bind_infos = util::to_slice(bind_infos, bind_info_count as usize); for bind_info in bind_infos { - parse_next_chain_const!{ + parse_next_chain_const! { bind_info, root = api::VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO, device_group_info: api::VkBindBufferMemoryDeviceGroupInfo = api::VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO, @@ -5005,7 +5005,7 @@ pub unsafe extern "system" fn vkBindImageMemory2( assert_ne!(bind_info_count, 0); let bind_infos = util::to_slice(bind_infos, bind_info_count as usize); for bind_info in bind_infos { - parse_next_chain_const!{ + parse_next_chain_const! { bind_info, root = api::VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO, device_group_info: api::VkBindImageMemoryDeviceGroupInfo = api::VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO, @@ -5086,7 +5086,7 @@ pub unsafe extern "system" fn vkEnumeratePhysicalDeviceGroups( physical_device_group_properties, iter::once(()), |physical_device_group_properties, _| { - parse_next_chain_mut!{ + parse_next_chain_mut! { physical_device_group_properties, root = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES, } @@ -5113,12 +5113,12 @@ pub unsafe extern "system" fn vkGetImageMemoryRequirements2( memory_requirements: *mut api::VkMemoryRequirements2, ) { #![cfg_attr(feature = "cargo-clippy", allow(clippy::needless_update))] - parse_next_chain_const!{ + parse_next_chain_const! { info, root = api::VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2, image_plane_memory_requirements_info: api::VkImagePlaneMemoryRequirementsInfo = api::VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO, } - parse_next_chain_mut!{ + parse_next_chain_mut! { memory_requirements, root = api::VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2, dedicated_requirements: api::VkMemoryDedicatedRequirements = api::VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS, @@ -5150,11 +5150,11 @@ pub unsafe extern "system" fn vkGetBufferMemoryRequirements2( memory_requirements: *mut api::VkMemoryRequirements2, ) { #![cfg_attr(feature = "cargo-clippy", allow(clippy::needless_update))] - parse_next_chain_const!{ + parse_next_chain_const! { info, root = api::VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2, } - parse_next_chain_mut!{ + parse_next_chain_mut! { memory_requirements, root = api::VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2, dedicated_requirements: api::VkMemoryDedicatedRequirements = api::VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS, @@ -5191,7 +5191,7 @@ pub unsafe extern "system" fn vkGetPhysicalDeviceFeatures2( physical_device: api::VkPhysicalDevice, features: *mut api::VkPhysicalDeviceFeatures2, ) { - parse_next_chain_mut!{ + parse_next_chain_mut! { features, root = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, sampler_ycbcr_conversion_features: api::VkPhysicalDeviceSamplerYcbcrConversionFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES, @@ -5240,7 +5240,7 @@ pub unsafe extern "system" fn vkGetPhysicalDeviceProperties2( physical_device: api::VkPhysicalDevice, properties: *mut api::VkPhysicalDeviceProperties2, ) { - parse_next_chain_mut!{ + parse_next_chain_mut! { properties, root = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, point_clipping_properties: api::VkPhysicalDevicePointClippingProperties = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES, @@ -5309,7 +5309,7 @@ pub unsafe extern "system" fn vkGetPhysicalDeviceFormatProperties2( format: api::VkFormat, format_properties: *mut api::VkFormatProperties2, ) { - parse_next_chain_mut!{ + parse_next_chain_mut! { format_properties, root = api::VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2, } @@ -5353,7 +5353,7 @@ pub unsafe extern "system" fn vkGetPhysicalDeviceMemoryProperties2( ) { #![cfg_attr(feature = "cargo-clippy", allow(clippy::needless_update))] let physical_device = SharedHandle::from(physical_device).unwrap(); - parse_next_chain_mut!{ + parse_next_chain_mut! { memory_properties, root = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2, } @@ -5404,7 +5404,7 @@ pub unsafe extern "system" fn vkGetDeviceQueue2( queue_info: *const api::VkDeviceQueueInfo2, queue: *mut api::VkQueue, ) { - parse_next_chain_const!{ + parse_next_chain_const! { queue_info, root = api::VK_STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2, } @@ -5604,7 +5604,7 @@ pub unsafe extern "system" fn vkCreateSwapchainKHR( _allocator: *const api::VkAllocationCallbacks, swapchain: *mut api::VkSwapchainKHR, ) -> api::VkResult { - parse_next_chain_const!{ + parse_next_chain_const! { create_info, root = api::VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR, device_group_swapchain_create_info: api::VkDeviceGroupSwapchainCreateInfoKHR = api::VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHR, @@ -5932,12 +5932,12 @@ pub unsafe extern "system" fn vkGetPhysicalDeviceSurfaceCapabilities2KHR( surface_info: *const api::VkPhysicalDeviceSurfaceInfo2KHR, surface_capabilities: *mut api::VkSurfaceCapabilities2KHR, ) -> api::VkResult { - parse_next_chain_const!{ + parse_next_chain_const! { surface_info, root = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR, } let surface_info = &*surface_info; - parse_next_chain_mut!{ + parse_next_chain_mut! { surface_capabilities, root = api::VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR, } @@ -6592,7 +6592,7 @@ pub unsafe extern "system" fn vkCreateXcbSurfaceKHR( _allocator: *const api::VkAllocationCallbacks, surface: *mut api::VkSurfaceKHR, ) -> api::VkResult { - parse_next_chain_const!{ + parse_next_chain_const! { create_info, root = api::VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR, } diff --git a/vulkan-driver/src/device_memory.rs b/vulkan-driver/src/device_memory.rs index 4388649..89816e8 100644 --- a/vulkan-driver/src/device_memory.rs +++ b/vulkan-driver/src/device_memory.rs @@ -47,7 +47,7 @@ pub struct DeviceMemoryTypes(EnumMap); impl Default for DeviceMemoryTypes { fn default() -> Self { - DeviceMemoryTypes(enum_map!{_ => false}) + DeviceMemoryTypes(enum_map! {_ => false}) } } @@ -121,7 +121,7 @@ pub struct DeviceMemoryHeaps(EnumMap); impl Default for DeviceMemoryHeaps { fn default() -> Self { - DeviceMemoryHeaps(enum_map!{_ => false}) + DeviceMemoryHeaps(enum_map! {_ => false}) } } diff --git a/vulkan-driver/src/pipeline.rs b/vulkan-driver/src/pipeline.rs index 279dc11..2bd6604 100644 --- a/vulkan-driver/src/pipeline.rs +++ b/vulkan-driver/src/pipeline.rs @@ -126,14 +126,14 @@ impl GenericPipelineSized for ComputePipeline { _pipeline_cache: Option>, create_info: &api::VkComputePipelineCreateInfo, ) -> Self { - parse_next_chain_const!{ + parse_next_chain_const! { create_info, root = api::VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, } if (create_info.flags & api::VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT) != 0 { unimplemented!(); } - get_shader_stages!{ + get_shader_stages! { iter::once(&create_info.stage), compute_stage = VK_SHADER_STAGE_COMPUTE_BIT, } @@ -169,11 +169,11 @@ impl GenericPipelineSized for GraphicsPipeline { _pipeline_cache: Option>, create_info: &api::VkGraphicsPipelineCreateInfo, ) -> Self { - parse_next_chain_const!{ + parse_next_chain_const! { create_info, root = api::VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO, } - get_shader_stages!{ + get_shader_stages! { util::to_slice(create_info.pStages, create_info.stageCount as usize), vertex_stage = VK_SHADER_STAGE_VERTEX_BIT, #[optional] diff --git a/vulkan-driver/src/xcb_swapchain.rs b/vulkan-driver/src/xcb_swapchain.rs index 7aad162..d2f60fd 100644 --- a/vulkan-driver/src/xcb_swapchain.rs +++ b/vulkan-driver/src/xcb_swapchain.rs @@ -50,8 +50,10 @@ impl Drop for ReplyObject { struct ServerObject { id: Id, connection: *mut xcb::ffi::xcb_connection_t, - free_fn: unsafe extern "C" fn(connection: *mut xcb::ffi::xcb_connection_t, id: Id) - -> xcb::ffi::xcb_void_cookie_t, + free_fn: unsafe extern "C" fn( + connection: *mut xcb::ffi::xcb_connection_t, + id: Id, + ) -> xcb::ffi::xcb_void_cookie_t, } impl ServerObject { -- 2.30.2