Hide functions reflect() behind VULKAN_HPP_USE_REFLECT.

This commit is contained in:
asuessenbach 2022-02-17 09:53:32 +01:00
parent 12dac7ffaa
commit 3e1e23914e
3 changed files with 1461 additions and 1457 deletions

View File

@ -639,11 +639,15 @@ With C++20, the so-called spaceship-operator ```<=>``` is introduced. If that op
With this define you can specify whether the ```DispatchLoaderDynamic``` is imported or exported (see ```VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE```). If ```VULKAN_HPP_STORAGE_API``` is not defined externally, and ```VULKAN_HPP_STORAGE_SHARED``` is defined, depending on the ```VULKAN_HPP_STORAGE_SHARED_EXPORT``` being defined, ```VULKAN_HPP_STORAGE_API``` is either set to ```__declspec( dllexport )``` (for MSVC) / ```__attribute__( ( visibility( "default" ) ) )``` (for gcc or clang) or ```__declspec( dllimport )``` (for MSVC), respectively. For other compilers, you might specify the corresponding storage by defining ```VULKAN_HPP_STORAGE_API``` on your own.
#### VULKAN_HPP_TYPESAFE_CONVERSION
32-bit vulkan is not typesafe for 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```.
#### VULKAN_HPP_USE_REFLECT
With this define you can include a reflection mechanism on the vk-structures. It adds a function ```reflect``` that returns a tuple-version of the structure. That tuple then could easily be iterated. But at least for now, that feature takes lots of compile-time resources, so currently it is recommended to enable that feature only if you're willing to pay that price.
## Deprecated elements
There are a couple of elements in vulkan.hpp that are marked as deprecated (with C++14 and above):

View File

@ -11244,10 +11244,10 @@ ${spaceshipMembers}
}
else
{
// reflection is not available with gcc 7.5 and below!
static const std::string compareBodyTemplate = R"(#if !defined( __GNUC__ ) || (70500 < GCC_VERSION)
// use reflection only if VULKAN_HPP_USE_REFLECT is defined
static const std::string compareBodyTemplate = R"(#if defined( VULKAN_HPP_USE_REFLECT )
return this->reflect() == rhs.reflect();
#else
#else
return ${compareMembers};
#endif)";
compareBody = replaceWithMap( compareBodyTemplate, { { "compareMembers", compareMembers } } );
@ -11607,9 +11607,9 @@ std::string VulkanHppGenerator::generateStructure( std::pair<std::string, Struct
std::string reflect;
if ( !structure.second.isUnion )
{
// gcc compilers 7.5 and before can't tie the large tuples you get here !!
// use reflection only if VULKAN_HPP_USE_REFLECT is defined
static const std::string reflectTemplate = R"(
#if !defined( __GNUC__ ) || (70500 < GCC_VERSION)
#if defined( VULKAN_HPP_USE_REFLECT )
#if 14 <= VULKAN_HPP_CPP_VERSION
auto
#else

File diff suppressed because it is too large Load Diff