From 588f91dc593568f999c64b9a2d211edba424bbe2 Mon Sep 17 00:00:00 2001 From: Austin Johnson Date: Sat, 4 Sep 2021 01:41:17 -0500 Subject: [PATCH] fix warnings/errors (#1692) --- examples/src/bin/immutable-sampler/main.rs | 3 ++- vulkano-win/src/winit.rs | 2 -- vulkano/src/buffer/device_local.rs | 14 ++++++++++++-- vulkano/src/sync/semaphore/semaphore.rs | 10 ++++++---- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/examples/src/bin/immutable-sampler/main.rs b/examples/src/bin/immutable-sampler/main.rs index 9652d8f2..0088fd60 100644 --- a/examples/src/bin/immutable-sampler/main.rs +++ b/examples/src/bin/immutable-sampler/main.rs @@ -160,7 +160,8 @@ fn main() { let png_bytes = include_bytes!("image_img.png").to_vec(); let cursor = Cursor::new(png_bytes); let decoder = png::Decoder::new(cursor); - let (info, mut reader) = decoder.read_info().unwrap(); + let mut reader = decoder.read_info().unwrap(); + let info = reader.info(); let dimensions = ImageDimensions::Dim2d { width: info.width, height: info.height, diff --git a/vulkano-win/src/winit.rs b/vulkano-win/src/winit.rs index 2223b304..e108381f 100644 --- a/vulkano-win/src/winit.rs +++ b/vulkano-win/src/winit.rs @@ -1,8 +1,6 @@ use std::borrow::Borrow; use std::error; use std::fmt; -#[cfg(target_os = "windows")] -use std::ptr; use std::rc::Rc; use std::sync::Arc; diff --git a/vulkano/src/buffer/device_local.rs b/vulkano/src/buffer/device_local.rs index d57d6721..c95f2b55 100644 --- a/vulkano/src/buffer/device_local.rs +++ b/vulkano/src/buffer/device_local.rs @@ -31,18 +31,28 @@ use crate::memory::pool::MemoryPoolAlloc; use crate::memory::pool::PotentialDedicatedAllocation; use crate::memory::pool::StdMemoryPoolAlloc; use crate::memory::{DedicatedAlloc, MemoryRequirements}; -use crate::memory::{DeviceMemoryAllocError, ExternalMemoryHandleType}; +use crate::memory::DeviceMemoryAllocError; use crate::sync::AccessError; use crate::sync::Sharing; use crate::DeviceSize; use smallvec::SmallVec; -use std::fs::File; use std::hash::Hash; use std::hash::Hasher; use std::marker::PhantomData; use std::mem; use std::sync::Arc; use std::sync::Mutex; +#[cfg(any( + target_os = "linux", + target_os = "dragonflybsd", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd" +))] +use { + crate::memory::ExternalMemoryHandleType, + std::fs::File +}; /// Buffer whose content is in device-local memory. /// diff --git a/vulkano/src/sync/semaphore/semaphore.rs b/vulkano/src/sync/semaphore/semaphore.rs index 21374312..2f7d6529 100644 --- a/vulkano/src/sync/semaphore/semaphore.rs +++ b/vulkano/src/sync/semaphore/semaphore.rs @@ -304,11 +304,8 @@ impl From for SemaphoreError { #[cfg(test)] mod tests { - use crate::device::physical::PhysicalDevice; - use crate::device::{Device, DeviceExtensions}; - use crate::instance::{Instance, InstanceExtensions}; use crate::VulkanObject; - use crate::{sync::Semaphore, Version}; + use crate::sync::Semaphore; #[test] fn semaphore_create() { @@ -342,6 +339,11 @@ mod tests { target_os = "openbsd" ))] fn semaphore_export() { + use crate::device::physical::PhysicalDevice; + use crate::device::{Device, DeviceExtensions}; + use crate::instance::{Instance, InstanceExtensions}; + use crate::Version; + let supported_ext = InstanceExtensions::supported_by_core().unwrap(); if supported_ext.khr_get_display_properties2 && supported_ext.khr_external_semaphore_capabilities