Introduce VULKAN_HPP_NO_TO_STRING to optionally remove the various vk::to_string functions.

Also extend the samples to hold some local version of the needed to_string functions in case VULKAN_HPP_NO_TO_STRING is defined.
This commit is contained in:
asuessenbach
2022-07-25 17:11:30 +02:00
parent 3610b08409
commit 527e52a1bd
24 changed files with 4170 additions and 1570 deletions

View File

@@ -24,6 +24,27 @@
static char const * AppName = "EnumerateDevicesAdvanced";
static char const * EngineName = "Vulkan.hpp";
#if defined( VULKAN_HPP_NO_TO_STRING )
namespace local
{
std::string to_string( vk::PhysicalDeviceType value )
{
switch ( value )
{
case vk::PhysicalDeviceType::eOther: return "Other";
case vk::PhysicalDeviceType::eIntegratedGpu: return "IntegratedGpu";
case vk::PhysicalDeviceType::eDiscreteGpu: return "DiscreteGpu";
case vk::PhysicalDeviceType::eVirtualGpu: return "VirtualGpu";
case vk::PhysicalDeviceType::eCpu: return "Cpu";
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
} // namespace local
using local::to_string;
#else
using vk::to_string;
#endif
int main( int /*argc*/, char ** /*argv*/ )
{
try
@@ -55,7 +76,7 @@ int main( int /*argc*/, char ** /*argv*/ )
std::cout << "deviceId: " << std::setw( 6 ) << properties.deviceID << '\n';
std::cout << std::noshowbase << std::right << std::setfill( ' ' ) << std::dec;
std::cout << "deviceType: " << vk::to_string( properties.deviceType ) << "\n";
std::cout << "deviceType: " << to_string( properties.deviceType ) << "\n";
std::cout << "deviceName: " << properties.deviceName << '\n';