mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Merge pull request #607 from asuessenbach/loader
Extend DynamicLoader loading policy
This commit is contained in:
commit
0f5a571e88
@ -1408,13 +1408,29 @@ void VulkanHppGenerator::appendDispatchLoaderDynamic( std::string & str )
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
# ifdef VULKAN_HPP_NO_EXCEPTIONS
|
# ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||||
DynamicLoader() VULKAN_HPP_NOEXCEPT : m_success( false )
|
DynamicLoader( std::string const & vulkanLibraryName = {} ) VULKAN_HPP_NOEXCEPT : m_success( false )
|
||||||
# else
|
# else
|
||||||
DynamicLoader() : m_success( false )
|
DynamicLoader( std::string const & vulkanLibraryName = {} ) : m_success( false )
|
||||||
# endif
|
# endif
|
||||||
{
|
{
|
||||||
|
if ( !vulkanLibraryName.empty() )
|
||||||
|
{
|
||||||
|
# if defined( __linux__ ) || defined( __APPLE__ )
|
||||||
|
m_library = dlopen( vulkanLibraryName.c_str(), RTLD_NOW | RTLD_LOCAL );
|
||||||
|
# elif defined( _WIN32 )
|
||||||
|
m_library = LoadLibrary( vulkanLibraryName.c_str() );
|
||||||
|
# else
|
||||||
|
VULKAN_HPP_ASSERT( false && "unsupported platform" );
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
# if defined( __linux__ )
|
# if defined( __linux__ )
|
||||||
|
m_library = dlopen( "libvulkan.so", RTLD_NOW | RTLD_LOCAL );
|
||||||
|
if ( m_library == nullptr )
|
||||||
|
{
|
||||||
m_library = dlopen( "libvulkan.so.1", RTLD_NOW | RTLD_LOCAL );
|
m_library = dlopen( "libvulkan.so.1", RTLD_NOW | RTLD_LOCAL );
|
||||||
|
}
|
||||||
# elif defined( __APPLE__ )
|
# elif defined( __APPLE__ )
|
||||||
m_library = dlopen( "libvulkan.dylib", RTLD_NOW | RTLD_LOCAL );
|
m_library = dlopen( "libvulkan.dylib", RTLD_NOW | RTLD_LOCAL );
|
||||||
# elif defined( _WIN32 )
|
# elif defined( _WIN32 )
|
||||||
@ -1422,8 +1438,9 @@ void VulkanHppGenerator::appendDispatchLoaderDynamic( std::string & str )
|
|||||||
# else
|
# else
|
||||||
VULKAN_HPP_ASSERT( false && "unsupported platform" );
|
VULKAN_HPP_ASSERT( false && "unsupported platform" );
|
||||||
# endif
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
m_success = m_library != 0;
|
m_success = (m_library != nullptr);
|
||||||
#ifndef VULKAN_HPP_NO_EXCEPTIONS
|
#ifndef VULKAN_HPP_NO_EXCEPTIONS
|
||||||
if ( !m_success )
|
if ( !m_success )
|
||||||
{
|
{
|
||||||
|
@ -96708,13 +96708,29 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
# ifdef VULKAN_HPP_NO_EXCEPTIONS
|
# ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||||
DynamicLoader() VULKAN_HPP_NOEXCEPT : m_success( false )
|
DynamicLoader( std::string const & vulkanLibraryName = {} ) VULKAN_HPP_NOEXCEPT : m_success( false )
|
||||||
# else
|
# else
|
||||||
DynamicLoader() : m_success( false )
|
DynamicLoader( std::string const & vulkanLibraryName = {} ) : m_success( false )
|
||||||
# endif
|
# endif
|
||||||
{
|
{
|
||||||
|
if ( !vulkanLibraryName.empty() )
|
||||||
|
{
|
||||||
|
# if defined( __linux__ ) || defined( __APPLE__ )
|
||||||
|
m_library = dlopen( vulkanLibraryName.c_str(), RTLD_NOW | RTLD_LOCAL );
|
||||||
|
# elif defined( _WIN32 )
|
||||||
|
m_library = LoadLibrary( vulkanLibraryName.c_str() );
|
||||||
|
# else
|
||||||
|
VULKAN_HPP_ASSERT( false && "unsupported platform" );
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
# if defined( __linux__ )
|
# if defined( __linux__ )
|
||||||
|
m_library = dlopen( "libvulkan.so", RTLD_NOW | RTLD_LOCAL );
|
||||||
|
if ( m_library == nullptr )
|
||||||
|
{
|
||||||
m_library = dlopen( "libvulkan.so.1", RTLD_NOW | RTLD_LOCAL );
|
m_library = dlopen( "libvulkan.so.1", RTLD_NOW | RTLD_LOCAL );
|
||||||
|
}
|
||||||
# elif defined( __APPLE__ )
|
# elif defined( __APPLE__ )
|
||||||
m_library = dlopen( "libvulkan.dylib", RTLD_NOW | RTLD_LOCAL );
|
m_library = dlopen( "libvulkan.dylib", RTLD_NOW | RTLD_LOCAL );
|
||||||
# elif defined( _WIN32 )
|
# elif defined( _WIN32 )
|
||||||
@ -96722,8 +96738,9 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
# else
|
# else
|
||||||
VULKAN_HPP_ASSERT( false && "unsupported platform" );
|
VULKAN_HPP_ASSERT( false && "unsupported platform" );
|
||||||
# endif
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
m_success = m_library != 0;
|
m_success = ( m_library != nullptr );
|
||||||
# ifndef VULKAN_HPP_NO_EXCEPTIONS
|
# ifndef VULKAN_HPP_NO_EXCEPTIONS
|
||||||
if ( !m_success )
|
if ( !m_success )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user