From 820ec7097abf9569271c2e2d9a4a54b5ab4205b2 Mon Sep 17 00:00:00 2001 From: Markus Tavenrath Date: Tue, 16 Aug 2016 08:42:01 +0200 Subject: [PATCH] Add support for operator< --- VulkanHppGenerator.cpp | 10 +- vulkan/vulkan.hpp | 270 ++++++++++++++++++++++++++++++++--------- 2 files changed, 218 insertions(+), 62 deletions(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index a1b272c..cb1ff37 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -2653,13 +2653,19 @@ void writeTypeHandle(std::ofstream & ofs, VkData const& vkData, DependencyData c // operator== << " bool operator==" << "(" << dependencyData.name << " const &rhs) const" << std::endl << " {" << std::endl - << " return m_" << memberName << " == rhs.m_" << memberName << ";" << std::endl + << " return m_" << memberName << " == rhs.m_" << memberName << ";" << std::endl << " }" << std::endl << std::endl // operator!= << " bool operator!=" << "(" << dependencyData.name << " const &rhs) const" << std::endl << " {" << std::endl - << " return m_" << memberName << " != rhs.m_" << memberName << ";" << std::endl + << " return m_" << memberName << " != rhs.m_" << memberName << ";" << std::endl + << " }" << std::endl + << std::endl + // operator< + << " bool operator<" << "(" << dependencyData.name << " const &rhs) const" << std::endl + << " {" << std::endl + << " return m_" << memberName << " < rhs.m_" << memberName << ";" << std::endl << " }" << std::endl << std::endl; diff --git a/vulkan/vulkan.hpp b/vulkan/vulkan.hpp index f9eac8d..869bb38 100644 --- a/vulkan/vulkan.hpp +++ b/vulkan/vulkan.hpp @@ -931,12 +931,17 @@ namespace vk bool operator==(DeviceMemory const &rhs) const { - return m_deviceMemory == rhs.m_deviceMemory; + return m_deviceMemory == rhs.m_deviceMemory; } bool operator!=(DeviceMemory const &rhs) const { - return m_deviceMemory != rhs.m_deviceMemory; + return m_deviceMemory != rhs.m_deviceMemory; + } + + bool operator<(DeviceMemory const &rhs) const + { + return m_deviceMemory < rhs.m_deviceMemory; } #if !defined(VULKAN_HPP_TYPESAFE_CONVERSION) @@ -983,12 +988,17 @@ namespace vk bool operator==(CommandPool const &rhs) const { - return m_commandPool == rhs.m_commandPool; + return m_commandPool == rhs.m_commandPool; } bool operator!=(CommandPool const &rhs) const { - return m_commandPool != rhs.m_commandPool; + return m_commandPool != rhs.m_commandPool; + } + + bool operator<(CommandPool const &rhs) const + { + return m_commandPool < rhs.m_commandPool; } #if !defined(VULKAN_HPP_TYPESAFE_CONVERSION) @@ -1035,12 +1045,17 @@ namespace vk bool operator==(Buffer const &rhs) const { - return m_buffer == rhs.m_buffer; + return m_buffer == rhs.m_buffer; } bool operator!=(Buffer const &rhs) const { - return m_buffer != rhs.m_buffer; + return m_buffer != rhs.m_buffer; + } + + bool operator<(Buffer const &rhs) const + { + return m_buffer < rhs.m_buffer; } #if !defined(VULKAN_HPP_TYPESAFE_CONVERSION) @@ -1087,12 +1102,17 @@ namespace vk bool operator==(BufferView const &rhs) const { - return m_bufferView == rhs.m_bufferView; + return m_bufferView == rhs.m_bufferView; } bool operator!=(BufferView const &rhs) const { - return m_bufferView != rhs.m_bufferView; + return m_bufferView != rhs.m_bufferView; + } + + bool operator<(BufferView const &rhs) const + { + return m_bufferView < rhs.m_bufferView; } #if !defined(VULKAN_HPP_TYPESAFE_CONVERSION) @@ -1139,12 +1159,17 @@ namespace vk bool operator==(Image const &rhs) const { - return m_image == rhs.m_image; + return m_image == rhs.m_image; } bool operator!=(Image const &rhs) const { - return m_image != rhs.m_image; + return m_image != rhs.m_image; + } + + bool operator<(Image const &rhs) const + { + return m_image < rhs.m_image; } #if !defined(VULKAN_HPP_TYPESAFE_CONVERSION) @@ -1191,12 +1216,17 @@ namespace vk bool operator==(ImageView const &rhs) const { - return m_imageView == rhs.m_imageView; + return m_imageView == rhs.m_imageView; } bool operator!=(ImageView const &rhs) const { - return m_imageView != rhs.m_imageView; + return m_imageView != rhs.m_imageView; + } + + bool operator<(ImageView const &rhs) const + { + return m_imageView < rhs.m_imageView; } #if !defined(VULKAN_HPP_TYPESAFE_CONVERSION) @@ -1243,12 +1273,17 @@ namespace vk bool operator==(ShaderModule const &rhs) const { - return m_shaderModule == rhs.m_shaderModule; + return m_shaderModule == rhs.m_shaderModule; } bool operator!=(ShaderModule const &rhs) const { - return m_shaderModule != rhs.m_shaderModule; + return m_shaderModule != rhs.m_shaderModule; + } + + bool operator<(ShaderModule const &rhs) const + { + return m_shaderModule < rhs.m_shaderModule; } #if !defined(VULKAN_HPP_TYPESAFE_CONVERSION) @@ -1295,12 +1330,17 @@ namespace vk bool operator==(Pipeline const &rhs) const { - return m_pipeline == rhs.m_pipeline; + return m_pipeline == rhs.m_pipeline; } bool operator!=(Pipeline const &rhs) const { - return m_pipeline != rhs.m_pipeline; + return m_pipeline != rhs.m_pipeline; + } + + bool operator<(Pipeline const &rhs) const + { + return m_pipeline < rhs.m_pipeline; } #if !defined(VULKAN_HPP_TYPESAFE_CONVERSION) @@ -1347,12 +1387,17 @@ namespace vk bool operator==(PipelineLayout const &rhs) const { - return m_pipelineLayout == rhs.m_pipelineLayout; + return m_pipelineLayout == rhs.m_pipelineLayout; } bool operator!=(PipelineLayout const &rhs) const { - return m_pipelineLayout != rhs.m_pipelineLayout; + return m_pipelineLayout != rhs.m_pipelineLayout; + } + + bool operator<(PipelineLayout const &rhs) const + { + return m_pipelineLayout < rhs.m_pipelineLayout; } #if !defined(VULKAN_HPP_TYPESAFE_CONVERSION) @@ -1399,12 +1444,17 @@ namespace vk bool operator==(Sampler const &rhs) const { - return m_sampler == rhs.m_sampler; + return m_sampler == rhs.m_sampler; } bool operator!=(Sampler const &rhs) const { - return m_sampler != rhs.m_sampler; + return m_sampler != rhs.m_sampler; + } + + bool operator<(Sampler const &rhs) const + { + return m_sampler < rhs.m_sampler; } #if !defined(VULKAN_HPP_TYPESAFE_CONVERSION) @@ -1451,12 +1501,17 @@ namespace vk bool operator==(DescriptorSet const &rhs) const { - return m_descriptorSet == rhs.m_descriptorSet; + return m_descriptorSet == rhs.m_descriptorSet; } bool operator!=(DescriptorSet const &rhs) const { - return m_descriptorSet != rhs.m_descriptorSet; + return m_descriptorSet != rhs.m_descriptorSet; + } + + bool operator<(DescriptorSet const &rhs) const + { + return m_descriptorSet < rhs.m_descriptorSet; } #if !defined(VULKAN_HPP_TYPESAFE_CONVERSION) @@ -1503,12 +1558,17 @@ namespace vk bool operator==(DescriptorSetLayout const &rhs) const { - return m_descriptorSetLayout == rhs.m_descriptorSetLayout; + return m_descriptorSetLayout == rhs.m_descriptorSetLayout; } bool operator!=(DescriptorSetLayout const &rhs) const { - return m_descriptorSetLayout != rhs.m_descriptorSetLayout; + return m_descriptorSetLayout != rhs.m_descriptorSetLayout; + } + + bool operator<(DescriptorSetLayout const &rhs) const + { + return m_descriptorSetLayout < rhs.m_descriptorSetLayout; } #if !defined(VULKAN_HPP_TYPESAFE_CONVERSION) @@ -1555,12 +1615,17 @@ namespace vk bool operator==(DescriptorPool const &rhs) const { - return m_descriptorPool == rhs.m_descriptorPool; + return m_descriptorPool == rhs.m_descriptorPool; } bool operator!=(DescriptorPool const &rhs) const { - return m_descriptorPool != rhs.m_descriptorPool; + return m_descriptorPool != rhs.m_descriptorPool; + } + + bool operator<(DescriptorPool const &rhs) const + { + return m_descriptorPool < rhs.m_descriptorPool; } #if !defined(VULKAN_HPP_TYPESAFE_CONVERSION) @@ -1607,12 +1672,17 @@ namespace vk bool operator==(Fence const &rhs) const { - return m_fence == rhs.m_fence; + return m_fence == rhs.m_fence; } bool operator!=(Fence const &rhs) const { - return m_fence != rhs.m_fence; + return m_fence != rhs.m_fence; + } + + bool operator<(Fence const &rhs) const + { + return m_fence < rhs.m_fence; } #if !defined(VULKAN_HPP_TYPESAFE_CONVERSION) @@ -1659,12 +1729,17 @@ namespace vk bool operator==(Semaphore const &rhs) const { - return m_semaphore == rhs.m_semaphore; + return m_semaphore == rhs.m_semaphore; } bool operator!=(Semaphore const &rhs) const { - return m_semaphore != rhs.m_semaphore; + return m_semaphore != rhs.m_semaphore; + } + + bool operator<(Semaphore const &rhs) const + { + return m_semaphore < rhs.m_semaphore; } #if !defined(VULKAN_HPP_TYPESAFE_CONVERSION) @@ -1711,12 +1786,17 @@ namespace vk bool operator==(Event const &rhs) const { - return m_event == rhs.m_event; + return m_event == rhs.m_event; } bool operator!=(Event const &rhs) const { - return m_event != rhs.m_event; + return m_event != rhs.m_event; + } + + bool operator<(Event const &rhs) const + { + return m_event < rhs.m_event; } #if !defined(VULKAN_HPP_TYPESAFE_CONVERSION) @@ -1763,12 +1843,17 @@ namespace vk bool operator==(QueryPool const &rhs) const { - return m_queryPool == rhs.m_queryPool; + return m_queryPool == rhs.m_queryPool; } bool operator!=(QueryPool const &rhs) const { - return m_queryPool != rhs.m_queryPool; + return m_queryPool != rhs.m_queryPool; + } + + bool operator<(QueryPool const &rhs) const + { + return m_queryPool < rhs.m_queryPool; } #if !defined(VULKAN_HPP_TYPESAFE_CONVERSION) @@ -1815,12 +1900,17 @@ namespace vk bool operator==(Framebuffer const &rhs) const { - return m_framebuffer == rhs.m_framebuffer; + return m_framebuffer == rhs.m_framebuffer; } bool operator!=(Framebuffer const &rhs) const { - return m_framebuffer != rhs.m_framebuffer; + return m_framebuffer != rhs.m_framebuffer; + } + + bool operator<(Framebuffer const &rhs) const + { + return m_framebuffer < rhs.m_framebuffer; } #if !defined(VULKAN_HPP_TYPESAFE_CONVERSION) @@ -1867,12 +1957,17 @@ namespace vk bool operator==(RenderPass const &rhs) const { - return m_renderPass == rhs.m_renderPass; + return m_renderPass == rhs.m_renderPass; } bool operator!=(RenderPass const &rhs) const { - return m_renderPass != rhs.m_renderPass; + return m_renderPass != rhs.m_renderPass; + } + + bool operator<(RenderPass const &rhs) const + { + return m_renderPass < rhs.m_renderPass; } #if !defined(VULKAN_HPP_TYPESAFE_CONVERSION) @@ -1919,12 +2014,17 @@ namespace vk bool operator==(PipelineCache const &rhs) const { - return m_pipelineCache == rhs.m_pipelineCache; + return m_pipelineCache == rhs.m_pipelineCache; } bool operator!=(PipelineCache const &rhs) const { - return m_pipelineCache != rhs.m_pipelineCache; + return m_pipelineCache != rhs.m_pipelineCache; + } + + bool operator<(PipelineCache const &rhs) const + { + return m_pipelineCache < rhs.m_pipelineCache; } #if !defined(VULKAN_HPP_TYPESAFE_CONVERSION) @@ -1971,12 +2071,17 @@ namespace vk bool operator==(DisplayKHR const &rhs) const { - return m_displayKHR == rhs.m_displayKHR; + return m_displayKHR == rhs.m_displayKHR; } bool operator!=(DisplayKHR const &rhs) const { - return m_displayKHR != rhs.m_displayKHR; + return m_displayKHR != rhs.m_displayKHR; + } + + bool operator<(DisplayKHR const &rhs) const + { + return m_displayKHR < rhs.m_displayKHR; } #if !defined(VULKAN_HPP_TYPESAFE_CONVERSION) @@ -2023,12 +2128,17 @@ namespace vk bool operator==(DisplayModeKHR const &rhs) const { - return m_displayModeKHR == rhs.m_displayModeKHR; + return m_displayModeKHR == rhs.m_displayModeKHR; } bool operator!=(DisplayModeKHR const &rhs) const { - return m_displayModeKHR != rhs.m_displayModeKHR; + return m_displayModeKHR != rhs.m_displayModeKHR; + } + + bool operator<(DisplayModeKHR const &rhs) const + { + return m_displayModeKHR < rhs.m_displayModeKHR; } #if !defined(VULKAN_HPP_TYPESAFE_CONVERSION) @@ -2075,12 +2185,17 @@ namespace vk bool operator==(SurfaceKHR const &rhs) const { - return m_surfaceKHR == rhs.m_surfaceKHR; + return m_surfaceKHR == rhs.m_surfaceKHR; } bool operator!=(SurfaceKHR const &rhs) const { - return m_surfaceKHR != rhs.m_surfaceKHR; + return m_surfaceKHR != rhs.m_surfaceKHR; + } + + bool operator<(SurfaceKHR const &rhs) const + { + return m_surfaceKHR < rhs.m_surfaceKHR; } #if !defined(VULKAN_HPP_TYPESAFE_CONVERSION) @@ -2127,12 +2242,17 @@ namespace vk bool operator==(SwapchainKHR const &rhs) const { - return m_swapchainKHR == rhs.m_swapchainKHR; + return m_swapchainKHR == rhs.m_swapchainKHR; } bool operator!=(SwapchainKHR const &rhs) const { - return m_swapchainKHR != rhs.m_swapchainKHR; + return m_swapchainKHR != rhs.m_swapchainKHR; + } + + bool operator<(SwapchainKHR const &rhs) const + { + return m_swapchainKHR < rhs.m_swapchainKHR; } #if !defined(VULKAN_HPP_TYPESAFE_CONVERSION) @@ -2179,12 +2299,17 @@ namespace vk bool operator==(DebugReportCallbackEXT const &rhs) const { - return m_debugReportCallbackEXT == rhs.m_debugReportCallbackEXT; + return m_debugReportCallbackEXT == rhs.m_debugReportCallbackEXT; } bool operator!=(DebugReportCallbackEXT const &rhs) const { - return m_debugReportCallbackEXT != rhs.m_debugReportCallbackEXT; + return m_debugReportCallbackEXT != rhs.m_debugReportCallbackEXT; + } + + bool operator<(DebugReportCallbackEXT const &rhs) const + { + return m_debugReportCallbackEXT < rhs.m_debugReportCallbackEXT; } #if !defined(VULKAN_HPP_TYPESAFE_CONVERSION) @@ -13286,12 +13411,17 @@ namespace vk bool operator==(CommandBuffer const &rhs) const { - return m_commandBuffer == rhs.m_commandBuffer; + return m_commandBuffer == rhs.m_commandBuffer; } bool operator!=(CommandBuffer const &rhs) const { - return m_commandBuffer != rhs.m_commandBuffer; + return m_commandBuffer != rhs.m_commandBuffer; + } + + bool operator<(CommandBuffer const &rhs) const + { + return m_commandBuffer < rhs.m_commandBuffer; } Result begin( const CommandBufferBeginInfo* pBeginInfo ) const @@ -14344,12 +14474,17 @@ namespace vk bool operator==(Queue const &rhs) const { - return m_queue == rhs.m_queue; + return m_queue == rhs.m_queue; } bool operator!=(Queue const &rhs) const { - return m_queue != rhs.m_queue; + return m_queue != rhs.m_queue; + } + + bool operator<(Queue const &rhs) const + { + return m_queue < rhs.m_queue; } Result submit( uint32_t submitCount, const SubmitInfo* pSubmits, Fence fence ) const @@ -15540,12 +15675,17 @@ namespace vk bool operator==(Device const &rhs) const { - return m_device == rhs.m_device; + return m_device == rhs.m_device; } bool operator!=(Device const &rhs) const { - return m_device != rhs.m_device; + return m_device != rhs.m_device; + } + + bool operator<(Device const &rhs) const + { + return m_device < rhs.m_device; } PFN_vkVoidFunction getProcAddr( const char* pName ) const @@ -16697,12 +16837,17 @@ namespace vk bool operator==(PhysicalDevice const &rhs) const { - return m_physicalDevice == rhs.m_physicalDevice; + return m_physicalDevice == rhs.m_physicalDevice; } bool operator!=(PhysicalDevice const &rhs) const { - return m_physicalDevice != rhs.m_physicalDevice; + return m_physicalDevice != rhs.m_physicalDevice; + } + + bool operator<(PhysicalDevice const &rhs) const + { + return m_physicalDevice < rhs.m_physicalDevice; } void getProperties( PhysicalDeviceProperties* pProperties ) const @@ -17223,12 +17368,17 @@ namespace vk bool operator==(Instance const &rhs) const { - return m_instance == rhs.m_instance; + return m_instance == rhs.m_instance; } bool operator!=(Instance const &rhs) const { - return m_instance != rhs.m_instance; + return m_instance != rhs.m_instance; + } + + bool operator<(Instance const &rhs) const + { + return m_instance < rhs.m_instance; } void destroy( const AllocationCallbacks* pAllocator ) const