From 779ed1023f881ee144cc0bfa7b83c92dc0657759 Mon Sep 17 00:00:00 2001 From: marc0246 <40955683+marc0246@users.noreply.github.com> Date: Fri, 24 Mar 2023 14:04:02 +0100 Subject: [PATCH] Move `impl_id_counter` to the `macros` module (#2158) --- vulkano/src/buffer/sys.rs | 3 +- vulkano/src/buffer/view.rs | 3 +- vulkano/src/command_buffer/pool.rs | 5 +-- vulkano/src/descriptor_set/layout.rs | 4 +-- vulkano/src/descriptor_set/pool.rs | 3 +- vulkano/src/descriptor_set/sys.rs | 3 +- vulkano/src/device/mod.rs | 6 ++-- vulkano/src/device/physical.rs | 4 +-- vulkano/src/image/sys.rs | 3 +- vulkano/src/image/view.rs | 4 +-- vulkano/src/instance/mod.rs | 6 ++-- vulkano/src/lib.rs | 47 -------------------------- vulkano/src/macros.rs | 47 +++++++++++++++++++++++++- vulkano/src/memory/device_memory.rs | 4 +-- vulkano/src/pipeline/compute.rs | 3 +- vulkano/src/pipeline/graphics/mod.rs | 3 +- vulkano/src/pipeline/layout.rs | 3 +- vulkano/src/query.rs | 4 +-- vulkano/src/render_pass/framebuffer.rs | 3 +- vulkano/src/render_pass/mod.rs | 4 +-- vulkano/src/sampler/mod.rs | 4 +-- vulkano/src/sampler/ycbcr.rs | 4 +-- vulkano/src/shader/mod.rs | 4 +-- vulkano/src/swapchain/surface.rs | 4 +-- vulkano/src/swapchain/swapchain.rs | 4 +-- vulkano/src/sync/event.rs | 3 +- vulkano/src/sync/fence.rs | 4 +-- vulkano/src/sync/semaphore.rs | 4 +-- 28 files changed, 101 insertions(+), 92 deletions(-) diff --git a/vulkano/src/buffer/sys.rs b/vulkano/src/buffer/sys.rs index 4821e9ab..93fb6d06 100644 --- a/vulkano/src/buffer/sys.rs +++ b/vulkano/src/buffer/sys.rs @@ -16,6 +16,7 @@ use super::{Buffer, BufferCreateFlags, BufferError, BufferMemory, BufferUsage}; use crate::{ device::{Device, DeviceOwned}, + macros::impl_id_counter, memory::{ allocator::{AllocationType, DeviceLayout, MemoryAlloc}, is_aligned, DedicatedTo, ExternalMemoryHandleTypes, MemoryAllocateFlags, @@ -628,7 +629,7 @@ unsafe impl DeviceOwned for RawBuffer { } } -crate::impl_id_counter!(RawBuffer); +impl_id_counter!(RawBuffer); /// Parameters to create a new [`Buffer`]. #[derive(Clone, Debug)] diff --git a/vulkano/src/buffer/view.rs b/vulkano/src/buffer/view.rs index 4dbed9e7..92723639 100644 --- a/vulkano/src/buffer/view.rs +++ b/vulkano/src/buffer/view.rs @@ -49,6 +49,7 @@ use super::{BufferUsage, Subbuffer}; use crate::{ device::{Device, DeviceOwned}, format::{Format, FormatFeatures}, + macros::impl_id_counter, memory::{is_aligned, DeviceAlignment}, DeviceSize, OomError, RequirementNotMet, RequiresOneOf, Version, VulkanError, VulkanObject, }; @@ -301,7 +302,7 @@ unsafe impl DeviceOwned for BufferView { } } -crate::impl_id_counter!(BufferView); +impl_id_counter!(BufferView); /// Parameters to create a new `BufferView`. #[derive(Clone, Debug)] diff --git a/vulkano/src/command_buffer/pool.rs b/vulkano/src/command_buffer/pool.rs index 362f8ef9..b93e6458 100644 --- a/vulkano/src/command_buffer/pool.rs +++ b/vulkano/src/command_buffer/pool.rs @@ -18,6 +18,7 @@ use crate::{ command_buffer::CommandBufferLevel, device::{Device, DeviceOwned}, + macros::impl_id_counter, OomError, RequiresOneOf, Version, VulkanError, VulkanObject, }; use smallvec::SmallVec; @@ -347,7 +348,7 @@ unsafe impl DeviceOwned for CommandPool { } } -crate::impl_id_counter!(CommandPool); +impl_id_counter!(CommandPool); /// Error that can happen when creating a `CommandPool`. #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -493,7 +494,7 @@ unsafe impl DeviceOwned for CommandPoolAlloc { } } -crate::impl_id_counter!(CommandPoolAlloc); +impl_id_counter!(CommandPoolAlloc); /// Error that can happen when trimming command pools. #[derive(Copy, Clone, Debug, PartialEq, Eq)] diff --git a/vulkano/src/descriptor_set/layout.rs b/vulkano/src/descriptor_set/layout.rs index 479117ee..7000e0a7 100644 --- a/vulkano/src/descriptor_set/layout.rs +++ b/vulkano/src/descriptor_set/layout.rs @@ -13,7 +13,7 @@ use crate::{ device::{Device, DeviceOwned}, - macros::vulkan_enum, + macros::{impl_id_counter, vulkan_enum}, sampler::Sampler, shader::{DescriptorBindingRequirements, ShaderStages}, OomError, RequirementNotMet, RequiresOneOf, Version, VulkanError, VulkanObject, @@ -457,7 +457,7 @@ unsafe impl DeviceOwned for DescriptorSetLayout { } } -crate::impl_id_counter!(DescriptorSetLayout); +impl_id_counter!(DescriptorSetLayout); /// Error related to descriptor set layout. #[derive(Debug, Clone, PartialEq, Eq)] diff --git a/vulkano/src/descriptor_set/pool.rs b/vulkano/src/descriptor_set/pool.rs index 80a96875..708cb6ef 100644 --- a/vulkano/src/descriptor_set/pool.rs +++ b/vulkano/src/descriptor_set/pool.rs @@ -13,6 +13,7 @@ use crate::{ sys::UnsafeDescriptorSet, }, device::{Device, DeviceOwned}, + macros::impl_id_counter, OomError, Version, VulkanError, VulkanObject, }; use ahash::HashMap; @@ -346,7 +347,7 @@ unsafe impl DeviceOwned for DescriptorPool { } } -crate::impl_id_counter!(DescriptorPool); +impl_id_counter!(DescriptorPool); /// Parameters to create a new `UnsafeDescriptorPool`. #[derive(Clone, Debug)] diff --git a/vulkano/src/descriptor_set/sys.rs b/vulkano/src/descriptor_set/sys.rs index bfbd4330..76042df7 100644 --- a/vulkano/src/descriptor_set/sys.rs +++ b/vulkano/src/descriptor_set/sys.rs @@ -15,6 +15,7 @@ use crate::{ update::{DescriptorWriteInfo, WriteDescriptorSet}, }, device::DeviceOwned, + macros::impl_id_counter, VulkanObject, }; use smallvec::SmallVec; @@ -129,4 +130,4 @@ impl Debug for UnsafeDescriptorSet { } } -crate::impl_id_counter!(UnsafeDescriptorSet); +impl_id_counter!(UnsafeDescriptorSet); diff --git a/vulkano/src/device/mod.rs b/vulkano/src/device/mod.rs index 285bb66c..af5354d3 100644 --- a/vulkano/src/device/mod.rs +++ b/vulkano/src/device/mod.rs @@ -114,8 +114,8 @@ pub use crate::{ fns::DeviceFunctions, }; use crate::{ - instance::Instance, memory::ExternalMemoryHandleType, OomError, RequirementNotMet, - RequiresOneOf, Version, VulkanError, VulkanObject, + instance::Instance, macros::impl_id_counter, memory::ExternalMemoryHandleType, OomError, + RequirementNotMet, RequiresOneOf, Version, VulkanError, VulkanObject, }; use ash::vk::Handle; use parking_lot::Mutex; @@ -645,7 +645,7 @@ unsafe impl VulkanObject for Device { } } -crate::impl_id_counter!(Device); +impl_id_counter!(Device); /// Error that can be returned when creating a device. #[derive(Copy, Clone, Debug)] diff --git a/vulkano/src/device/physical.rs b/vulkano/src/device/physical.rs index af7ee1fa..0ae07273 100644 --- a/vulkano/src/device/physical.rs +++ b/vulkano/src/device/physical.rs @@ -18,7 +18,7 @@ use crate::{ SparseImageFormatProperties, }, instance::Instance, - macros::{vulkan_bitflags, vulkan_enum}, + macros::{impl_id_counter, vulkan_bitflags, vulkan_enum}, memory::MemoryProperties, swapchain::{ ColorSpace, FullScreenExclusive, PresentMode, Surface, SurfaceApi, SurfaceCapabilities, @@ -2421,7 +2421,7 @@ unsafe impl VulkanObject for PhysicalDevice { } } -crate::impl_id_counter!(PhysicalDevice); +impl_id_counter!(PhysicalDevice); vulkan_enum! { #[non_exhaustive] diff --git a/vulkano/src/image/sys.rs b/vulkano/src/image/sys.rs index a18d0c22..9af0e6f5 100644 --- a/vulkano/src/image/sys.rs +++ b/vulkano/src/image/sys.rs @@ -27,6 +27,7 @@ use crate::{ view::ImageViewCreationError, ImageFormatInfo, ImageFormatProperties, ImageType, SparseImageFormatProperties, }, + macros::impl_id_counter, memory::{ allocator::{AllocationCreationError, AllocationType, DeviceLayout, MemoryAlloc}, is_aligned, DedicatedTo, DeviceAlignment, ExternalMemoryHandleType, @@ -1877,7 +1878,7 @@ unsafe impl DeviceOwned for RawImage { } } -crate::impl_id_counter!(RawImage); +impl_id_counter!(RawImage); /// Parameters to create a new `Image`. #[derive(Clone, Debug)] diff --git a/vulkano/src/image/view.rs b/vulkano/src/image/view.rs index 718505c6..98ab6ae7 100644 --- a/vulkano/src/image/view.rs +++ b/vulkano/src/image/view.rs @@ -20,7 +20,7 @@ use crate::{ device::{Device, DeviceOwned}, format::{ChromaSampling, Format, FormatFeatures}, image::{ImageAspects, ImageCreateFlags, ImageTiling, ImageType, SampleCount}, - macros::vulkan_enum, + macros::{impl_id_counter, vulkan_enum}, sampler::{ycbcr::SamplerYcbcrConversion, ComponentMapping}, OomError, RequirementNotMet, RequiresOneOf, Version, VulkanError, VulkanObject, }; @@ -797,7 +797,7 @@ where } } -crate::impl_id_counter!(ImageView); +impl_id_counter!(ImageView); /// Parameters to create a new `ImageView`. #[derive(Debug)] diff --git a/vulkano/src/instance/mod.rs b/vulkano/src/instance/mod.rs index ba375ae8..d497af30 100644 --- a/vulkano/src/instance/mod.rs +++ b/vulkano/src/instance/mod.rs @@ -84,8 +84,8 @@ use self::debug::{ }; pub use self::{extensions::InstanceExtensions, layers::LayerProperties}; use crate::{ - device::physical::PhysicalDevice, instance::debug::trampoline, OomError, RequiresOneOf, - VulkanError, VulkanLibrary, VulkanObject, + device::physical::PhysicalDevice, instance::debug::trampoline, macros::impl_id_counter, + OomError, RequiresOneOf, VulkanError, VulkanLibrary, VulkanObject, }; pub use crate::{ extensions::{ExtensionRestriction, ExtensionRestrictionError}, @@ -658,7 +658,7 @@ unsafe impl VulkanObject for Instance { } } -crate::impl_id_counter!(Instance); +impl_id_counter!(Instance); impl Debug for Instance { fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { diff --git a/vulkano/src/lib.rs b/vulkano/src/lib.rs index b3e9d1cb..8d78d1b6 100644 --- a/vulkano/src/lib.rs +++ b/vulkano/src/lib.rs @@ -483,50 +483,3 @@ pub(crate) struct RequirementNotMet { /// syntax from being used. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] // add traits as needed pub struct NonExhaustive(pub(crate) ()); - -macro_rules! impl_id_counter { - ($type:ident $(< $($param:ident $(: $bound:ident $(+ $bounds:ident)* )?),+ >)?) => { - $crate::impl_id_counter!( - @inner $type $(< $($param),+ >)?, $( $($param $(: $bound $(+ $bounds)* )?),+)? - ); - }; - ($type:ident $(< $($param:ident $(: $bound:ident $(+ $bounds:ident)* )? + ?Sized),+ >)?) => { - $crate::impl_id_counter!( - @inner $type $(< $($param),+ >)?, $( $($param $(: $bound $(+ $bounds)* )? + ?Sized),+)? - ); - }; - (@inner $type:ident $(< $($param:ident),+ >)?, $($bounds:tt)*) => { - impl< $($bounds)* > $type $(< $($param),+ >)? { - fn next_id() -> std::num::NonZeroU64 { - use std::{ - num::NonZeroU64, - sync::atomic::{AtomicU64, Ordering}, - }; - - static COUNTER: AtomicU64 = AtomicU64::new(1); - - NonZeroU64::new(COUNTER.fetch_add(1, Ordering::Relaxed)).unwrap_or_else(|| { - println!("an ID counter has overflown ...somehow"); - std::process::abort(); - }) - } - } - - impl< $($bounds)* > PartialEq for $type $(< $($param),+ >)? { - #[inline] - fn eq(&self, other: &Self) -> bool { - self.id == other.id - } - } - - impl< $($bounds)* > Eq for $type $(< $($param),+ >)? {} - - impl< $($bounds)* > std::hash::Hash for $type $(< $($param),+ >)? { - fn hash(&self, state: &mut H) { - self.id.hash(state); - } - } - }; -} - -pub(crate) use impl_id_counter; diff --git a/vulkano/src/macros.rs b/vulkano/src/macros.rs index 1c158cad..ee57133d 100644 --- a/vulkano/src/macros.rs +++ b/vulkano/src/macros.rs @@ -888,6 +888,51 @@ macro_rules! vulkan_bitflags_enum { } } +macro_rules! impl_id_counter { + ($type:ident $(< $($param:ident $(: $bound:ident $(+ $bounds:ident)* )?),+ >)?) => { + $crate::macros::impl_id_counter!( + @inner $type $(< $($param),+ >)?, $( $($param $(: $bound $(+ $bounds)* )?),+)? + ); + }; + ($type:ident $(< $($param:ident $(: $bound:ident $(+ $bounds:ident)* )? + ?Sized),+ >)?) => { + $crate::macros::impl_id_counter!( + @inner $type $(< $($param),+ >)?, $( $($param $(: $bound $(+ $bounds)* )? + ?Sized),+)? + ); + }; + (@inner $type:ident $(< $($param:ident),+ >)?, $($bounds:tt)*) => { + impl< $($bounds)* > $type $(< $($param),+ >)? { + fn next_id() -> std::num::NonZeroU64 { + use std::{ + num::NonZeroU64, + sync::atomic::{AtomicU64, Ordering}, + }; + + static COUNTER: AtomicU64 = AtomicU64::new(1); + + NonZeroU64::new(COUNTER.fetch_add(1, Ordering::Relaxed)).unwrap_or_else(|| { + println!("an ID counter has overflown ...somehow"); + std::process::abort(); + }) + } + } + + impl< $($bounds)* > PartialEq for $type $(< $($param),+ >)? { + #[inline] + fn eq(&self, other: &Self) -> bool { + self.id == other.id + } + } + + impl< $($bounds)* > Eq for $type $(< $($param),+ >)? {} + + impl< $($bounds)* > std::hash::Hash for $type $(< $($param),+ >)? { + fn hash(&self, state: &mut H) { + self.id.hash(state); + } + } + }; +} + // TODO: Replace with the `?` operator once its constness is stabilized. macro_rules! try_opt { ($e:expr) => { @@ -899,4 +944,4 @@ macro_rules! try_opt { }; } -pub(crate) use {try_opt, vulkan_bitflags, vulkan_bitflags_enum, vulkan_enum}; +pub(crate) use {impl_id_counter, try_opt, vulkan_bitflags, vulkan_bitflags_enum, vulkan_enum}; diff --git a/vulkano/src/memory/device_memory.rs b/vulkano/src/memory/device_memory.rs index 1fdf802e..8a0de859 100644 --- a/vulkano/src/memory/device_memory.rs +++ b/vulkano/src/memory/device_memory.rs @@ -10,7 +10,7 @@ use super::{DedicatedAllocation, DedicatedTo, DeviceAlignment}; use crate::{ device::{Device, DeviceOwned}, - macros::{vulkan_bitflags, vulkan_bitflags_enum}, + macros::{impl_id_counter, vulkan_bitflags, vulkan_bitflags_enum}, memory::{is_aligned, MemoryPropertyFlags}, DeviceSize, OomError, RequirementNotMet, RequiresOneOf, Version, VulkanError, VulkanObject, }; @@ -748,7 +748,7 @@ unsafe impl DeviceOwned for DeviceMemory { } } -crate::impl_id_counter!(DeviceMemory); +impl_id_counter!(DeviceMemory); /// Parameters to allocate a new `DeviceMemory`. #[derive(Clone, Debug)] diff --git a/vulkano/src/pipeline/compute.rs b/vulkano/src/pipeline/compute.rs index d48b18a0..5f728fac 100644 --- a/vulkano/src/pipeline/compute.rs +++ b/vulkano/src/pipeline/compute.rs @@ -28,6 +28,7 @@ use crate::{ DescriptorSetLayout, DescriptorSetLayoutCreateInfo, DescriptorSetLayoutCreationError, }, device::{Device, DeviceOwned}, + macros::impl_id_counter, pipeline::{ cache::PipelineCache, layout::{PipelineLayout, PipelineLayoutCreationError, PipelineLayoutSupersetError}, @@ -279,7 +280,7 @@ impl Debug for ComputePipeline { } } -crate::impl_id_counter!(ComputePipeline); +impl_id_counter!(ComputePipeline); unsafe impl VulkanObject for ComputePipeline { type Handle = ash::vk::Pipeline; diff --git a/vulkano/src/pipeline/graphics/mod.rs b/vulkano/src/pipeline/graphics/mod.rs index b5465078..a85e8b51 100644 --- a/vulkano/src/pipeline/graphics/mod.rs +++ b/vulkano/src/pipeline/graphics/mod.rs @@ -67,6 +67,7 @@ use self::{ use super::{DynamicState, Pipeline, PipelineBindPoint, PipelineLayout}; use crate::{ device::{Device, DeviceOwned}, + macros::impl_id_counter, shader::{DescriptorBindingRequirements, FragmentTestsStages, ShaderStage}, VulkanObject, }; @@ -298,4 +299,4 @@ impl Drop for GraphicsPipeline { } } -crate::impl_id_counter!(GraphicsPipeline); +impl_id_counter!(GraphicsPipeline); diff --git a/vulkano/src/pipeline/layout.rs b/vulkano/src/pipeline/layout.rs index c915965f..8fc7bcf6 100644 --- a/vulkano/src/pipeline/layout.rs +++ b/vulkano/src/pipeline/layout.rs @@ -66,6 +66,7 @@ use crate::{ descriptor_set::layout::{DescriptorRequirementsNotMet, DescriptorSetLayout, DescriptorType}, device::{Device, DeviceOwned}, + macros::impl_id_counter, shader::{DescriptorBindingRequirements, ShaderStages}, OomError, RequirementNotMet, RequiresOneOf, VulkanError, VulkanObject, }; @@ -694,7 +695,7 @@ unsafe impl DeviceOwned for PipelineLayout { } } -crate::impl_id_counter!(PipelineLayout); +impl_id_counter!(PipelineLayout); /// Error that can happen when creating a pipeline layout. #[derive(Clone, Debug, PartialEq, Eq)] diff --git a/vulkano/src/query.rs b/vulkano/src/query.rs index 7cb487c5..bb4b8856 100644 --- a/vulkano/src/query.rs +++ b/vulkano/src/query.rs @@ -16,7 +16,7 @@ use crate::{ buffer::BufferContents, device::{Device, DeviceOwned}, - macros::vulkan_bitflags, + macros::{impl_id_counter, vulkan_bitflags}, DeviceSize, OomError, RequirementNotMet, RequiresOneOf, VulkanError, VulkanObject, }; use std::{ @@ -198,7 +198,7 @@ unsafe impl DeviceOwned for QueryPool { } } -crate::impl_id_counter!(QueryPool); +impl_id_counter!(QueryPool); /// Parameters to create a new `QueryPool`. #[derive(Clone, Debug)] diff --git a/vulkano/src/render_pass/framebuffer.rs b/vulkano/src/render_pass/framebuffer.rs index b5a3c14e..83d6a594 100644 --- a/vulkano/src/render_pass/framebuffer.rs +++ b/vulkano/src/render_pass/framebuffer.rs @@ -12,6 +12,7 @@ use crate::{ device::{Device, DeviceOwned}, format::Format, image::{view::ImageViewType, ImageDimensions, ImageUsage, ImageViewAbstract, SampleCount}, + macros::impl_id_counter, OomError, VulkanError, VulkanObject, }; use smallvec::SmallVec; @@ -422,7 +423,7 @@ unsafe impl DeviceOwned for Framebuffer { } } -crate::impl_id_counter!(Framebuffer); +impl_id_counter!(Framebuffer); /// Parameters to create a new `Framebuffer`. #[derive(Clone, Debug)] diff --git a/vulkano/src/render_pass/mod.rs b/vulkano/src/render_pass/mod.rs index 4d477bb4..fc152e24 100644 --- a/vulkano/src/render_pass/mod.rs +++ b/vulkano/src/render_pass/mod.rs @@ -33,7 +33,7 @@ use crate::{ device::{Device, DeviceOwned}, format::Format, image::{ImageAspects, ImageLayout, SampleCount}, - macros::{vulkan_bitflags_enum, vulkan_enum}, + macros::{impl_id_counter, vulkan_bitflags_enum, vulkan_enum}, shader::ShaderInterface, sync::{AccessFlags, DependencyFlags, PipelineStages}, Version, VulkanObject, @@ -544,7 +544,7 @@ unsafe impl DeviceOwned for RenderPass { } } -crate::impl_id_counter!(RenderPass); +impl_id_counter!(RenderPass); /// Represents a subpass within a `RenderPass` object. /// diff --git a/vulkano/src/sampler/mod.rs b/vulkano/src/sampler/mod.rs index 289e65bd..80f26491 100644 --- a/vulkano/src/sampler/mod.rs +++ b/vulkano/src/sampler/mod.rs @@ -51,7 +51,7 @@ use crate::{ device::{Device, DeviceOwned}, format::FormatFeatures, image::{view::ImageViewType, ImageAspects, ImageViewAbstract}, - macros::vulkan_enum, + macros::{impl_id_counter, vulkan_enum}, pipeline::graphics::depth_stencil::CompareOp, shader::ShaderScalarType, OomError, RequirementNotMet, RequiresOneOf, VulkanError, VulkanObject, @@ -779,7 +779,7 @@ unsafe impl DeviceOwned for Sampler { } } -crate::impl_id_counter!(Sampler); +impl_id_counter!(Sampler); /// Error that can happen when creating an instance. #[derive(Clone, Debug, PartialEq)] diff --git a/vulkano/src/sampler/ycbcr.rs b/vulkano/src/sampler/ycbcr.rs index ccf82a08..9d9aaf76 100644 --- a/vulkano/src/sampler/ycbcr.rs +++ b/vulkano/src/sampler/ycbcr.rs @@ -92,7 +92,7 @@ use crate::{ device::{Device, DeviceOwned}, format::{ChromaSampling, Format, FormatFeatures, NumericType}, - macros::vulkan_enum, + macros::{impl_id_counter, vulkan_enum}, sampler::{ComponentMapping, ComponentSwizzle, Filter}, OomError, RequirementNotMet, RequiresOneOf, Version, VulkanError, VulkanObject, }; @@ -509,7 +509,7 @@ unsafe impl DeviceOwned for SamplerYcbcrConversion { } } -crate::impl_id_counter!(SamplerYcbcrConversion); +impl_id_counter!(SamplerYcbcrConversion); /// Error that can happen when creating a `SamplerYcbcrConversion`. #[derive(Clone, Debug, PartialEq, Eq)] diff --git a/vulkano/src/shader/mod.rs b/vulkano/src/shader/mod.rs index 907b9208..298baad2 100644 --- a/vulkano/src/shader/mod.rs +++ b/vulkano/src/shader/mod.rs @@ -136,7 +136,7 @@ use crate::{ device::{Device, DeviceOwned}, format::{Format, NumericType}, image::view::ImageViewType, - macros::vulkan_bitflags_enum, + macros::{impl_id_counter, vulkan_bitflags_enum}, pipeline::{graphics::input_assembly::PrimitiveTopology, layout::PushConstantRange}, shader::spirv::{Capability, Spirv, SpirvError}, sync::PipelineStages, @@ -401,7 +401,7 @@ unsafe impl DeviceOwned for ShaderModule { } } -crate::impl_id_counter!(ShaderModule); +impl_id_counter!(ShaderModule); /// Error that can happen when creating a new shader module. #[derive(Clone, Debug)] diff --git a/vulkano/src/swapchain/surface.rs b/vulkano/src/swapchain/surface.rs index 3c47a044..44dda8bd 100644 --- a/vulkano/src/swapchain/surface.rs +++ b/vulkano/src/swapchain/surface.rs @@ -13,7 +13,7 @@ use crate::{ format::Format, image::ImageUsage, instance::Instance, - macros::{vulkan_bitflags_enum, vulkan_enum}, + macros::{impl_id_counter, vulkan_bitflags_enum, vulkan_enum}, swapchain::{ display::{DisplayMode, DisplayPlane}, SurfaceSwapchainLock, @@ -1305,7 +1305,7 @@ unsafe impl VulkanObject for Surface { } } -crate::impl_id_counter!(Surface); +impl_id_counter!(Surface); impl Debug for Surface { fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { diff --git a/vulkano/src/swapchain/swapchain.rs b/vulkano/src/swapchain/swapchain.rs index 47ba625e..ed67718b 100644 --- a/vulkano/src/swapchain/swapchain.rs +++ b/vulkano/src/swapchain/swapchain.rs @@ -19,7 +19,7 @@ use crate::{ sys::Image, ImageFormatInfo, ImageLayout, ImageTiling, ImageType, ImageUsage, SwapchainImage, }, - macros::vulkan_enum, + macros::{impl_id_counter, vulkan_enum}, swapchain::{PresentInfo, SurfaceApi, SurfaceInfo, SurfaceSwapchainLock}, sync::{ fence::{Fence, FenceError}, @@ -934,7 +934,7 @@ unsafe impl DeviceOwned for Swapchain { } } -crate::impl_id_counter!(Swapchain); +impl_id_counter!(Swapchain); impl Debug for Swapchain { fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { diff --git a/vulkano/src/sync/event.rs b/vulkano/src/sync/event.rs index 7d1253c6..8f8bc332 100644 --- a/vulkano/src/sync/event.rs +++ b/vulkano/src/sync/event.rs @@ -26,6 +26,7 @@ use crate::{ device::{Device, DeviceOwned}, + macros::impl_id_counter, OomError, RequiresOneOf, VulkanError, VulkanObject, }; use std::{ @@ -247,7 +248,7 @@ unsafe impl DeviceOwned for Event { } } -crate::impl_id_counter!(Event); +impl_id_counter!(Event); /// Parameters to create a new `Event`. #[derive(Clone, Debug)] diff --git a/vulkano/src/sync/fence.rs b/vulkano/src/sync/fence.rs index 0f541ec2..05968f2f 100644 --- a/vulkano/src/sync/fence.rs +++ b/vulkano/src/sync/fence.rs @@ -12,7 +12,7 @@ use crate::{ device::{Device, DeviceOwned, Queue}, - macros::{vulkan_bitflags, vulkan_bitflags_enum}, + macros::{impl_id_counter, vulkan_bitflags, vulkan_bitflags_enum}, OomError, RequirementNotMet, RequiresOneOf, Version, VulkanError, VulkanObject, }; use parking_lot::{Mutex, MutexGuard}; @@ -1123,7 +1123,7 @@ unsafe impl DeviceOwned for Fence { } } -crate::impl_id_counter!(Fence); +impl_id_counter!(Fence); #[derive(Debug, Default)] pub(crate) struct FenceState { diff --git a/vulkano/src/sync/semaphore.rs b/vulkano/src/sync/semaphore.rs index 656364bd..ac0ca56a 100644 --- a/vulkano/src/sync/semaphore.rs +++ b/vulkano/src/sync/semaphore.rs @@ -12,7 +12,7 @@ use crate::{ device::{Device, DeviceOwned, Queue}, - macros::{vulkan_bitflags, vulkan_bitflags_enum}, + macros::{impl_id_counter, vulkan_bitflags, vulkan_bitflags_enum}, OomError, RequirementNotMet, RequiresOneOf, Version, VulkanError, VulkanObject, }; use parking_lot::{Mutex, MutexGuard}; @@ -1019,7 +1019,7 @@ unsafe impl DeviceOwned for Semaphore { } } -crate::impl_id_counter!(Semaphore); +impl_id_counter!(Semaphore); #[derive(Debug, Default)] pub(crate) struct SemaphoreState {