diff --git a/src/vk/Context.cpp b/src/vk/Context.cpp index db4e1a0..2600011 100644 --- a/src/vk/Context.cpp +++ b/src/vk/Context.cpp @@ -803,6 +803,9 @@ VKAPI_ATTR VkBool32 VKAPI_CALL Context::log_debug_message( const VkDebugUtilsMessengerCallbackDataEXT* data, void* user_data ) { + if(data->messageIdNumber == 0) // Loader message + return VK_FALSE; + { auto stream = [severity]() { switch(severity) { @@ -834,7 +837,9 @@ VKAPI_ATTR VkBool32 VKAPI_CALL Context::log_debug_message( } if(severity == VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT - && data->messageIdNumber != 2094043421 // wrong swapchain extent + && ( + data->messageIdNumber != 2094043421 // wrong swapchain extent + ) ) abort(); diff --git a/src/vk/DescriptorSet.cpp b/src/vk/DescriptorSet.cpp index c9c7677..8f899c2 100644 --- a/src/vk/DescriptorSet.cpp +++ b/src/vk/DescriptorSet.cpp @@ -17,7 +17,7 @@ DescriptorSet::DescriptorSet( VkDescriptorPool descriptor_pool, const VkDescriptorSetLayout& set_layout ) - : Wrapper(context, 0) + : Wrapper(context, DontOwnUnderlyingObject) , m_descriptor_pool(descriptor_pool) { assert(m_descriptor_pool != VK_NULL_HANDLE); diff --git a/src/vk/DescriptorSet.h b/src/vk/DescriptorSet.h index cc7ed4b..c23dae4 100644 --- a/src/vk/DescriptorSet.h +++ b/src/vk/DescriptorSet.h @@ -18,11 +18,11 @@ public: VkDescriptorPool descriptor_pool, const VkDescriptorSetLayout& set_layout ); - DescriptorSet(const DescriptorSet&) = delete; + DescriptorSet(const DescriptorSet&) = default; DescriptorSet(DescriptorSet&& other) noexcept; ~DescriptorSet() noexcept; - DescriptorSet& operator=(const DescriptorSet&) = delete; + DescriptorSet& operator=(const DescriptorSet&) = default; DescriptorSet& operator=(DescriptorSet&& other) noexcept; explicit inline operator bool() const noexcept { @@ -33,14 +33,6 @@ public: return m_descriptor_set == VK_NULL_HANDLE; } - inline const Context* context() const noexcept { - return m_context; - } - - inline Context* context() noexcept { - return m_context; - } - inline const VkDescriptorPool descriptor_pool() const noexcept { return m_descriptor_pool; } @@ -59,7 +51,7 @@ public: inline void swap(DescriptorSet& other) noexcept { using std::swap; - swap(m_context, other.m_context); + Wrapper::swap(other); swap(m_descriptor_pool, other.m_descriptor_pool); swap(m_descriptor_set, other.m_descriptor_set); } diff --git a/src/vk/Swapchain.cpp b/src/vk/Swapchain.cpp index d6d18cf..bc803b0 100644 --- a/src/vk/Swapchain.cpp +++ b/src/vk/Swapchain.cpp @@ -137,9 +137,9 @@ void Swapchain::begin_frame() { } } - logger.info() << "begin frame " << m_frame_index - << ": image " << m_current_image_index - << ", frame: " << m_frame_resources_index; + // logger.info() << "begin frame " << m_frame_index + // << ": image " << m_current_image_index + // << ", frame: " << m_frame_resources_index; auto& image_resources = m_image_resources[m_current_image_index]; diff --git a/src/vk/Wrapper.cpp b/src/vk/Wrapper.cpp index 6c3d5e5..0c3e5a7 100644 --- a/src/vk/Wrapper.cpp +++ b/src/vk/Wrapper.cpp @@ -35,6 +35,7 @@ Wrapper::~Wrapper() noexcept { Wrapper& Wrapper::operator=(const Wrapper& other) noexcept { if (&other != this) { m_context = other.m_context; + m_flags = other.m_flags & ~OwnUnderlyingObject; } return *this; } diff --git a/src/vk/Wrapper.h b/src/vk/Wrapper.h index a2d9913..2799b1b 100644 --- a/src/vk/Wrapper.h +++ b/src/vk/Wrapper.h @@ -12,7 +12,8 @@ namespace vk { class Wrapper { public: enum Flag { - OwnUnderlyingObject = 0x01, + DontOwnUnderlyingObject = 0x00, + OwnUnderlyingObject = 0x01, }; using Flags = unsigned; @@ -35,12 +36,20 @@ public: } inline bool own_underlying_object() const noexcept { - return (m_flags & Flags(OwnUnderlyingObject)) != 0; + return (m_flags & OwnUnderlyingObject) != 0; + } + + inline void set_own_underlying_object(bool own_underlying_object) noexcept { + if(own_underlying_object) + m_flags |= OwnUnderlyingObject; + else + m_flags &= ~OwnUnderlyingObject; } inline void swap(Wrapper& other) noexcept { using std::swap; swap(m_context, other.m_context); + swap(m_flags, other.m_flags); } friend inline void swap(Wrapper& wrapper_0, Wrapper& wrapper_1) noexcept {