Merge pull request #1365 from asuessenbach/compile

Move the vk::to_string functions into a separate header vulkan_to_string.hpp.
This commit is contained in:
Andreas Süßenbach 2022-07-26 15:08:39 +02:00 committed by GitHub
commit fa62e680f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 8026 additions and 10566 deletions

View File

@ -86,30 +86,6 @@ if (NOT DEFINED VulkanHeaders_INCLUDE_DIR)
set(VulkanHeaders_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
endif()
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan.hpp vulkan_hpp)
string(REPLACE "\\" "\\\\" vulkan_hpp ${vulkan_hpp})
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_enums.hpp vulkan_enums_hpp)
string(REPLACE "\\" "\\\\" vulkan_enums_hpp ${vulkan_enums_hpp})
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_format_traits.hpp vulkan_format_traits_hpp)
string(REPLACE "\\" "\\\\" vulkan_format_traits_hpp ${vulkan_format_traits_hpp})
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_funcs.hpp vulkan_funcs_hpp)
string(REPLACE "\\" "\\\\" vulkan_funcs_hpp ${vulkan_funcs_hpp})
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_handles.hpp vulkan_handles_hpp)
string(REPLACE "\\" "\\\\" vulkan_handles_hpp ${vulkan_handles_hpp})
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_structs.hpp vulkan_structs_hpp)
string(REPLACE "\\" "\\\\" vulkan_structs_hpp ${vulkan_structs_hpp})
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_hash.hpp vulkan_hash_hpp)
string(REPLACE "\\" "\\\\" vulkan_hash_hpp ${vulkan_hash_hpp})
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_raii.hpp vulkan_raii_hpp)
string(REPLACE "\\" "\\\\" vulkan_raii_hpp ${vulkan_raii_hpp})
add_definitions(-DVULKAN_HPP_FILE="${vulkan_hpp}"
-DVULKAN_ENUMS_HPP_FILE="${vulkan_enums_hpp}"
-DVULKAN_FORMAT_TRAITS_HPP_FILE="${vulkan_format_traits_hpp}"
-DVULKAN_FUNCS_HPP_FILE="${vulkan_funcs_hpp}"
-DVULKAN_HANDLES_HPP_FILE="${vulkan_handles_hpp}"
-DVULKAN_STRUCTS_HPP_FILE="${vulkan_structs_hpp}"
-DVULKAN_HASH_HPP_FILE="${vulkan_hash_hpp}"
-DVULKAN_RAII_HPP_FILE="${vulkan_raii_hpp}")
include_directories(${VulkanHeaders_INCLUDE_DIR})
set(HEADERS
@ -145,27 +121,56 @@ add_executable(VulkanHppGenerator
${TINYXML2_HEADERS}
)
set_property(TARGET VulkanHppGenerator PROPERTY CXX_STANDARD 17)
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan.hpp vulkan_hpp)
string(REPLACE "\\" "\\\\" vulkan_hpp ${vulkan_hpp})
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_enums.hpp vulkan_enums_hpp)
string(REPLACE "\\" "\\\\" vulkan_enums_hpp ${vulkan_enums_hpp})
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_format_traits.hpp vulkan_format_traits_hpp)
string(REPLACE "\\" "\\\\" vulkan_format_traits_hpp ${vulkan_format_traits_hpp})
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_funcs.hpp vulkan_funcs_hpp)
string(REPLACE "\\" "\\\\" vulkan_funcs_hpp ${vulkan_funcs_hpp})
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_handles.hpp vulkan_handles_hpp)
string(REPLACE "\\" "\\\\" vulkan_handles_hpp ${vulkan_handles_hpp})
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_hash.hpp vulkan_hash_hpp)
string(REPLACE "\\" "\\\\" vulkan_hash_hpp ${vulkan_hash_hpp})
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_raii.hpp vulkan_raii_hpp)
string(REPLACE "\\" "\\\\" vulkan_raii_hpp ${vulkan_raii_hpp})
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_structs.hpp vulkan_structs_hpp)
string(REPLACE "\\" "\\\\" vulkan_structs_hpp ${vulkan_structs_hpp})
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_to_string.hpp vulkan_to_string_hpp)
string(REPLACE "\\" "\\\\" vulkan_to_string_hpp ${vulkan_to_string_hpp})
target_compile_definitions(${PROJECT_NAME} PUBLIC
-DVULKAN_HPP_FILE="${vulkan_hpp}"
-DVULKAN_ENUMS_HPP_FILE="${vulkan_enums_hpp}"
-DVULKAN_FORMAT_TRAITS_HPP_FILE="${vulkan_format_traits_hpp}"
-DVULKAN_FUNCS_HPP_FILE="${vulkan_funcs_hpp}"
-DVULKAN_HANDLES_HPP_FILE="${vulkan_handles_hpp}"
-DVULKAN_HASH_HPP_FILE="${vulkan_hash_hpp}"
-DVULKAN_RAII_HPP_FILE="${vulkan_raii_hpp}"
-DVULKAN_STRUCTS_HPP_FILE="${vulkan_structs_hpp}"
-DVULKAN_TO_STRING_HPP_FILE="${vulkan_to_string_hpp}")
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17)
if(MSVC)
target_compile_options(VulkanHppGenerator PRIVATE /W4 /WX)
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX)
if (MSVC_VER GREATER_EQUAL 1910)
target_compile_options(VulkanHppGenerator PRIVATE /permissive-)
target_compile_options(${PROJECT_NAME} PRIVATE /permissive-)
endif()
else(MSVC)
target_compile_options(VulkanHppGenerator PRIVATE -Wall -Wextra -pedantic -Werror)
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -pedantic -Werror)
endif(MSVC)
target_include_directories(VulkanHppGenerator PRIVATE ${VULKAN_HPP_TINYXML2_SRC_DIR})
target_include_directories(${PROJECT_NAME} PRIVATE ${VULKAN_HPP_TINYXML2_SRC_DIR})
option (VULKAN_HPP_RUN_GENERATOR "Run the HPP generator" OFF)
if (VULKAN_HPP_RUN_GENERATOR)
add_custom_command(
COMMAND VulkanHppGenerator
COMMAND ${PROJECT_NAME}
OUTPUT "${vulkan_hpp}"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
COMMENT "run VulkanHppGenerator"
DEPENDS VulkanHppGenerator "${vk_spec}")
COMMENT "run ${PROJECT_NAME}"
DEPENDS ${PROJECT_NAME} "${vk_spec}")
add_custom_target(build_vulkan_hpp ALL
DEPENDS "${vulkan_hpp}" "${vk_spec}")

View File

