Merge pull request #768 from kiroma/master

Remove m_success from vk::DynamicLoader
This commit is contained in:
Andreas Süßenbach 2020-10-12 09:35:18 +02:00 committed by GitHub
commit 6f38e39e4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 20 deletions

View File

@ -1976,9 +1976,9 @@ void VulkanHppGenerator::appendDispatchLoaderDynamic( std::string & str )
{ {
public: public:
# ifdef VULKAN_HPP_NO_EXCEPTIONS # ifdef VULKAN_HPP_NO_EXCEPTIONS
DynamicLoader( std::string const & vulkanLibraryName = {} ) VULKAN_HPP_NOEXCEPT : m_success( false ) DynamicLoader( std::string const & vulkanLibraryName = {} ) VULKAN_HPP_NOEXCEPT
# else # else
DynamicLoader( std::string const & vulkanLibraryName = {} ) : m_success( false ) DynamicLoader( std::string const & vulkanLibraryName = {} )
# endif # endif
{ {
if ( !vulkanLibraryName.empty() ) if ( !vulkanLibraryName.empty() )
@ -2008,9 +2008,8 @@ void VulkanHppGenerator::appendDispatchLoaderDynamic( std::string & str )
# endif # endif
} }
m_success = (m_library != nullptr);
#ifndef VULKAN_HPP_NO_EXCEPTIONS #ifndef VULKAN_HPP_NO_EXCEPTIONS
if ( !m_success ) if ( m_library == nullptr )
{ {
// NOTE there should be an InitializationFailedError, but msvc insists on the symbol does not exist within the scope of this function. // NOTE there should be an InitializationFailedError, but msvc insists on the symbol does not exist within the scope of this function.
throw std::runtime_error( "Failed to load vulkan library!" ); throw std::runtime_error( "Failed to load vulkan library!" );
@ -2020,9 +2019,7 @@ void VulkanHppGenerator::appendDispatchLoaderDynamic( std::string & str )
DynamicLoader( DynamicLoader const& ) = delete; DynamicLoader( DynamicLoader const& ) = delete;
DynamicLoader( DynamicLoader && other ) VULKAN_HPP_NOEXCEPT DynamicLoader( DynamicLoader && other ) VULKAN_HPP_NOEXCEPT : m_library(other.m_library)
: m_success(other.m_success)
, m_library(other.m_library)
{ {
other.m_library = nullptr; other.m_library = nullptr;
} }
@ -2031,7 +2028,6 @@ void VulkanHppGenerator::appendDispatchLoaderDynamic( std::string & str )
DynamicLoader &operator=( DynamicLoader && other ) VULKAN_HPP_NOEXCEPT DynamicLoader &operator=( DynamicLoader && other ) VULKAN_HPP_NOEXCEPT
{ {
m_success = other.m_success;
std::swap(m_library, other.m_library); std::swap(m_library, other.m_library);
return *this; return *this;
} }
@ -2062,10 +2058,9 @@ void VulkanHppGenerator::appendDispatchLoaderDynamic( std::string & str )
# endif # endif
} }
bool success() const VULKAN_HPP_NOEXCEPT { return m_success; } bool success() const VULKAN_HPP_NOEXCEPT { return m_library != nullptr; }
private: private:
bool m_success;
# if defined( __linux__ ) || defined( __APPLE__ ) # if defined( __linux__ ) || defined( __APPLE__ )
void * m_library; void * m_library;
# elif defined( _WIN32 ) # elif defined( _WIN32 )

View File

@ -108298,9 +108298,9 @@ namespace VULKAN_HPP_NAMESPACE
{ {
public: public:
# ifdef VULKAN_HPP_NO_EXCEPTIONS # ifdef VULKAN_HPP_NO_EXCEPTIONS
DynamicLoader( std::string const & vulkanLibraryName = {} ) VULKAN_HPP_NOEXCEPT : m_success( false ) DynamicLoader( std::string const & vulkanLibraryName = {} ) VULKAN_HPP_NOEXCEPT
# else # else
DynamicLoader( std::string const & vulkanLibraryName = {} ) : m_success( false ) DynamicLoader( std::string const & vulkanLibraryName = {} )
# endif # endif
{ {
if ( !vulkanLibraryName.empty() ) if ( !vulkanLibraryName.empty() )
@ -108330,9 +108330,8 @@ namespace VULKAN_HPP_NAMESPACE
# endif # endif
} }
m_success = ( m_library != nullptr );
# ifndef VULKAN_HPP_NO_EXCEPTIONS # ifndef VULKAN_HPP_NO_EXCEPTIONS
if ( !m_success ) if ( m_library == nullptr )
{ {
// NOTE there should be an InitializationFailedError, but msvc insists on the symbol does not exist within the // NOTE there should be an InitializationFailedError, but msvc insists on the symbol does not exist within the
// scope of this function. // scope of this function.
@ -108343,9 +108342,7 @@ namespace VULKAN_HPP_NAMESPACE
DynamicLoader( DynamicLoader const & ) = delete; DynamicLoader( DynamicLoader const & ) = delete;
DynamicLoader( DynamicLoader && other ) VULKAN_HPP_NOEXCEPT DynamicLoader( DynamicLoader && other ) VULKAN_HPP_NOEXCEPT : m_library( other.m_library )
: m_success( other.m_success )
, m_library( other.m_library )
{ {
other.m_library = nullptr; other.m_library = nullptr;
} }
@ -108354,7 +108351,6 @@ namespace VULKAN_HPP_NAMESPACE
DynamicLoader & operator=( DynamicLoader && other ) VULKAN_HPP_NOEXCEPT DynamicLoader & operator=( DynamicLoader && other ) VULKAN_HPP_NOEXCEPT
{ {
m_success = other.m_success;
std::swap( m_library, other.m_library ); std::swap( m_library, other.m_library );
return *this; return *this;
} }
@ -108387,11 +108383,10 @@ namespace VULKAN_HPP_NAMESPACE
bool success() const VULKAN_HPP_NOEXCEPT bool success() const VULKAN_HPP_NOEXCEPT
{ {
return m_success; return m_library != nullptr;
} }
private: private:
bool m_success;
# if defined( __linux__ ) || defined( __APPLE__ ) # if defined( __linux__ ) || defined( __APPLE__ )
void * m_library; void * m_library;
# elif defined( _WIN32 ) # elif defined( _WIN32 )