Introduce constructor and assignment operator on nullptr_t (#77)

Fix issue #77
This commit is contained in:
Andreas Süßenbach 2017-02-14 13:56:11 +01:00 committed by Markus Tavenrath
parent 43b2c5ef66
commit f0eff17d9b
2 changed files with 331 additions and 0 deletions

View File

@ -3338,6 +3338,10 @@ void writeTypeHandle(std::ofstream & ofs, VkData const& vkData, DependencyData c
<< " : m_" << memberName << "(VK_NULL_HANDLE)" << std::endl
<< " {}" << std::endl
<< std::endl
<< " " << dependencyData.name << "( nullptr_t )" << std::endl
<< " : m_" << memberName << "(VK_NULL_HANDLE)" << std::endl
<< " {}" << std::endl
<< std::endl
<< "#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)" << std::endl
// construct from native handle
<< " " << dependencyData.name << "(Vk" << dependencyData.name << " " << memberName << ")" << std::endl
@ -3352,6 +3356,13 @@ void writeTypeHandle(std::ofstream & ofs, VkData const& vkData, DependencyData c
<< " }" << std::endl
<< "#endif\n"
<< std::endl
// assignment from nullptr_t
<< " " << dependencyData.name << "& operator=( nullptr_t )" << std::endl
<< " {" << std::endl
<< " m_" << memberName << " = VK_NULL_HANDLE;" << std::endl
<< " return *this;" << std::endl
<< " }" << std::endl
<< std::endl
// operator==
<< " bool operator==" << "(" << dependencyData.name << " const &rhs) const" << std::endl
<< " {" << std::endl

View File

@ -1092,6 +1092,10 @@ namespace vk
: m_deviceMemory(VK_NULL_HANDLE)
{}
DeviceMemory( nullptr_t )
: m_deviceMemory(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
DeviceMemory(VkDeviceMemory deviceMemory)
: m_deviceMemory(deviceMemory)
@ -1104,6 +1108,12 @@ namespace vk
}
#endif
DeviceMemory& operator=( nullptr_t )
{
m_deviceMemory = VK_NULL_HANDLE;
return *this;
}
bool operator==(DeviceMemory const &rhs) const
{
return m_deviceMemory == rhs.m_deviceMemory;
@ -1149,6 +1159,10 @@ namespace vk
: m_commandPool(VK_NULL_HANDLE)
{}
CommandPool( nullptr_t )
: m_commandPool(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
CommandPool(VkCommandPool commandPool)
: m_commandPool(commandPool)
@ -1161,6 +1175,12 @@ namespace vk
}
#endif
CommandPool& operator=( nullptr_t )
{
m_commandPool = VK_NULL_HANDLE;
return *this;
}
bool operator==(CommandPool const &rhs) const
{
return m_commandPool == rhs.m_commandPool;
@ -1206,6 +1226,10 @@ namespace vk
: m_buffer(VK_NULL_HANDLE)
{}
Buffer( nullptr_t )
: m_buffer(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
Buffer(VkBuffer buffer)
: m_buffer(buffer)
@ -1218,6 +1242,12 @@ namespace vk
}
#endif
Buffer& operator=( nullptr_t )
{
m_buffer = VK_NULL_HANDLE;
return *this;
}
bool operator==(Buffer const &rhs) const
{
return m_buffer == rhs.m_buffer;
@ -1263,6 +1293,10 @@ namespace vk
: m_bufferView(VK_NULL_HANDLE)
{}
BufferView( nullptr_t )
: m_bufferView(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
BufferView(VkBufferView bufferView)
: m_bufferView(bufferView)
@ -1275,6 +1309,12 @@ namespace vk
}
#endif
BufferView& operator=( nullptr_t )
{
m_bufferView = VK_NULL_HANDLE;
return *this;
}
bool operator==(BufferView const &rhs) const
{
return m_bufferView == rhs.m_bufferView;
@ -1320,6 +1360,10 @@ namespace vk
: m_image(VK_NULL_HANDLE)
{}
Image( nullptr_t )
: m_image(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
Image(VkImage image)
: m_image(image)
@ -1332,6 +1376,12 @@ namespace vk
}
#endif
Image& operator=( nullptr_t )
{
m_image = VK_NULL_HANDLE;
return *this;
}
bool operator==(Image const &rhs) const
{
return m_image == rhs.m_image;
@ -1377,6 +1427,10 @@ namespace vk
: m_imageView(VK_NULL_HANDLE)
{}
ImageView( nullptr_t )
: m_imageView(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
ImageView(VkImageView imageView)
: m_imageView(imageView)
@ -1389,6 +1443,12 @@ namespace vk
}
#endif
ImageView& operator=( nullptr_t )
{
m_imageView = VK_NULL_HANDLE;
return *this;
}
bool operator==(ImageView const &rhs) const
{
return m_imageView == rhs.m_imageView;
@ -1434,6 +1494,10 @@ namespace vk
: m_shaderModule(VK_NULL_HANDLE)
{}
ShaderModule( nullptr_t )
: m_shaderModule(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
ShaderModule(VkShaderModule shaderModule)
: m_shaderModule(shaderModule)
@ -1446,6 +1510,12 @@ namespace vk
}
#endif
ShaderModule& operator=( nullptr_t )
{
m_shaderModule = VK_NULL_HANDLE;
return *this;
}
bool operator==(ShaderModule const &rhs) const
{
return m_shaderModule == rhs.m_shaderModule;
@ -1491,6 +1561,10 @@ namespace vk
: m_pipeline(VK_NULL_HANDLE)
{}
Pipeline( nullptr_t )
: m_pipeline(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
Pipeline(VkPipeline pipeline)
: m_pipeline(pipeline)
@ -1503,6 +1577,12 @@ namespace vk
}
#endif
Pipeline& operator=( nullptr_t )
{
m_pipeline = VK_NULL_HANDLE;
return *this;
}
bool operator==(Pipeline const &rhs) const
{
return m_pipeline == rhs.m_pipeline;
@ -1548,6 +1628,10 @@ namespace vk
: m_pipelineLayout(VK_NULL_HANDLE)
{}
PipelineLayout( nullptr_t )
: m_pipelineLayout(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
PipelineLayout(VkPipelineLayout pipelineLayout)
: m_pipelineLayout(pipelineLayout)
@ -1560,6 +1644,12 @@ namespace vk
}
#endif
PipelineLayout& operator=( nullptr_t )
{
m_pipelineLayout = VK_NULL_HANDLE;
return *this;
}
bool operator==(PipelineLayout const &rhs) const
{
return m_pipelineLayout == rhs.m_pipelineLayout;
@ -1605,6 +1695,10 @@ namespace vk
: m_sampler(VK_NULL_HANDLE)
{}
Sampler( nullptr_t )
: m_sampler(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
Sampler(VkSampler sampler)
: m_sampler(sampler)
@ -1617,6 +1711,12 @@ namespace vk
}
#endif
Sampler& operator=( nullptr_t )
{
m_sampler = VK_NULL_HANDLE;
return *this;
}
bool operator==(Sampler const &rhs) const
{
return m_sampler == rhs.m_sampler;
@ -1662,6 +1762,10 @@ namespace vk
: m_descriptorSet(VK_NULL_HANDLE)
{}
DescriptorSet( nullptr_t )
: m_descriptorSet(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
DescriptorSet(VkDescriptorSet descriptorSet)
: m_descriptorSet(descriptorSet)
@ -1674,6 +1778,12 @@ namespace vk
}
#endif
DescriptorSet& operator=( nullptr_t )
{
m_descriptorSet = VK_NULL_HANDLE;
return *this;
}
bool operator==(DescriptorSet const &rhs) const
{
return m_descriptorSet == rhs.m_descriptorSet;
@ -1719,6 +1829,10 @@ namespace vk
: m_descriptorSetLayout(VK_NULL_HANDLE)
{}
DescriptorSetLayout( nullptr_t )
: m_descriptorSetLayout(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
DescriptorSetLayout(VkDescriptorSetLayout descriptorSetLayout)
: m_descriptorSetLayout(descriptorSetLayout)
@ -1731,6 +1845,12 @@ namespace vk
}
#endif
DescriptorSetLayout& operator=( nullptr_t )
{
m_descriptorSetLayout = VK_NULL_HANDLE;
return *this;
}
bool operator==(DescriptorSetLayout const &rhs) const
{
return m_descriptorSetLayout == rhs.m_descriptorSetLayout;
@ -1776,6 +1896,10 @@ namespace vk
: m_descriptorPool(VK_NULL_HANDLE)
{}
DescriptorPool( nullptr_t )
: m_descriptorPool(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
DescriptorPool(VkDescriptorPool descriptorPool)
: m_descriptorPool(descriptorPool)
@ -1788,6 +1912,12 @@ namespace vk
}
#endif
DescriptorPool& operator=( nullptr_t )
{
m_descriptorPool = VK_NULL_HANDLE;
return *this;
}
bool operator==(DescriptorPool const &rhs) const
{
return m_descriptorPool == rhs.m_descriptorPool;
@ -1833,6 +1963,10 @@ namespace vk
: m_fence(VK_NULL_HANDLE)
{}
Fence( nullptr_t )
: m_fence(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
Fence(VkFence fence)
: m_fence(fence)
@ -1845,6 +1979,12 @@ namespace vk
}
#endif
Fence& operator=( nullptr_t )
{
m_fence = VK_NULL_HANDLE;
return *this;
}
bool operator==(Fence const &rhs) const
{
return m_fence == rhs.m_fence;
@ -1890,6 +2030,10 @@ namespace vk
: m_semaphore(VK_NULL_HANDLE)
{}
Semaphore( nullptr_t )
: m_semaphore(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
Semaphore(VkSemaphore semaphore)
: m_semaphore(semaphore)
@ -1902,6 +2046,12 @@ namespace vk
}
#endif
Semaphore& operator=( nullptr_t )
{
m_semaphore = VK_NULL_HANDLE;
return *this;
}
bool operator==(Semaphore const &rhs) const
{
return m_semaphore == rhs.m_semaphore;
@ -1947,6 +2097,10 @@ namespace vk
: m_event(VK_NULL_HANDLE)
{}
Event( nullptr_t )
: m_event(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
Event(VkEvent event)
: m_event(event)
@ -1959,6 +2113,12 @@ namespace vk
}
#endif
Event& operator=( nullptr_t )
{
m_event = VK_NULL_HANDLE;
return *this;
}
bool operator==(Event const &rhs) const
{
return m_event == rhs.m_event;
@ -2004,6 +2164,10 @@ namespace vk
: m_queryPool(VK_NULL_HANDLE)
{}
QueryPool( nullptr_t )
: m_queryPool(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
QueryPool(VkQueryPool queryPool)
: m_queryPool(queryPool)
@ -2016,6 +2180,12 @@ namespace vk
}
#endif
QueryPool& operator=( nullptr_t )
{
m_queryPool = VK_NULL_HANDLE;
return *this;
}
bool operator==(QueryPool const &rhs) const
{
return m_queryPool == rhs.m_queryPool;
@ -2061,6 +2231,10 @@ namespace vk
: m_framebuffer(VK_NULL_HANDLE)
{}
Framebuffer( nullptr_t )
: m_framebuffer(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
Framebuffer(VkFramebuffer framebuffer)
: m_framebuffer(framebuffer)
@ -2073,6 +2247,12 @@ namespace vk
}
#endif
Framebuffer& operator=( nullptr_t )
{
m_framebuffer = VK_NULL_HANDLE;
return *this;
}
bool operator==(Framebuffer const &rhs) const
{
return m_framebuffer == rhs.m_framebuffer;
@ -2118,6 +2298,10 @@ namespace vk
: m_renderPass(VK_NULL_HANDLE)
{}
RenderPass( nullptr_t )
: m_renderPass(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
RenderPass(VkRenderPass renderPass)
: m_renderPass(renderPass)
@ -2130,6 +2314,12 @@ namespace vk
}
#endif
RenderPass& operator=( nullptr_t )
{
m_renderPass = VK_NULL_HANDLE;
return *this;
}
bool operator==(RenderPass const &rhs) const
{
return m_renderPass == rhs.m_renderPass;
@ -2175,6 +2365,10 @@ namespace vk
: m_pipelineCache(VK_NULL_HANDLE)
{}
PipelineCache( nullptr_t )
: m_pipelineCache(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
PipelineCache(VkPipelineCache pipelineCache)
: m_pipelineCache(pipelineCache)
@ -2187,6 +2381,12 @@ namespace vk
}
#endif
PipelineCache& operator=( nullptr_t )
{
m_pipelineCache = VK_NULL_HANDLE;
return *this;
}
bool operator==(PipelineCache const &rhs) const
{
return m_pipelineCache == rhs.m_pipelineCache;
@ -2232,6 +2432,10 @@ namespace vk
: m_objectTableNVX(VK_NULL_HANDLE)
{}
ObjectTableNVX( nullptr_t )
: m_objectTableNVX(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
ObjectTableNVX(VkObjectTableNVX objectTableNVX)
: m_objectTableNVX(objectTableNVX)
@ -2244,6 +2448,12 @@ namespace vk
}
#endif
ObjectTableNVX& operator=( nullptr_t )
{
m_objectTableNVX = VK_NULL_HANDLE;
return *this;
}
bool operator==(ObjectTableNVX const &rhs) const
{
return m_objectTableNVX == rhs.m_objectTableNVX;
@ -2289,6 +2499,10 @@ namespace vk
: m_indirectCommandsLayoutNVX(VK_NULL_HANDLE)
{}
IndirectCommandsLayoutNVX( nullptr_t )
: m_indirectCommandsLayoutNVX(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
IndirectCommandsLayoutNVX(VkIndirectCommandsLayoutNVX indirectCommandsLayoutNVX)
: m_indirectCommandsLayoutNVX(indirectCommandsLayoutNVX)
@ -2301,6 +2515,12 @@ namespace vk
}
#endif
IndirectCommandsLayoutNVX& operator=( nullptr_t )
{
m_indirectCommandsLayoutNVX = VK_NULL_HANDLE;
return *this;
}
bool operator==(IndirectCommandsLayoutNVX const &rhs) const
{
return m_indirectCommandsLayoutNVX == rhs.m_indirectCommandsLayoutNVX;
@ -2346,6 +2566,10 @@ namespace vk
: m_displayKHR(VK_NULL_HANDLE)
{}
DisplayKHR( nullptr_t )
: m_displayKHR(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
DisplayKHR(VkDisplayKHR displayKHR)
: m_displayKHR(displayKHR)
@ -2358,6 +2582,12 @@ namespace vk
}
#endif
DisplayKHR& operator=( nullptr_t )
{
m_displayKHR = VK_NULL_HANDLE;
return *this;
}
bool operator==(DisplayKHR const &rhs) const
{
return m_displayKHR == rhs.m_displayKHR;
@ -2403,6 +2633,10 @@ namespace vk
: m_displayModeKHR(VK_NULL_HANDLE)
{}
DisplayModeKHR( nullptr_t )
: m_displayModeKHR(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
DisplayModeKHR(VkDisplayModeKHR displayModeKHR)
: m_displayModeKHR(displayModeKHR)
@ -2415,6 +2649,12 @@ namespace vk
}
#endif
DisplayModeKHR& operator=( nullptr_t )
{
m_displayModeKHR = VK_NULL_HANDLE;
return *this;
}
bool operator==(DisplayModeKHR const &rhs) const
{
return m_displayModeKHR == rhs.m_displayModeKHR;
@ -2460,6 +2700,10 @@ namespace vk
: m_surfaceKHR(VK_NULL_HANDLE)
{}
SurfaceKHR( nullptr_t )
: m_surfaceKHR(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
SurfaceKHR(VkSurfaceKHR surfaceKHR)
: m_surfaceKHR(surfaceKHR)
@ -2472,6 +2716,12 @@ namespace vk
}
#endif
SurfaceKHR& operator=( nullptr_t )
{
m_surfaceKHR = VK_NULL_HANDLE;
return *this;
}
bool operator==(SurfaceKHR const &rhs) const
{
return m_surfaceKHR == rhs.m_surfaceKHR;
@ -2517,6 +2767,10 @@ namespace vk
: m_swapchainKHR(VK_NULL_HANDLE)
{}
SwapchainKHR( nullptr_t )
: m_swapchainKHR(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
SwapchainKHR(VkSwapchainKHR swapchainKHR)
: m_swapchainKHR(swapchainKHR)
@ -2529,6 +2783,12 @@ namespace vk
}
#endif
SwapchainKHR& operator=( nullptr_t )
{
m_swapchainKHR = VK_NULL_HANDLE;
return *this;
}
bool operator==(SwapchainKHR const &rhs) const
{
return m_swapchainKHR == rhs.m_swapchainKHR;
@ -2574,6 +2834,10 @@ namespace vk
: m_debugReportCallbackEXT(VK_NULL_HANDLE)
{}
DebugReportCallbackEXT( nullptr_t )
: m_debugReportCallbackEXT(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
DebugReportCallbackEXT(VkDebugReportCallbackEXT debugReportCallbackEXT)
: m_debugReportCallbackEXT(debugReportCallbackEXT)
@ -2586,6 +2850,12 @@ namespace vk
}
#endif
DebugReportCallbackEXT& operator=( nullptr_t )
{
m_debugReportCallbackEXT = VK_NULL_HANDLE;
return *this;
}
bool operator==(DebugReportCallbackEXT const &rhs) const
{
return m_debugReportCallbackEXT == rhs.m_debugReportCallbackEXT;
@ -17289,6 +17559,10 @@ namespace vk
: m_commandBuffer(VK_NULL_HANDLE)
{}
CommandBuffer( nullptr_t )
: m_commandBuffer(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
CommandBuffer(VkCommandBuffer commandBuffer)
: m_commandBuffer(commandBuffer)
@ -17301,6 +17575,12 @@ namespace vk
}
#endif
CommandBuffer& operator=( nullptr_t )
{
m_commandBuffer = VK_NULL_HANDLE;
return *this;
}
bool operator==(CommandBuffer const &rhs) const
{
return m_commandBuffer == rhs.m_commandBuffer;
@ -18092,6 +18372,10 @@ namespace vk
: m_queue(VK_NULL_HANDLE)
{}
Queue( nullptr_t )
: m_queue(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
Queue(VkQueue queue)
: m_queue(queue)
@ -18104,6 +18388,12 @@ namespace vk
}
#endif
Queue& operator=( nullptr_t )
{
m_queue = VK_NULL_HANDLE;
return *this;
}
bool operator==(Queue const &rhs) const
{
return m_queue == rhs.m_queue;
@ -18269,6 +18559,10 @@ namespace vk
: m_device(VK_NULL_HANDLE)
{}
Device( nullptr_t )
: m_device(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
Device(VkDevice device)
: m_device(device)
@ -18281,6 +18575,12 @@ namespace vk
}
#endif
Device& operator=( nullptr_t )
{
m_device = VK_NULL_HANDLE;
return *this;
}
bool operator==(Device const &rhs) const
{
return m_device == rhs.m_device;
@ -20718,6 +21018,10 @@ namespace vk
: m_physicalDevice(VK_NULL_HANDLE)
{}
PhysicalDevice( nullptr_t )
: m_physicalDevice(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
PhysicalDevice(VkPhysicalDevice physicalDevice)
: m_physicalDevice(physicalDevice)
@ -20730,6 +21034,12 @@ namespace vk
}
#endif
PhysicalDevice& operator=( nullptr_t )
{
m_physicalDevice = VK_NULL_HANDLE;
return *this;
}
bool operator==(PhysicalDevice const &rhs) const
{
return m_physicalDevice == rhs.m_physicalDevice;
@ -21635,6 +21945,10 @@ namespace vk
: m_instance(VK_NULL_HANDLE)
{}
Instance( nullptr_t )
: m_instance(VK_NULL_HANDLE)
{}
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
Instance(VkInstance instance)
: m_instance(instance)
@ -21647,6 +21961,12 @@ namespace vk
}
#endif
Instance& operator=( nullptr_t )
{
m_instance = VK_NULL_HANDLE;
return *this;
}
bool operator==(Instance const &rhs) const
{
return m_instance == rhs.m_instance;