Skip to content

Commit

Permalink
Fix for VULKAN_HPP_TYPESAFE_CONVERSION defined to 0 (#1806)
Browse files Browse the repository at this point in the history
* Fix for VULKAN_HPP_TYPESAFE_CONVERSION defined to 0

* Remove the check if VULKAN_HPP_TYPESAFE_CONVERSION actually is defined, just check if it's 1.

---------

Co-authored-by: asuessenbach <[email protected]>
  • Loading branch information
d235j and asuessenbach authored Mar 11, 2024
1 parent 80826e4 commit 1722636
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 84 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ With this define you can specify whether the ```DispatchLoaderDynamic``` is impo

#### VULKAN_HPP_TYPESAFE_CONVERSION

32-bit vulkan is not typesafe for non-dispatchable handles, so we don't allow copy constructors on this platform by default. To enable this feature on 32-bit platforms define ```VULKAN_HPP_TYPESAFE_CONVERSION```.
32-bit vulkan is not typesafe for non-dispatchable handles, so we don't allow copy constructors on this platform by default. To enable this feature on 32-bit platforms, ```#define VULKAN_HPP_TYPESAFE_CONVERSION 1```. To disable this feature on 64-bit platforms, ```#define VULKAN_HPP_TYPESAFE_CONVERSION 0```.

#### VULKAN_HPP_UNEXPECTED

Expand Down
2 changes: 1 addition & 1 deletion VulkanHppGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7582,7 +7582,7 @@ std::string VulkanHppGenerator::generateHandle( std::pair<std::string, HandleDat
}

const std::string typesafeExplicitKeyword = handleData.second.isDispatchable ? "" : "VULKAN_HPP_TYPESAFE_EXPLICIT ";
const std::string typesafeConversionConditional = handleData.second.isDispatchable ? "" : "#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)\n";
const std::string typesafeConversionConditional = handleData.second.isDispatchable ? "" : "#if ( VULKAN_HPP_TYPESAFE_CONVERSION == 1 )\n";
const std::string typesafeConversionConditionalEnd = handleData.second.isDispatchable ? "" : "#endif\n";

static const std::string templateString = R"(
Expand Down
8 changes: 5 additions & 3 deletions snippets/macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,15 @@
#endif

// 32-bit vulkan is not typesafe for non-dispatchable handles, so don't allow copy constructors on this platform by default.
// To enable this feature on 32-bit platforms please define VULKAN_HPP_TYPESAFE_CONVERSION
// To enable this feature on 32-bit platforms please #define VULKAN_HPP_TYPESAFE_CONVERSION 1
// To disable this feature on 64-bit platforms please #define VULKAN_HPP_TYPESAFE_CONVERSION 0
#if ( VK_USE_64_BIT_PTR_DEFINES == 1 )
# if !defined( VULKAN_HPP_TYPESAFE_CONVERSION )
# define VULKAN_HPP_TYPESAFE_CONVERSION
# define VULKAN_HPP_TYPESAFE_CONVERSION 1
# endif
#endif


#if defined( __GNUC__ )
# define GCC_VERSION ( __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ )
#endif
Expand Down Expand Up @@ -121,7 +123,7 @@
# endif
#endif

#if defined( VULKAN_HPP_TYPESAFE_CONVERSION )
#if ( VULKAN_HPP_TYPESAFE_CONVERSION == 1 )
# define VULKAN_HPP_TYPESAFE_EXPLICIT
#else
# define VULKAN_HPP_TYPESAFE_EXPLICIT explicit
Expand Down
Loading

0 comments on commit 1722636

Please sign in to comment.