mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Make generated headers resistant to missing definition of NOMINMAX for windows builds. (#1906)
This commit is contained in:
parent
3be51fe651
commit
6604f5a1d9
@ -54,7 +54,7 @@ function( vulkan_hpp__setup_platform )
|
||||
cmake_parse_arguments( TARGET "{options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
|
||||
if( WIN32 )
|
||||
target_compile_definitions( ${TARGET_NAME} PUBLIC NOMINMAX VK_USE_PLATFORM_WIN32_KHR )
|
||||
target_compile_definitions( ${TARGET_NAME} PUBLIC VK_USE_PLATFORM_WIN32_KHR )
|
||||
elseif( APPLE )
|
||||
target_compile_definitions( ${TARGET_NAME} PUBLIC VK_USE_PLATFORM_MACOS_MVK )
|
||||
elseif( UNIX )
|
||||
|
@ -93,7 +93,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
|
||||
vk::SurfaceCapabilitiesKHR surfaceCapabilities = physicalDevice.getSurfaceCapabilitiesKHR( surface );
|
||||
vk::Extent2D swapchainExtent;
|
||||
if ( surfaceCapabilities.currentExtent.width == std::numeric_limits<uint32_t>::max() )
|
||||
if ( surfaceCapabilities.currentExtent.width == (std::numeric_limits<uint32_t>::max)() )
|
||||
{
|
||||
// If the surface size is undefined, the size is set to the size of the images requested.
|
||||
swapchainExtent.width = vk::su::clamp( width, surfaceCapabilities.minImageExtent.width, surfaceCapabilities.maxImageExtent.width );
|
||||
|
@ -342,7 +342,7 @@ namespace vk
|
||||
|
||||
vk::SurfaceCapabilitiesKHR surfaceCapabilities = physicalDevice.getSurfaceCapabilitiesKHR( surface );
|
||||
vk::Extent2D swapchainExtent;
|
||||
if ( surfaceCapabilities.currentExtent.width == std::numeric_limits<uint32_t>::max() )
|
||||
if ( surfaceCapabilities.currentExtent.width == (std::numeric_limits<uint32_t>::max)() )
|
||||
{
|
||||
// If the surface size is undefined, the size is set to the size of the images requested.
|
||||
swapchainExtent.width = vk::su::clamp( extent.width, surfaceCapabilities.minImageExtent.width, surfaceCapabilities.maxImageExtent.width );
|
||||
@ -509,7 +509,7 @@ namespace vk
|
||||
vk::raii::SurfaceKHR const & surface )
|
||||
{
|
||||
std::vector<vk::QueueFamilyProperties> queueFamilyProperties = physicalDevice.getQueueFamilyProperties();
|
||||
assert( queueFamilyProperties.size() < std::numeric_limits<uint32_t>::max() );
|
||||
assert( queueFamilyProperties.size() < (std::numeric_limits<uint32_t>::max)() );
|
||||
|
||||
uint32_t graphicsQueueFamilyIndex = vk::su::findGraphicsQueueFamilyIndex( queueFamilyProperties );
|
||||
if ( physicalDevice.getSurfaceSupportKHR( graphicsQueueFamilyIndex, surface ) )
|
||||
|
@ -8220,7 +8220,7 @@ std::string VulkanHppGenerator::generateLenInitializer(
|
||||
if ( !litit->second.front()->arraySizes.empty() )
|
||||
{
|
||||
assert( litit->second.front()->arraySizes.size() == 1 );
|
||||
initializer = "std::min( " + initializer + ", " + litit->second.front()->arraySizes[0] + " )";
|
||||
initializer = "(std::min)( " + initializer + ", " + litit->second.front()->arraySizes[0] + " )";
|
||||
}
|
||||
return initializer;
|
||||
}
|
||||
@ -11720,7 +11720,7 @@ std::string VulkanHppGenerator::generateStructSetter( std::string const & struct
|
||||
if ( !member.arraySizes.empty() )
|
||||
{
|
||||
assert( member.arraySizes.size() == 1 );
|
||||
lenValue = "std::min( " + lenValue + ", " + member.arraySizes[0] + " )";
|
||||
lenValue = "(std::min)( " + lenValue + ", " + member.arraySizes[0] + " )";
|
||||
}
|
||||
|
||||
if ( member.type.isPointer() )
|
||||
|
@ -96,7 +96,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
|
||||
vk::SurfaceCapabilitiesKHR surfaceCapabilities = physicalDevice.getSurfaceCapabilitiesKHR( surface );
|
||||
vk::Extent2D swapchainExtent;
|
||||
if ( surfaceCapabilities.currentExtent.width == std::numeric_limits<uint32_t>::max() )
|
||||
if ( surfaceCapabilities.currentExtent.width == (std::numeric_limits<uint32_t>::max)() )
|
||||
{
|
||||
// If the surface size is undefined, the size is set to the size of the images requested.
|
||||
swapchainExtent.width = vk::su::clamp( width, surfaceCapabilities.minImageExtent.width, surfaceCapabilities.maxImageExtent.width );
|
||||
|
@ -422,7 +422,7 @@ namespace vk
|
||||
std::pair<uint32_t, uint32_t> findGraphicsAndPresentQueueFamilyIndex( vk::PhysicalDevice physicalDevice, vk::SurfaceKHR const & surface )
|
||||
{
|
||||
std::vector<vk::QueueFamilyProperties> queueFamilyProperties = physicalDevice.getQueueFamilyProperties();
|
||||
assert( queueFamilyProperties.size() < std::numeric_limits<uint32_t>::max() );
|
||||
assert( queueFamilyProperties.size() < (std::numeric_limits<uint32_t>::max)() );
|
||||
|
||||
uint32_t graphicsQueueFamilyIndex = findGraphicsQueueFamilyIndex( queueFamilyProperties );
|
||||
if ( physicalDevice.getSurfaceSupportKHR( graphicsQueueFamilyIndex, surface ) )
|
||||
@ -806,7 +806,7 @@ namespace vk
|
||||
|
||||
vk::SurfaceCapabilitiesKHR surfaceCapabilities = physicalDevice.getSurfaceCapabilitiesKHR( surface );
|
||||
vk::Extent2D swapchainExtent;
|
||||
if ( surfaceCapabilities.currentExtent.width == std::numeric_limits<uint32_t>::max() )
|
||||
if ( surfaceCapabilities.currentExtent.width == (std::numeric_limits<uint32_t>::max)() )
|
||||
{
|
||||
// If the surface size is undefined, the size is set to the size of the images requested.
|
||||
swapchainExtent.width = clamp( extent.width, surfaceCapabilities.minImageExtent.width, surfaceCapabilities.maxImageExtent.width );
|
||||
|
@ -76,10 +76,10 @@ namespace vk
|
||||
|
||||
VULKAN_HPP_INLINE uint32_t clampSurfaceImageCount( const uint32_t desiredImageCount, const uint32_t minImageCount, const uint32_t maxImageCount )
|
||||
{
|
||||
uint32_t imageCount = std::max( desiredImageCount, minImageCount );
|
||||
uint32_t imageCount = (std::max)( desiredImageCount, minImageCount );
|
||||
if ( maxImageCount > 0 )
|
||||
{
|
||||
imageCount = std::min( imageCount, maxImageCount );
|
||||
imageCount = (std::min)( imageCount, maxImageCount );
|
||||
}
|
||||
return imageCount;
|
||||
}
|
||||
@ -355,7 +355,7 @@ namespace vk
|
||||
static_assert( !std::numeric_limits<SourceType>::is_signed, "Only unsigned types supported!" );
|
||||
static_assert( std::numeric_limits<TargetType>::is_integer, "Only integer types supported!" );
|
||||
static_assert( !std::numeric_limits<TargetType>::is_signed, "Only unsigned types supported!" );
|
||||
assert( value <= std::numeric_limits<TargetType>::max() );
|
||||
assert( value <= (std::numeric_limits<TargetType>::max)() );
|
||||
return static_cast<TargetType>( value );
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
private:
|
||||
VULKAN_HPP_CONSTEXPR_14 void copy( char const * data, size_t len ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
size_t n = std::min( N - 1, len );
|
||||
size_t n = (std::min)( N - 1, len );
|
||||
for ( size_t i = 0; i < n; ++i )
|
||||
{
|
||||
( *this )[i] = data[i];
|
||||
|
@ -174,7 +174,7 @@ vk::UniqueSwapchainKHR createSwapchainKHRUnique( vk::PhysicalDevice physicalDevi
|
||||
vk::SurfaceCapabilitiesKHR surfaceCapabilities = physicalDevice.getSurfaceCapabilitiesKHR( surface );
|
||||
vk::SurfaceFormatKHR surfaceFormat = vk::su::pickSurfaceFormat( physicalDevice.getSurfaceFormatsKHR( surface ) );
|
||||
vk::Extent2D swapchainExtent;
|
||||
if ( surfaceCapabilities.currentExtent.width == std::numeric_limits<uint32_t>::max() )
|
||||
if ( surfaceCapabilities.currentExtent.width == (std::numeric_limits<uint32_t>::max)() )
|
||||
{
|
||||
// If the surface size is undefined, the size is set to the size of the images requested.
|
||||
swapchainExtent.width = vk::su::clamp<uint32_t>( 64, surfaceCapabilities.minImageExtent.width, surfaceCapabilities.maxImageExtent.width );
|
||||
|
@ -149,7 +149,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
private:
|
||||
VULKAN_HPP_CONSTEXPR_14 void copy( char const * data, size_t len ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
size_t n = std::min( N - 1, len );
|
||||
size_t n = ( std::min )( N - 1, len );
|
||||
for ( size_t i = 0; i < n; ++i )
|
||||
{
|
||||
( *this )[i] = data[i];
|
||||
@ -16853,7 +16853,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
m_library = dlopen( "libvulkan.1.dylib", RTLD_NOW | RTLD_LOCAL );
|
||||
}
|
||||
# elif defined( _WIN32 )
|
||||
m_library = ::LoadLibraryA( "vulkan-1.dll" );
|
||||
m_library = ::LoadLibraryA( "vulkan-1.dll" );
|
||||
# else
|
||||
# error unsupported platform
|
||||
# endif
|
||||
|
@ -67661,7 +67661,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
VULKAN_HPP_NAMESPACE::Bool32 subsetAllocation_ = {},
|
||||
void * pNext_ = nullptr )
|
||||
: pNext( pNext_ )
|
||||
, physicalDeviceCount( std::min( static_cast<uint32_t>( physicalDevices_.size() ), VK_MAX_DEVICE_GROUP_SIZE ) )
|
||||
, physicalDeviceCount( ( std::min )( static_cast<uint32_t>( physicalDevices_.size() ), VK_MAX_DEVICE_GROUP_SIZE ) )
|
||||
, subsetAllocation( subsetAllocation_ )
|
||||
{
|
||||
VULKAN_HPP_ASSERT( physicalDevices_.size() < VK_MAX_DEVICE_GROUP_SIZE );
|
||||
@ -73118,8 +73118,8 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
# if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
|
||||
PhysicalDeviceMemoryProperties( VULKAN_HPP_NAMESPACE::ArrayProxy<VULKAN_HPP_NAMESPACE::MemoryType> const & memoryTypes_,
|
||||
VULKAN_HPP_NAMESPACE::ArrayProxy<VULKAN_HPP_NAMESPACE::MemoryHeap> const & memoryHeaps_ = {} )
|
||||
: memoryTypeCount( std::min( static_cast<uint32_t>( memoryTypes_.size() ), VK_MAX_MEMORY_TYPES ) )
|
||||
, memoryHeapCount( std::min( static_cast<uint32_t>( memoryHeaps_.size() ), VK_MAX_MEMORY_HEAPS ) )
|
||||
: memoryTypeCount( ( std::min )( static_cast<uint32_t>( memoryTypes_.size() ), VK_MAX_MEMORY_TYPES ) )
|
||||
, memoryHeapCount( ( std::min )( static_cast<uint32_t>( memoryHeaps_.size() ), VK_MAX_MEMORY_HEAPS ) )
|
||||
{
|
||||
VULKAN_HPP_ASSERT( memoryTypes_.size() < VK_MAX_MEMORY_TYPES );
|
||||
memcpy( memoryTypes, memoryTypes_.data(), memoryTypeCount * sizeof( VULKAN_HPP_NAMESPACE::MemoryType ) );
|
||||
@ -100492,7 +100492,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
# if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
|
||||
QueueFamilyGlobalPriorityPropertiesKHR( VULKAN_HPP_NAMESPACE::ArrayProxy<VULKAN_HPP_NAMESPACE::QueueGlobalPriorityKHR> const & priorities_,
|
||||
void * pNext_ = nullptr )
|
||||
: pNext( pNext_ ), priorityCount( std::min( static_cast<uint32_t>( priorities_.size() ), VK_MAX_GLOBAL_PRIORITY_SIZE_KHR ) )
|
||||
: pNext( pNext_ ), priorityCount( ( std::min )( static_cast<uint32_t>( priorities_.size() ), VK_MAX_GLOBAL_PRIORITY_SIZE_KHR ) )
|
||||
{
|
||||
VULKAN_HPP_ASSERT( priorities_.size() < VK_MAX_GLOBAL_PRIORITY_SIZE_KHR );
|
||||
memcpy( priorities, priorities_.data(), priorityCount * sizeof( VULKAN_HPP_NAMESPACE::QueueGlobalPriorityKHR ) );
|
||||
@ -109942,7 +109942,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
|
||||
# if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
|
||||
ShaderModuleIdentifierEXT( VULKAN_HPP_NAMESPACE::ArrayProxy<uint8_t> const & identifier_, void * pNext_ = nullptr )
|
||||
: pNext( pNext_ ), identifierSize( std::min( static_cast<uint32_t>( identifier_.size() ), VK_MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT ) )
|
||||
: pNext( pNext_ ), identifierSize( ( std::min )( static_cast<uint32_t>( identifier_.size() ), VK_MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT ) )
|
||||
{
|
||||
VULKAN_HPP_ASSERT( identifier_.size() < VK_MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT );
|
||||
memcpy( identifier, identifier_.data(), identifierSize * sizeof( uint8_t ) );
|
||||
|
@ -149,7 +149,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
private:
|
||||
VULKAN_HPP_CONSTEXPR_14 void copy( char const * data, size_t len ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
size_t n = std::min( N - 1, len );
|
||||
size_t n = ( std::min )( N - 1, len );
|
||||
for ( size_t i = 0; i < n; ++i )
|
||||
{
|
||||
( *this )[i] = data[i];
|
||||
@ -6985,7 +6985,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
m_library = dlopen( "libvulkan.1.dylib", RTLD_NOW | RTLD_LOCAL );
|
||||
}
|
||||
# elif defined( _WIN32 )
|
||||
m_library = ::LoadLibraryA( "vulkan-1.dll" );
|
||||
m_library = ::LoadLibraryA( "vulkan-1.dll" );
|
||||
# else
|
||||
# error unsupported platform
|
||||
# endif
|
||||
|
@ -32923,7 +32923,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
VULKAN_HPP_NAMESPACE::Bool32 subsetAllocation_ = {},
|
||||
void * pNext_ = nullptr )
|
||||
: pNext( pNext_ )
|
||||
, physicalDeviceCount( std::min( static_cast<uint32_t>( physicalDevices_.size() ), VK_MAX_DEVICE_GROUP_SIZE ) )
|
||||
, physicalDeviceCount( ( std::min )( static_cast<uint32_t>( physicalDevices_.size() ), VK_MAX_DEVICE_GROUP_SIZE ) )
|
||||
, subsetAllocation( subsetAllocation_ )
|
||||
{
|
||||
VULKAN_HPP_ASSERT( physicalDevices_.size() < VK_MAX_DEVICE_GROUP_SIZE );
|
||||
@ -35080,8 +35080,8 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
# if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
|
||||
PhysicalDeviceMemoryProperties( VULKAN_HPP_NAMESPACE::ArrayProxy<VULKAN_HPP_NAMESPACE::MemoryType> const & memoryTypes_,
|
||||
VULKAN_HPP_NAMESPACE::ArrayProxy<VULKAN_HPP_NAMESPACE::MemoryHeap> const & memoryHeaps_ = {} )
|
||||
: memoryTypeCount( std::min( static_cast<uint32_t>( memoryTypes_.size() ), VK_MAX_MEMORY_TYPES ) )
|
||||
, memoryHeapCount( std::min( static_cast<uint32_t>( memoryHeaps_.size() ), VK_MAX_MEMORY_HEAPS ) )
|
||||
: memoryTypeCount( ( std::min )( static_cast<uint32_t>( memoryTypes_.size() ), VK_MAX_MEMORY_TYPES ) )
|
||||
, memoryHeapCount( ( std::min )( static_cast<uint32_t>( memoryHeaps_.size() ), VK_MAX_MEMORY_HEAPS ) )
|
||||
{
|
||||
VULKAN_HPP_ASSERT( memoryTypes_.size() < VK_MAX_MEMORY_TYPES );
|
||||
memcpy( memoryTypes, memoryTypes_.data(), memoryTypeCount * sizeof( VULKAN_HPP_NAMESPACE::MemoryType ) );
|
||||
|
Loading…
Reference in New Issue
Block a user