mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-25 08:14:20 +00:00
parent
6bee63404f
commit
f78e06fc6e
@ -41,7 +41,7 @@ fn include_callback(
|
|||||||
include_directories: &[impl AsRef<Path>],
|
include_directories: &[impl AsRef<Path>],
|
||||||
root_source_has_path: bool,
|
root_source_has_path: bool,
|
||||||
base_path: &impl AsRef<Path>,
|
base_path: &impl AsRef<Path>,
|
||||||
mut includes_tracker: RefMut<Vec<String>>,
|
mut includes_tracker: RefMut<'_, Vec<String>>,
|
||||||
) -> Result<ResolvedInclude, String> {
|
) -> Result<ResolvedInclude, String> {
|
||||||
let file_to_include = match directive_type {
|
let file_to_include = match directive_type {
|
||||||
IncludeType::Relative => {
|
IncludeType::Relative => {
|
||||||
|
@ -217,12 +217,12 @@
|
|||||||
|
|
||||||
#![doc(html_logo_url = "https://raw.githubusercontent.com/vulkano-rs/vulkano/master/logo.png")]
|
#![doc(html_logo_url = "https://raw.githubusercontent.com/vulkano-rs/vulkano/master/logo.png")]
|
||||||
#![recursion_limit = "1024"]
|
#![recursion_limit = "1024"]
|
||||||
|
#![warn(rust_2018_idioms, rust_2021_compatibility)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate quote;
|
extern crate quote;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate syn;
|
extern crate syn;
|
||||||
extern crate proc_macro;
|
|
||||||
|
|
||||||
use crate::codegen::ShaderKind;
|
use crate::codegen::ShaderKind;
|
||||||
use shaderc::{EnvVersion, SpirvVersion};
|
use shaderc::{EnvVersion, SpirvVersion};
|
||||||
@ -367,7 +367,7 @@ struct MacroInput {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Parse for MacroInput {
|
impl Parse for MacroInput {
|
||||||
fn parse(input: ParseStream) -> Result<Self> {
|
fn parse(input: ParseStream<'_>) -> Result<Self> {
|
||||||
let mut dump = None;
|
let mut dump = None;
|
||||||
let mut exact_entrypoint_interface = None;
|
let mut exact_entrypoint_interface = None;
|
||||||
let mut include_directories = Vec::new();
|
let mut include_directories = Vec::new();
|
||||||
@ -381,7 +381,7 @@ impl Parse for MacroInput {
|
|||||||
fn parse_shader_fields<'k>(
|
fn parse_shader_fields<'k>(
|
||||||
output: &mut (Option<ShaderKind>, Option<SourceKind>),
|
output: &mut (Option<ShaderKind>, Option<SourceKind>),
|
||||||
name: &'k str,
|
name: &'k str,
|
||||||
input: ParseStream,
|
input: ParseStream<'_>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
match name {
|
match name {
|
||||||
"ty" => {
|
"ty" => {
|
||||||
|
@ -286,7 +286,7 @@ fn write_impls<'a>(
|
|||||||
|
|
||||||
quote! {
|
quote! {
|
||||||
impl std::fmt::Debug for #struct_ident {
|
impl std::fmt::Debug for #struct_ident {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
|
||||||
f
|
f
|
||||||
.debug_struct(#struct_name)
|
.debug_struct(#struct_name)
|
||||||
#( #fields )*
|
#( #fields )*
|
||||||
@ -306,7 +306,7 @@ fn write_impls<'a>(
|
|||||||
|
|
||||||
quote! {
|
quote! {
|
||||||
impl std::fmt::Display for #struct_ident {
|
impl std::fmt::Display for #struct_ident {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
|
||||||
f
|
f
|
||||||
.debug_struct(#struct_name)
|
.debug_struct(#struct_name)
|
||||||
#( #fields )*
|
#( #fields )*
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
// according to those terms.
|
// according to those terms.
|
||||||
|
|
||||||
#![allow(clippy::missing_safety_doc)]
|
#![allow(clippy::missing_safety_doc)]
|
||||||
|
#![warn(rust_2018_idioms, rust_2021_compatibility)]
|
||||||
|
|
||||||
pub mod context;
|
pub mod context;
|
||||||
pub mod renderer;
|
pub mod renderer;
|
||||||
|
@ -231,12 +231,12 @@ impl VulkanoWindows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Return iterator over window renderers
|
/// Return iterator over window renderers
|
||||||
pub fn iter(&self) -> Iter<WindowId, VulkanoWindowRenderer> {
|
pub fn iter(&self) -> Iter<'_, WindowId, VulkanoWindowRenderer> {
|
||||||
self.windows.iter()
|
self.windows.iter()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return iterator over mutable window renderers
|
/// Return iterator over mutable window renderers
|
||||||
pub fn iter_mut(&mut self) -> IterMut<WindowId, VulkanoWindowRenderer> {
|
pub fn iter_mut(&mut self) -> IterMut<'_, WindowId, VulkanoWindowRenderer> {
|
||||||
self.windows.iter_mut()
|
self.windows.iter_mut()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#![doc(html_logo_url = "https://raw.githubusercontent.com/vulkano-rs/vulkano/master/logo.png")]
|
#![doc(html_logo_url = "https://raw.githubusercontent.com/vulkano-rs/vulkano/master/logo.png")]
|
||||||
#![allow(clippy::missing_safety_doc)]
|
#![allow(clippy::missing_safety_doc)]
|
||||||
|
#![warn(rust_2018_idioms, rust_2021_compatibility)]
|
||||||
|
|
||||||
/// Create a surface either using winit or a RawWindowHandle
|
/// Create a surface either using winit or a RawWindowHandle
|
||||||
/// Its possible to disable either one using features
|
/// Its possible to disable either one using features
|
||||||
|
@ -88,7 +88,7 @@ impl Error for CreationError {
|
|||||||
|
|
||||||
impl Display for CreationError {
|
impl Display for CreationError {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
|
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
"{}",
|
"{}",
|
||||||
|
@ -509,7 +509,7 @@ fn extensions_common_output(struct_name: Ident, members: &[ExtensionsMember]) ->
|
|||||||
|
|
||||||
impl std::fmt::Debug for #struct_name {
|
impl std::fmt::Debug for #struct_name {
|
||||||
#[allow(unused_assignments)]
|
#[allow(unused_assignments)]
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
|
||||||
write!(f, "[")?;
|
write!(f, "[")?;
|
||||||
|
|
||||||
let mut first = true;
|
let mut first = true;
|
||||||
|
@ -486,7 +486,7 @@ fn features_output(members: &[FeaturesMember]) -> TokenStream {
|
|||||||
|
|
||||||
impl std::fmt::Debug for Features {
|
impl std::fmt::Debug for Features {
|
||||||
#[allow(unused_assignments)]
|
#[allow(unused_assignments)]
|
||||||
fn fmt(&self, f: &mut std::fmt:: Formatter) -> Result<(), std::fmt::Error> {
|
fn fmt(&self, f: &mut std::fmt:: Formatter<'_>) -> Result<(), std::fmt::Error> {
|
||||||
write!(f, "[")?;
|
write!(f, "[")?;
|
||||||
|
|
||||||
let mut first = true;
|
let mut first = true;
|
||||||
|
@ -90,7 +90,7 @@ fn fns_output(extension_members: &[FnsMember], fns_level: &str, doc: &str) -> To
|
|||||||
|
|
||||||
impl std::fmt::Debug for #struct_name {
|
impl std::fmt::Debug for #struct_name {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn fmt(&self, _f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
|
fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ fn instruction_output(members: &[InstructionMember], spec_constant: bool) -> Tok
|
|||||||
|
|
||||||
impl #enum_name {
|
impl #enum_name {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
fn parse(reader: &mut InstructionReader) -> Result<Self, ParseError> {
|
fn parse(reader: &mut InstructionReader<'_>) -> Result<Self, ParseError> {
|
||||||
let opcode = (reader.next_u32()? & 0xffff) as u16;
|
let opcode = (reader.next_u32()? & 0xffff) as u16;
|
||||||
|
|
||||||
Ok(match opcode {
|
Ok(match opcode {
|
||||||
@ -392,7 +392,7 @@ fn bit_enum_output(enums: &[(Ident, Vec<KindEnumMember>)]) -> TokenStream {
|
|||||||
|
|
||||||
impl #name {
|
impl #name {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
fn parse(reader: &mut InstructionReader) -> Result<#name, ParseError> {
|
fn parse(reader: &mut InstructionReader<'_>) -> Result<#name, ParseError> {
|
||||||
let value = reader.next_u32()?;
|
let value = reader.next_u32()?;
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
@ -536,7 +536,7 @@ fn value_enum_output(enums: &[(Ident, Vec<KindEnumMember>)]) -> TokenStream {
|
|||||||
|
|
||||||
impl #name {
|
impl #name {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
fn parse(reader: &mut InstructionReader) -> Result<#name, ParseError> {
|
fn parse(reader: &mut InstructionReader<'_>) -> Result<#name, ParseError> {
|
||||||
Ok(match reader.next_u32()? {
|
Ok(match reader.next_u32()? {
|
||||||
#(#parse_items)*
|
#(#parse_items)*
|
||||||
value => return Err(reader.map_err(ParseErrors::UnknownEnumerant(#name_string, value))),
|
value => return Err(reader.map_err(ParseErrors::UnknownEnumerant(#name_string, value))),
|
||||||
|
@ -431,18 +431,45 @@ impl Default for DebugUtilsLabel {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use crate::{
|
||||||
|
instance::{InstanceCreateInfo, InstanceExtensions},
|
||||||
|
VulkanLibrary,
|
||||||
|
};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn ensure_sendable() {
|
fn ensure_sendable() {
|
||||||
// It's useful to be able to initialize a DebugUtilsMessenger on one thread
|
// It's useful to be able to initialize a DebugUtilsMessenger on one thread
|
||||||
// and keep it alive on another thread.
|
// and keep it alive on another thread.
|
||||||
let instance = instance!();
|
let instance = {
|
||||||
|
let library = match VulkanLibrary::new() {
|
||||||
|
Ok(x) => x,
|
||||||
|
Err(_) => return,
|
||||||
|
};
|
||||||
|
|
||||||
|
match Instance::new(
|
||||||
|
library,
|
||||||
|
InstanceCreateInfo {
|
||||||
|
enabled_extensions: InstanceExtensions {
|
||||||
|
ext_debug_utils: true,
|
||||||
|
..InstanceExtensions::empty()
|
||||||
|
},
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
Ok(x) => x,
|
||||||
|
Err(_) => return,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let callback = unsafe {
|
let callback = unsafe {
|
||||||
DebugUtilsMessenger::new(
|
DebugUtilsMessenger::new(
|
||||||
instance,
|
instance,
|
||||||
DebugUtilsMessengerCreateInfo {
|
DebugUtilsMessengerCreateInfo {
|
||||||
message_severity: DebugUtilsMessageSeverity::empty(),
|
message_severity: DebugUtilsMessageSeverity {
|
||||||
|
error: true,
|
||||||
|
..DebugUtilsMessageSeverity::empty()
|
||||||
|
},
|
||||||
message_type: DebugUtilsMessageType {
|
message_type: DebugUtilsMessageType {
|
||||||
general: true,
|
general: true,
|
||||||
validation: true,
|
validation: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user