@ -19,161 +19,11 @@
#include <iostream>
#include <sstream>
#include <vulkan/vulkan_to_string.hpp>
static char const * AppName = "CreateDebugReportMessenger";
static char const * EngineName = "Vulkan.hpp";
#if defined( VULKAN_HPP_NO_TO_STRING )
namespace local
{
std::string to_string( vk::DebugUtilsMessageSeverityFlagBitsEXT value )
{
switch ( value )
{
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eVerbose: return "Verbose";
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eInfo: return "Info";
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning: return "Warning";
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eError: return "Error";
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
std::string to_string( vk::DebugUtilsMessageTypeFlagsEXT value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::DebugUtilsMessageTypeFlagBitsEXT::eGeneral )
result += "General | ";
if ( value & vk::DebugUtilsMessageTypeFlagBitsEXT::eValidation )
result += "Validation | ";
if ( value & vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance )
result += "Performance | ";
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
std::string to_string( vk::ObjectType value )
{
switch ( value )
{
case vk::ObjectType::eUnknown: return "Unknown";
case vk::ObjectType::eInstance: return "Instance";
case vk::ObjectType::ePhysicalDevice: return "PhysicalDevice";
case vk::ObjectType::eDevice: return "Device";
case vk::ObjectType::eQueue: return "Queue";
case vk::ObjectType::eSemaphore: return "Semaphore";
case vk::ObjectType::eCommandBuffer: return "CommandBuffer";
case vk::ObjectType::eFence: return "Fence";
case vk::ObjectType::eDeviceMemory: return "DeviceMemory";
case vk::ObjectType::eBuffer: return "Buffer";
case vk::ObjectType::eImage: return "Image";
case vk::ObjectType::eEvent: return "Event";
case vk::ObjectType::eQueryPool: return "QueryPool";
case vk::ObjectType::eBufferView: return "BufferView";
case vk::ObjectType::eImageView: return "ImageView";
case vk::ObjectType::eShaderModule: return "ShaderModule";
case vk::ObjectType::ePipelineCache: return "PipelineCache";
case vk::ObjectType::ePipelineLayout: return "PipelineLayout";
case vk::ObjectType::eRenderPass: return "RenderPass";
case vk::ObjectType::ePipeline: return "Pipeline";
case vk::ObjectType::eDescriptorSetLayout: return "DescriptorSetLayout";
case vk::ObjectType::eSampler: return "Sampler";
case vk::ObjectType::eDescriptorPool: return "DescriptorPool";
case vk::ObjectType::eDescriptorSet: return "DescriptorSet";
case vk::ObjectType::eFramebuffer: return "Framebuffer";
case vk::ObjectType::eCommandPool: return "CommandPool";
case vk::ObjectType::eSamplerYcbcrConversion: return "SamplerYcbcrConversion";
case vk::ObjectType::eDescriptorUpdateTemplate: return "DescriptorUpdateTemplate";
case vk::ObjectType::ePrivateDataSlot: return "PrivateDataSlot";
case vk::ObjectType::eSurfaceKHR: return "SurfaceKHR";
case vk::ObjectType::eSwapchainKHR: return "SwapchainKHR";
case vk::ObjectType::eDisplayKHR: return "DisplayKHR";
case vk::ObjectType::eDisplayModeKHR: return "DisplayModeKHR";
case vk::ObjectType::eDebugReportCallbackEXT: return "DebugReportCallbackEXT";
# if defined( VK_ENABLE_BETA_EXTENSIONS )
case vk::ObjectType::eVideoSessionKHR: return "VideoSessionKHR";
case vk::ObjectType::eVideoSessionParametersKHR: return "VideoSessionParametersKHR";
# endif /*VK_ENABLE_BETA_EXTENSIONS*/
case vk::ObjectType::eCuModuleNVX: return "CuModuleNVX";
case vk::ObjectType::eCuFunctionNVX: return "CuFunctionNVX";
case vk::ObjectType::eDebugUtilsMessengerEXT: return "DebugUtilsMessengerEXT";
case vk::ObjectType::eAccelerationStructureKHR: return "AccelerationStructureKHR";
case vk::ObjectType::eValidationCacheEXT: return "ValidationCacheEXT";
case vk::ObjectType::eAccelerationStructureNV: return "AccelerationStructureNV";
case vk::ObjectType::ePerformanceConfigurationINTEL: return "PerformanceConfigurationINTEL";
case vk::ObjectType::eDeferredOperationKHR: return "DeferredOperationKHR";
case vk::ObjectType::eIndirectCommandsLayoutNV: return "IndirectCommandsLayoutNV";
# if defined( VK_USE_PLATFORM_FUCHSIA )
case vk::ObjectType::eBufferCollectionFUCHSIA: return "BufferCollectionFUCHSIA";
# endif /*VK_USE_PLATFORM_FUCHSIA*/
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
std::string to_string( vk::Result value )
{
switch ( value )
{
case vk::Result::eSuccess: return "Success";
case vk::Result::eNotReady: return "NotReady";
case vk::Result::eTimeout: return "Timeout";
case vk::Result::eEventSet: return "EventSet";
case vk::Result::eEventReset: return "EventReset";
case vk::Result::eIncomplete: return "Incomplete";
case vk::Result::eErrorOutOfHostMemory: return "ErrorOutOfHostMemory";
case vk::Result::eErrorOutOfDeviceMemory: return "ErrorOutOfDeviceMemory";
case vk::Result::eErrorInitializationFailed: return "ErrorInitializationFailed";
case vk::Result::eErrorDeviceLost: return "ErrorDeviceLost";
case vk::Result::eErrorMemoryMapFailed: return "ErrorMemoryMapFailed";
case vk::Result::eErrorLayerNotPresent: return "ErrorLayerNotPresent";
case vk::Result::eErrorExtensionNotPresent: return "ErrorExtensionNotPresent";
case vk::Result::eErrorFeatureNotPresent: return "ErrorFeatureNotPresent";
case vk::Result::eErrorIncompatibleDriver: return "ErrorIncompatibleDriver";
case vk::Result::eErrorTooManyObjects: return "ErrorTooManyObjects";
case vk::Result::eErrorFormatNotSupported: return "ErrorFormatNotSupported";
case vk::Result::eErrorFragmentedPool: return "ErrorFragmentedPool";
case vk::Result::eErrorUnknown: return "ErrorUnknown";
case vk::Result::eErrorOutOfPoolMemory: return "ErrorOutOfPoolMemory";
case vk::Result::eErrorInvalidExternalHandle: return "ErrorInvalidExternalHandle";
case vk::Result::eErrorFragmentation: return "ErrorFragmentation";
case vk::Result::eErrorInvalidOpaqueCaptureAddress: return "ErrorInvalidOpaqueCaptureAddress";
case vk::Result::ePipelineCompileRequired: return "PipelineCompileRequired";
case vk::Result::eErrorSurfaceLostKHR: return "ErrorSurfaceLostKHR";
case vk::Result::eErrorNativeWindowInUseKHR: return "ErrorNativeWindowInUseKHR";
case vk::Result::eSuboptimalKHR: return "SuboptimalKHR";
case vk::Result::eErrorOutOfDateKHR: return "ErrorOutOfDateKHR";
case vk::Result::eErrorIncompatibleDisplayKHR: return "ErrorIncompatibleDisplayKHR";
case vk::Result::eErrorValidationFailedEXT: return "ErrorValidationFailedEXT";
case vk::Result::eErrorInvalidShaderNV: return "ErrorInvalidShaderNV";
# if defined( VK_ENABLE_BETA_EXTENSIONS )
case vk::Result::eErrorImageUsageNotSupportedKHR: return "ErrorImageUsageNotSupportedKHR";
case vk::Result::eErrorVideoPictureLayoutNotSupportedKHR: return "ErrorVideoPictureLayoutNotSupportedKHR";
case vk::Result::eErrorVideoProfileOperationNotSupportedKHR: return "ErrorVideoProfileOperationNotSupportedKHR";
case vk::Result::eErrorVideoProfileFormatNotSupportedKHR: return "ErrorVideoProfileFormatNotSupportedKHR";
case vk::Result::eErrorVideoProfileCodecNotSupportedKHR: return "ErrorVideoProfileCodecNotSupportedKHR";
case vk::Result::eErrorVideoStdVersionNotSupportedKHR: return "ErrorVideoStdVersionNotSupportedKHR";
# endif /*VK_ENABLE_BETA_EXTENSIONS*/
case vk::Result::eErrorInvalidDrmFormatModifierPlaneLayoutEXT: return "ErrorInvalidDrmFormatModifierPlaneLayoutEXT";
case vk::Result::eErrorNotPermittedKHR: return "ErrorNotPermittedKHR";
# if defined( VK_USE_PLATFORM_WIN32_KHR )
case vk::Result::eErrorFullScreenExclusiveModeLostEXT: return "ErrorFullScreenExclusiveModeLostEXT";
# endif /*VK_USE_PLATFORM_WIN32_KHR*/
case vk::Result::eThreadIdleKHR: return "ThreadIdleKHR";
case vk::Result::eThreadDoneKHR: return "ThreadDoneKHR";
case vk::Result::eOperationDeferredKHR: return "OperationDeferredKHR";
case vk::Result::eOperationNotDeferredKHR: return "OperationNotDeferredKHR";
case vk::Result::eErrorCompressionExhaustedEXT: return "ErrorCompressionExhaustedEXT";
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
} // namespace local
using local::to_string;
#else
using vk::to_string;
#endif
VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
VkDebugUtilsMessageTypeFlagsEXT messageTypes,
VkDebugUtilsMessengerCallbackDataEXT const * pCallbackData,
@ -181,8 +31,8 @@ VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( VkDebugUtilsMessageSeverityFlag
{
std::ostringstream message;
message << to_string( static_cast<vk::DebugUtilsMessageSeverityFlagBitsEXT>( messageSeverity ) ) << ": "
<< to_string( static_cast<vk::DebugUtilsMessageTypeFlagsEXT>( messageTypes ) ) << ":\n";
message << vk::to_string( static_cast<vk::DebugUtilsMessageSeverityFlagBitsEXT>( messageSeverity ) ) << ": "
<< vk::to_string( static_cast<vk::DebugUtilsMessageTypeFlagsEXT>( messageTypes ) ) << ":\n";
message << std::string( "\t" ) << "messageIDName = <" << pCallbackData->pMessageIdName << ">\n";
message << std::string( "\t" ) << "messageIdNumber = " << pCallbackData->messageIdNumber << "\n";
message << std::string( "\t" ) << "message = <" << pCallbackData->pMessage << ">\n";
@ -208,7 +58,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( VkDebugUtilsMessageSeverityFlag
for ( uint32_t i = 0; i < pCallbackData->objectCount; i++ )
{
message << std::string( "\t\t" ) << "Object " << i << "\n";
message << std::string( "\t\t\t" ) << "objectType = " << to_string( static_cast<vk::ObjectType>( pCallbackData->pObjects[i].objectType ) ) << "\n";
message << std::string( "\t\t\t" ) << "objectType = " << vk::to_string( static_cast<vk::ObjectType>( pCallbackData->pObjects[i].objectType ) ) << "\n";
message << std::string( "\t\t\t" ) << "objectHandle = " << pCallbackData->pObjects[i].objectHandle << "\n";
if ( pCallbackData->pObjects[i].pObjectName )
{

View File

@ -26,11 +26,12 @@
#endif
#include "../utils/utils.hpp"
#include "vulkan/vulkan_raii.hpp"
#include <algorithm>
#include <iostream>
#include <sstream>
#include <vulkan/vulkan_raii.hpp>
#include <vulkan/vulkan_to_string.hpp>
static char const * AppName = "EnableValidationWithCallback";
static char const * EngineName = "Vulkan.hpp";
@ -38,100 +39,6 @@ static char const * EngineName = "Vulkan.hpp";
PFN_vkCreateDebugUtilsMessengerEXT pfnVkCreateDebugUtilsMessengerEXT;
PFN_vkDestroyDebugUtilsMessengerEXT pfnVkDestroyDebugUtilsMessengerEXT;
#if defined( VULKAN_HPP_NO_TO_STRING )
namespace local
{
std::string to_string( vk::DebugUtilsMessageSeverityFlagBitsEXT value )
{
switch ( value )
{
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eVerbose: return "Verbose";
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eInfo: return "Info";
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning: return "Warning";
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eError: return "Error";
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
std::string to_string( vk::DebugUtilsMessageTypeFlagsEXT value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::DebugUtilsMessageTypeFlagBitsEXT::eGeneral )
result += "General | ";
if ( value & vk::DebugUtilsMessageTypeFlagBitsEXT::eValidation )
result += "Validation | ";
if ( value & vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance )
result += "Performance | ";
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
std::string to_string( vk::ObjectType value )
{
switch ( value )
{
case vk::ObjectType::eUnknown: return "Unknown";
case vk::ObjectType::eInstance: return "Instance";
case vk::ObjectType::ePhysicalDevice: return "PhysicalDevice";
case vk::ObjectType::eDevice: return "Device";
case vk::ObjectType::eQueue: return "Queue";
case vk::ObjectType::eSemaphore: return "Semaphore";
case vk::ObjectType::eCommandBuffer: return "CommandBuffer";
case vk::ObjectType::eFence: return "Fence";
case vk::ObjectType::eDeviceMemory: return "DeviceMemory";
case vk::ObjectType::eBuffer: return "Buffer";
case vk::ObjectType::eImage: return "Image";
case vk::ObjectType::eEvent: return "Event";
case vk::ObjectType::eQueryPool: return "QueryPool";
case vk::ObjectType::eBufferView: return "BufferView";
case vk::ObjectType::eImageView: return "ImageView";
case vk::ObjectType::eShaderModule: return "ShaderModule";
case vk::ObjectType::ePipelineCache: return "PipelineCache";
case vk::ObjectType::ePipelineLayout: return "PipelineLayout";
case vk::ObjectType::eRenderPass: return "RenderPass";
case vk::ObjectType::ePipeline: return "Pipeline";
case vk::ObjectType::eDescriptorSetLayout: return "DescriptorSetLayout";
case vk::ObjectType::eSampler: return "Sampler";
case vk::ObjectType::eDescriptorPool: return "DescriptorPool";
case vk::ObjectType::eDescriptorSet: return "DescriptorSet";
case vk::ObjectType::eFramebuffer: return "Framebuffer";
case vk::ObjectType::eCommandPool: return "CommandPool";
case vk::ObjectType::eSamplerYcbcrConversion: return "SamplerYcbcrConversion";
case vk::ObjectType::eDescriptorUpdateTemplate: return "DescriptorUpdateTemplate";
case vk::ObjectType::ePrivateDataSlot: return "PrivateDataSlot";
case vk::ObjectType::eSurfaceKHR: return "SurfaceKHR";
case vk::ObjectType::eSwapchainKHR: return "SwapchainKHR";
case vk::ObjectType::eDisplayKHR: return "DisplayKHR";
case vk::ObjectType::eDisplayModeKHR: return "DisplayModeKHR";
case vk::ObjectType::eDebugReportCallbackEXT: return "DebugReportCallbackEXT";
# if defined( VK_ENABLE_BETA_EXTENSIONS )
case vk::ObjectType::eVideoSessionKHR: return "VideoSessionKHR";
case vk::ObjectType::eVideoSessionParametersKHR: return "VideoSessionParametersKHR";
# endif /*VK_ENABLE_BETA_EXTENSIONS*/
case vk::ObjectType::eCuModuleNVX: return "CuModuleNVX";
case vk::ObjectType::eCuFunctionNVX: return "CuFunctionNVX";
case vk::ObjectType::eDebugUtilsMessengerEXT: return "DebugUtilsMessengerEXT";
case vk::ObjectType::eAccelerationStructureKHR: return "AccelerationStructureKHR";
case vk::ObjectType::eValidationCacheEXT: return "ValidationCacheEXT";
case vk::ObjectType::eAccelerationStructureNV: return "AccelerationStructureNV";
case vk::ObjectType::ePerformanceConfigurationINTEL: return "PerformanceConfigurationINTEL";
case vk::ObjectType::eDeferredOperationKHR: return "DeferredOperationKHR";
case vk::ObjectType::eIndirectCommandsLayoutNV: return "IndirectCommandsLayoutNV";
# if defined( VK_USE_PLATFORM_FUCHSIA )
case vk::ObjectType::eBufferCollectionFUCHSIA: return "BufferCollectionFUCHSIA";
# endif /*VK_USE_PLATFORM_FUCHSIA*/
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
} // namespace local
using local::to_string;
#else
using vk::to_string;
#endif
VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugUtilsMessengerEXT( VkInstance instance,
const VkDebugUtilsMessengerCreateInfoEXT * pCreateInfo,
const VkAllocationCallbacks * pAllocator,
@ -152,8 +59,8 @@ VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( VkDebugUtilsMessageSeverityFlag
{
std::string message;
message += to_string( static_cast<vk::DebugUtilsMessageSeverityFlagBitsEXT>( messageSeverity ) ) + ": " +
to_string( static_cast<vk::DebugUtilsMessageTypeFlagsEXT>( messageTypes ) ) + ":\n";
message += vk::to_string( static_cast<vk::DebugUtilsMessageSeverityFlagBitsEXT>( messageSeverity ) ) + ": " +
vk::to_string( static_cast<vk::DebugUtilsMessageTypeFlagsEXT>( messageTypes ) ) + ":\n";
message += std::string( "\t" ) + "messageIDName = <" + pCallbackData->pMessageIdName + ">\n";
message += std::string( "\t" ) + "messageIdNumber = " + std::to_string( pCallbackData->messageIdNumber ) + "\n";
message += std::string( "\t" ) + "message = <" + pCallbackData->pMessage + ">\n";
@ -178,7 +85,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( VkDebugUtilsMessageSeverityFlag
for ( uint32_t i = 0; i < pCallbackData->objectCount; i++ )
{
message += std::string( "\t" ) + "Object " + std::to_string( i ) + "\n";
message += std::string( "\t\t" ) + "objectType = " + to_string( static_cast<vk::ObjectType>( pCallbackData->pObjects[i].objectType ) ) + "\n";
message += std::string( "\t\t" ) + "objectType = " + vk::to_string( static_cast<vk::ObjectType>( pCallbackData->pObjects[i].objectType ) ) + "\n";
message += std::string( "\t\t" ) + "objectHandle = " + std::to_string( pCallbackData->pObjects[i].objectHandle ) + "\n";
if ( pCallbackData->pObjects[i].pObjectName )
{

View File

@ -16,35 +16,15 @@
// Enumerate physical devices
#include "../utils/utils.hpp"
#include "vulkan/vulkan_raii.hpp"
#include <iomanip>
#include <iostream>
#include <vulkan/vulkan_raii.hpp>
#include <vulkan/vulkan_to_string.hpp>
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
@ -77,7 +57,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: " << to_string( properties.deviceType ) << "\n";
std::cout << "deviceType: " << vk::to_string( properties.deviceType ) << "\n";
std::cout << "deviceName: " << properties.deviceName << '\n';

View File

@ -16,64 +16,15 @@
// Get memory properties per physical device.
#include "../utils/utils.hpp"
#include "vulkan/vulkan.hpp"
#include <sstream>
#include <vector>
#include <vulkan/vulkan.hpp>
#include <vulkan/vulkan_to_string.hpp>
static char const * AppName = "PhysicalDeviceMemoryProperties";
static char const * EngineName = "Vulkan.hpp";
#if defined( VULKAN_HPP_NO_TO_STRING )
namespace local
{
std::string to_string( vk::MemoryHeapFlags value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::MemoryHeapFlagBits::eDeviceLocal )
result += "DeviceLocal | ";
if ( value & vk::MemoryHeapFlagBits::eMultiInstance )
result += "MultiInstance | ";
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
std::string to_string( vk::MemoryPropertyFlags value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::MemoryPropertyFlagBits::eDeviceLocal )
result += "DeviceLocal | ";
if ( value & vk::MemoryPropertyFlagBits::eHostVisible )
result += "HostVisible | ";
if ( value & vk::MemoryPropertyFlagBits::eHostCoherent )
result += "HostCoherent | ";
if ( value & vk::MemoryPropertyFlagBits::eHostCached )
result += "HostCached | ";
if ( value & vk::MemoryPropertyFlagBits::eLazilyAllocated )
result += "LazilyAllocated | ";
if ( value & vk::MemoryPropertyFlagBits::eProtected )
result += "Protected | ";
if ( value & vk::MemoryPropertyFlagBits::eDeviceCoherentAMD )
result += "DeviceCoherentAMD | ";
if ( value & vk::MemoryPropertyFlagBits::eDeviceUncachedAMD )
result += "DeviceUncachedAMD | ";
if ( value & vk::MemoryPropertyFlagBits::eRdmaCapableNV )
result += "RdmaCapableNV | ";
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
} // namespace local
using local::to_string;
#else
using vk::to_string;
#endif
std::string formatSize( vk::DeviceSize size )
{
std::ostringstream oss;
@ -125,7 +76,7 @@ int main( int /*argc*/, char ** /*argv*/ )
for ( uint32_t j = 0; j < memoryProperties.memoryHeapCount; j++ )
{
std::cout << " " << j << ": size = " << formatSize( memoryProperties.memoryHeaps[j].size )
<< ", flags = " << to_string( memoryProperties.memoryHeaps[j].flags ) << "\n";
<< ", flags = " << vk::to_string( memoryProperties.memoryHeaps[j].flags ) << "\n";
if ( containsMemoryBudget )
{
std::cout << " heapBudget = " << formatSize( memoryBudgetProperties.heapBudget[j] )
@ -136,7 +87,7 @@ int main( int /*argc*/, char ** /*argv*/ )
for ( uint32_t j = 0; j < memoryProperties.memoryTypeCount; j++ )
{
std::cout << " " << j << ": heapIndex = " << memoryProperties.memoryTypes[j].heapIndex
<< ", flags = " << to_string( memoryProperties.memoryTypes[j].propertyFlags ) << "\n";
<< ", flags = " << vk::to_string( memoryProperties.memoryTypes[j].propertyFlags ) << "\n";
}
}

View File

@ -16,225 +16,16 @@
// Get properties per physical device.
#include "../utils/utils.hpp"
#include "vulkan/vulkan.hpp"
#include <iomanip>
#include <sstream>
#include <vector>
#include <vulkan/vulkan.hpp>
#include <vulkan/vulkan_to_string.hpp>
static char const * AppName = "PhysicalDeviceProperties";
static char const * EngineName = "Vulkan.hpp";
#if defined( VULKAN_HPP_NO_TO_STRING )
namespace local
{
std::string to_string( vk::DriverId value )
{
switch ( value )
{
case vk::DriverId::eAmdProprietary: return "AmdProprietary";
case vk::DriverId::eAmdOpenSource: return "AmdOpenSource";
case vk::DriverId::eMesaRadv: return "MesaRadv";
case vk::DriverId::eNvidiaProprietary: return "NvidiaProprietary";
case vk::DriverId::eIntelProprietaryWindows: return "IntelProprietaryWindows";
case vk::DriverId::eIntelOpenSourceMESA: return "IntelOpenSourceMESA";
case vk::DriverId::eImaginationProprietary: return "ImaginationProprietary";
case vk::DriverId::eQualcommProprietary: return "QualcommProprietary";
case vk::DriverId::eArmProprietary: return "ArmProprietary";
case vk::DriverId::eGoogleSwiftshader: return "GoogleSwiftshader";
case vk::DriverId::eGgpProprietary: return "GgpProprietary";
case vk::DriverId::eBroadcomProprietary: return "BroadcomProprietary";
case vk::DriverId::eMesaLlvmpipe: return "MesaLlvmpipe";
case vk::DriverId::eMoltenvk: return "Moltenvk";
case vk::DriverId::eCoreaviProprietary: return "CoreaviProprietary";
case vk::DriverId::eJuiceProprietary: return "JuiceProprietary";
case vk::DriverId::eVerisiliconProprietary: return "VerisiliconProprietary";
case vk::DriverId::eMesaTurnip: return "MesaTurnip";
case vk::DriverId::eMesaV3Dv: return "MesaV3Dv";
case vk::DriverId::eMesaPanvk: return "MesaPanvk";
case vk::DriverId::eSamsungProprietary: return "SamsungProprietary";
case vk::DriverId::eMesaVenus: return "MesaVenus";
case vk::DriverId::eMesaDozen: return "MesaDozen";
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
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 ) ) + " )";
}
}
std::string to_string( vk::PointClippingBehavior value )
{
switch ( value )
{
case vk::PointClippingBehavior::eAllClipPlanes: return "AllClipPlanes";
case vk::PointClippingBehavior::eUserClipPlanesOnly: return "UserClipPlanesOnly";
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
std::string to_string( vk::ResolveModeFlags value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::ResolveModeFlagBits::eSampleZero )
result += "SampleZero | ";
if ( value & vk::ResolveModeFlagBits::eAverage )
result += "Average | ";
if ( value & vk::ResolveModeFlagBits::eMin )
result += "Min | ";
if ( value & vk::ResolveModeFlagBits::eMax )
result += "Max | ";
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
std::string to_string( vk::SampleCountFlags value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::SampleCountFlagBits::e1 )
result += "1 | ";
if ( value & vk::SampleCountFlagBits::e2 )
result += "2 | ";
if ( value & vk::SampleCountFlagBits::e4 )
result += "4 | ";
if ( value & vk::SampleCountFlagBits::e8 )
result += "8 | ";
if ( value & vk::SampleCountFlagBits::e16 )
result += "16 | ";
if ( value & vk::SampleCountFlagBits::e32 )
result += "32 | ";
if ( value & vk::SampleCountFlagBits::e64 )
result += "64 | ";
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
std::string to_string( vk::ShaderCorePropertiesFlagsAMD )
{
return "{}";
}
std::string to_string( vk::ShaderFloatControlsIndependence value )
{
switch ( value )
{
case vk::ShaderFloatControlsIndependence::e32BitOnly: return "32BitOnly";
case vk::ShaderFloatControlsIndependence::eAll: return "All";
case vk::ShaderFloatControlsIndependence::eNone: return "None";
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
std::string to_string( vk::ShaderStageFlags value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::ShaderStageFlagBits::eVertex )
result += "Vertex | ";
if ( value & vk::ShaderStageFlagBits::eTessellationControl )
result += "TessellationControl | ";
if ( value & vk::ShaderStageFlagBits::eTessellationEvaluation )
result += "TessellationEvaluation | ";
if ( value & vk::ShaderStageFlagBits::eGeometry )
result += "Geometry | ";
if ( value & vk::ShaderStageFlagBits::eFragment )
result += "Fragment | ";
if ( value & vk::ShaderStageFlagBits::eCompute )
result += "Compute | ";
if ( value & vk::ShaderStageFlagBits::eRaygenKHR )
result += "RaygenKHR | ";
if ( value & vk::ShaderStageFlagBits::eAnyHitKHR )
result += "AnyHitKHR | ";
if ( value & vk::ShaderStageFlagBits::eClosestHitKHR )
result += "ClosestHitKHR | ";
if ( value & vk::ShaderStageFlagBits::eMissKHR )
result += "MissKHR | ";
if ( value & vk::ShaderStageFlagBits::eIntersectionKHR )
result += "IntersectionKHR | ";
if ( value & vk::ShaderStageFlagBits::eCallableKHR )
result += "CallableKHR | ";
if ( value & vk::ShaderStageFlagBits::eTaskNV )
result += "TaskNV | ";
if ( value & vk::ShaderStageFlagBits::eMeshNV )
result += "MeshNV | ";
if ( value & vk::ShaderStageFlagBits::eSubpassShadingHUAWEI )
result += "SubpassShadingHUAWEI | ";
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
std::string to_string( vk::SubgroupFeatureFlags value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::SubgroupFeatureFlagBits::eBasic )
result += "Basic | ";
if ( value & vk::SubgroupFeatureFlagBits::eVote )
result += "Vote | ";
if ( value & vk::SubgroupFeatureFlagBits::eArithmetic )
result += "Arithmetic | ";
if ( value & vk::SubgroupFeatureFlagBits::eBallot )
result += "Ballot | ";
if ( value & vk::SubgroupFeatureFlagBits::eShuffle )
result += "Shuffle | ";
if ( value & vk::SubgroupFeatureFlagBits::eShuffleRelative )
result += "ShuffleRelative | ";
if ( value & vk::SubgroupFeatureFlagBits::eClustered )
result += "Clustered | ";
if ( value & vk::SubgroupFeatureFlagBits::eQuad )
result += "Quad | ";
if ( value & vk::SubgroupFeatureFlagBits::ePartitionedNV )
result += "PartitionedNV | ";
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
} // namespace local
using local::to_string;
#else
using vk::to_string;
#endif
#if defined( VULKAN_HPP_NO_TO_STRING )
namespace local
{
std::string to_string( vk::VendorId value )
{
switch ( value )
{
case vk::VendorId::eVIV: return "VIV";
case vk::VendorId::eVSI: return "VSI";
case vk::VendorId::eKazan: return "Kazan";
case vk::VendorId::eCodeplay: return "Codeplay";
case vk::VendorId::eMESA: return "MESA";
case vk::VendorId::ePocl: return "Pocl";
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
} // namespace local
using local::to_string;
#else
using vk::to_string;
#endif
std::string decodeAPIVersion( uint32_t apiVersion )
{
return std::to_string( VK_VERSION_MAJOR( apiVersion ) ) + "." + std::to_string( VK_VERSION_MINOR( apiVersion ) ) + "." +
@ -269,7 +60,7 @@ std::string decodeVendorID( uint32_t vendorID )
else
{
// above 0x10000 should be vkVendorIDs
return to_string( vk::VendorId( vendorID ) );
return vk::to_string( vk::VendorId( vendorID ) );
}
}
@ -369,20 +160,20 @@ int main( int /*argc*/, char ** /*argv*/ )
std::cout << std::string( "\t\t" ) << "driverVersion = " << decodeDriverVersion( properties.driverVersion, properties.vendorID ) << "\n";
std::cout << std::string( "\t\t" ) << "vendorID = " << decodeVendorID( properties.vendorID ) << "\n";
std::cout << std::string( "\t\t" ) << "deviceID = " << properties.deviceID << "\n";
std::cout << std::string( "\t\t" ) << "deviceType = " << to_string( properties.deviceType ) << "\n";
std::cout << std::string( "\t\t" ) << "deviceType = " << vk::to_string( properties.deviceType ) << "\n";
std::cout << std::string( "\t\t" ) << "deviceName = " << properties.deviceName << "\n";
std::cout << std::string( "\t\t" ) << "pipelineCacheUUID = " << vk::su::UUID( properties.pipelineCacheUUID ) << "\n";
std::cout << std::string( "\t\t" ) << "limits:\n";
std::cout << std::string( "\t\t\t" ) << "bufferImageGranularity = " << properties.limits.bufferImageGranularity << "\n";
std::cout << std::string( "\t\t\t" ) << "discreteQueuePriorities = " << properties.limits.discreteQueuePriorities << "\n";
std::cout << std::string( "\t\t\t" )
<< "framebufferColorSampleCounts = " << to_string( properties.limits.framebufferColorSampleCounts ) << "\n";
<< "framebufferColorSampleCounts = " << vk::to_string( properties.limits.framebufferColorSampleCounts ) << "\n";
std::cout << std::string( "\t\t\t" )
<< "framebufferDepthSampleCounts = " << to_string( properties.limits.framebufferDepthSampleCounts ) << "\n";
<< "framebufferDepthSampleCounts = " << vk::to_string( properties.limits.framebufferDepthSampleCounts ) << "\n";
std::cout << std::string( "\t\t\t" )
<< "framebufferNoAttachmentsSampleCounts = " << to_string( properties.limits.framebufferNoAttachmentsSampleCounts ) << "\n";
<< "framebufferNoAttachmentsSampleCounts = " << vk::to_string( properties.limits.framebufferNoAttachmentsSampleCounts ) << "\n";
std::cout << std::string( "\t\t\t" )
<< "framebufferStencilSampleCounts = " << to_string( properties.limits.framebufferStencilSampleCounts ) << "\n";
<< "framebufferStencilSampleCounts = " << vk::to_string( properties.limits.framebufferStencilSampleCounts ) << "\n";
std::cout << std::string( "\t\t\t" ) << "lineWidthGranularity = " << properties.limits.lineWidthGranularity << "\n";
std::cout << std::string( "\t\t\t" ) << "lineWidthRange = "
<< "[" << properties.limits.lineWidthRange[0] << ", " << properties.limits.lineWidthRange[1] << "]"
@ -499,17 +290,17 @@ int main( int /*argc*/, char ** /*argv*/ )
<< "[" << properties.limits.pointSizeRange[0] << ", " << properties.limits.pointSizeRange[1] << "]"
<< "\n";
std::cout << std::string( "\t\t\t" )
<< "sampledImageColorSampleCounts = " << to_string( properties.limits.sampledImageColorSampleCounts ) << "\n";
<< "sampledImageColorSampleCounts = " << vk::to_string( properties.limits.sampledImageColorSampleCounts ) << "\n";
std::cout << std::string( "\t\t\t" )
<< "sampledImageDepthSampleCounts = " << to_string( properties.limits.sampledImageDepthSampleCounts ) << "\n";
<< "sampledImageDepthSampleCounts = " << vk::to_string( properties.limits.sampledImageDepthSampleCounts ) << "\n";
std::cout << std::string( "\t\t\t" )
<< "sampledImageIntegerSampleCounts = " << to_string( properties.limits.sampledImageIntegerSampleCounts ) << "\n";
<< "sampledImageIntegerSampleCounts = " << vk::to_string( properties.limits.sampledImageIntegerSampleCounts ) << "\n";
std::cout << std::string( "\t\t\t" )
<< "sampledImageStencilSampleCounts = " << to_string( properties.limits.sampledImageStencilSampleCounts ) << "\n";
<< "sampledImageStencilSampleCounts = " << vk::to_string( properties.limits.sampledImageStencilSampleCounts ) << "\n";
std::cout << std::string( "\t\t\t" ) << "sparseAddressSpaceSize = " << properties.limits.sparseAddressSpaceSize << "\n";
std::cout << std::string( "\t\t\t" ) << "standardSampleLocations = " << !!properties.limits.standardSampleLocations << "\n";
std::cout << std::string( "\t\t\t" ) << "storageImageSampleCounts = " << to_string( properties.limits.storageImageSampleCounts )
<< "\n";
std::cout << std::string( "\t\t\t" )
<< "storageImageSampleCounts = " << vk::to_string( properties.limits.storageImageSampleCounts ) << "\n";
std::cout << std::string( "\t\t\t" ) << "strictLines = " << !!properties.limits.strictLines << "\n";
std::cout << std::string( "\t\t\t" ) << "subPixelInterpolationOffsetBits = " << properties.limits.subPixelInterpolationOffsetBits << "\n";
std::cout << std::string( "\t\t\t" ) << "subPixelPrecisionBits = " << properties.limits.subPixelPrecisionBits << "\n";
@ -586,7 +377,7 @@ int main( int /*argc*/, char ** /*argv*/ )
properties2.get<vk::PhysicalDeviceCooperativeMatrixPropertiesNV>();
std::cout << std::string( "\t" ) << "CooperativeMatrixProperties:\n";
std::cout << std::string( "\t\t" )
<< "cooperativeMatrixSupportedStages = " << to_string( cooperativeMatrixProperties.cooperativeMatrixSupportedStages ) << "\n";
<< "cooperativeMatrixSupportedStages = " << vk::to_string( cooperativeMatrixProperties.cooperativeMatrixSupportedStages ) << "\n";
std::cout << "\n";
}
@ -597,9 +388,9 @@ int main( int /*argc*/, char ** /*argv*/ )
std::cout << std::string( "\t" ) << "DepthStencilResolveProperties:\n";
std::cout << std::string( "\t\t" ) << "independentResolve = " << !!depthStencilResolveProperties.independentResolve << "\n";
std::cout << std::string( "\t\t" ) << "independentResolveNone = " << !!depthStencilResolveProperties.independentResolveNone << "\n";
std::cout << std::string( "\t\t" ) << "supportedDepthResolveModes = " << to_string( depthStencilResolveProperties.supportedDepthResolveModes )
std::cout << std::string( "\t\t" ) << "supportedDepthResolveModes = " << vk::to_string( depthStencilResolveProperties.supportedDepthResolveModes )
<< "\n";
std::cout << std::string( "\t\t" ) << "supportedStencilResolveModes = " << to_string( depthStencilResolveProperties.supportedStencilResolveModes )
std::cout << std::string( "\t\t" ) << "supportedStencilResolveModes = " << vk::to_string( depthStencilResolveProperties.supportedStencilResolveModes )
<< "\n";
std::cout << "\n";
}
@ -676,7 +467,7 @@ int main( int /*argc*/, char ** /*argv*/ )
{
vk::PhysicalDeviceDriverPropertiesKHR const & driverProperties = properties2.get<vk::PhysicalDeviceDriverPropertiesKHR>();
std::cout << std::string( "\t" ) << "DriverProperties:\n";
std::cout << std::string( "\t\t" ) << "driverID = " << to_string( driverProperties.driverID ) << "\n";
std::cout << std::string( "\t\t" ) << "driverID = " << vk::to_string( driverProperties.driverID ) << "\n";
std::cout << std::string( "\t\t" ) << "driverName = " << driverProperties.driverName << "\n";
std::cout << std::string( "\t\t" ) << "driverInfo = " << driverProperties.driverInfo << "\n";
std::cout << std::string( "\t\t" ) << "conformanceVersion = " << static_cast<uint32_t>( driverProperties.conformanceVersion.major ) << "."
@ -699,9 +490,9 @@ int main( int /*argc*/, char ** /*argv*/ )
{
vk::PhysicalDeviceFloatControlsPropertiesKHR const & floatControlsProperties = properties2.get<vk::PhysicalDeviceFloatControlsPropertiesKHR>();
std::cout << std::string( "\t" ) << "FloatControlsProperties:\n";
std::cout << std::string( "\t\t" ) << "denormBehaviorIndependence = " << to_string( floatControlsProperties.denormBehaviorIndependence )
std::cout << std::string( "\t\t" ) << "denormBehaviorIndependence = " << vk::to_string( floatControlsProperties.denormBehaviorIndependence )
<< "\n";
std::cout << std::string( "\t\t" ) << "roundingModeIndependence = " << to_string( floatControlsProperties.roundingModeIndependence )
std::cout << std::string( "\t\t" ) << "roundingModeIndependence = " << vk::to_string( floatControlsProperties.roundingModeIndependence )
<< "\n";
std::cout << std::string( "\t\t" ) << "shaderDenormFlushToZeroFloat16 = " << !!floatControlsProperties.shaderDenormFlushToZeroFloat16 << "\n";
std::cout << std::string( "\t\t" ) << "shaderDenormFlushToZeroFloat32 = " << !!floatControlsProperties.shaderDenormFlushToZeroFloat32 << "\n";
@ -836,7 +627,7 @@ int main( int /*argc*/, char ** /*argv*/ )
{
vk::PhysicalDevicePointClippingProperties const & pointClippingProperties = properties2.get<vk::PhysicalDevicePointClippingProperties>();
std::cout << std::string( "\t" ) << "PointClippingProperties:\n";
std::cout << std::string( "\t\t" ) << "pointClippingBehavior = " << to_string( pointClippingProperties.pointClippingBehavior ) << "\n";
std::cout << std::string( "\t\t" ) << "pointClippingBehavior = " << vk::to_string( pointClippingProperties.pointClippingBehavior ) << "\n";
std::cout << "\n";
}
@ -879,7 +670,8 @@ int main( int /*argc*/, char ** /*argv*/ )
<< "[" << sampleLocationProperties.sampleLocationCoordinateRange[0] << ", " << sampleLocationProperties.sampleLocationCoordinateRange[1]
<< "]"
<< "\n";
std::cout << std::string( "\t\t" ) << "sampleLocationSampleCounts = " << to_string( sampleLocationProperties.sampleLocationSampleCounts ) << "\n";
std::cout << std::string( "\t\t" ) << "sampleLocationSampleCounts = " << vk::to_string( sampleLocationProperties.sampleLocationSampleCounts )
<< "\n";
std::cout << std::string( "\t\t" ) << "sampleLocationSubPixelBits = " << sampleLocationProperties.sampleLocationSubPixelBits << "\n";
std::cout << std::string( "\t\t" ) << "variableSampleLocations = " << !!sampleLocationProperties.variableSampleLocations << "\n";
std::cout << "\n";
@ -902,7 +694,7 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::PhysicalDeviceShaderCoreProperties2AMD const & shaderCoreProperties2 = properties2.get<vk::PhysicalDeviceShaderCoreProperties2AMD>();
std::cout << std::string( "\t" ) << "ShaderCoreProperties2:\n";
std::cout << std::string( "\t\t" ) << "activeComputeUnitCount = " << shaderCoreProperties2.activeComputeUnitCount << "\n";
std::cout << std::string( "\t\t" ) << "shaderCoreFeatures = " << to_string( shaderCoreProperties2.shaderCoreFeatures ) << "\n";
std::cout << std::string( "\t\t" ) << "shaderCoreFeatures = " << vk::to_string( shaderCoreProperties2.shaderCoreFeatures ) << "\n";
std::cout << "\n";
}
@ -952,8 +744,8 @@ int main( int /*argc*/, char ** /*argv*/ )
std::cout << std::string( "\t" ) << "SubgroupProperties:\n";
std::cout << std::string( "\t\t" ) << "quadOperationsInAllStages = " << !!subgroupProperties.quadOperationsInAllStages << "\n";
std::cout << std::string( "\t\t" ) << "subgroupSize = " << subgroupProperties.subgroupSize << "\n";
std::cout << std::string( "\t\t" ) << "supportedOperations = " << to_string( subgroupProperties.supportedOperations ) << "\n";
std::cout << std::string( "\t\t" ) << "supportedStages = " << to_string( subgroupProperties.supportedStages ) << "\n";
std::cout << std::string( "\t\t" ) << "supportedOperations = " << vk::to_string( subgroupProperties.supportedOperations ) << "\n";
std::cout << std::string( "\t\t" ) << "supportedStages = " << vk::to_string( subgroupProperties.supportedStages ) << "\n";
std::cout << "\n";
if ( vk::su::contains( extensionProperties, "VK_EXT_subgroup_size_control" ) )
@ -964,7 +756,7 @@ int main( int /*argc*/, char ** /*argv*/ )
std::cout << std::string( "\t\t" ) << "maxComputeWorkgroupSubgroups = " << subgroupSizeControlProperties.maxComputeWorkgroupSubgroups << "\n";
std::cout << std::string( "\t\t" ) << "maxSubgroupSize = " << subgroupSizeControlProperties.maxSubgroupSize << "\n";
std::cout << std::string( "\t\t" ) << "minSubgroupSize = " << subgroupSizeControlProperties.minSubgroupSize << "\n";
std::cout << std::string( "\t\t" ) << "requiredSubgroupSizeStages = " << to_string( subgroupSizeControlProperties.requiredSubgroupSizeStages )
std::cout << std::string( "\t\t" ) << "requiredSubgroupSizeStages = " << vk::to_string( subgroupSizeControlProperties.requiredSubgroupSizeStages )
<< "\n";
std::cout << "\n";
}

View File

@ -16,111 +16,16 @@
// Get queue family properties per physical device.
#include "../utils/utils.hpp"
#include "vulkan/vulkan.hpp"
#include <iomanip>
#include <sstream>
#include <vector>
#include <vulkan/vulkan.hpp>
#include <vulkan/vulkan_to_string.hpp>
static char const * AppName = "PhysicalDeviceQueueFamilyProperties";
static char const * EngineName = "Vulkan.hpp";
#if defined( VULKAN_HPP_NO_TO_STRING )
namespace local
{
std::string to_string( vk::PipelineStageFlags value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::PipelineStageFlagBits::eTopOfPipe )
result += "TopOfPipe | ";
if ( value & vk::PipelineStageFlagBits::eDrawIndirect )
result += "DrawIndirect | ";
if ( value & vk::PipelineStageFlagBits::eVertexInput )
result += "VertexInput | ";
if ( value & vk::PipelineStageFlagBits::eVertexShader )
result += "VertexShader | ";
if ( value & vk::PipelineStageFlagBits::eTessellationControlShader )
result += "TessellationControlShader | ";
if ( value & vk::PipelineStageFlagBits::eTessellationEvaluationShader )
result += "TessellationEvaluationShader | ";
if ( value & vk::PipelineStageFlagBits::eGeometryShader )
result += "GeometryShader | ";
if ( value & vk::PipelineStageFlagBits::eFragmentShader )
result += "FragmentShader | ";
if ( value & vk::PipelineStageFlagBits::eEarlyFragmentTests )
result += "EarlyFragmentTests | ";
if ( value & vk::PipelineStageFlagBits::eLateFragmentTests )
result += "LateFragmentTests | ";
if ( value & vk::PipelineStageFlagBits::eColorAttachmentOutput )
result += "ColorAttachmentOutput | ";
if ( value & vk::PipelineStageFlagBits::eComputeShader )
result += "ComputeShader | ";
if ( value & vk::PipelineStageFlagBits::eTransfer )
result += "Transfer | ";
if ( value & vk::PipelineStageFlagBits::eBottomOfPipe )
result += "BottomOfPipe | ";
if ( value & vk::PipelineStageFlagBits::eHost )
result += "Host | ";
if ( value & vk::PipelineStageFlagBits::eAllGraphics )
result += "AllGraphics | ";
if ( value & vk::PipelineStageFlagBits::eAllCommands )
result += "AllCommands | ";
if ( value & vk::PipelineStageFlagBits::eTransformFeedbackEXT )
result += "TransformFeedbackEXT | ";
if ( value & vk::PipelineStageFlagBits::eConditionalRenderingEXT )
result += "ConditionalRenderingEXT | ";
if ( value & vk::PipelineStageFlagBits::eAccelerationStructureBuildKHR )
result += "AccelerationStructureBuildKHR | ";
if ( value & vk::PipelineStageFlagBits::eRayTracingShaderKHR )
result += "RayTracingShaderKHR | ";
if ( value & vk::PipelineStageFlagBits::eTaskShaderNV )
result += "TaskShaderNV | ";
if ( value & vk::PipelineStageFlagBits::eMeshShaderNV )
result += "MeshShaderNV | ";
if ( value & vk::PipelineStageFlagBits::eFragmentDensityProcessEXT )
result += "FragmentDensityProcessEXT | ";
if ( value & vk::PipelineStageFlagBits::eFragmentShadingRateAttachmentKHR )
result += "FragmentShadingRateAttachmentKHR | ";
if ( value & vk::PipelineStageFlagBits::eCommandPreprocessNV )
result += "CommandPreprocessNV | ";
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
std::string to_string( vk::QueueFlags value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::QueueFlagBits::eGraphics )
result += "Graphics | ";
if ( value & vk::QueueFlagBits::eCompute )
result += "Compute | ";
if ( value & vk::QueueFlagBits::eTransfer )
result += "Transfer | ";
if ( value & vk::QueueFlagBits::eSparseBinding )
result += "SparseBinding | ";
if ( value & vk::QueueFlagBits::eProtected )
result += "Protected | ";
# if defined( VK_ENABLE_BETA_EXTENSIONS )
if ( value & vk::QueueFlagBits::eVideoDecodeKHR )
result += "VideoDecodeKHR | ";
if ( value & vk::QueueFlagBits::eVideoEncodeKHR )
result += "VideoEncodeKHR | ";
# endif /*VK_ENABLE_BETA_EXTENSIONS*/
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
} // namespace local
using local::to_string;
#else
using vk::to_string;
#endif
int main( int /*argc*/, char ** /*argv*/ )
{
try
@ -152,7 +57,7 @@ int main( int /*argc*/, char ** /*argv*/ )
std::cout << std::string( "\t" ) << "QueueFamily " << j << " :" << std::endl;
vk::QueueFamilyProperties const & properties = queueFamilyProperties2[j].get<vk::QueueFamilyProperties2>().queueFamilyProperties;
std::cout << std::string( "\t\t" ) << "QueueFamilyProperties:" << std::endl;
std::cout << std::string( "\t\t\t" ) << "queueFlags = " << to_string( properties.queueFlags ) << std::endl;
std::cout << std::string( "\t\t\t" ) << "queueFlags = " << vk::to_string( properties.queueFlags ) << std::endl;
std::cout << std::string( "\t\t\t" ) << "queueCount = " << properties.queueCount << std::endl;
std::cout << std::string( "\t\t\t" ) << "timestampValidBits = " << properties.timestampValidBits << std::endl;
std::cout << std::string( "\t\t\t" ) << "minImageTransferGranularity = " << properties.minImageTransferGranularity.width << " x "
@ -163,7 +68,7 @@ int main( int /*argc*/, char ** /*argv*/ )
{
vk::QueueFamilyCheckpointPropertiesNV const & checkpointProperties = queueFamilyProperties2[j].get<vk::QueueFamilyCheckpointPropertiesNV>();
std::cout << std::string( "\t\t" ) << "CheckPointPropertiesNV:" << std::endl;
std::cout << std::string( "\t\t\t" ) << "checkpointExecutionStageMask = " << to_string( checkpointProperties.checkpointExecutionStageMask )
std::cout << std::string( "\t\t\t" ) << "checkpointExecutionStageMask = " << vk::to_string( checkpointProperties.checkpointExecutionStageMask )
<< std::endl;
std::cout << std::endl;
}

View File

@ -38,6 +38,7 @@
#include <numeric>
#include <random>
#include <sstream>
#include <vulkan/vulkan_to_string.hpp>
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
#define GLM_FORCE_RADIANS
@ -54,71 +55,6 @@
static char const * AppName = "RayTracing";
static char const * EngineName = "Vulkan.hpp";
#if defined( VULKAN_HPP_NO_TO_STRING )
namespace local
{
std::string to_string( vk::Result value )
{
switch ( value )
{
case vk::Result::eSuccess: return "Success";
case vk::Result::eNotReady: return "NotReady";
case vk::Result::eTimeout: return "Timeout";
case vk::Result::eEventSet: return "EventSet";
case vk::Result::eEventReset: return "EventReset";
case vk::Result::eIncomplete: return "Incomplete";
case vk::Result::eErrorOutOfHostMemory: return "ErrorOutOfHostMemory";
case vk::Result::eErrorOutOfDeviceMemory: return "ErrorOutOfDeviceMemory";
case vk::Result::eErrorInitializationFailed: return "ErrorInitializationFailed";
case vk::Result::eErrorDeviceLost: return "ErrorDeviceLost";
case vk::Result::eErrorMemoryMapFailed: return "ErrorMemoryMapFailed";
case vk::Result::eErrorLayerNotPresent: return "ErrorLayerNotPresent";
case vk::Result::eErrorExtensionNotPresent: return "ErrorExtensionNotPresent";
case vk::Result::eErrorFeatureNotPresent: return "ErrorFeatureNotPresent";
case vk::Result::eErrorIncompatibleDriver: return "ErrorIncompatibleDriver";
case vk::Result::eErrorTooManyObjects: return "ErrorTooManyObjects";
case vk::Result::eErrorFormatNotSupported: return "ErrorFormatNotSupported";
case vk::Result::eErrorFragmentedPool: return "ErrorFragmentedPool";
case vk::Result::eErrorUnknown: return "ErrorUnknown";
case vk::Result::eErrorOutOfPoolMemory: return "ErrorOutOfPoolMemory";
case vk::Result::eErrorInvalidExternalHandle: return "ErrorInvalidExternalHandle";
case vk::Result::eErrorFragmentation: return "ErrorFragmentation";
case vk::Result::eErrorInvalidOpaqueCaptureAddress: return "ErrorInvalidOpaqueCaptureAddress";
case vk::Result::ePipelineCompileRequired: return "PipelineCompileRequired";
case vk::Result::eErrorSurfaceLostKHR: return "ErrorSurfaceLostKHR";
case vk::Result::eErrorNativeWindowInUseKHR: return "ErrorNativeWindowInUseKHR";
case vk::Result::eSuboptimalKHR: return "SuboptimalKHR";
case vk::Result::eErrorOutOfDateKHR: return "ErrorOutOfDateKHR";
case vk::Result::eErrorIncompatibleDisplayKHR: return "ErrorIncompatibleDisplayKHR";
case vk::Result::eErrorValidationFailedEXT: return "ErrorValidationFailedEXT";
case vk::Result::eErrorInvalidShaderNV: return "ErrorInvalidShaderNV";
# if defined( VK_ENABLE_BETA_EXTENSIONS )
case vk::Result::eErrorImageUsageNotSupportedKHR: return "ErrorImageUsageNotSupportedKHR";
case vk::Result::eErrorVideoPictureLayoutNotSupportedKHR: return "ErrorVideoPictureLayoutNotSupportedKHR";
case vk::Result::eErrorVideoProfileOperationNotSupportedKHR: return "ErrorVideoProfileOperationNotSupportedKHR";
case vk::Result::eErrorVideoProfileFormatNotSupportedKHR: return "ErrorVideoProfileFormatNotSupportedKHR";
case vk::Result::eErrorVideoProfileCodecNotSupportedKHR: return "ErrorVideoProfileCodecNotSupportedKHR";
case vk::Result::eErrorVideoStdVersionNotSupportedKHR: return "ErrorVideoStdVersionNotSupportedKHR";
# endif /*VK_ENABLE_BETA_EXTENSIONS*/
case vk::Result::eErrorInvalidDrmFormatModifierPlaneLayoutEXT: return "ErrorInvalidDrmFormatModifierPlaneLayoutEXT";
case vk::Result::eErrorNotPermittedKHR: return "ErrorNotPermittedKHR";
# if defined( VK_USE_PLATFORM_WIN32_KHR )
case vk::Result::eErrorFullScreenExclusiveModeLostEXT: return "ErrorFullScreenExclusiveModeLostEXT";
# endif /*VK_USE_PLATFORM_WIN32_KHR*/
case vk::Result::eThreadIdleKHR: return "ThreadIdleKHR";
case vk::Result::eThreadDoneKHR: return "ThreadDoneKHR";
case vk::Result::eOperationDeferredKHR: return "OperationDeferredKHR";
case vk::Result::eOperationNotDeferredKHR: return "OperationNotDeferredKHR";
case vk::Result::eErrorCompressionExhaustedEXT: return "ErrorCompressionExhaustedEXT";
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
} // namespace local
using local::to_string;
#else
using vk::to_string;
#endif
struct GeometryInstanceData
{
GeometryInstanceData(
@ -588,7 +524,7 @@ static void check_vk_result( VkResult err )
{
if ( err != 0 )
{
std::cerr << AppName << ": Vulkan error " << to_string( static_cast<vk::Result>( err ) );
std::cerr << AppName << ": Vulkan error " << vk::to_string( static_cast<vk::Result>( err ) );
if ( err < 0 )
{
abort();

View File

@ -16,144 +16,22 @@
// Get surface capabilities.
#include "../utils/utils.hpp"
#include "vulkan/vulkan.hpp"
#include <iomanip>
#include <sstream>
#include <vector>
#include <vulkan/vulkan.hpp>
#include <vulkan/vulkan_to_string.hpp>
static char const * AppName = "SurfaceCapabilities";
static char const * EngineName = "Vulkan.hpp";
#if defined( VULKAN_HPP_NO_TO_STRING )
namespace local
{
std::string to_string( vk::CompositeAlphaFlagsKHR value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::CompositeAlphaFlagBitsKHR::eOpaque )
result += "Opaque | ";
if ( value & vk::CompositeAlphaFlagBitsKHR::ePreMultiplied )
result += "PreMultiplied | ";
if ( value & vk::CompositeAlphaFlagBitsKHR::ePostMultiplied )
result += "PostMultiplied | ";
if ( value & vk::CompositeAlphaFlagBitsKHR::eInherit )
result += "Inherit | ";
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
std::string to_string( vk::ImageUsageFlags value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::ImageUsageFlagBits::eTransferSrc )
result += "TransferSrc | ";
if ( value & vk::ImageUsageFlagBits::eTransferDst )
result += "TransferDst | ";
if ( value & vk::ImageUsageFlagBits::eSampled )
result += "Sampled | ";
if ( value & vk::ImageUsageFlagBits::eStorage )
result += "Storage | ";
if ( value & vk::ImageUsageFlagBits::eColorAttachment )
result += "ColorAttachment | ";
if ( value & vk::ImageUsageFlagBits::eDepthStencilAttachment )
result += "DepthStencilAttachment | ";
if ( value & vk::ImageUsageFlagBits::eTransientAttachment )
result += "TransientAttachment | ";
if ( value & vk::ImageUsageFlagBits::eInputAttachment )
result += "InputAttachment | ";
# if defined( VK_ENABLE_BETA_EXTENSIONS )
if ( value & vk::ImageUsageFlagBits::eVideoDecodeDstKHR )
result += "VideoDecodeDstKHR | ";
if ( value & vk::ImageUsageFlagBits::eVideoDecodeSrcKHR )
result += "VideoDecodeSrcKHR | ";
if ( value & vk::ImageUsageFlagBits::eVideoDecodeDpbKHR )
result += "VideoDecodeDpbKHR | ";
# endif /*VK_ENABLE_BETA_EXTENSIONS*/
if ( value & vk::ImageUsageFlagBits::eFragmentDensityMapEXT )
result += "FragmentDensityMapEXT | ";
if ( value & vk::ImageUsageFlagBits::eFragmentShadingRateAttachmentKHR )
result += "FragmentShadingRateAttachmentKHR | ";
# if defined( VK_ENABLE_BETA_EXTENSIONS )
if ( value & vk::ImageUsageFlagBits::eVideoEncodeDstKHR )
result += "VideoEncodeDstKHR | ";
if ( value & vk::ImageUsageFlagBits::eVideoEncodeSrcKHR )
result += "VideoEncodeSrcKHR | ";
if ( value & vk::ImageUsageFlagBits::eVideoEncodeDpbKHR )
result += "VideoEncodeDpbKHR | ";
# endif /*VK_ENABLE_BETA_EXTENSIONS*/
if ( value & vk::ImageUsageFlagBits::eInvocationMaskHUAWEI )
result += "InvocationMaskHUAWEI | ";
if ( value & vk::ImageUsageFlagBits::eSampleWeightQCOM )
result += "SampleWeightQCOM | ";
if ( value & vk::ImageUsageFlagBits::eSampleBlockMatchQCOM )
result += "SampleBlockMatchQCOM | ";
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
std::string to_string( vk::SurfaceTransformFlagBitsKHR value )
{
switch ( value )
{
case vk::SurfaceTransformFlagBitsKHR::eIdentity: return "Identity";
case vk::SurfaceTransformFlagBitsKHR::eRotate90: return "Rotate90";
case vk::SurfaceTransformFlagBitsKHR::eRotate180: return "Rotate180";
case vk::SurfaceTransformFlagBitsKHR::eRotate270: return "Rotate270";
case vk::SurfaceTransformFlagBitsKHR::eHorizontalMirror: return "HorizontalMirror";
case vk::SurfaceTransformFlagBitsKHR::eHorizontalMirrorRotate90: return "HorizontalMirrorRotate90";
case vk::SurfaceTransformFlagBitsKHR::eHorizontalMirrorRotate180: return "HorizontalMirrorRotate180";
case vk::SurfaceTransformFlagBitsKHR::eHorizontalMirrorRotate270: return "HorizontalMirrorRotate270";
case vk::SurfaceTransformFlagBitsKHR::eInherit: return "Inherit";
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
std::string to_string( vk::SurfaceTransformFlagsKHR value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::SurfaceTransformFlagBitsKHR::eIdentity )
result += "Identity | ";
if ( value & vk::SurfaceTransformFlagBitsKHR::eRotate90 )
result += "Rotate90 | ";
if ( value & vk::SurfaceTransformFlagBitsKHR::eRotate180 )
result += "Rotate180 | ";
if ( value & vk::SurfaceTransformFlagBitsKHR::eRotate270 )
result += "Rotate270 | ";
if ( value & vk::SurfaceTransformFlagBitsKHR::eHorizontalMirror )
result += "HorizontalMirror | ";
if ( value & vk::SurfaceTransformFlagBitsKHR::eHorizontalMirrorRotate90 )
result += "HorizontalMirrorRotate90 | ";
if ( value & vk::SurfaceTransformFlagBitsKHR::eHorizontalMirrorRotate180 )
result += "HorizontalMirrorRotate180 | ";
if ( value & vk::SurfaceTransformFlagBitsKHR::eHorizontalMirrorRotate270 )
result += "HorizontalMirrorRotate270 | ";
if ( value & vk::SurfaceTransformFlagBitsKHR::eInherit )
result += "Inherit | ";
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
} // namespace local
using local::to_string;
#else
using vk::to_string;
#endif
void cout( vk::SurfaceCapabilitiesKHR const & surfaceCapabilities )
{
std::cout << std::string( "\t" ) << "Capabilities:\n";
std::cout << std::string( "\t\t" ) << "currentExtent = " << surfaceCapabilities.currentExtent.width << " x "
<< surfaceCapabilities.currentExtent.height << "\n";
std::cout << std::string( "\t\t" ) << "currentTransform = " << to_string( surfaceCapabilities.currentTransform ) << "\n";
std::cout << std::string( "\t\t" ) << "currentTransform = " << vk::to_string( surfaceCapabilities.currentTransform ) << "\n";
std::cout << std::string( "\t\t" ) << "maxImageArrayLayers = " << surfaceCapabilities.maxImageArrayLayers << "\n";
std::cout << std::string( "\t\t" ) << "maxImageCount = " << surfaceCapabilities.maxImageCount << "\n";
std::cout << std::string( "\t\t" ) << "maxImageExtent = " << surfaceCapabilities.maxImageExtent.width << " x "
@ -161,9 +39,9 @@ void cout( vk::SurfaceCapabilitiesKHR const & surfaceCapabilities )
std::cout << std::string( "\t\t" ) << "minImageCount = " << surfaceCapabilities.minImageCount << "\n";
std::cout << std::string( "\t\t" ) << "minImageExtent = " << surfaceCapabilities.minImageExtent.width << " x "
<< surfaceCapabilities.minImageExtent.height << "\n";
std::cout << std::string( "\t\t" ) << "supportedCompositeAlpha = " << to_string( surfaceCapabilities.supportedCompositeAlpha ) << "\n";
std::cout << std::string( "\t\t" ) << "supportedTransforms = " << to_string( surfaceCapabilities.supportedTransforms ) << "\n";
std::cout << std::string( "\t\t" ) << "supportedUsageFlags = " << to_string( surfaceCapabilities.supportedUsageFlags ) << "\n";
std::cout << std::string( "\t\t" ) << "supportedCompositeAlpha = " << vk::to_string( surfaceCapabilities.supportedCompositeAlpha ) << "\n";
std::cout << std::string( "\t\t" ) << "supportedTransforms = " << vk::to_string( surfaceCapabilities.supportedTransforms ) << "\n";
std::cout << std::string( "\t\t" ) << "supportedUsageFlags = " << vk::to_string( surfaceCapabilities.supportedUsageFlags ) << "\n";
std::cout << "\n";
}
@ -231,7 +109,7 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::SharedPresentSurfaceCapabilitiesKHR sharedPresentSurfaceCapabilities = surfaceCapabilities2.get<vk::SharedPresentSurfaceCapabilitiesKHR>();
std::cout << std::string( "\t" ) << "SharedPresentSurfaceCapabilitiesKHR:\n";
std::cout << std::string( "\t\t" )
<< "sharedPresentSupportedUsageFlags = " << to_string( sharedPresentSurfaceCapabilities.sharedPresentSupportedUsageFlags ) << "\n";
<< "sharedPresentSupportedUsageFlags = " << vk::to_string( sharedPresentSurfaceCapabilities.sharedPresentSupportedUsageFlags ) << "\n";
std::cout << "\n";
}

View File

@ -16,302 +16,16 @@
// Get surface formats.
#include "../utils/utils.hpp"
#include "vulkan/vulkan.hpp"
#include <iomanip>
#include <sstream>
#include <vector>
#include <vulkan/vulkan.hpp>
#include <vulkan/vulkan_to_string.hpp>
static char const * AppName = "SurfaceFormats";
static char const * EngineName = "Vulkan.hpp";
#if defined( VULKAN_HPP_NO_TO_STRING )
namespace local
{
std::string to_string( vk::ColorSpaceKHR value )
{
switch ( value )
{
case vk::ColorSpaceKHR::eSrgbNonlinear: return "SrgbNonlinear";
case vk::ColorSpaceKHR::eDisplayP3NonlinearEXT: return "DisplayP3NonlinearEXT";
case vk::ColorSpaceKHR::eExtendedSrgbLinearEXT: return "ExtendedSrgbLinearEXT";
case vk::ColorSpaceKHR::eDisplayP3LinearEXT: return "DisplayP3LinearEXT";
case vk::ColorSpaceKHR::eDciP3NonlinearEXT: return "DciP3NonlinearEXT";
case vk::ColorSpaceKHR::eBt709LinearEXT: return "Bt709LinearEXT";
case vk::ColorSpaceKHR::eBt709NonlinearEXT: return "Bt709NonlinearEXT";
case vk::ColorSpaceKHR::eBt2020LinearEXT: return "Bt2020LinearEXT";
case vk::ColorSpaceKHR::eHdr10St2084EXT: return "Hdr10St2084EXT";
case vk::ColorSpaceKHR::eDolbyvisionEXT: return "DolbyvisionEXT";
case vk::ColorSpaceKHR::eHdr10HlgEXT: return "Hdr10HlgEXT";
case vk::ColorSpaceKHR::eAdobergbLinearEXT: return "AdobergbLinearEXT";
case vk::ColorSpaceKHR::eAdobergbNonlinearEXT: return "AdobergbNonlinearEXT";
case vk::ColorSpaceKHR::ePassThroughEXT: return "PassThroughEXT";
case vk::ColorSpaceKHR::eExtendedSrgbNonlinearEXT: return "ExtendedSrgbNonlinearEXT";
case vk::ColorSpaceKHR::eDisplayNativeAMD: return "DisplayNativeAMD";
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
std::string to_string( vk::Format value )
{
switch ( value )
{
case vk::Format::eUndefined: return "Undefined";
case vk::Format::eR4G4UnormPack8: return "R4G4UnormPack8";
case vk::Format::eR4G4B4A4UnormPack16: return "R4G4B4A4UnormPack16";
case vk::Format::eB4G4R4A4UnormPack16: return "B4G4R4A4UnormPack16";
case vk::Format::eR5G6B5UnormPack16: return "R5G6B5UnormPack16";
case vk::Format::eB5G6R5UnormPack16: return "B5G6R5UnormPack16";
case vk::Format::eR5G5B5A1UnormPack16: return "R5G5B5A1UnormPack16";
case vk::Format::eB5G5R5A1UnormPack16: return "B5G5R5A1UnormPack16";
case vk::Format::eA1R5G5B5UnormPack16: return "A1R5G5B5UnormPack16";
case vk::Format::eR8Unorm: return "R8Unorm";
case vk::Format::eR8Snorm: return "R8Snorm";
case vk::Format::eR8Uscaled: return "R8Uscaled";
case vk::Format::eR8Sscaled: return "R8Sscaled";
case vk::Format::eR8Uint: return "R8Uint";
case vk::Format::eR8Sint: return "R8Sint";
case vk::Format::eR8Srgb: return "R8Srgb";
case vk::Format::eR8G8Unorm: return "R8G8Unorm";
case vk::Format::eR8G8Snorm: return "R8G8Snorm";
case vk::Format::eR8G8Uscaled: return "R8G8Uscaled";
case vk::Format::eR8G8Sscaled: return "R8G8Sscaled";
case vk::Format::eR8G8Uint: return "R8G8Uint";
case vk::Format::eR8G8Sint: return "R8G8Sint";
case vk::Format::eR8G8Srgb: return "R8G8Srgb";
case vk::Format::eR8G8B8Unorm: return "R8G8B8Unorm";
case vk::Format::eR8G8B8Snorm: return "R8G8B8Snorm";
case vk::Format::eR8G8B8Uscaled: return "R8G8B8Uscaled";
case vk::Format::eR8G8B8Sscaled: return "R8G8B8Sscaled";
case vk::Format::eR8G8B8Uint: return "R8G8B8Uint";
case vk::Format::eR8G8B8Sint: return "R8G8B8Sint";
case vk::Format::eR8G8B8Srgb: return "R8G8B8Srgb";
case vk::Format::eB8G8R8Unorm: return "B8G8R8Unorm";
case vk::Format::eB8G8R8Snorm: return "B8G8R8Snorm";
case vk::Format::eB8G8R8Uscaled: return "B8G8R8Uscaled";
case vk::Format::eB8G8R8Sscaled: return "B8G8R8Sscaled";
case vk::Format::eB8G8R8Uint: return "B8G8R8Uint";
case vk::Format::eB8G8R8Sint: return "B8G8R8Sint";
case vk::Format::eB8G8R8Srgb: return "B8G8R8Srgb";
case vk::Format::eR8G8B8A8Unorm: return "R8G8B8A8Unorm";
case vk::Format::eR8G8B8A8Snorm: return "R8G8B8A8Snorm";
case vk::Format::eR8G8B8A8Uscaled: return "R8G8B8A8Uscaled";
case vk::Format::eR8G8B8A8Sscaled: return "R8G8B8A8Sscaled";
case vk::Format::eR8G8B8A8Uint: return "R8G8B8A8Uint";
case vk::Format::eR8G8B8A8Sint: return "R8G8B8A8Sint";
case vk::Format::eR8G8B8A8Srgb: return "R8G8B8A8Srgb";
case vk::Format::eB8G8R8A8Unorm: return "B8G8R8A8Unorm";
case vk::Format::eB8G8R8A8Snorm: return "B8G8R8A8Snorm";
case vk::Format::eB8G8R8A8Uscaled: return "B8G8R8A8Uscaled";
case vk::Format::eB8G8R8A8Sscaled: return "B8G8R8A8Sscaled";
case vk::Format::eB8G8R8A8Uint: return "B8G8R8A8Uint";
case vk::Format::eB8G8R8A8Sint: return "B8G8R8A8Sint";
case vk::Format::eB8G8R8A8Srgb: return "B8G8R8A8Srgb";
case vk::Format::eA8B8G8R8UnormPack32: return "A8B8G8R8UnormPack32";
case vk::Format::eA8B8G8R8SnormPack32: return "A8B8G8R8SnormPack32";
case vk::Format::eA8B8G8R8UscaledPack32: return "A8B8G8R8UscaledPack32";
case vk::Format::eA8B8G8R8SscaledPack32: return "A8B8G8R8SscaledPack32";
case vk::Format::eA8B8G8R8UintPack32: return "A8B8G8R8UintPack32";
case vk::Format::eA8B8G8R8SintPack32: return "A8B8G8R8SintPack32";
case vk::Format::eA8B8G8R8SrgbPack32: return "A8B8G8R8SrgbPack32";
case vk::Format::eA2R10G10B10UnormPack32: return "A2R10G10B10UnormPack32";
case vk::Format::eA2R10G10B10SnormPack32: return "A2R10G10B10SnormPack32";
case vk::Format::eA2R10G10B10UscaledPack32: return "A2R10G10B10UscaledPack32";
case vk::Format::eA2R10G10B10SscaledPack32: return "A2R10G10B10SscaledPack32";
case vk::Format::eA2R10G10B10UintPack32: return "A2R10G10B10UintPack32";
case vk::Format::eA2R10G10B10SintPack32: return "A2R10G10B10SintPack32";
case vk::Format::eA2B10G10R10UnormPack32: return "A2B10G10R10UnormPack32";
case vk::Format::eA2B10G10R10SnormPack32: return "A2B10G10R10SnormPack32";
case vk::Format::eA2B10G10R10UscaledPack32: return "A2B10G10R10UscaledPack32";
case vk::Format::eA2B10G10R10SscaledPack32: return "A2B10G10R10SscaledPack32";
case vk::Format::eA2B10G10R10UintPack32: return "A2B10G10R10UintPack32";
case vk::Format::eA2B10G10R10SintPack32: return "A2B10G10R10SintPack32";
case vk::Format::eR16Unorm: return "R16Unorm";
case vk::Format::eR16Snorm: return "R16Snorm";
case vk::Format::eR16Uscaled: return "R16Uscaled";
case vk::Format::eR16Sscaled: return "R16Sscaled";
case vk::Format::eR16Uint: return "R16Uint";
case vk::Format::eR16Sint: return "R16Sint";
case vk::Format::eR16Sfloat: return "R16Sfloat";
case vk::Format::eR16G16Unorm: return "R16G16Unorm";
case vk::Format::eR16G16Snorm: return "R16G16Snorm";
case vk::Format::eR16G16Uscaled: return "R16G16Uscaled";
case vk::Format::eR16G16Sscaled: return "R16G16Sscaled";
case vk::Format::eR16G16Uint: return "R16G16Uint";
case vk::Format::eR16G16Sint: return "R16G16Sint";
case vk::Format::eR16G16Sfloat: return "R16G16Sfloat";
case vk::Format::eR16G16B16Unorm: return "R16G16B16Unorm";
case vk::Format::eR16G16B16Snorm: return "R16G16B16Snorm";
case vk::Format::eR16G16B16Uscaled: return "R16G16B16Uscaled";
case vk::Format::eR16G16B16Sscaled: return "R16G16B16Sscaled";
case vk::Format::eR16G16B16Uint: return "R16G16B16Uint";
case vk::Format::eR16G16B16Sint: return "R16G16B16Sint";
case vk::Format::eR16G16B16Sfloat: return "R16G16B16Sfloat";
case vk::Format::eR16G16B16A16Unorm: return "R16G16B16A16Unorm";
case vk::Format::eR16G16B16A16Snorm: return "R16G16B16A16Snorm";
case vk::Format::eR16G16B16A16Uscaled: return "R16G16B16A16Uscaled";
case vk::Format::eR16G16B16A16Sscaled: return "R16G16B16A16Sscaled";
case vk::Format::eR16G16B16A16Uint: return "R16G16B16A16Uint";
case vk::Format::eR16G16B16A16Sint: return "R16G16B16A16Sint";
case vk::Format::eR16G16B16A16Sfloat: return "R16G16B16A16Sfloat";
case vk::Format::eR32Uint: return "R32Uint";
case vk::Format::eR32Sint: return "R32Sint";
case vk::Format::eR32Sfloat: return "R32Sfloat";
case vk::Format::eR32G32Uint: return "R32G32Uint";
case vk::Format::eR32G32Sint: return "R32G32Sint";
case vk::Format::eR32G32Sfloat: return "R32G32Sfloat";
case vk::Format::eR32G32B32Uint: return "R32G32B32Uint";
case vk::Format::eR32G32B32Sint: return "R32G32B32Sint";
case vk::Format::eR32G32B32Sfloat: return "R32G32B32Sfloat";
case vk::Format::eR32G32B32A32Uint: return "R32G32B32A32Uint";
case vk::Format::eR32G32B32A32Sint: return "R32G32B32A32Sint";
case vk::Format::eR32G32B32A32Sfloat: return "R32G32B32A32Sfloat";
case vk::Format::eR64Uint: return "R64Uint";
case vk::Format::eR64Sint: return "R64Sint";
case vk::Format::eR64Sfloat: return "R64Sfloat";
case vk::Format::eR64G64Uint: return "R64G64Uint";
case vk::Format::eR64G64Sint: return "R64G64Sint";
case vk::Format::eR64G64Sfloat: return "R64G64Sfloat";
case vk::Format::eR64G64B64Uint: return "R64G64B64Uint";
case vk::Format::eR64G64B64Sint: return "R64G64B64Sint";
case vk::Format::eR64G64B64Sfloat: return "R64G64B64Sfloat";
case vk::Format::eR64G64B64A64Uint: return "R64G64B64A64Uint";
case vk::Format::eR64G64B64A64Sint: return "R64G64B64A64Sint";
case vk::Format::eR64G64B64A64Sfloat: return "R64G64B64A64Sfloat";
case vk::Format::eB10G11R11UfloatPack32: return "B10G11R11UfloatPack32";
case vk::Format::eE5B9G9R9UfloatPack32: return "E5B9G9R9UfloatPack32";
case vk::Format::eD16Unorm: return "D16Unorm";
case vk::Format::eX8D24UnormPack32: return "X8D24UnormPack32";
case vk::Format::eD32Sfloat: return "D32Sfloat";
case vk::Format::eS8Uint: return "S8Uint";
case vk::Format::eD16UnormS8Uint: return "D16UnormS8Uint";
case vk::Format::eD24UnormS8Uint: return "D24UnormS8Uint";
case vk::Format::eD32SfloatS8Uint: return "D32SfloatS8Uint";
case vk::Format::eBc1RgbUnormBlock: return "Bc1RgbUnormBlock";
case vk::Format::eBc1RgbSrgbBlock: return "Bc1RgbSrgbBlock";
case vk::Format::eBc1RgbaUnormBlock: return "Bc1RgbaUnormBlock";
case vk::Format::eBc1RgbaSrgbBlock: return "Bc1RgbaSrgbBlock";
case vk::Format::eBc2UnormBlock: return "Bc2UnormBlock";
case vk::Format::eBc2SrgbBlock: return "Bc2SrgbBlock";
case vk::Format::eBc3UnormBlock: return "Bc3UnormBlock";
case vk::Format::eBc3SrgbBlock: return "Bc3SrgbBlock";
case vk::Format::eBc4UnormBlock: return "Bc4UnormBlock";
case vk::Format::eBc4SnormBlock: return "Bc4SnormBlock";
case vk::Format::eBc5UnormBlock: return "Bc5UnormBlock";
case vk::Format::eBc5SnormBlock: return "Bc5SnormBlock";
case vk::Format::eBc6HUfloatBlock: return "Bc6HUfloatBlock";
case vk::Format::eBc6HSfloatBlock: return "Bc6HSfloatBlock";
case vk::Format::eBc7UnormBlock: return "Bc7UnormBlock";
case vk::Format::eBc7SrgbBlock: return "Bc7SrgbBlock";
case vk::Format::eEtc2R8G8B8UnormBlock: return "Etc2R8G8B8UnormBlock";
case vk::Format::eEtc2R8G8B8SrgbBlock: return "Etc2R8G8B8SrgbBlock";
case vk::Format::eEtc2R8G8B8A1UnormBlock: return "Etc2R8G8B8A1UnormBlock";
case vk::Format::eEtc2R8G8B8A1SrgbBlock: return "Etc2R8G8B8A1SrgbBlock";
case vk::Format::eEtc2R8G8B8A8UnormBlock: return "Etc2R8G8B8A8UnormBlock";
case vk::Format::eEtc2R8G8B8A8SrgbBlock: return "Etc2R8G8B8A8SrgbBlock";
case vk::Format::eEacR11UnormBlock: return "EacR11UnormBlock";
case vk::Format::eEacR11SnormBlock: return "EacR11SnormBlock";
case vk::Format::eEacR11G11UnormBlock: return "EacR11G11UnormBlock";
case vk::Format::eEacR11G11SnormBlock: return "EacR11G11SnormBlock";
case vk::Format::eAstc4x4UnormBlock: return "Astc4x4UnormBlock";
case vk::Format::eAstc4x4SrgbBlock: return "Astc4x4SrgbBlock";
case vk::Format::eAstc5x4UnormBlock: return "Astc5x4UnormBlock";
case vk::Format::eAstc5x4SrgbBlock: return "Astc5x4SrgbBlock";
case vk::Format::eAstc5x5UnormBlock: return "Astc5x5UnormBlock";
case vk::Format::eAstc5x5SrgbBlock: return "Astc5x5SrgbBlock";
case vk::Format::eAstc6x5UnormBlock: return "Astc6x5UnormBlock";
case vk::Format::eAstc6x5SrgbBlock: return "Astc6x5SrgbBlock";
case vk::Format::eAstc6x6UnormBlock: return "Astc6x6UnormBlock";
case vk::Format::eAstc6x6SrgbBlock: return "Astc6x6SrgbBlock";
case vk::Format::eAstc8x5UnormBlock: return "Astc8x5UnormBlock";
case vk::Format::eAstc8x5SrgbBlock: return "Astc8x5SrgbBlock";
case vk::Format::eAstc8x6UnormBlock: return "Astc8x6UnormBlock";
case vk::Format::eAstc8x6SrgbBlock: return "Astc8x6SrgbBlock";
case vk::Format::eAstc8x8UnormBlock: return "Astc8x8UnormBlock";
case vk::Format::eAstc8x8SrgbBlock: return "Astc8x8SrgbBlock";
case vk::Format::eAstc10x5UnormBlock: return "Astc10x5UnormBlock";
case vk::Format::eAstc10x5SrgbBlock: return "Astc10x5SrgbBlock";
case vk::Format::eAstc10x6UnormBlock: return "Astc10x6UnormBlock";
case vk::Format::eAstc10x6SrgbBlock: return "Astc10x6SrgbBlock";
case vk::Format::eAstc10x8UnormBlock: return "Astc10x8UnormBlock";
case vk::Format::eAstc10x8SrgbBlock: return "Astc10x8SrgbBlock";
case vk::Format::eAstc10x10UnormBlock: return "Astc10x10UnormBlock";
case vk::Format::eAstc10x10SrgbBlock: return "Astc10x10SrgbBlock";
case vk::Format::eAstc12x10UnormBlock: return "Astc12x10UnormBlock";
case vk::Format::eAstc12x10SrgbBlock: return "Astc12x10SrgbBlock";
case vk::Format::eAstc12x12UnormBlock: return "Astc12x12UnormBlock";
case vk::Format::eAstc12x12SrgbBlock: return "Astc12x12SrgbBlock";
case vk::Format::eG8B8G8R8422Unorm: return "G8B8G8R8422Unorm";
case vk::Format::eB8G8R8G8422Unorm: return "B8G8R8G8422Unorm";
case vk::Format::eG8B8R83Plane420Unorm: return "G8B8R83Plane420Unorm";
case vk::Format::eG8B8R82Plane420Unorm: return "G8B8R82Plane420Unorm";
case vk::Format::eG8B8R83Plane422Unorm: return "G8B8R83Plane422Unorm";
case vk::Format::eG8B8R82Plane422Unorm: return "G8B8R82Plane422Unorm";
case vk::Format::eG8B8R83Plane444Unorm: return "G8B8R83Plane444Unorm";
case vk::Format::eR10X6UnormPack16: return "R10X6UnormPack16";
case vk::Format::eR10X6G10X6Unorm2Pack16: return "R10X6G10X6Unorm2Pack16";
case vk::Format::eR10X6G10X6B10X6A10X6Unorm4Pack16: return "R10X6G10X6B10X6A10X6Unorm4Pack16";
case vk::Format::eG10X6B10X6G10X6R10X6422Unorm4Pack16: return "G10X6B10X6G10X6R10X6422Unorm4Pack16";
case vk::Format::eB10X6G10X6R10X6G10X6422Unorm4Pack16: return "B10X6G10X6R10X6G10X6422Unorm4Pack16";
case vk::Format::eG10X6B10X6R10X63Plane420Unorm3Pack16: return "G10X6B10X6R10X63Plane420Unorm3Pack16";
case vk::Format::eG10X6B10X6R10X62Plane420Unorm3Pack16: return "G10X6B10X6R10X62Plane420Unorm3Pack16";
case vk::Format::eG10X6B10X6R10X63Plane422Unorm3Pack16: return "G10X6B10X6R10X63Plane422Unorm3Pack16";
case vk::Format::eG10X6B10X6R10X62Plane422Unorm3Pack16: return "G10X6B10X6R10X62Plane422Unorm3Pack16";
case vk::Format::eG10X6B10X6R10X63Plane444Unorm3Pack16: return "G10X6B10X6R10X63Plane444Unorm3Pack16";
case vk::Format::eR12X4UnormPack16: return "R12X4UnormPack16";
case vk::Format::eR12X4G12X4Unorm2Pack16: return "R12X4G12X4Unorm2Pack16";
case vk::Format::eR12X4G12X4B12X4A12X4Unorm4Pack16: return "R12X4G12X4B12X4A12X4Unorm4Pack16";
case vk::Format::eG12X4B12X4G12X4R12X4422Unorm4Pack16: return "G12X4B12X4G12X4R12X4422Unorm4Pack16";
case vk::Format::eB12X4G12X4R12X4G12X4422Unorm4Pack16: return "B12X4G12X4R12X4G12X4422Unorm4Pack16";
case vk::Format::eG12X4B12X4R12X43Plane420Unorm3Pack16: return "G12X4B12X4R12X43Plane420Unorm3Pack16";
case vk::Format::eG12X4B12X4R12X42Plane420Unorm3Pack16: return "G12X4B12X4R12X42Plane420Unorm3Pack16";
case vk::Format::eG12X4B12X4R12X43Plane422Unorm3Pack16: return "G12X4B12X4R12X43Plane422Unorm3Pack16";
case vk::Format::eG12X4B12X4R12X42Plane422Unorm3Pack16: return "G12X4B12X4R12X42Plane422Unorm3Pack16";
case vk::Format::eG12X4B12X4R12X43Plane444Unorm3Pack16: return "G12X4B12X4R12X43Plane444Unorm3Pack16";
case vk::Format::eG16B16G16R16422Unorm: return "G16B16G16R16422Unorm";
case vk::Format::eB16G16R16G16422Unorm: return "B16G16R16G16422Unorm";
case vk::Format::eG16B16R163Plane420Unorm: return "G16B16R163Plane420Unorm";
case vk::Format::eG16B16R162Plane420Unorm: return "G16B16R162Plane420Unorm";
case vk::Format::eG16B16R163Plane422Unorm: return "G16B16R163Plane422Unorm";
case vk::Format::eG16B16R162Plane422Unorm: return "G16B16R162Plane422Unorm";
case vk::Format::eG16B16R163Plane444Unorm: return "G16B16R163Plane444Unorm";
case vk::Format::eG8B8R82Plane444Unorm: return "G8B8R82Plane444Unorm";
case vk::Format::eG10X6B10X6R10X62Plane444Unorm3Pack16: return "G10X6B10X6R10X62Plane444Unorm3Pack16";
case vk::Format::eG12X4B12X4R12X42Plane444Unorm3Pack16: return "G12X4B12X4R12X42Plane444Unorm3Pack16";
case vk::Format::eG16B16R162Plane444Unorm: return "G16B16R162Plane444Unorm";
case vk::Format::eA4R4G4B4UnormPack16: return "A4R4G4B4UnormPack16";
case vk::Format::eA4B4G4R4UnormPack16: return "A4B4G4R4UnormPack16";
case vk::Format::eAstc4x4SfloatBlock: return "Astc4x4SfloatBlock";
case vk::Format::eAstc5x4SfloatBlock: return "Astc5x4SfloatBlock";
case vk::Format::eAstc5x5SfloatBlock: return "Astc5x5SfloatBlock";
case vk::Format::eAstc6x5SfloatBlock: return "Astc6x5SfloatBlock";
case vk::Format::eAstc6x6SfloatBlock: return "Astc6x6SfloatBlock";
case vk::Format::eAstc8x5SfloatBlock: return "Astc8x5SfloatBlock";
case vk::Format::eAstc8x6SfloatBlock: return "Astc8x6SfloatBlock";
case vk::Format::eAstc8x8SfloatBlock: return "Astc8x8SfloatBlock";
case vk::Format::eAstc10x5SfloatBlock: return "Astc10x5SfloatBlock";
case vk::Format::eAstc10x6SfloatBlock: return "Astc10x6SfloatBlock";
case vk::Format::eAstc10x8SfloatBlock: return "Astc10x8SfloatBlock";
case vk::Format::eAstc10x10SfloatBlock: return "Astc10x10SfloatBlock";
case vk::Format::eAstc12x10SfloatBlock: return "Astc12x10SfloatBlock";
case vk::Format::eAstc12x12SfloatBlock: return "Astc12x12SfloatBlock";
case vk::Format::ePvrtc12BppUnormBlockIMG: return "Pvrtc12BppUnormBlockIMG";
case vk::Format::ePvrtc14BppUnormBlockIMG: return "Pvrtc14BppUnormBlockIMG";
case vk::Format::ePvrtc22BppUnormBlockIMG: return "Pvrtc22BppUnormBlockIMG";
case vk::Format::ePvrtc24BppUnormBlockIMG: return "Pvrtc24BppUnormBlockIMG";
case vk::Format::ePvrtc12BppSrgbBlockIMG: return "Pvrtc12BppSrgbBlockIMG";
case vk::Format::ePvrtc14BppSrgbBlockIMG: return "Pvrtc14BppSrgbBlockIMG";
case vk::Format::ePvrtc22BppSrgbBlockIMG: return "Pvrtc22BppSrgbBlockIMG";
case vk::Format::ePvrtc24BppSrgbBlockIMG: return "Pvrtc24BppSrgbBlockIMG";
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
@ -337,8 +51,8 @@ int main( int /*argc*/, char ** /*argv*/ )
for ( size_t j = 0; j < surfaceFormats.size(); j++ )
{
std::cout << std::string( "\t" ) << "Format " << j << "\n";
std::cout << std::string( "\t\t" ) << "colorSpace = " << to_string( surfaceFormats[j].colorSpace ) << "\n";
std::cout << std::string( "\t\t" ) << "format = " << to_string( surfaceFormats[j].format ) << "\n";
std::cout << std::string( "\t\t" ) << "colorSpace = " << vk::to_string( surfaceFormats[j].colorSpace ) << "\n";
std::cout << std::string( "\t\t" ) << "format = " << vk::to_string( surfaceFormats[j].format ) << "\n";
std::cout << "\n";
}
}

View File

@ -553,7 +553,7 @@ When you configure your project using CMake, you can enable TESTS_BUILD to add s
### Compile time issues
As vulkan.hpp is pretty big, some compilers might need some time to digest all that stuff. In order to potentially reduce the time needed to compile that header, a couple of defines will be introduced, that allow you to hide certain features. Whenever you don't need that corresponding feature, defining that value might improve your compile time.
Currently, there are just two such defines:
Currently, there are just a couple of such defines:
- ```VULKAN_HPP_NO_SPACESHIP_OPERATOR```, which removes the spaceship operator on structures (available with C++20)
- ```VULKAN_HPP_NO_TO_STRING```, which removes the various vk::to_string functions on enums and bitmasks.
- ```VULKAN_HPP_USE_REFLECT```, this one needs to be defined to use the reflection function on structures. It's very slow to compile, though!
@ -624,7 +624,7 @@ By default, the namespace used with vulkan.hpp is ```vk```. By defining ```VULKA
#### VULKAN_HPP_NO_TO_STRING
By default, there are functions ```vk::to_string``` for enums and bitmasks. If you don't need that functionality, you can define ```VULKAN_HPP_NO_TO_STRING``` to spare some compilation time.
By default, the file vulkan_to_string.hpp is included by vulkan.hpp and provides functions ```vk::to_string``` for enums and bitmasks. If you don't need those functions, you can define VULKAN_HPP_NO_TO_STRING to prevent that inclusion. If you have certain files where you want to use those functions nevertheless, you can explicitly include vulkan_to_string.hpp there.
#### VULKAN_HPP_NO_CONSTRUCTORS

View File

@ -172,6 +172,30 @@ ${bitmasks}
return replaceWithMap( bitmasksTemplate, { { "bitmasks", bitmasks } } );
}
std::string VulkanHppGenerator::generateBitmasksToString() const
{
const std::string bitmasksToStringTemplate = R"(
//==========================
//=== BITMASKs to_string ===
//==========================
${bitmasksToString}
)";
std::string bitmasksToString;
std::set<std::string> listedBitmasks;
for ( auto const & feature : m_features )
{
bitmasksToString += generateBitmasksToString( feature.second.requireData, listedBitmasks, feature.first );
}
for ( auto const & extIt : m_extensionsByNumber )
{
bitmasksToString += generateBitmasksToString( extIt.second->second.requireData, listedBitmasks, extIt.second->first );
}
return replaceWithMap( bitmasksToStringTemplate, { { "bitmasksToString", bitmasksToString } } );
}
std::string VulkanHppGenerator::generateCommandDefinitions() const
{
const std::string commandDefinitionsTemplate = R"(
@ -344,15 +368,7 @@ ${commands}
std::string VulkanHppGenerator::generateEnums() const
{
// start with toHexString, which is used in all the to_string functions here!
const std::string enumsTemplate = R"(
VULKAN_HPP_INLINE std::string toHexString( uint32_t value )
{
std::stringstream stream;
stream << std::hex << value;
return stream.str();
}
//=============
//=== ENUMs ===
//=============
@ -374,6 +390,38 @@ ${enums}
return replaceWithMap( enumsTemplate, { { "enums", enums } } );
}
std::string VulkanHppGenerator::generateEnumsToString() const
{
// start with toHexString, which is used in all the to_string functions here!
const std::string enumsToStringTemplate = R"(
//=======================
//=== ENUMs to_string ===
//=======================
VULKAN_HPP_INLINE std::string toHexString( uint32_t value )
{
std::stringstream stream;
stream << std::hex << value;
return stream.str();
}
${enumsToString}
)";
std::string enumsToString;
std::set<std::string> listedEnums;
for ( auto const & feature : m_features )
{
enumsToString += generateEnumsToString( feature.second.requireData, listedEnums, feature.first );
}
for ( auto const & extIt : m_extensionsByNumber )
{
enumsToString += generateEnumsToString( extIt.second->second.requireData, listedEnums, extIt.second->first );
}
return replaceWithMap( enumsToStringTemplate, { { "enumsToString", enumsToString } } );
}
std::string VulkanHppGenerator::generateFormatTraits() const
{
if ( m_formats.empty() )
@ -2691,30 +2739,21 @@ std::string VulkanHppGenerator::generateBitmask( std::map<std::string, BitmaskDa
auto bitmaskBitsIt = m_enums.find( bitmaskIt->second.requirements );
assert( bitmaskBitsIt != m_enums.end() );
std::string strippedBitmaskName = stripPrefix( bitmaskIt->first, "Vk" );
std::string strippedEnumName = stripPrefix( bitmaskBitsIt->first, "Vk" );
std::string bitmaskName = stripPrefix( bitmaskIt->first, "Vk" );
std::string enumName = stripPrefix( bitmaskBitsIt->first, "Vk" );
// each Flags class is using the class 'Flags' with the corresponding FlagBits enum as the template parameter
std::string str = "\n using " + strippedBitmaskName + " = Flags<" + strippedEnumName + ">;\n";
std::string str = "\n using " + bitmaskName + " = Flags<" + enumName + ">;\n";
std::string alias =
bitmaskIt->second.alias.empty() ? "" : ( "\n using " + stripPrefix( bitmaskIt->second.alias, "Vk" ) + " = " + strippedBitmaskName + ";\n" );
std::string alias = bitmaskIt->second.alias.empty() ? "" : ( "\n using " + stripPrefix( bitmaskIt->second.alias, "Vk" ) + " = " + bitmaskName + ";\n" );
if ( bitmaskBitsIt->second.values.empty() )
{
static std::string bitmaskValuesTemplate = R"(${alias}
#if !defined( VULKAN_HPP_NO_TO_STRING )
VULKAN_HPP_INLINE std::string to_string( ${bitmaskName} )
{
return "{}";
}
#endif
)";
str += replaceWithMap( bitmaskValuesTemplate, { { "alias", alias }, { "bitmaskName", strippedBitmaskName } } );
str += alias + "\n";
}
else
{
static const std::string bitmaskValuesTemplate = R"(
static const std::string bitmaskTemplate = R"(
template <> struct FlagTraits<${enumName}>
{
enum : ${bitmaskType}
@ -2743,20 +2782,9 @@ std::string VulkanHppGenerator::generateBitmask( std::map<std::string, BitmaskDa
return ~( ${bitmaskName}( bits ) );
}
${alias}
#if !defined( VULKAN_HPP_NO_TO_STRING )
VULKAN_HPP_INLINE std::string to_string( ${bitmaskName} value )
{
if ( !value )
return "{}";
std::string result;
${toStringChecks}
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
#endif
)";
std::string allFlags, toStringChecks;
std::string allFlags;
bool encounteredFlag = false;
std::string previousEnter, previousLeave;
for ( auto const & value : bitmaskBitsIt->second.values )
@ -2764,12 +2792,7 @@ ${toStringChecks}
auto [enter, leave] = generateProtection( value.extension, value.protect );
std::string valueName = generateEnumValueName( bitmaskBitsIt->first, value.name, true, m_tags );
allFlags += ( ( previousEnter != enter ) ? ( "\n" + previousLeave + enter ) : "\n" ) + " " + ( encounteredFlag ? "| " : " " ) +
bitmaskIt->second.type + "( " + strippedEnumName + "::" + valueName + " )";
if ( value.singleBit )
{
toStringChecks += ( ( previousEnter != enter ) ? ( previousLeave + enter ) : "" ) + " if ( value & " + strippedEnumName + "::" + valueName +
" ) result += \"" + valueName.substr( 1 ) + " | \";\n";
}
bitmaskIt->second.type + "( " + enumName + "::" + valueName + " )";
encounteredFlag = true;
previousEnter = enter;
previousLeave = leave;
@ -2777,18 +2800,13 @@ ${toStringChecks}
if ( !previousLeave.empty() )
{
assert( endsWith( previousLeave, "\n" ) );
toStringChecks += previousLeave;
previousLeave.resize( previousLeave.size() - strlen( "\n" ) );
allFlags += "\n" + previousLeave;
}
str += replaceWithMap( bitmaskValuesTemplate,
{ { "alias", alias },
{ "allFlags", allFlags },
{ "bitmaskName", strippedBitmaskName },
{ "bitmaskType", bitmaskIt->second.type },
{ "enumName", strippedEnumName },
{ "toStringChecks", toStringChecks } } );
str += replaceWithMap(
bitmaskTemplate,
{ { "alias", alias }, { "allFlags", allFlags }, { "bitmaskName", bitmaskName }, { "bitmaskType", bitmaskIt->second.type }, { "enumName", enumName } } );
}
return str;
@ -2813,6 +2831,86 @@ std::string
return addTitleAndProtection( title, str );
}
std::string VulkanHppGenerator::generateBitmasksToString( std::vector<RequireData> const & requireData,
std::set<std::string> & listedBitmasks,
std::string const & title ) const
{
std::string str;
for ( auto const & require : requireData )
{
for ( auto const & type : require.types )
{
auto bitmaskIt = m_bitmasks.find( type );
if ( ( bitmaskIt != m_bitmasks.end() ) && ( listedBitmasks.find( type ) == listedBitmasks.end() ) )
{
listedBitmasks.insert( type );
str += generateBitmaskToString( bitmaskIt );
}
}
}
return addTitleAndProtection( title, str );
}
std::string VulkanHppGenerator::generateBitmaskToString( std::map<std::string, BitmaskData>::const_iterator bitmaskIt ) const
{
auto bitmaskBitsIt = m_enums.find( bitmaskIt->second.requirements );
assert( bitmaskBitsIt != m_enums.end() );
std::string bitmaskName = stripPrefix( bitmaskIt->first, "Vk" );
std::string enumName = stripPrefix( bitmaskBitsIt->first, "Vk" );
std::string str;
if ( bitmaskBitsIt->second.values.empty() )
{
static std::string bitmaskToStringTemplate = R"(
VULKAN_HPP_INLINE std::string to_string( ${bitmaskName} )
{
return "{}";
}
)";
str += replaceWithMap( bitmaskToStringTemplate, { { "bitmaskName", bitmaskName } } );
}
else
{
static const std::string bitmaskToStringTemplate = R"(
VULKAN_HPP_INLINE std::string to_string( ${bitmaskName} value )
{
if ( !value )
return "{}";
std::string result;
${toStringChecks}
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
)";
std::string toStringChecks;
std::string previousEnter, previousLeave;
for ( auto const & value : bitmaskBitsIt->second.values )
{
auto [enter, leave] = generateProtection( value.extension, value.protect );
std::string valueName = generateEnumValueName( bitmaskBitsIt->first, value.name, true, m_tags );
if ( value.singleBit )
{
toStringChecks += ( ( previousEnter != enter ) ? ( previousLeave + enter ) : "" ) + " if ( value & " + enumName + "::" + valueName +
" ) result += \"" + valueName.substr( 1 ) + " | \";\n";
}
previousEnter = enter;
previousLeave = leave;
}
if ( !previousLeave.empty() )
{
assert( endsWith( previousLeave, "\n" ) );
toStringChecks += previousLeave;
previousLeave.resize( previousLeave.size() - strlen( "\n" ) );
}
str += replaceWithMap( bitmaskToStringTemplate, { { "bitmaskName", bitmaskName }, { "toStringChecks", toStringChecks } } );
}
return str;
}
std::string VulkanHppGenerator::generateCallArgumentsEnhanced( CommandData const & commandData,
size_t initialSkipCount,
bool nonConstPointerAsNullptr,
@ -5303,6 +5401,27 @@ std::string
str += "\n";
str += generateEnum( *enumIt );
}
}
}
return addTitleAndProtection( title, str );
}
std::string VulkanHppGenerator::generateEnumsToString( std::vector<RequireData> const & requireData,
std::set<std::string> & listedEnums,
std::string const & title ) const
{
std::string str;
for ( auto const & require : requireData )
{
for ( auto const & type : require.types )
{
auto enumIt = m_enums.find( type );
if ( ( enumIt != m_enums.end() ) && ( listedEnums.find( type ) == listedEnums.end() ) )
{
listedEnums.insert( type );
str += "\n";
str += generateEnumToString( *enumIt );
}
}
@ -5381,12 +5500,10 @@ ${cases} default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString(
}
const std::string enumToStringTemplate = R"(
#if !defined( VULKAN_HPP_NO_TO_STRING )
VULKAN_HPP_INLINE std::string to_string( ${enumName}${argument} )
{
${functionBody}
}
#endif
)";
return replaceWithMap( enumToStringTemplate,
@ -6624,8 +6741,6 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithE
return "";
}
std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithErrors3Return( std::map<std::string, CommandData>::const_iterator commandIt,
size_t initialSkipCount,
bool definition,
@ -15303,6 +15418,9 @@ namespace VULKAN_HPP_NAMESPACE
str += R"(} // namespace VULKAN_HPP_NAMESPACE
#include <vulkan/vulkan_enums.hpp>
#if !defined( VULKAN_HPP_NO_TO_STRING )
#include <vulkan/vulkan_to_string.hpp>
#endif
#ifndef VULKAN_HPP_NO_EXCEPTIONS
namespace std
@ -15374,6 +15492,26 @@ namespace std
)";
writeToFile( str, VULKAN_HASH_HPP_FILE );
std::cout << "VulkanHppGenerator: Generating " << VULKAN_TO_STRING_HPP_FILE << "..." << std::endl;
str.clear();
str = generator.getVulkanLicenseHeader();
str += +R"(
#ifndef VULKAN_TO_STRING_HPP
# define VULKAN_TO_STRING_HPP
#include <vulkan/vulkan_enums.hpp>
namespace VULKAN_HPP_NAMESPACE
{
)";
str += generator.generateBitmasksToString();
str += generator.generateEnumsToString();
str += R"(
} // namespace VULKAN_HPP_NAMESPACE
#endif // VULKAN_TO_STRING_HPP
)";
writeToFile( str, VULKAN_TO_STRING_HPP_FILE );
std::cout << "VulkanHppGenerator: Generating " << VULKAN_RAII_HPP_FILE << " ..." << std::endl;
str.clear();
str = generator.getVulkanLicenseHeader() + R"(

View File

@ -27,10 +27,12 @@ public:
std::string generateBaseTypes() const;
std::string generateBitmasks() const;
std::string generateBitmasksToString() const;
std::string generateCommandDefinitions() const;
std::string generateDispatchLoaderDynamic() const; // uses vkGet*ProcAddress to get function pointers
std::string generateDispatchLoaderStatic() const; // uses exported symbols from loader
std::string generateEnums() const;
std::string generateEnumsToString() const;
std::string generateFormatTraits() const;
std::string generateHandles() const;
std::string generateHandleHashStructures() const;
@ -459,6 +461,8 @@ private:
bool raii ) const;
std::string generateBitmask( std::map<std::string, BitmaskData>::const_iterator bitmaskIt ) const;
std::string generateBitmasks( std::vector<RequireData> const & requireData, std::set<std::string> & listedBitmasks, std::string const & title ) const;
std::string generateBitmasksToString( std::vector<RequireData> const & requireData, std::set<std::string> & listedBitmasks, std::string const & title ) const;
std::string generateBitmaskToString( std::map<std::string, BitmaskData>::const_iterator bitmaskIt ) const;
std::string generateCallArgumentsEnhanced( CommandData const & commandData,
size_t initialSkipCount,
bool nonConstPointerAsNullptr,
@ -654,6 +658,7 @@ private:
std::string const & title ) const;
std::string generateEnum( std::pair<std::string, EnumData> const & enumData ) const;
std::string generateEnums( std::vector<RequireData> const & requireData, std::set<std::string> & listedEnums, std::string const & title ) const;
std::string generateEnumsToString( std::vector<RequireData> const & requireData, std::set<std::string> & listedEnums, std::string const & title ) const;
std::string generateEnumInitializer( TypeInfo const & type,
std::vector<std::string> const & arraySizes,
std::vector<EnumValueData> const & values,

View File

@ -15,10 +15,10 @@
// VulkanHpp Samples : CreateDebugReportMessenger
// Draw a cube
#include "vulkan/vulkan.hpp"
#include <iostream>
#include <sstream>
#include <vulkan/vulkan.hpp>
#include <vulkan/vulkan_to_string.hpp>
static char const * AppName = "CreateDebugReportMessenger";
static char const * EngineName = "Vulkan.hpp";
@ -26,100 +26,6 @@ static char const * EngineName = "Vulkan.hpp";
PFN_vkCreateDebugUtilsMessengerEXT pfnVkCreateDebugUtilsMessengerEXT;
PFN_vkDestroyDebugUtilsMessengerEXT pfnVkDestroyDebugUtilsMessengerEXT;
#if defined( VULKAN_HPP_NO_TO_STRING )
namespace local
{
std::string to_string( vk::DebugUtilsMessageSeverityFlagBitsEXT value )
{
switch ( value )
{
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eVerbose: return "Verbose";
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eInfo: return "Info";
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning: return "Warning";
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eError: return "Error";
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
std::string to_string( vk::DebugUtilsMessageTypeFlagsEXT value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::DebugUtilsMessageTypeFlagBitsEXT::eGeneral )
result += "General | ";
if ( value & vk::DebugUtilsMessageTypeFlagBitsEXT::eValidation )
result += "Validation | ";
if ( value & vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance )
result += "Performance | ";
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
std::string to_string( vk::ObjectType value )
{
switch ( value )
{
case vk::ObjectType::eUnknown: return "Unknown";
case vk::ObjectType::eInstance: return "Instance";
case vk::ObjectType::ePhysicalDevice: return "PhysicalDevice";
case vk::ObjectType::eDevice: return "Device";
case vk::ObjectType::eQueue: return "Queue";
case vk::ObjectType::eSemaphore: return "Semaphore";
case vk::ObjectType::eCommandBuffer: return "CommandBuffer";
case vk::ObjectType::eFence: return "Fence";
case vk::ObjectType::eDeviceMemory: return "DeviceMemory";
case vk::ObjectType::eBuffer: return "Buffer";
case vk::ObjectType::eImage: return "Image";
case vk::ObjectType::eEvent: return "Event";
case vk::ObjectType::eQueryPool: return "QueryPool";
case vk::ObjectType::eBufferView: return "BufferView";
case vk::ObjectType::eImageView: return "ImageView";
case vk::ObjectType::eShaderModule: return "ShaderModule";
case vk::ObjectType::ePipelineCache: return "PipelineCache";
case vk::ObjectType::ePipelineLayout: return "PipelineLayout";
case vk::ObjectType::eRenderPass: return "RenderPass";
case vk::ObjectType::ePipeline: return "Pipeline";
case vk::ObjectType::eDescriptorSetLayout: return "DescriptorSetLayout";
case vk::ObjectType::eSampler: return "Sampler";
case vk::ObjectType::eDescriptorPool: return "DescriptorPool";
case vk::ObjectType::eDescriptorSet: return "DescriptorSet";
case vk::ObjectType::eFramebuffer: return "Framebuffer";
case vk::ObjectType::eCommandPool: return "CommandPool";
case vk::ObjectType::eSamplerYcbcrConversion: return "SamplerYcbcrConversion";
case vk::ObjectType::eDescriptorUpdateTemplate: return "DescriptorUpdateTemplate";
case vk::ObjectType::ePrivateDataSlot: return "PrivateDataSlot";
case vk::ObjectType::eSurfaceKHR: return "SurfaceKHR";
case vk::ObjectType::eSwapchainKHR: return "SwapchainKHR";
case vk::ObjectType::eDisplayKHR: return "DisplayKHR";
case vk::ObjectType::eDisplayModeKHR: return "DisplayModeKHR";
case vk::ObjectType::eDebugReportCallbackEXT: return "DebugReportCallbackEXT";
# if defined( VK_ENABLE_BETA_EXTENSIONS )
case vk::ObjectType::eVideoSessionKHR: return "VideoSessionKHR";
case vk::ObjectType::eVideoSessionParametersKHR: return "VideoSessionParametersKHR";
# endif /*VK_ENABLE_BETA_EXTENSIONS*/
case vk::ObjectType::eCuModuleNVX: return "CuModuleNVX";
case vk::ObjectType::eCuFunctionNVX: return "CuFunctionNVX";
case vk::ObjectType::eDebugUtilsMessengerEXT: return "DebugUtilsMessengerEXT";
case vk::ObjectType::eAccelerationStructureKHR: return "AccelerationStructureKHR";
case vk::ObjectType::eValidationCacheEXT: return "ValidationCacheEXT";
case vk::ObjectType::eAccelerationStructureNV: return "AccelerationStructureNV";
case vk::ObjectType::ePerformanceConfigurationINTEL: return "PerformanceConfigurationINTEL";
case vk::ObjectType::eDeferredOperationKHR: return "DeferredOperationKHR";
case vk::ObjectType::eIndirectCommandsLayoutNV: return "IndirectCommandsLayoutNV";
# if defined( VK_USE_PLATFORM_FUCHSIA )
case vk::ObjectType::eBufferCollectionFUCHSIA: return "BufferCollectionFUCHSIA";
# endif /*VK_USE_PLATFORM_FUCHSIA*/
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
} // namespace local
using local::to_string;
#else
using vk::to_string;
#endif
VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugUtilsMessengerEXT( VkInstance instance,
const VkDebugUtilsMessengerCreateInfoEXT * pCreateInfo,
const VkAllocationCallbacks * pAllocator,
@ -140,8 +46,8 @@ VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( VkDebugUtilsMessageSeverityFlag
{
std::ostringstream message;
message << to_string( static_cast<vk::DebugUtilsMessageSeverityFlagBitsEXT>( messageSeverity ) ) << ": "
<< to_string( static_cast<vk::DebugUtilsMessageTypeFlagsEXT>( messageTypes ) ) << ":\n";
message << vk::to_string( static_cast<vk::DebugUtilsMessageSeverityFlagBitsEXT>( messageSeverity ) ) << ": "
<< vk::to_string( static_cast<vk::DebugUtilsMessageTypeFlagsEXT>( messageTypes ) ) << ":\n";
message << std::string( "\t" ) << "messageIDName = <" << pCallbackData->pMessageIdName << ">\n";
message << std::string( "\t" ) << "messageIdNumber = " << pCallbackData->messageIdNumber << "\n";
message << std::string( "\t" ) << "message = <" << pCallbackData->pMessage << ">\n";
@ -167,7 +73,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( VkDebugUtilsMessageSeverityFlag
for ( uint32_t i = 0; i < pCallbackData->objectCount; i++ )
{
message << std::string( "\t\t" ) << "Object " << i << "\n";
message << std::string( "\t\t\t" ) << "objectType = " << to_string( static_cast<vk::ObjectType>( pCallbackData->pObjects[i].objectType ) ) << "\n";
message << std::string( "\t\t\t" ) << "objectType = " << vk::to_string( static_cast<vk::ObjectType>( pCallbackData->pObjects[i].objectType ) ) << "\n";
message << std::string( "\t\t\t" ) << "objectHandle = " << pCallbackData->pObjects[i].objectHandle << "\n";
if ( pCallbackData->pObjects[i].pObjectName )
{

View File

@ -26,11 +26,12 @@
#endif
#include "../utils/utils.hpp"
#include "vulkan/vulkan.hpp"
#include <algorithm>
#include <iostream>
#include <sstream>
#include <vulkan/vulkan.hpp>
#include <vulkan/vulkan_to_string.hpp>
static char const * AppName = "EnableValidationWithCallback";
static char const * EngineName = "Vulkan.hpp";
@ -38,100 +39,6 @@ static char const * EngineName = "Vulkan.hpp";
PFN_vkCreateDebugUtilsMessengerEXT pfnVkCreateDebugUtilsMessengerEXT;
PFN_vkDestroyDebugUtilsMessengerEXT pfnVkDestroyDebugUtilsMessengerEXT;
#if defined( VULKAN_HPP_NO_TO_STRING )
namespace local
{
std::string to_string( vk::DebugUtilsMessageSeverityFlagBitsEXT value )
{
switch ( value )
{
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eVerbose: return "Verbose";
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eInfo: return "Info";
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning: return "Warning";
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eError: return "Error";
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
std::string to_string( vk::DebugUtilsMessageTypeFlagsEXT value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::DebugUtilsMessageTypeFlagBitsEXT::eGeneral )
result += "General | ";
if ( value & vk::DebugUtilsMessageTypeFlagBitsEXT::eValidation )
result += "Validation | ";
if ( value & vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance )
result += "Performance | ";
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
std::string to_string( vk::ObjectType value )
{
switch ( value )
{
case vk::ObjectType::eUnknown: return "Unknown";
case vk::ObjectType::eInstance: return "Instance";
case vk::ObjectType::ePhysicalDevice: return "PhysicalDevice";
case vk::ObjectType::eDevice: return "Device";
case vk::ObjectType::eQueue: return "Queue";
case vk::ObjectType::eSemaphore: return "Semaphore";
case vk::ObjectType::eCommandBuffer: return "CommandBuffer";
case vk::ObjectType::eFence: return "Fence";
case vk::ObjectType::eDeviceMemory: return "DeviceMemory";
case vk::ObjectType::eBuffer: return "Buffer";
case vk::ObjectType::eImage: return "Image";
case vk::ObjectType::eEvent: return "Event";
case vk::ObjectType::eQueryPool: return "QueryPool";
case vk::ObjectType::eBufferView: return "BufferView";
case vk::ObjectType::eImageView: return "ImageView";
case vk::ObjectType::eShaderModule: return "ShaderModule";
case vk::ObjectType::ePipelineCache: return "PipelineCache";
case vk::ObjectType::ePipelineLayout: return "PipelineLayout";
case vk::ObjectType::eRenderPass: return "RenderPass";
case vk::ObjectType::ePipeline: return "Pipeline";
case vk::ObjectType::eDescriptorSetLayout: return "DescriptorSetLayout";
case vk::ObjectType::eSampler: return "Sampler";
case vk::ObjectType::eDescriptorPool: return "DescriptorPool";
case vk::ObjectType::eDescriptorSet: return "DescriptorSet";
case vk::ObjectType::eFramebuffer: return "Framebuffer";
case vk::ObjectType::eCommandPool: return "CommandPool";
case vk::ObjectType::eSamplerYcbcrConversion: return "SamplerYcbcrConversion";
case vk::ObjectType::eDescriptorUpdateTemplate: return "DescriptorUpdateTemplate";
case vk::ObjectType::ePrivateDataSlot: return "PrivateDataSlot";
case vk::ObjectType::eSurfaceKHR: return "SurfaceKHR";
case vk::ObjectType::eSwapchainKHR: return "SwapchainKHR";
case vk::ObjectType::eDisplayKHR: return "DisplayKHR";
case vk::ObjectType::eDisplayModeKHR: return "DisplayModeKHR";
case vk::ObjectType::eDebugReportCallbackEXT: return "DebugReportCallbackEXT";
# if defined( VK_ENABLE_BETA_EXTENSIONS )
case vk::ObjectType::eVideoSessionKHR: return "VideoSessionKHR";
case vk::ObjectType::eVideoSessionParametersKHR: return "VideoSessionParametersKHR";
# endif /*VK_ENABLE_BETA_EXTENSIONS*/
case vk::ObjectType::eCuModuleNVX: return "CuModuleNVX";
case vk::ObjectType::eCuFunctionNVX: return "CuFunctionNVX";
case vk::ObjectType::eDebugUtilsMessengerEXT: return "DebugUtilsMessengerEXT";
case vk::ObjectType::eAccelerationStructureKHR: return "AccelerationStructureKHR";
case vk::ObjectType::eValidationCacheEXT: return "ValidationCacheEXT";
case vk::ObjectType::eAccelerationStructureNV: return "AccelerationStructureNV";
case vk::ObjectType::ePerformanceConfigurationINTEL: return "PerformanceConfigurationINTEL";
case vk::ObjectType::eDeferredOperationKHR: return "DeferredOperationKHR";
case vk::ObjectType::eIndirectCommandsLayoutNV: return "IndirectCommandsLayoutNV";
# if defined( VK_USE_PLATFORM_FUCHSIA )
case vk::ObjectType::eBufferCollectionFUCHSIA: return "BufferCollectionFUCHSIA";
# endif /*VK_USE_PLATFORM_FUCHSIA*/
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
} // namespace local
using local::to_string;
#else
using vk::to_string;
#endif
VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugUtilsMessengerEXT( VkInstance instance,
const VkDebugUtilsMessengerCreateInfoEXT * pCreateInfo,
const VkAllocationCallbacks * pAllocator,
@ -152,8 +59,8 @@ VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( VkDebugUtilsMessageSeverityFlag
{
std::string message;
message += to_string( static_cast<vk::DebugUtilsMessageSeverityFlagBitsEXT>( messageSeverity ) ) + ": " +
to_string( static_cast<vk::DebugUtilsMessageTypeFlagsEXT>( messageTypes ) ) + ":\n";
message += vk::to_string( static_cast<vk::DebugUtilsMessageSeverityFlagBitsEXT>( messageSeverity ) ) + ": " +
vk::to_string( static_cast<vk::DebugUtilsMessageTypeFlagsEXT>( messageTypes ) ) + ":\n";
message += std::string( "\t" ) + "messageIDName = <" + pCallbackData->pMessageIdName + ">\n";
message += std::string( "\t" ) + "messageIdNumber = " + std::to_string( pCallbackData->messageIdNumber ) + "\n";
message += std::string( "\t" ) + "message = <" + pCallbackData->pMessage + ">\n";
@ -178,7 +85,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( VkDebugUtilsMessageSeverityFlag
for ( uint32_t i = 0; i < pCallbackData->objectCount; i++ )
{
message += std::string( "\t" ) + "Object " + std::to_string( i ) + "\n";
message += std::string( "\t\t" ) + "objectType = " + to_string( static_cast<vk::ObjectType>( pCallbackData->pObjects[i].objectType ) ) + "\n";
message += std::string( "\t\t" ) + "objectType = " + vk::to_string( static_cast<vk::ObjectType>( pCallbackData->pObjects[i].objectType ) ) + "\n";
message += std::string( "\t\t" ) + "objectHandle = " + std::to_string( pCallbackData->pObjects[i].objectHandle ) + "\n";
if ( pCallbackData->pObjects[i].pObjectName )
{

View File

@ -16,35 +16,15 @@
// Enumerate physical devices
#include "../utils/utils.hpp"
#include "vulkan/vulkan.hpp"
#include <iomanip>
#include <iostream>
#include <vulkan/vulkan.hpp>
#include <vulkan/vulkan_to_string.hpp>
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
@ -76,7 +56,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: " << to_string( properties.deviceType ) << "\n";
std::cout << "deviceType: " << vk::to_string( properties.deviceType ) << "\n";
std::cout << "deviceName: " << properties.deviceName << '\n';

View File

@ -16,10 +16,11 @@
// Get memory properties per physical device.
#include "../utils/utils.hpp"
#include "vulkan/vulkan.hpp"
#include <sstream>
#include <vector>
#include <vulkan/vulkan.hpp>
#include <vulkan/vulkan_to_string.hpp>
static char const * AppName = "PhysicalDeviceMemoryProperties";
static char const * EngineName = "Vulkan.hpp";
@ -46,56 +47,6 @@ std::string formatSize( vk::DeviceSize size )
return oss.str();
}
#if defined( VULKAN_HPP_NO_TO_STRING )
namespace local
{
std::string to_string( vk::MemoryHeapFlags value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::MemoryHeapFlagBits::eDeviceLocal )
result += "DeviceLocal | ";
if ( value & vk::MemoryHeapFlagBits::eMultiInstance )
result += "MultiInstance | ";
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
std::string to_string( vk::MemoryPropertyFlags value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::MemoryPropertyFlagBits::eDeviceLocal )
result += "DeviceLocal | ";
if ( value & vk::MemoryPropertyFlagBits::eHostVisible )
result += "HostVisible | ";
if ( value & vk::MemoryPropertyFlagBits::eHostCoherent )
result += "HostCoherent | ";
if ( value & vk::MemoryPropertyFlagBits::eHostCached )
result += "HostCached | ";
if ( value & vk::MemoryPropertyFlagBits::eLazilyAllocated )
result += "LazilyAllocated | ";
if ( value & vk::MemoryPropertyFlagBits::eProtected )
result += "Protected | ";
if ( value & vk::MemoryPropertyFlagBits::eDeviceCoherentAMD )
result += "DeviceCoherentAMD | ";
if ( value & vk::MemoryPropertyFlagBits::eDeviceUncachedAMD )
result += "DeviceUncachedAMD | ";
if ( value & vk::MemoryPropertyFlagBits::eRdmaCapableNV )
result += "RdmaCapableNV | ";
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
} // namespace local
using local::to_string;
#else
using vk::to_string;
#endif
int main( int /*argc*/, char ** /*argv*/ )
{
try
@ -124,7 +75,7 @@ using vk::to_string;
for ( uint32_t j = 0; j < memoryProperties.memoryHeapCount; j++ )
{
std::cout << " " << j << ": size = " << formatSize( memoryProperties.memoryHeaps[j].size )
<< ", flags = " << to_string( memoryProperties.memoryHeaps[j].flags ) << "\n";
<< ", flags = " << vk::to_string( memoryProperties.memoryHeaps[j].flags ) << "\n";
if ( containsMemoryBudget )
{
std::cout << " heapBudget = " << formatSize( memoryBudgetProperties.heapBudget[j] )
@ -135,7 +86,7 @@ using vk::to_string;
for ( uint32_t j = 0; j < memoryProperties.memoryTypeCount; j++ )
{
std::cout << " " << j << ": heapIndex = " << memoryProperties.memoryTypes[j].heapIndex
<< ", flags = " << to_string( memoryProperties.memoryTypes[j].propertyFlags ) << "\n";
<< ", flags = " << vk::to_string( memoryProperties.memoryTypes[j].propertyFlags ) << "\n";
}
}

View File

@ -16,217 +16,16 @@
// Get properties per physical device.
#include "../utils/utils.hpp"
#include "vulkan/vulkan.hpp"
#include <iomanip>
#include <sstream>
#include <vector>
#include <vulkan/vulkan.hpp>
#include <vulkan/vulkan_to_string.hpp>
static char const * AppName = "PhysicalDeviceProperties";
static char const * EngineName = "Vulkan.hpp";
#if defined( VULKAN_HPP_NO_TO_STRING )
namespace local
{
std::string to_string( vk::DriverId value )
{
switch ( value )
{
case vk::DriverId::eAmdProprietary: return "AmdProprietary";
case vk::DriverId::eAmdOpenSource: return "AmdOpenSource";
case vk::DriverId::eMesaRadv: return "MesaRadv";
case vk::DriverId::eNvidiaProprietary: return "NvidiaProprietary";
case vk::DriverId::eIntelProprietaryWindows: return "IntelProprietaryWindows";
case vk::DriverId::eIntelOpenSourceMESA: return "IntelOpenSourceMESA";
case vk::DriverId::eImaginationProprietary: return "ImaginationProprietary";
case vk::DriverId::eQualcommProprietary: return "QualcommProprietary";
case vk::DriverId::eArmProprietary: return "ArmProprietary";
case vk::DriverId::eGoogleSwiftshader: return "GoogleSwiftshader";
case vk::DriverId::eGgpProprietary: return "GgpProprietary";
case vk::DriverId::eBroadcomProprietary: return "BroadcomProprietary";
case vk::DriverId::eMesaLlvmpipe: return "MesaLlvmpipe";
case vk::DriverId::eMoltenvk: return "Moltenvk";
case vk::DriverId::eCoreaviProprietary: return "CoreaviProprietary";
case vk::DriverId::eJuiceProprietary: return "JuiceProprietary";
case vk::DriverId::eVerisiliconProprietary: return "VerisiliconProprietary";
case vk::DriverId::eMesaTurnip: return "MesaTurnip";
case vk::DriverId::eMesaV3Dv: return "MesaV3Dv";
case vk::DriverId::eMesaPanvk: return "MesaPanvk";
case vk::DriverId::eSamsungProprietary: return "SamsungProprietary";
case vk::DriverId::eMesaVenus: return "MesaVenus";
case vk::DriverId::eMesaDozen: return "MesaDozen";
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
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 ) ) + " )";
}
}
std::string to_string( vk::PointClippingBehavior value )
{
switch ( value )
{
case vk::PointClippingBehavior::eAllClipPlanes: return "AllClipPlanes";
case vk::PointClippingBehavior::eUserClipPlanesOnly: return "UserClipPlanesOnly";
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
std::string to_string( vk::ResolveModeFlags value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::ResolveModeFlagBits::eSampleZero )
result += "SampleZero | ";
if ( value & vk::ResolveModeFlagBits::eAverage )
result += "Average | ";
if ( value & vk::ResolveModeFlagBits::eMin )
result += "Min | ";
if ( value & vk::ResolveModeFlagBits::eMax )
result += "Max | ";
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
std::string to_string( vk::SampleCountFlags value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::SampleCountFlagBits::e1 )
result += "1 | ";
if ( value & vk::SampleCountFlagBits::e2 )
result += "2 | ";
if ( value & vk::SampleCountFlagBits::e4 )
result += "4 | ";
if ( value & vk::SampleCountFlagBits::e8 )
result += "8 | ";
if ( value & vk::SampleCountFlagBits::e16 )
result += "16 | ";
if ( value & vk::SampleCountFlagBits::e32 )
result += "32 | ";
if ( value & vk::SampleCountFlagBits::e64 )
result += "64 | ";
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
std::string to_string( vk::ShaderCorePropertiesFlagsAMD )
{
return "{}";
}
std::string to_string( vk::ShaderFloatControlsIndependence value )
{
switch ( value )
{
case vk::ShaderFloatControlsIndependence::e32BitOnly: return "32BitOnly";
case vk::ShaderFloatControlsIndependence::eAll: return "All";
case vk::ShaderFloatControlsIndependence::eNone: return "None";
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
std::string to_string( vk::ShaderStageFlags value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::ShaderStageFlagBits::eVertex )
result += "Vertex | ";
if ( value & vk::ShaderStageFlagBits::eTessellationControl )
result += "TessellationControl | ";
if ( value & vk::ShaderStageFlagBits::eTessellationEvaluation )
result += "TessellationEvaluation | ";
if ( value & vk::ShaderStageFlagBits::eGeometry )
result += "Geometry | ";
if ( value & vk::ShaderStageFlagBits::eFragment )
result += "Fragment | ";
if ( value & vk::ShaderStageFlagBits::eCompute )
result += "Compute | ";
if ( value & vk::ShaderStageFlagBits::eRaygenKHR )
result += "RaygenKHR | ";
if ( value & vk::ShaderStageFlagBits::eAnyHitKHR )
result += "AnyHitKHR | ";
if ( value & vk::ShaderStageFlagBits::eClosestHitKHR )
result += "ClosestHitKHR | ";
if ( value & vk::ShaderStageFlagBits::eMissKHR )
result += "MissKHR | ";
if ( value & vk::ShaderStageFlagBits::eIntersectionKHR )
result += "IntersectionKHR | ";
if ( value & vk::ShaderStageFlagBits::eCallableKHR )
result += "CallableKHR | ";
if ( value & vk::ShaderStageFlagBits::eTaskNV )
result += "TaskNV | ";
if ( value & vk::ShaderStageFlagBits::eMeshNV )
result += "MeshNV | ";
if ( value & vk::ShaderStageFlagBits::eSubpassShadingHUAWEI )
result += "SubpassShadingHUAWEI | ";
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
std::string to_string( vk::SubgroupFeatureFlags value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::SubgroupFeatureFlagBits::eBasic )
result += "Basic | ";
if ( value & vk::SubgroupFeatureFlagBits::eVote )
result += "Vote | ";
if ( value & vk::SubgroupFeatureFlagBits::eArithmetic )
result += "Arithmetic | ";
if ( value & vk::SubgroupFeatureFlagBits::eBallot )
result += "Ballot | ";
if ( value & vk::SubgroupFeatureFlagBits::eShuffle )
result += "Shuffle | ";
if ( value & vk::SubgroupFeatureFlagBits::eShuffleRelative )
result += "ShuffleRelative | ";
if ( value & vk::SubgroupFeatureFlagBits::eClustered )
result += "Clustered | ";
if ( value & vk::SubgroupFeatureFlagBits::eQuad )
result += "Quad | ";
if ( value & vk::SubgroupFeatureFlagBits::ePartitionedNV )
result += "PartitionedNV | ";
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
std::string to_string( vk::VendorId value )
{
switch ( value )
{
case vk::VendorId::eVIV: return "VIV";
case vk::VendorId::eVSI: return "VSI";
case vk::VendorId::eKazan: return "Kazan";
case vk::VendorId::eCodeplay: return "Codeplay";
case vk::VendorId::eMESA: return "MESA";
case vk::VendorId::ePocl: return "Pocl";
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
} // namespace local
using local::to_string;
#else
using vk::to_string;
#endif
std::string decodeAPIVersion( uint32_t apiVersion )
{
return std::to_string( VK_VERSION_MAJOR( apiVersion ) ) + "." + std::to_string( VK_VERSION_MINOR( apiVersion ) ) + "." +
@ -261,7 +60,7 @@ std::string decodeVendorID( uint32_t vendorID )
else
{
// above 0x10000 should be vkVendorIDs
return to_string( vk::VendorId( vendorID ) );
return vk::to_string( vk::VendorId( vendorID ) );
}
}
@ -360,20 +159,20 @@ int main( int /*argc*/, char ** /*argv*/ )
std::cout << std::string( "\t\t" ) << "driverVersion = " << decodeDriverVersion( properties.driverVersion, properties.vendorID ) << "\n";
std::cout << std::string( "\t\t" ) << "vendorID = " << decodeVendorID( properties.vendorID ) << "\n";
std::cout << std::string( "\t\t" ) << "deviceID = " << properties.deviceID << "\n";
std::cout << std::string( "\t\t" ) << "deviceType = " << to_string( properties.deviceType ) << "\n";
std::cout << std::string( "\t\t" ) << "deviceType = " << vk::to_string( properties.deviceType ) << "\n";
std::cout << std::string( "\t\t" ) << "deviceName = " << properties.deviceName << "\n";
std::cout << std::string( "\t\t" ) << "pipelineCacheUUID = " << vk::su::UUID( properties.pipelineCacheUUID ) << "\n";
std::cout << std::string( "\t\t" ) << "limits:\n";
std::cout << std::string( "\t\t\t" ) << "bufferImageGranularity = " << properties.limits.bufferImageGranularity << "\n";
std::cout << std::string( "\t\t\t" ) << "discreteQueuePriorities = " << properties.limits.discreteQueuePriorities << "\n";
std::cout << std::string( "\t\t\t" )
<< "framebufferColorSampleCounts = " << to_string( properties.limits.framebufferColorSampleCounts ) << "\n";
<< "framebufferColorSampleCounts = " << vk::to_string( properties.limits.framebufferColorSampleCounts ) << "\n";
std::cout << std::string( "\t\t\t" )
<< "framebufferDepthSampleCounts = " << to_string( properties.limits.framebufferDepthSampleCounts ) << "\n";
<< "framebufferDepthSampleCounts = " << vk::to_string( properties.limits.framebufferDepthSampleCounts ) << "\n";
std::cout << std::string( "\t\t\t" )
<< "framebufferNoAttachmentsSampleCounts = " << to_string( properties.limits.framebufferNoAttachmentsSampleCounts ) << "\n";
<< "framebufferNoAttachmentsSampleCounts = " << vk::to_string( properties.limits.framebufferNoAttachmentsSampleCounts ) << "\n";
std::cout << std::string( "\t\t\t" )
<< "framebufferStencilSampleCounts = " << to_string( properties.limits.framebufferStencilSampleCounts ) << "\n";
<< "framebufferStencilSampleCounts = " << vk::to_string( properties.limits.framebufferStencilSampleCounts ) << "\n";
std::cout << std::string( "\t\t\t" ) << "lineWidthGranularity = " << properties.limits.lineWidthGranularity << "\n";
std::cout << std::string( "\t\t\t" ) << "lineWidthRange = "
<< "[" << properties.limits.lineWidthRange[0] << ", " << properties.limits.lineWidthRange[1] << "]"
@ -490,17 +289,17 @@ int main( int /*argc*/, char ** /*argv*/ )
<< "[" << properties.limits.pointSizeRange[0] << ", " << properties.limits.pointSizeRange[1] << "]"
<< "\n";
std::cout << std::string( "\t\t\t" )
<< "sampledImageColorSampleCounts = " << to_string( properties.limits.sampledImageColorSampleCounts ) << "\n";
<< "sampledImageColorSampleCounts = " << vk::to_string( properties.limits.sampledImageColorSampleCounts ) << "\n";
std::cout << std::string( "\t\t\t" )
<< "sampledImageDepthSampleCounts = " << to_string( properties.limits.sampledImageDepthSampleCounts ) << "\n";
<< "sampledImageDepthSampleCounts = " << vk::to_string( properties.limits.sampledImageDepthSampleCounts ) << "\n";
std::cout << std::string( "\t\t\t" )
<< "sampledImageIntegerSampleCounts = " << to_string( properties.limits.sampledImageIntegerSampleCounts ) << "\n";
<< "sampledImageIntegerSampleCounts = " << vk::to_string( properties.limits.sampledImageIntegerSampleCounts ) << "\n";
std::cout << std::string( "\t\t\t" )
<< "sampledImageStencilSampleCounts = " << to_string( properties.limits.sampledImageStencilSampleCounts ) << "\n";
<< "sampledImageStencilSampleCounts = " << vk::to_string( properties.limits.sampledImageStencilSampleCounts ) << "\n";
std::cout << std::string( "\t\t\t" ) << "sparseAddressSpaceSize = " << properties.limits.sparseAddressSpaceSize << "\n";
std::cout << std::string( "\t\t\t" ) << "standardSampleLocations = " << !!properties.limits.standardSampleLocations << "\n";
std::cout << std::string( "\t\t\t" ) << "storageImageSampleCounts = " << to_string( properties.limits.storageImageSampleCounts )
<< "\n";
std::cout << std::string( "\t\t\t" )
<< "storageImageSampleCounts = " << vk::to_string( properties.limits.storageImageSampleCounts ) << "\n";
std::cout << std::string( "\t\t\t" ) << "strictLines = " << !!properties.limits.strictLines << "\n";
std::cout << std::string( "\t\t\t" ) << "subPixelInterpolationOffsetBits = " << properties.limits.subPixelInterpolationOffsetBits << "\n";
std::cout << std::string( "\t\t\t" ) << "subPixelPrecisionBits = " << properties.limits.subPixelPrecisionBits << "\n";
@ -577,7 +376,7 @@ int main( int /*argc*/, char ** /*argv*/ )
properties2.get<vk::PhysicalDeviceCooperativeMatrixPropertiesNV>();
std::cout << std::string( "\t" ) << "CooperativeMatrixProperties:\n";
std::cout << std::string( "\t\t" )
<< "cooperativeMatrixSupportedStages = " << to_string( cooperativeMatrixProperties.cooperativeMatrixSupportedStages ) << "\n";
<< "cooperativeMatrixSupportedStages = " << vk::to_string( cooperativeMatrixProperties.cooperativeMatrixSupportedStages ) << "\n";
std::cout << "\n";
}
@ -588,9 +387,9 @@ int main( int /*argc*/, char ** /*argv*/ )
std::cout << std::string( "\t" ) << "DepthStencilResolveProperties:\n";
std::cout << std::string( "\t\t" ) << "independentResolve = " << !!depthStencilResolveProperties.independentResolve << "\n";
std::cout << std::string( "\t\t" ) << "independentResolveNone = " << !!depthStencilResolveProperties.independentResolveNone << "\n";
std::cout << std::string( "\t\t" ) << "supportedDepthResolveModes = " << to_string( depthStencilResolveProperties.supportedDepthResolveModes )
std::cout << std::string( "\t\t" ) << "supportedDepthResolveModes = " << vk::to_string( depthStencilResolveProperties.supportedDepthResolveModes )
<< "\n";
std::cout << std::string( "\t\t" ) << "supportedStencilResolveModes = " << to_string( depthStencilResolveProperties.supportedStencilResolveModes )
std::cout << std::string( "\t\t" ) << "supportedStencilResolveModes = " << vk::to_string( depthStencilResolveProperties.supportedStencilResolveModes )
<< "\n";
std::cout << "\n";
}
@ -667,7 +466,7 @@ int main( int /*argc*/, char ** /*argv*/ )
{
vk::PhysicalDeviceDriverPropertiesKHR const & driverProperties = properties2.get<vk::PhysicalDeviceDriverPropertiesKHR>();
std::cout << std::string( "\t" ) << "DriverProperties:\n";
std::cout << std::string( "\t\t" ) << "driverID = " << to_string( driverProperties.driverID ) << "\n";
std::cout << std::string( "\t\t" ) << "driverID = " << vk::to_string( driverProperties.driverID ) << "\n";
std::cout << std::string( "\t\t" ) << "driverName = " << driverProperties.driverName << "\n";
std::cout << std::string( "\t\t" ) << "driverInfo = " << driverProperties.driverInfo << "\n";
std::cout << std::string( "\t\t" ) << "conformanceVersion = " << static_cast<uint32_t>( driverProperties.conformanceVersion.major ) << "."
@ -690,9 +489,9 @@ int main( int /*argc*/, char ** /*argv*/ )
{
vk::PhysicalDeviceFloatControlsPropertiesKHR const & floatControlsProperties = properties2.get<vk::PhysicalDeviceFloatControlsPropertiesKHR>();
std::cout << std::string( "\t" ) << "FloatControlsProperties:\n";
std::cout << std::string( "\t\t" ) << "denormBehaviorIndependence = " << to_string( floatControlsProperties.denormBehaviorIndependence )
std::cout << std::string( "\t\t" ) << "denormBehaviorIndependence = " << vk::to_string( floatControlsProperties.denormBehaviorIndependence )
<< "\n";
std::cout << std::string( "\t\t" ) << "roundingModeIndependence = " << to_string( floatControlsProperties.roundingModeIndependence )
std::cout << std::string( "\t\t" ) << "roundingModeIndependence = " << vk::to_string( floatControlsProperties.roundingModeIndependence )
<< "\n";
std::cout << std::string( "\t\t" ) << "shaderDenormFlushToZeroFloat16 = " << !!floatControlsProperties.shaderDenormFlushToZeroFloat16 << "\n";
std::cout << std::string( "\t\t" ) << "shaderDenormFlushToZeroFloat32 = " << !!floatControlsProperties.shaderDenormFlushToZeroFloat32 << "\n";
@ -827,7 +626,7 @@ int main( int /*argc*/, char ** /*argv*/ )
{
vk::PhysicalDevicePointClippingProperties const & pointClippingProperties = properties2.get<vk::PhysicalDevicePointClippingProperties>();
std::cout << std::string( "\t" ) << "PointClippingProperties:\n";
std::cout << std::string( "\t\t" ) << "pointClippingBehavior = " << to_string( pointClippingProperties.pointClippingBehavior ) << "\n";
std::cout << std::string( "\t\t" ) << "pointClippingBehavior = " << vk::to_string( pointClippingProperties.pointClippingBehavior ) << "\n";
std::cout << "\n";
}
@ -870,7 +669,8 @@ int main( int /*argc*/, char ** /*argv*/ )
<< "[" << sampleLocationProperties.sampleLocationCoordinateRange[0] << ", " << sampleLocationProperties.sampleLocationCoordinateRange[1]
<< "]"
<< "\n";
std::cout << std::string( "\t\t" ) << "sampleLocationSampleCounts = " << to_string( sampleLocationProperties.sampleLocationSampleCounts ) << "\n";
std::cout << std::string( "\t\t" ) << "sampleLocationSampleCounts = " << vk::to_string( sampleLocationProperties.sampleLocationSampleCounts )
<< "\n";
std::cout << std::string( "\t\t" ) << "sampleLocationSubPixelBits = " << sampleLocationProperties.sampleLocationSubPixelBits << "\n";
std::cout << std::string( "\t\t" ) << "variableSampleLocations = " << !!sampleLocationProperties.variableSampleLocations << "\n";
std::cout << "\n";
@ -893,7 +693,7 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::PhysicalDeviceShaderCoreProperties2AMD const & shaderCoreProperties2 = properties2.get<vk::PhysicalDeviceShaderCoreProperties2AMD>();
std::cout << std::string( "\t" ) << "ShaderCoreProperties2:\n";
std::cout << std::string( "\t\t" ) << "activeComputeUnitCount = " << shaderCoreProperties2.activeComputeUnitCount << "\n";
std::cout << std::string( "\t\t" ) << "shaderCoreFeatures = " << to_string( shaderCoreProperties2.shaderCoreFeatures ) << "\n";
std::cout << std::string( "\t\t" ) << "shaderCoreFeatures = " << vk::to_string( shaderCoreProperties2.shaderCoreFeatures ) << "\n";
std::cout << "\n";
}
@ -943,8 +743,8 @@ int main( int /*argc*/, char ** /*argv*/ )
std::cout << std::string( "\t" ) << "SubgroupProperties:\n";
std::cout << std::string( "\t\t" ) << "quadOperationsInAllStages = " << !!subgroupProperties.quadOperationsInAllStages << "\n";
std::cout << std::string( "\t\t" ) << "subgroupSize = " << subgroupProperties.subgroupSize << "\n";
std::cout << std::string( "\t\t" ) << "supportedOperations = " << to_string( subgroupProperties.supportedOperations ) << "\n";
std::cout << std::string( "\t\t" ) << "supportedStages = " << to_string( subgroupProperties.supportedStages ) << "\n";
std::cout << std::string( "\t\t" ) << "supportedOperations = " << vk::to_string( subgroupProperties.supportedOperations ) << "\n";
std::cout << std::string( "\t\t" ) << "supportedStages = " << vk::to_string( subgroupProperties.supportedStages ) << "\n";
std::cout << "\n";
if ( vk::su::contains( extensionProperties, "VK_EXT_subgroup_size_control" ) )
@ -955,7 +755,7 @@ int main( int /*argc*/, char ** /*argv*/ )
std::cout << std::string( "\t\t" ) << "maxComputeWorkgroupSubgroups = " << subgroupSizeControlProperties.maxComputeWorkgroupSubgroups << "\n";
std::cout << std::string( "\t\t" ) << "maxSubgroupSize = " << subgroupSizeControlProperties.maxSubgroupSize << "\n";
std::cout << std::string( "\t\t" ) << "minSubgroupSize = " << subgroupSizeControlProperties.minSubgroupSize << "\n";
std::cout << std::string( "\t\t" ) << "requiredSubgroupSizeStages = " << to_string( subgroupSizeControlProperties.requiredSubgroupSizeStages )
std::cout << std::string( "\t\t" ) << "requiredSubgroupSizeStages = " << vk::to_string( subgroupSizeControlProperties.requiredSubgroupSizeStages )
<< "\n";
std::cout << "\n";
}

View File

@ -16,111 +16,16 @@
// Get queue family properties per physical device.
#include "../utils/utils.hpp"
#include "vulkan/vulkan.hpp"
#include <iomanip>
#include <sstream>
#include <vector>
#include <vulkan/vulkan.hpp>
#include <vulkan/vulkan_to_string.hpp>
static char const * AppName = "PhysicalDeviceQueueFamilyProperties";
static char const * EngineName = "Vulkan.hpp";
#if defined( VULKAN_HPP_NO_TO_STRING )
namespace local
{
std::string to_string( vk::PipelineStageFlags value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::PipelineStageFlagBits::eTopOfPipe )
result += "TopOfPipe | ";
if ( value & vk::PipelineStageFlagBits::eDrawIndirect )
result += "DrawIndirect | ";
if ( value & vk::PipelineStageFlagBits::eVertexInput )
result += "VertexInput | ";
if ( value & vk::PipelineStageFlagBits::eVertexShader )
result += "VertexShader | ";
if ( value & vk::PipelineStageFlagBits::eTessellationControlShader )
result += "TessellationControlShader | ";
if ( value & vk::PipelineStageFlagBits::eTessellationEvaluationShader )
result += "TessellationEvaluationShader | ";
if ( value & vk::PipelineStageFlagBits::eGeometryShader )
result += "GeometryShader | ";
if ( value & vk::PipelineStageFlagBits::eFragmentShader )
result += "FragmentShader | ";
if ( value & vk::PipelineStageFlagBits::eEarlyFragmentTests )
result += "EarlyFragmentTests | ";
if ( value & vk::PipelineStageFlagBits::eLateFragmentTests )
result += "LateFragmentTests | ";
if ( value & vk::PipelineStageFlagBits::eColorAttachmentOutput )
result += "ColorAttachmentOutput | ";
if ( value & vk::PipelineStageFlagBits::eComputeShader )
result += "ComputeShader | ";
if ( value & vk::PipelineStageFlagBits::eTransfer )
result += "Transfer | ";
if ( value & vk::PipelineStageFlagBits::eBottomOfPipe )
result += "BottomOfPipe | ";
if ( value & vk::PipelineStageFlagBits::eHost )
result += "Host | ";
if ( value & vk::PipelineStageFlagBits::eAllGraphics )
result += "AllGraphics | ";
if ( value & vk::PipelineStageFlagBits::eAllCommands )
result += "AllCommands | ";
if ( value & vk::PipelineStageFlagBits::eTransformFeedbackEXT )
result += "TransformFeedbackEXT | ";
if ( value & vk::PipelineStageFlagBits::eConditionalRenderingEXT )
result += "ConditionalRenderingEXT | ";
if ( value & vk::PipelineStageFlagBits::eAccelerationStructureBuildKHR )
result += "AccelerationStructureBuildKHR | ";
if ( value & vk::PipelineStageFlagBits::eRayTracingShaderKHR )
result += "RayTracingShaderKHR | ";
if ( value & vk::PipelineStageFlagBits::eTaskShaderNV )
result += "TaskShaderNV | ";
if ( value & vk::PipelineStageFlagBits::eMeshShaderNV )
result += "MeshShaderNV | ";
if ( value & vk::PipelineStageFlagBits::eFragmentDensityProcessEXT )
result += "FragmentDensityProcessEXT | ";
if ( value & vk::PipelineStageFlagBits::eFragmentShadingRateAttachmentKHR )
result += "FragmentShadingRateAttachmentKHR | ";
if ( value & vk::PipelineStageFlagBits::eCommandPreprocessNV )
result += "CommandPreprocessNV | ";
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
std::string to_string( vk::QueueFlags value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::QueueFlagBits::eGraphics )
result += "Graphics | ";
if ( value & vk::QueueFlagBits::eCompute )
result += "Compute | ";
if ( value & vk::QueueFlagBits::eTransfer )
result += "Transfer | ";
if ( value & vk::QueueFlagBits::eSparseBinding )
result += "SparseBinding | ";
if ( value & vk::QueueFlagBits::eProtected )
result += "Protected | ";
# if defined( VK_ENABLE_BETA_EXTENSIONS )
if ( value & vk::QueueFlagBits::eVideoDecodeKHR )
result += "VideoDecodeKHR | ";
if ( value & vk::QueueFlagBits::eVideoEncodeKHR )
result += "VideoEncodeKHR | ";
# endif /*VK_ENABLE_BETA_EXTENSIONS*/
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
} // namespace local
using local::to_string;
#else
using vk::to_string;
#endif
int main( int /*argc*/, char ** /*argv*/ )
{
try
@ -151,7 +56,7 @@ int main( int /*argc*/, char ** /*argv*/ )
std::cout << std::string( "\t" ) << "QueueFamily " << j << "\n";
vk::QueueFamilyProperties const & properties = queueFamilyProperties2[j].get<vk::QueueFamilyProperties2>().queueFamilyProperties;
std::cout << std::string( "\t\t" ) << "QueueFamilyProperties:\n";
std::cout << std::string( "\t\t\t" ) << "queueFlags = " << to_string( properties.queueFlags ) << "\n";
std::cout << std::string( "\t\t\t" ) << "queueFlags = " << vk::to_string( properties.queueFlags ) << "\n";
std::cout << std::string( "\t\t\t" ) << "queueCount = " << properties.queueCount << "\n";
std::cout << std::string( "\t\t\t" ) << "timestampValidBits = " << properties.timestampValidBits << "\n";
std::cout << std::string( "\t\t\t" ) << "minImageTransferGranularity = " << properties.minImageTransferGranularity.width << " x "
@ -162,7 +67,8 @@ int main( int /*argc*/, char ** /*argv*/ )
{
vk::QueueFamilyCheckpointPropertiesNV const & checkpointProperties = queueFamilyProperties2[j].get<vk::QueueFamilyCheckpointPropertiesNV>();
std::cout << std::string( "\t\t" ) << "CheckPointPropertiesNV:\n";
std::cout << std::string( "\t\t\t" ) << "checkpointExecutionStageMask = " << to_string( checkpointProperties.checkpointExecutionStageMask ) << "\n";
std::cout << std::string( "\t\t\t" ) << "checkpointExecutionStageMask = " << vk::to_string( checkpointProperties.checkpointExecutionStageMask )
<< "\n";
std::cout << "\n";
}
}

View File

@ -36,6 +36,7 @@
#include <numeric>
#include <random>
#include <sstream>
#include <vulkan/vulkan_to_string.hpp>
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
#define GLM_FORCE_RADIANS
@ -52,71 +53,6 @@
static char const * AppName = "RayTracing";
static char const * EngineName = "Vulkan.hpp";
#if defined( VULKAN_HPP_NO_TO_STRING )
namespace local
{
std::string to_string( vk::Result value )
{
switch ( value )
{
case vk::Result::eSuccess: return "Success";
case vk::Result::eNotReady: return "NotReady";
case vk::Result::eTimeout: return "Timeout";
case vk::Result::eEventSet: return "EventSet";
case vk::Result::eEventReset: return "EventReset";
case vk::Result::eIncomplete: return "Incomplete";
case vk::Result::eErrorOutOfHostMemory: return "ErrorOutOfHostMemory";
case vk::Result::eErrorOutOfDeviceMemory: return "ErrorOutOfDeviceMemory";
case vk::Result::eErrorInitializationFailed: return "ErrorInitializationFailed";
case vk::Result::eErrorDeviceLost: return "ErrorDeviceLost";
case vk::Result::eErrorMemoryMapFailed: return "ErrorMemoryMapFailed";
case vk::Result::eErrorLayerNotPresent: return "ErrorLayerNotPresent";
case vk::Result::eErrorExtensionNotPresent: return "ErrorExtensionNotPresent";
case vk::Result::eErrorFeatureNotPresent: return "ErrorFeatureNotPresent";
case vk::Result::eErrorIncompatibleDriver: return "ErrorIncompatibleDriver";
case vk::Result::eErrorTooManyObjects: return "ErrorTooManyObjects";
case vk::Result::eErrorFormatNotSupported: return "ErrorFormatNotSupported";
case vk::Result::eErrorFragmentedPool: return "ErrorFragmentedPool";
case vk::Result::eErrorUnknown: return "ErrorUnknown";
case vk::Result::eErrorOutOfPoolMemory: return "ErrorOutOfPoolMemory";
case vk::Result::eErrorInvalidExternalHandle: return "ErrorInvalidExternalHandle";
case vk::Result::eErrorFragmentation: return "ErrorFragmentation";
case vk::Result::eErrorInvalidOpaqueCaptureAddress: return "ErrorInvalidOpaqueCaptureAddress";
case vk::Result::ePipelineCompileRequired: return "PipelineCompileRequired";
case vk::Result::eErrorSurfaceLostKHR: return "ErrorSurfaceLostKHR";
case vk::Result::eErrorNativeWindowInUseKHR: return "ErrorNativeWindowInUseKHR";
case vk::Result::eSuboptimalKHR: return "SuboptimalKHR";
case vk::Result::eErrorOutOfDateKHR: return "ErrorOutOfDateKHR";
case vk::Result::eErrorIncompatibleDisplayKHR: return "ErrorIncompatibleDisplayKHR";
case vk::Result::eErrorValidationFailedEXT: return "ErrorValidationFailedEXT";
case vk::Result::eErrorInvalidShaderNV: return "ErrorInvalidShaderNV";
# if defined( VK_ENABLE_BETA_EXTENSIONS )
case vk::Result::eErrorImageUsageNotSupportedKHR: return "ErrorImageUsageNotSupportedKHR";
case vk::Result::eErrorVideoPictureLayoutNotSupportedKHR: return "ErrorVideoPictureLayoutNotSupportedKHR";
case vk::Result::eErrorVideoProfileOperationNotSupportedKHR: return "ErrorVideoProfileOperationNotSupportedKHR";
case vk::Result::eErrorVideoProfileFormatNotSupportedKHR: return "ErrorVideoProfileFormatNotSupportedKHR";
case vk::Result::eErrorVideoProfileCodecNotSupportedKHR: return "ErrorVideoProfileCodecNotSupportedKHR";
case vk::Result::eErrorVideoStdVersionNotSupportedKHR: return "ErrorVideoStdVersionNotSupportedKHR";
# endif /*VK_ENABLE_BETA_EXTENSIONS*/
case vk::Result::eErrorInvalidDrmFormatModifierPlaneLayoutEXT: return "ErrorInvalidDrmFormatModifierPlaneLayoutEXT";
case vk::Result::eErrorNotPermittedKHR: return "ErrorNotPermittedKHR";
# if defined( VK_USE_PLATFORM_WIN32_KHR )
case vk::Result::eErrorFullScreenExclusiveModeLostEXT: return "ErrorFullScreenExclusiveModeLostEXT";
# endif /*VK_USE_PLATFORM_WIN32_KHR*/
case vk::Result::eThreadIdleKHR: return "ThreadIdleKHR";
case vk::Result::eThreadDoneKHR: return "ThreadDoneKHR";
case vk::Result::eOperationDeferredKHR: return "OperationDeferredKHR";
case vk::Result::eOperationNotDeferredKHR: return "OperationNotDeferredKHR";
case vk::Result::eErrorCompressionExhaustedEXT: return "ErrorCompressionExhaustedEXT";
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
} // namespace local
using local::to_string;
#else
using vk::to_string;
#endif
struct GeometryInstanceData
{
GeometryInstanceData(
@ -601,7 +537,7 @@ static void check_vk_result( VkResult err )
{
if ( err != 0 )
{
std::cerr << AppName << ": Vulkan error " << to_string( static_cast<vk::Result>( err ) );
std::cerr << AppName << ": Vulkan error " << vk::to_string( static_cast<vk::Result>( err ) );
if ( err < 0 )
{
abort();

View File

@ -16,144 +16,22 @@
// Get surface capabilities.
#include "../utils/utils.hpp"
#include "vulkan/vulkan.hpp"
#include <iomanip>
#include <sstream>
#include <vector>
#include <vulkan/vulkan.hpp>
#include <vulkan/vulkan_to_string.hpp>
static char const * AppName = "SurfaceCapabilities";
static char const * EngineName = "Vulkan.hpp";
#if defined( VULKAN_HPP_NO_TO_STRING )
namespace local
{
std::string to_string( vk::CompositeAlphaFlagsKHR value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::CompositeAlphaFlagBitsKHR::eOpaque )
result += "Opaque | ";
if ( value & vk::CompositeAlphaFlagBitsKHR::ePreMultiplied )
result += "PreMultiplied | ";
if ( value & vk::CompositeAlphaFlagBitsKHR::ePostMultiplied )
result += "PostMultiplied | ";
if ( value & vk::CompositeAlphaFlagBitsKHR::eInherit )
result += "Inherit | ";
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
std::string to_string( vk::ImageUsageFlags value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::ImageUsageFlagBits::eTransferSrc )
result += "TransferSrc | ";
if ( value & vk::ImageUsageFlagBits::eTransferDst )
result += "TransferDst | ";
if ( value & vk::ImageUsageFlagBits::eSampled )
result += "Sampled | ";
if ( value & vk::ImageUsageFlagBits::eStorage )
result += "Storage | ";
if ( value & vk::ImageUsageFlagBits::eColorAttachment )
result += "ColorAttachment | ";
if ( value & vk::ImageUsageFlagBits::eDepthStencilAttachment )
result += "DepthStencilAttachment | ";
if ( value & vk::ImageUsageFlagBits::eTransientAttachment )
result += "TransientAttachment | ";
if ( value & vk::ImageUsageFlagBits::eInputAttachment )
result += "InputAttachment | ";
# if defined( VK_ENABLE_BETA_EXTENSIONS )
if ( value & vk::ImageUsageFlagBits::eVideoDecodeDstKHR )
result += "VideoDecodeDstKHR | ";
if ( value & vk::ImageUsageFlagBits::eVideoDecodeSrcKHR )
result += "VideoDecodeSrcKHR | ";
if ( value & vk::ImageUsageFlagBits::eVideoDecodeDpbKHR )
result += "VideoDecodeDpbKHR | ";
# endif /*VK_ENABLE_BETA_EXTENSIONS*/
if ( value & vk::ImageUsageFlagBits::eFragmentDensityMapEXT )
result += "FragmentDensityMapEXT | ";
if ( value & vk::ImageUsageFlagBits::eFragmentShadingRateAttachmentKHR )
result += "FragmentShadingRateAttachmentKHR | ";
# if defined( VK_ENABLE_BETA_EXTENSIONS )
if ( value & vk::ImageUsageFlagBits::eVideoEncodeDstKHR )
result += "VideoEncodeDstKHR | ";
if ( value & vk::ImageUsageFlagBits::eVideoEncodeSrcKHR )
result += "VideoEncodeSrcKHR | ";
if ( value & vk::ImageUsageFlagBits::eVideoEncodeDpbKHR )
result += "VideoEncodeDpbKHR | ";
# endif /*VK_ENABLE_BETA_EXTENSIONS*/
if ( value & vk::ImageUsageFlagBits::eInvocationMaskHUAWEI )
result += "InvocationMaskHUAWEI | ";
if ( value & vk::ImageUsageFlagBits::eSampleWeightQCOM )
result += "SampleWeightQCOM | ";
if ( value & vk::ImageUsageFlagBits::eSampleBlockMatchQCOM )
result += "SampleBlockMatchQCOM | ";
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
std::string to_string( vk::SurfaceTransformFlagBitsKHR value )
{
switch ( value )
{
case vk::SurfaceTransformFlagBitsKHR::eIdentity: return "Identity";
case vk::SurfaceTransformFlagBitsKHR::eRotate90: return "Rotate90";
case vk::SurfaceTransformFlagBitsKHR::eRotate180: return "Rotate180";
case vk::SurfaceTransformFlagBitsKHR::eRotate270: return "Rotate270";
case vk::SurfaceTransformFlagBitsKHR::eHorizontalMirror: return "HorizontalMirror";
case vk::SurfaceTransformFlagBitsKHR::eHorizontalMirrorRotate90: return "HorizontalMirrorRotate90";
case vk::SurfaceTransformFlagBitsKHR::eHorizontalMirrorRotate180: return "HorizontalMirrorRotate180";
case vk::SurfaceTransformFlagBitsKHR::eHorizontalMirrorRotate270: return "HorizontalMirrorRotate270";
case vk::SurfaceTransformFlagBitsKHR::eInherit: return "Inherit";
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
std::string to_string( vk::SurfaceTransformFlagsKHR value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::SurfaceTransformFlagBitsKHR::eIdentity )
result += "Identity | ";
if ( value & vk::SurfaceTransformFlagBitsKHR::eRotate90 )
result += "Rotate90 | ";
if ( value & vk::SurfaceTransformFlagBitsKHR::eRotate180 )
result += "Rotate180 | ";
if ( value & vk::SurfaceTransformFlagBitsKHR::eRotate270 )
result += "Rotate270 | ";
if ( value & vk::SurfaceTransformFlagBitsKHR::eHorizontalMirror )
result += "HorizontalMirror | ";
if ( value & vk::SurfaceTransformFlagBitsKHR::eHorizontalMirrorRotate90 )
result += "HorizontalMirrorRotate90 | ";
if ( value & vk::SurfaceTransformFlagBitsKHR::eHorizontalMirrorRotate180 )
result += "HorizontalMirrorRotate180 | ";
if ( value & vk::SurfaceTransformFlagBitsKHR::eHorizontalMirrorRotate270 )
result += "HorizontalMirrorRotate270 | ";
if ( value & vk::SurfaceTransformFlagBitsKHR::eInherit )
result += "Inherit | ";
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
} // namespace local
using local::to_string;
#else
using vk::to_string;
#endif
void cout( vk::SurfaceCapabilitiesKHR const & surfaceCapabilities )
{
std::cout << std::string( "\t" ) << "Capabilities:\n";
std::cout << std::string( "\t\t" ) << "currentExtent = " << surfaceCapabilities.currentExtent.width << " x "
<< surfaceCapabilities.currentExtent.height << "\n";
std::cout << std::string( "\t\t" ) << "currentTransform = " << to_string( surfaceCapabilities.currentTransform ) << "\n";
std::cout << std::string( "\t\t" ) << "currentTransform = " << vk::to_string( surfaceCapabilities.currentTransform ) << "\n";
std::cout << std::string( "\t\t" ) << "maxImageArrayLayers = " << surfaceCapabilities.maxImageArrayLayers << "\n";
std::cout << std::string( "\t\t" ) << "maxImageCount = " << surfaceCapabilities.maxImageCount << "\n";
std::cout << std::string( "\t\t" ) << "maxImageExtent = " << surfaceCapabilities.maxImageExtent.width << " x "
@ -161,9 +39,9 @@ void cout( vk::SurfaceCapabilitiesKHR const & surfaceCapabilities )
std::cout << std::string( "\t\t" ) << "minImageCount = " << surfaceCapabilities.minImageCount << "\n";
std::cout << std::string( "\t\t" ) << "minImageExtent = " << surfaceCapabilities.minImageExtent.width << " x "
<< surfaceCapabilities.minImageExtent.height << "\n";
std::cout << std::string( "\t\t" ) << "supportedCompositeAlpha = " << to_string( surfaceCapabilities.supportedCompositeAlpha ) << "\n";
std::cout << std::string( "\t\t" ) << "supportedTransforms = " << to_string( surfaceCapabilities.supportedTransforms ) << "\n";
std::cout << std::string( "\t\t" ) << "supportedUsageFlags = " << to_string( surfaceCapabilities.supportedUsageFlags ) << "\n";
std::cout << std::string( "\t\t" ) << "supportedCompositeAlpha = " << vk::to_string( surfaceCapabilities.supportedCompositeAlpha ) << "\n";
std::cout << std::string( "\t\t" ) << "supportedTransforms = " << vk::to_string( surfaceCapabilities.supportedTransforms ) << "\n";
std::cout << std::string( "\t\t" ) << "supportedUsageFlags = " << vk::to_string( surfaceCapabilities.supportedUsageFlags ) << "\n";
std::cout << "\n";
}
@ -236,7 +114,7 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::SharedPresentSurfaceCapabilitiesKHR sharedPresentSurfaceCapabilities = surfaceCapabilities2.get<vk::SharedPresentSurfaceCapabilitiesKHR>();
std::cout << std::string( "\t" ) << "SharedPresentSurfaceCapabilitiesKHR:\n";
std::cout << std::string( "\t\t" )
<< "sharedPresentSupportedUsageFlags = " << to_string( sharedPresentSurfaceCapabilities.sharedPresentSupportedUsageFlags ) << "\n";
<< "sharedPresentSupportedUsageFlags = " << vk::to_string( sharedPresentSurfaceCapabilities.sharedPresentSupportedUsageFlags ) << "\n";
std::cout << "\n";
}

View File

@ -16,302 +16,16 @@
// Get surface formats.
#include "../utils/utils.hpp"
#include "vulkan/vulkan.hpp"
#include <iomanip>
#include <sstream>
#include <vector>
#include <vulkan/vulkan.hpp>
#include <vulkan/vulkan_to_string.hpp>
static char const * AppName = "SurfaceFormats";
static char const * EngineName = "Vulkan.hpp";
#if defined( VULKAN_HPP_NO_TO_STRING )
namespace local
{
std::string to_string( vk::ColorSpaceKHR value )
{
switch ( value )
{
case vk::ColorSpaceKHR::eSrgbNonlinear: return "SrgbNonlinear";
case vk::ColorSpaceKHR::eDisplayP3NonlinearEXT: return "DisplayP3NonlinearEXT";
case vk::ColorSpaceKHR::eExtendedSrgbLinearEXT: return "ExtendedSrgbLinearEXT";
case vk::ColorSpaceKHR::eDisplayP3LinearEXT: return "DisplayP3LinearEXT";
case vk::ColorSpaceKHR::eDciP3NonlinearEXT: return "DciP3NonlinearEXT";
case vk::ColorSpaceKHR::eBt709LinearEXT: return "Bt709LinearEXT";
case vk::ColorSpaceKHR::eBt709NonlinearEXT: return "Bt709NonlinearEXT";
case vk::ColorSpaceKHR::eBt2020LinearEXT: return "Bt2020LinearEXT";
case vk::ColorSpaceKHR::eHdr10St2084EXT: return "Hdr10St2084EXT";
case vk::ColorSpaceKHR::eDolbyvisionEXT: return "DolbyvisionEXT";
case vk::ColorSpaceKHR::eHdr10HlgEXT: return "Hdr10HlgEXT";
case vk::ColorSpaceKHR::eAdobergbLinearEXT: return "AdobergbLinearEXT";
case vk::ColorSpaceKHR::eAdobergbNonlinearEXT: return "AdobergbNonlinearEXT";
case vk::ColorSpaceKHR::ePassThroughEXT: return "PassThroughEXT";
case vk::ColorSpaceKHR::eExtendedSrgbNonlinearEXT: return "ExtendedSrgbNonlinearEXT";
case vk::ColorSpaceKHR::eDisplayNativeAMD: return "DisplayNativeAMD";
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
std::string to_string( vk::Format value )
{
switch ( value )
{
case vk::Format::eUndefined: return "Undefined";
case vk::Format::eR4G4UnormPack8: return "R4G4UnormPack8";
case vk::Format::eR4G4B4A4UnormPack16: return "R4G4B4A4UnormPack16";
case vk::Format::eB4G4R4A4UnormPack16: return "B4G4R4A4UnormPack16";
case vk::Format::eR5G6B5UnormPack16: return "R5G6B5UnormPack16";
case vk::Format::eB5G6R5UnormPack16: return "B5G6R5UnormPack16";
case vk::Format::eR5G5B5A1UnormPack16: return "R5G5B5A1UnormPack16";
case vk::Format::eB5G5R5A1UnormPack16: return "B5G5R5A1UnormPack16";
case vk::Format::eA1R5G5B5UnormPack16: return "A1R5G5B5UnormPack16";
case vk::Format::eR8Unorm: return "R8Unorm";
case vk::Format::eR8Snorm: return "R8Snorm";
case vk::Format::eR8Uscaled: return "R8Uscaled";
case vk::Format::eR8Sscaled: return "R8Sscaled";
case vk::Format::eR8Uint: return "R8Uint";
case vk::Format::eR8Sint: return "R8Sint";
case vk::Format::eR8Srgb: return "R8Srgb";
case vk::Format::eR8G8Unorm: return "R8G8Unorm";
case vk::Format::eR8G8Snorm: return "R8G8Snorm";
case vk::Format::eR8G8Uscaled: return "R8G8Uscaled";
case vk::Format::eR8G8Sscaled: return "R8G8Sscaled";
case vk::Format::eR8G8Uint: return "R8G8Uint";
case vk::Format::eR8G8Sint: return "R8G8Sint";
case vk::Format::eR8G8Srgb: return "R8G8Srgb";
case vk::Format::eR8G8B8Unorm: return "R8G8B8Unorm";
case vk::Format::eR8G8B8Snorm: return "R8G8B8Snorm";
case vk::Format::eR8G8B8Uscaled: return "R8G8B8Uscaled";
case vk::Format::eR8G8B8Sscaled: return "R8G8B8Sscaled";
case vk::Format::eR8G8B8Uint: return "R8G8B8Uint";
case vk::Format::eR8G8B8Sint: return "R8G8B8Sint";
case vk::Format::eR8G8B8Srgb: return "R8G8B8Srgb";
case vk::Format::eB8G8R8Unorm: return "B8G8R8Unorm";
case vk::Format::eB8G8R8Snorm: return "B8G8R8Snorm";
case vk::Format::eB8G8R8Uscaled: return "B8G8R8Uscaled";
case vk::Format::eB8G8R8Sscaled: return "B8G8R8Sscaled";
case vk::Format::eB8G8R8Uint: return "B8G8R8Uint";
case vk::Format::eB8G8R8Sint: return "B8G8R8Sint";
case vk::Format::eB8G8R8Srgb: return "B8G8R8Srgb";
case vk::Format::eR8G8B8A8Unorm: return "R8G8B8A8Unorm";
case vk::Format::eR8G8B8A8Snorm: return "R8G8B8A8Snorm";
case vk::Format::eR8G8B8A8Uscaled: return "R8G8B8A8Uscaled";
case vk::Format::eR8G8B8A8Sscaled: return "R8G8B8A8Sscaled";
case vk::Format::eR8G8B8A8Uint: return "R8G8B8A8Uint";
case vk::Format::eR8G8B8A8Sint: return "R8G8B8A8Sint";
case vk::Format::eR8G8B8A8Srgb: return "R8G8B8A8Srgb";
case vk::Format::eB8G8R8A8Unorm: return "B8G8R8A8Unorm";
case vk::Format::eB8G8R8A8Snorm: return "B8G8R8A8Snorm";
case vk::Format::eB8G8R8A8Uscaled: return "B8G8R8A8Uscaled";
case vk::Format::eB8G8R8A8Sscaled: return "B8G8R8A8Sscaled";
case vk::Format::eB8G8R8A8Uint: return "B8G8R8A8Uint";
case vk::Format::eB8G8R8A8Sint: return "B8G8R8A8Sint";
case vk::Format::eB8G8R8A8Srgb: return "B8G8R8A8Srgb";
case vk::Format::eA8B8G8R8UnormPack32: return "A8B8G8R8UnormPack32";
case vk::Format::eA8B8G8R8SnormPack32: return "A8B8G8R8SnormPack32";
case vk::Format::eA8B8G8R8UscaledPack32: return "A8B8G8R8UscaledPack32";
case vk::Format::eA8B8G8R8SscaledPack32: return "A8B8G8R8SscaledPack32";
case vk::Format::eA8B8G8R8UintPack32: return "A8B8G8R8UintPack32";
case vk::Format::eA8B8G8R8SintPack32: return "A8B8G8R8SintPack32";
case vk::Format::eA8B8G8R8SrgbPack32: return "A8B8G8R8SrgbPack32";
case vk::Format::eA2R10G10B10UnormPack32: return "A2R10G10B10UnormPack32";
case vk::Format::eA2R10G10B10SnormPack32: return "A2R10G10B10SnormPack32";
case vk::Format::eA2R10G10B10UscaledPack32: return "A2R10G10B10UscaledPack32";
case vk::Format::eA2R10G10B10SscaledPack32: return "A2R10G10B10SscaledPack32";
case vk::Format::eA2R10G10B10UintPack32: return "A2R10G10B10UintPack32";
case vk::Format::eA2R10G10B10SintPack32: return "A2R10G10B10SintPack32";
case vk::Format::eA2B10G10R10UnormPack32: return "A2B10G10R10UnormPack32";
case vk::Format::eA2B10G10R10SnormPack32: return "A2B10G10R10SnormPack32";
case vk::Format::eA2B10G10R10UscaledPack32: return "A2B10G10R10UscaledPack32";
case vk::Format::eA2B10G10R10SscaledPack32: return "A2B10G10R10SscaledPack32";
case vk::Format::eA2B10G10R10UintPack32: return "A2B10G10R10UintPack32";
case vk::Format::eA2B10G10R10SintPack32: return "A2B10G10R10SintPack32";
case vk::Format::eR16Unorm: return "R16Unorm";
case vk::Format::eR16Snorm: return "R16Snorm";
case vk::Format::eR16Uscaled: return "R16Uscaled";
case vk::Format::eR16Sscaled: return "R16Sscaled";
case vk::Format::eR16Uint: return "R16Uint";
case vk::Format::eR16Sint: return "R16Sint";
case vk::Format::eR16Sfloat: return "R16Sfloat";
case vk::Format::eR16G16Unorm: return "R16G16Unorm";
case vk::Format::eR16G16Snorm: return "R16G16Snorm";
case vk::Format::eR16G16Uscaled: return "R16G16Uscaled";
case vk::Format::eR16G16Sscaled: return "R16G16Sscaled";
case vk::Format::eR16G16Uint: return "R16G16Uint";
case vk::Format::eR16G16Sint: return "R16G16Sint";
case vk::Format::eR16G16Sfloat: return "R16G16Sfloat";
case vk::Format::eR16G16B16Unorm: return "R16G16B16Unorm";
case vk::Format::eR16G16B16Snorm: return "R16G16B16Snorm";
case vk::Format::eR16G16B16Uscaled: return "R16G16B16Uscaled";
case vk::Format::eR16G16B16Sscaled: return "R16G16B16Sscaled";
case vk::Format::eR16G16B16Uint: return "R16G16B16Uint";
case vk::Format::eR16G16B16Sint: return "R16G16B16Sint";
case vk::Format::eR16G16B16Sfloat: return "R16G16B16Sfloat";
case vk::Format::eR16G16B16A16Unorm: return "R16G16B16A16Unorm";
case vk::Format::eR16G16B16A16Snorm: return "R16G16B16A16Snorm";
case vk::Format::eR16G16B16A16Uscaled: return "R16G16B16A16Uscaled";
case vk::Format::eR16G16B16A16Sscaled: return "R16G16B16A16Sscaled";
case vk::Format::eR16G16B16A16Uint: return "R16G16B16A16Uint";
case vk::Format::eR16G16B16A16Sint: return "R16G16B16A16Sint";
case vk::Format::eR16G16B16A16Sfloat: return "R16G16B16A16Sfloat";
case vk::Format::eR32Uint: return "R32Uint";
case vk::Format::eR32Sint: return "R32Sint";
case vk::Format::eR32Sfloat: return "R32Sfloat";
case vk::Format::eR32G32Uint: return "R32G32Uint";
case vk::Format::eR32G32Sint: return "R32G32Sint";
case vk::Format::eR32G32Sfloat: return "R32G32Sfloat";
case vk::Format::eR32G32B32Uint: return "R32G32B32Uint";
case vk::Format::eR32G32B32Sint: return "R32G32B32Sint";
case vk::Format::eR32G32B32Sfloat: return "R32G32B32Sfloat";
case vk::Format::eR32G32B32A32Uint: return "R32G32B32A32Uint";
case vk::Format::eR32G32B32A32Sint: return "R32G32B32A32Sint";
case vk::Format::eR32G32B32A32Sfloat: return "R32G32B32A32Sfloat";
case vk::Format::eR64Uint: return "R64Uint";
case vk::Format::eR64Sint: return "R64Sint";
case vk::Format::eR64Sfloat: return "R64Sfloat";
case vk::Format::eR64G64Uint: return "R64G64Uint";
case vk::Format::eR64G64Sint: return "R64G64Sint";
case vk::Format::eR64G64Sfloat: return "R64G64Sfloat";
case vk::Format::eR64G64B64Uint: return "R64G64B64Uint";
case vk::Format::eR64G64B64Sint: return "R64G64B64Sint";
case vk::Format::eR64G64B64Sfloat: return "R64G64B64Sfloat";
case vk::Format::eR64G64B64A64Uint: return "R64G64B64A64Uint";
case vk::Format::eR64G64B64A64Sint: return "R64G64B64A64Sint";
case vk::Format::eR64G64B64A64Sfloat: return "R64G64B64A64Sfloat";
case vk::Format::eB10G11R11UfloatPack32: return "B10G11R11UfloatPack32";
case vk::Format::eE5B9G9R9UfloatPack32: return "E5B9G9R9UfloatPack32";
case vk::Format::eD16Unorm: return "D16Unorm";
case vk::Format::eX8D24UnormPack32: return "X8D24UnormPack32";
case vk::Format::eD32Sfloat: return "D32Sfloat";
case vk::Format::eS8Uint: return "S8Uint";
case vk::Format::eD16UnormS8Uint: return "D16UnormS8Uint";
case vk::Format::eD24UnormS8Uint: return "D24UnormS8Uint";
case vk::Format::eD32SfloatS8Uint: return "D32SfloatS8Uint";
case vk::Format::eBc1RgbUnormBlock: return "Bc1RgbUnormBlock";
case vk::Format::eBc1RgbSrgbBlock: return "Bc1RgbSrgbBlock";
case vk::Format::eBc1RgbaUnormBlock: return "Bc1RgbaUnormBlock";
case vk::Format::eBc1RgbaSrgbBlock: return "Bc1RgbaSrgbBlock";
case vk::Format::eBc2UnormBlock: return "Bc2UnormBlock";
case vk::Format::eBc2SrgbBlock: return "Bc2SrgbBlock";
case vk::Format::eBc3UnormBlock: return "Bc3UnormBlock";
case vk::Format::eBc3SrgbBlock: return "Bc3SrgbBlock";
case vk::Format::eBc4UnormBlock: return "Bc4UnormBlock";
case vk::Format::eBc4SnormBlock: return "Bc4SnormBlock";
case vk::Format::eBc5UnormBlock: return "Bc5UnormBlock";
case vk::Format::eBc5SnormBlock: return "Bc5SnormBlock";
case vk::Format::eBc6HUfloatBlock: return "Bc6HUfloatBlock";
case vk::Format::eBc6HSfloatBlock: return "Bc6HSfloatBlock";
case vk::Format::eBc7UnormBlock: return "Bc7UnormBlock";
case vk::Format::eBc7SrgbBlock: return "Bc7SrgbBlock";
case vk::Format::eEtc2R8G8B8UnormBlock: return "Etc2R8G8B8UnormBlock";
case vk::Format::eEtc2R8G8B8SrgbBlock: return "Etc2R8G8B8SrgbBlock";
case vk::Format::eEtc2R8G8B8A1UnormBlock: return "Etc2R8G8B8A1UnormBlock";
case vk::Format::eEtc2R8G8B8A1SrgbBlock: return "Etc2R8G8B8A1SrgbBlock";
case vk::Format::eEtc2R8G8B8A8UnormBlock: return "Etc2R8G8B8A8UnormBlock";
case vk::Format::eEtc2R8G8B8A8SrgbBlock: return "Etc2R8G8B8A8SrgbBlock";
case vk::Format::eEacR11UnormBlock: return "EacR11UnormBlock";
case vk::Format::eEacR11SnormBlock: return "EacR11SnormBlock";
case vk::Format::eEacR11G11UnormBlock: return "EacR11G11UnormBlock";
case vk::Format::eEacR11G11SnormBlock: return "EacR11G11SnormBlock";
case vk::Format::eAstc4x4UnormBlock: return "Astc4x4UnormBlock";
case vk::Format::eAstc4x4SrgbBlock: return "Astc4x4SrgbBlock";
case vk::Format::eAstc5x4UnormBlock: return "Astc5x4UnormBlock";
case vk::Format::eAstc5x4SrgbBlock: return "Astc5x4SrgbBlock";
case vk::Format::eAstc5x5UnormBlock: return "Astc5x5UnormBlock";
case vk::Format::eAstc5x5SrgbBlock: return "Astc5x5SrgbBlock";
case vk::Format::eAstc6x5UnormBlock: return "Astc6x5UnormBlock";
case vk::Format::eAstc6x5SrgbBlock: return "Astc6x5SrgbBlock";
case vk::Format::eAstc6x6UnormBlock: return "Astc6x6UnormBlock";
case vk::Format::eAstc6x6SrgbBlock: return "Astc6x6SrgbBlock";
case vk::Format::eAstc8x5UnormBlock: return "Astc8x5UnormBlock";
case vk::Format::eAstc8x5SrgbBlock: return "Astc8x5SrgbBlock";
case vk::Format::eAstc8x6UnormBlock: return "Astc8x6UnormBlock";
case vk::Format::eAstc8x6SrgbBlock: return "Astc8x6SrgbBlock";
case vk::Format::eAstc8x8UnormBlock: return "Astc8x8UnormBlock";
case vk::Format::eAstc8x8SrgbBlock: return "Astc8x8SrgbBlock";
case vk::Format::eAstc10x5UnormBlock: return "Astc10x5UnormBlock";
case vk::Format::eAstc10x5SrgbBlock: return "Astc10x5SrgbBlock";
case vk::Format::eAstc10x6UnormBlock: return "Astc10x6UnormBlock";
case vk::Format::eAstc10x6SrgbBlock: return "Astc10x6SrgbBlock";
case vk::Format::eAstc10x8UnormBlock: return "Astc10x8UnormBlock";
case vk::Format::eAstc10x8SrgbBlock: return "Astc10x8SrgbBlock";
case vk::Format::eAstc10x10UnormBlock: return "Astc10x10UnormBlock";
case vk::Format::eAstc10x10SrgbBlock: return "Astc10x10SrgbBlock";
case vk::Format::eAstc12x10UnormBlock: return "Astc12x10UnormBlock";
case vk::Format::eAstc12x10SrgbBlock: return "Astc12x10SrgbBlock";
case vk::Format::eAstc12x12UnormBlock: return "Astc12x12UnormBlock";
case vk::Format::eAstc12x12SrgbBlock: return "Astc12x12SrgbBlock";
case vk::Format::eG8B8G8R8422Unorm: return "G8B8G8R8422Unorm";
case vk::Format::eB8G8R8G8422Unorm: return "B8G8R8G8422Unorm";
case vk::Format::eG8B8R83Plane420Unorm: return "G8B8R83Plane420Unorm";
case vk::Format::eG8B8R82Plane420Unorm: return "G8B8R82Plane420Unorm";
case vk::Format::eG8B8R83Plane422Unorm: return "G8B8R83Plane422Unorm";
case vk::Format::eG8B8R82Plane422Unorm: return "G8B8R82Plane422Unorm";
case vk::Format::eG8B8R83Plane444Unorm: return "G8B8R83Plane444Unorm";
case vk::Format::eR10X6UnormPack16: return "R10X6UnormPack16";
case vk::Format::eR10X6G10X6Unorm2Pack16: return "R10X6G10X6Unorm2Pack16";
case vk::Format::eR10X6G10X6B10X6A10X6Unorm4Pack16: return "R10X6G10X6B10X6A10X6Unorm4Pack16";
case vk::Format::eG10X6B10X6G10X6R10X6422Unorm4Pack16: return "G10X6B10X6G10X6R10X6422Unorm4Pack16";
case vk::Format::eB10X6G10X6R10X6G10X6422Unorm4Pack16: return "B10X6G10X6R10X6G10X6422Unorm4Pack16";
case vk::Format::eG10X6B10X6R10X63Plane420Unorm3Pack16: return "G10X6B10X6R10X63Plane420Unorm3Pack16";
case vk::Format::eG10X6B10X6R10X62Plane420Unorm3Pack16: return "G10X6B10X6R10X62Plane420Unorm3Pack16";
case vk::Format::eG10X6B10X6R10X63Plane422Unorm3Pack16: return "G10X6B10X6R10X63Plane422Unorm3Pack16";
case vk::Format::eG10X6B10X6R10X62Plane422Unorm3Pack16: return "G10X6B10X6R10X62Plane422Unorm3Pack16";
case vk::Format::eG10X6B10X6R10X63Plane444Unorm3Pack16: return "G10X6B10X6R10X63Plane444Unorm3Pack16";
case vk::Format::eR12X4UnormPack16: return "R12X4UnormPack16";
case vk::Format::eR12X4G12X4Unorm2Pack16: return "R12X4G12X4Unorm2Pack16";
case vk::Format::eR12X4G12X4B12X4A12X4Unorm4Pack16: return "R12X4G12X4B12X4A12X4Unorm4Pack16";
case vk::Format::eG12X4B12X4G12X4R12X4422Unorm4Pack16: return "G12X4B12X4G12X4R12X4422Unorm4Pack16";
case vk::Format::eB12X4G12X4R12X4G12X4422Unorm4Pack16: return "B12X4G12X4R12X4G12X4422Unorm4Pack16";
case vk::Format::eG12X4B12X4R12X43Plane420Unorm3Pack16: return "G12X4B12X4R12X43Plane420Unorm3Pack16";
case vk::Format::eG12X4B12X4R12X42Plane420Unorm3Pack16: return "G12X4B12X4R12X42Plane420Unorm3Pack16";
case vk::Format::eG12X4B12X4R12X43Plane422Unorm3Pack16: return "G12X4B12X4R12X43Plane422Unorm3Pack16";
case vk::Format::eG12X4B12X4R12X42Plane422Unorm3Pack16: return "G12X4B12X4R12X42Plane422Unorm3Pack16";
case vk::Format::eG12X4B12X4R12X43Plane444Unorm3Pack16: return "G12X4B12X4R12X43Plane444Unorm3Pack16";
case vk::Format::eG16B16G16R16422Unorm: return "G16B16G16R16422Unorm";
case vk::Format::eB16G16R16G16422Unorm: return "B16G16R16G16422Unorm";
case vk::Format::eG16B16R163Plane420Unorm: return "G16B16R163Plane420Unorm";
case vk::Format::eG16B16R162Plane420Unorm: return "G16B16R162Plane420Unorm";
case vk::Format::eG16B16R163Plane422Unorm: return "G16B16R163Plane422Unorm";
case vk::Format::eG16B16R162Plane422Unorm: return "G16B16R162Plane422Unorm";
case vk::Format::eG16B16R163Plane444Unorm: return "G16B16R163Plane444Unorm";
case vk::Format::eG8B8R82Plane444Unorm: return "G8B8R82Plane444Unorm";
case vk::Format::eG10X6B10X6R10X62Plane444Unorm3Pack16: return "G10X6B10X6R10X62Plane444Unorm3Pack16";
case vk::Format::eG12X4B12X4R12X42Plane444Unorm3Pack16: return "G12X4B12X4R12X42Plane444Unorm3Pack16";
case vk::Format::eG16B16R162Plane444Unorm: return "G16B16R162Plane444Unorm";
case vk::Format::eA4R4G4B4UnormPack16: return "A4R4G4B4UnormPack16";
case vk::Format::eA4B4G4R4UnormPack16: return "A4B4G4R4UnormPack16";
case vk::Format::eAstc4x4SfloatBlock: return "Astc4x4SfloatBlock";
case vk::Format::eAstc5x4SfloatBlock: return "Astc5x4SfloatBlock";
case vk::Format::eAstc5x5SfloatBlock: return "Astc5x5SfloatBlock";
case vk::Format::eAstc6x5SfloatBlock: return "Astc6x5SfloatBlock";
case vk::Format::eAstc6x6SfloatBlock: return "Astc6x6SfloatBlock";
case vk::Format::eAstc8x5SfloatBlock: return "Astc8x5SfloatBlock";
case vk::Format::eAstc8x6SfloatBlock: return "Astc8x6SfloatBlock";
case vk::Format::eAstc8x8SfloatBlock: return "Astc8x8SfloatBlock";
case vk::Format::eAstc10x5SfloatBlock: return "Astc10x5SfloatBlock";
case vk::Format::eAstc10x6SfloatBlock: return "Astc10x6SfloatBlock";
case vk::Format::eAstc10x8SfloatBlock: return "Astc10x8SfloatBlock";
case vk::Format::eAstc10x10SfloatBlock: return "Astc10x10SfloatBlock";
case vk::Format::eAstc12x10SfloatBlock: return "Astc12x10SfloatBlock";
case vk::Format::eAstc12x12SfloatBlock: return "Astc12x12SfloatBlock";
case vk::Format::ePvrtc12BppUnormBlockIMG: return "Pvrtc12BppUnormBlockIMG";
case vk::Format::ePvrtc14BppUnormBlockIMG: return "Pvrtc14BppUnormBlockIMG";
case vk::Format::ePvrtc22BppUnormBlockIMG: return "Pvrtc22BppUnormBlockIMG";
case vk::Format::ePvrtc24BppUnormBlockIMG: return "Pvrtc24BppUnormBlockIMG";
case vk::Format::ePvrtc12BppSrgbBlockIMG: return "Pvrtc12BppSrgbBlockIMG";
case vk::Format::ePvrtc14BppSrgbBlockIMG: return "Pvrtc14BppSrgbBlockIMG";
case vk::Format::ePvrtc22BppSrgbBlockIMG: return "Pvrtc22BppSrgbBlockIMG";
case vk::Format::ePvrtc24BppSrgbBlockIMG: return "Pvrtc24BppSrgbBlockIMG";
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
@ -336,8 +50,8 @@ int main( int /*argc*/, char ** /*argv*/ )
for ( size_t j = 0; j < surfaceFormats.size(); j++ )
{
std::cout << std::string( "\t" ) << "Format " << j << "\n";
std::cout << std::string( "\t\t" ) << "colorSpace = " << to_string( surfaceFormats[j].colorSpace ) << "\n";
std::cout << std::string( "\t\t" ) << "format = " << to_string( surfaceFormats[j].format ) << "\n";
std::cout << std::string( "\t\t" ) << "colorSpace = " << vk::to_string( surfaceFormats[j].colorSpace ) << "\n";
std::cout << std::string( "\t\t" ) << "format = " << vk::to_string( surfaceFormats[j].format ) << "\n";
std::cout << "\n";
}
}

View File

@ -25,10 +25,12 @@
#include "utils.hpp"
#include "vulkan/vulkan.hpp"
#include <iomanip>
#include <numeric>
#include <vulkan/vulkan.hpp>
#if defined( VULKAN_HPP_NO_TO_STRING )
# include <vulkan/vulkan_to_string.hpp>
#endif
#if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 )
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
@ -361,97 +363,6 @@ namespace vk
return device.createRenderPass( vk::RenderPassCreateInfo( vk::RenderPassCreateFlags(), attachmentDescriptions, subpassDescription ) );
}
#if defined( VULKAN_HPP_NO_TO_STRING )
namespace local
{
std::string to_string( vk::DebugUtilsMessageSeverityFlagBitsEXT value )
{
switch ( value )
{
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eVerbose: return "Verbose";
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eInfo: return "Info";
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning: return "Warning";
case vk::DebugUtilsMessageSeverityFlagBitsEXT::eError: return "Error";
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
std::string to_string( vk::DebugUtilsMessageTypeFlagsEXT value )
{
if ( !value )
return "{}";
std::string result;
if ( value & vk::DebugUtilsMessageTypeFlagBitsEXT::eGeneral )
result += "General | ";
if ( value & vk::DebugUtilsMessageTypeFlagBitsEXT::eValidation )
result += "Validation | ";
if ( value & vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance )
result += "Performance | ";
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
}
std::string to_string( vk::ObjectType value )
{
switch ( value )
{
case vk::ObjectType::eUnknown: return "Unknown";
case vk::ObjectType::eInstance: return "Instance";
case vk::ObjectType::ePhysicalDevice: return "PhysicalDevice";
case vk::ObjectType::eDevice: return "Device";
case vk::ObjectType::eQueue: return "Queue";
case vk::ObjectType::eSemaphore: return "Semaphore";
case vk::ObjectType::eCommandBuffer: return "CommandBuffer";
case vk::ObjectType::eFence: return "Fence";
case vk::ObjectType::eDeviceMemory: return "DeviceMemory";
case vk::ObjectType::eBuffer: return "Buffer";
case vk::ObjectType::eImage: return "Image";
case vk::ObjectType::eEvent: return "Event";
case vk::ObjectType::eQueryPool: return "QueryPool";
case vk::ObjectType::eBufferView: return "BufferView";
case vk::ObjectType::eImageView: return "ImageView";
case vk::ObjectType::eShaderModule: return "ShaderModule";
case vk::ObjectType::ePipelineCache: return "PipelineCache";
case vk::ObjectType::ePipelineLayout: return "PipelineLayout";
case vk::ObjectType::eRenderPass: return "RenderPass";
case vk::ObjectType::ePipeline: return "Pipeline";
case vk::ObjectType::eDescriptorSetLayout: return "DescriptorSetLayout";
case vk::ObjectType::eSampler: return "Sampler";
case vk::ObjectType::eDescriptorPool: return "DescriptorPool";
case vk::ObjectType::eDescriptorSet: return "DescriptorSet";
case vk::ObjectType::eFramebuffer: return "Framebuffer";
case vk::ObjectType::eCommandPool: return "CommandPool";
case vk::ObjectType::eSamplerYcbcrConversion: return "SamplerYcbcrConversion";
case vk::ObjectType::eDescriptorUpdateTemplate: return "DescriptorUpdateTemplate";
case vk::ObjectType::ePrivateDataSlot: return "PrivateDataSlot";
case vk::ObjectType::eSurfaceKHR: return "SurfaceKHR";
case vk::ObjectType::eSwapchainKHR: return "SwapchainKHR";
case vk::ObjectType::eDisplayKHR: return "DisplayKHR";
case vk::ObjectType::eDisplayModeKHR: return "DisplayModeKHR";
case vk::ObjectType::eDebugReportCallbackEXT: return "DebugReportCallbackEXT";
# if defined( VK_ENABLE_BETA_EXTENSIONS )
case vk::ObjectType::eVideoSessionKHR: return "VideoSessionKHR";
case vk::ObjectType::eVideoSessionParametersKHR: return "VideoSessionParametersKHR";
# endif /*VK_ENABLE_BETA_EXTENSIONS*/
case vk::ObjectType::eCuModuleNVX: return "CuModuleNVX";
case vk::ObjectType::eCuFunctionNVX: return "CuFunctionNVX";
case vk::ObjectType::eDebugUtilsMessengerEXT: return "DebugUtilsMessengerEXT";
case vk::ObjectType::eAccelerationStructureKHR: return "AccelerationStructureKHR";
case vk::ObjectType::eValidationCacheEXT: return "ValidationCacheEXT";
case vk::ObjectType::eAccelerationStructureNV: return "AccelerationStructureNV";
case vk::ObjectType::ePerformanceConfigurationINTEL: return "PerformanceConfigurationINTEL";
case vk::ObjectType::eDeferredOperationKHR: return "DeferredOperationKHR";
case vk::ObjectType::eIndirectCommandsLayoutNV: return "IndirectCommandsLayoutNV";
# if defined( VK_USE_PLATFORM_FUCHSIA )
case vk::ObjectType::eBufferCollectionFUCHSIA: return "BufferCollectionFUCHSIA";
# endif /*VK_USE_PLATFORM_FUCHSIA*/
default: return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString( static_cast<uint32_t>( value ) ) + " )";
}
}
} // namespace local
#endif
VKAPI_ATTR VkBool32 VKAPI_CALL debugUtilsMessengerCallback( VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
VkDebugUtilsMessageTypeFlagsEXT messageTypes,
VkDebugUtilsMessengerCallbackDataEXT const * pCallbackData,
@ -470,13 +381,8 @@ namespace vk
}
#endif
#if defined( VULKAN_HPP_NO_TO_STRING )
std::cerr << local::to_string( static_cast<vk::DebugUtilsMessageSeverityFlagBitsEXT>( messageSeverity ) ) << ": "
<< local::to_string( static_cast<vk::DebugUtilsMessageTypeFlagsEXT>( messageTypes ) ) << ":\n";
#else
std::cerr << vk::to_string( static_cast<vk::DebugUtilsMessageSeverityFlagBitsEXT>( messageSeverity ) ) << ": "
<< vk::to_string( static_cast<vk::DebugUtilsMessageTypeFlagsEXT>( messageTypes ) ) << ":\n";
#endif
std::cerr << std::string( "\t" ) << "messageIDName = <" << pCallbackData->pMessageIdName << ">\n";
std::cerr << std::string( "\t" ) << "messageIdNumber = " << pCallbackData->messageIdNumber << "\n";
std::cerr << std::string( "\t" ) << "message = <" << pCallbackData->pMessage << ">\n";
@ -502,13 +408,8 @@ namespace vk
for ( uint32_t i = 0; i < pCallbackData->objectCount; i++ )
{
std::cerr << std::string( "\t\t" ) << "Object " << i << "\n";
#if defined( VULKAN_HPP_NO_TO_STRING )
std::cerr << std::string( "\t\t\t" ) << "objectType = " << local::to_string( static_cast<vk::ObjectType>( pCallbackData->pObjects[i].objectType ) )
<< "\n";
#else
std::cerr << std::string( "\t\t\t" ) << "objectType = " << vk::to_string( static_cast<vk::ObjectType>( pCallbackData->pObjects[i].objectType ) )
<< "\n";
#endif
std::cerr << std::string( "\t\t\t" ) << "objectHandle = " << pCallbackData->pObjects[i].objectHandle << "\n";
if ( pCallbackData->pObjects[i].pObjectName )
{

View File

@ -5600,6 +5600,9 @@ namespace VULKAN_HPP_NAMESPACE
} // namespace VULKAN_HPP_NAMESPACE
#include <vulkan/vulkan_enums.hpp>
#if !defined( VULKAN_HPP_NO_TO_STRING )
# include <vulkan/vulkan_to_string.hpp>
#endif
#ifndef VULKAN_HPP_NO_EXCEPTIONS
namespace std

File diff suppressed because it is too large Load Diff

7661
vulkan/vulkan_to_string.hpp Normal file

File diff suppressed because it is too large Load Diff