mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Resolve issues with release build.
This commit is contained in:
parent
5fe7d29f90
commit
cb87566cdd
@ -260,9 +260,11 @@ namespace vk
|
||||
copyToDevice( *stagingBuffer.deviceMemory, data.data(), data.size(), elementSize );
|
||||
|
||||
vk::raii::su::oneTimeSubmit(
|
||||
device, commandPool, queue, [&]( vk::raii::CommandBuffer const & commandBuffer ) {
|
||||
commandBuffer.copyBuffer( **stagingBuffer.buffer, **this->buffer, vk::BufferCopy( 0, 0, dataSize ) );
|
||||
} );
|
||||
device,
|
||||
commandPool,
|
||||
queue,
|
||||
[&]( vk::raii::CommandBuffer const & commandBuffer )
|
||||
{ commandBuffer.copyBuffer( **stagingBuffer.buffer, **this->buffer, vk::BufferCopy( 0, 0, dataSize ) ); } );
|
||||
}
|
||||
|
||||
std::unique_ptr<vk::raii::Buffer> buffer;
|
||||
@ -634,10 +636,11 @@ namespace vk
|
||||
std::vector<vk::DescriptorPoolSize> const & poolSizes )
|
||||
{
|
||||
assert( !poolSizes.empty() );
|
||||
uint32_t maxSets = std::accumulate(
|
||||
poolSizes.begin(), poolSizes.end(), 0, []( uint32_t sum, vk::DescriptorPoolSize const & dps ) {
|
||||
return sum + dps.descriptorCount;
|
||||
} );
|
||||
uint32_t maxSets = std::accumulate( poolSizes.begin(),
|
||||
poolSizes.end(),
|
||||
0,
|
||||
[]( uint32_t sum, vk::DescriptorPoolSize const & dps )
|
||||
{ return sum + dps.descriptorCount; } );
|
||||
assert( 0 < maxSets );
|
||||
|
||||
vk::DescriptorPoolCreateInfo descriptorPoolCreateInfo(
|
||||
@ -853,10 +856,19 @@ namespace vk
|
||||
uint32_t apiVersion = VK_API_VERSION_1_0 )
|
||||
{
|
||||
vk::ApplicationInfo applicationInfo( appName.c_str(), 1, engineName.c_str(), 1, apiVersion );
|
||||
std::vector<char const *> enabledLayers =
|
||||
vk::su::gatherLayers( layers, context.enumerateInstanceLayerProperties() );
|
||||
std::vector<char const *> enabledLayers = vk::su::gatherLayers( layers
|
||||
#if !defined( NDEBUG )
|
||||
,
|
||||
context.enumerateInstanceLayerProperties()
|
||||
#endif
|
||||
);
|
||||
std::vector<char const *> enabledExtensions =
|
||||
vk::su::gatherExtensions( extensions, context.enumerateInstanceExtensionProperties() );
|
||||
vk::su::gatherExtensions( extensions
|
||||
#if !defined( NDEBUG )
|
||||
,
|
||||
context.enumerateInstanceExtensionProperties()
|
||||
#endif
|
||||
);
|
||||
#if defined( NDEBUG )
|
||||
vk::StructureChain<vk::InstanceCreateInfo>
|
||||
#else
|
||||
|
@ -49,7 +49,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
|
||||
/* VULKAN_HPP_KEY_END */
|
||||
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -59,7 +59,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
device.destroy();
|
||||
|
||||
/* VULKAN_HPP_KEY_END */
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -60,7 +60,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
/* VULKAN_HPP_KEY_END */
|
||||
|
||||
device.destroy();
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -187,7 +187,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
/* VULKAN_HPP_KEY_END */
|
||||
|
||||
device.destroy();
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -111,7 +111,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
|
||||
device.destroy();
|
||||
instance.destroySurfaceKHR( surfaceData.surface );
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -90,7 +90,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
/* VULKAN_HPP_KEY_END */
|
||||
|
||||
device.destroy();
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -58,7 +58,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
/* VULKAN_HPP_KEY_END */
|
||||
|
||||
device.destroy();
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -84,7 +84,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
device.destroyDescriptorSetLayout( descriptorSetLayout );
|
||||
uniformBufferData.clear( device );
|
||||
device.destroy();
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -94,7 +94,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
|
||||
device.destroy();
|
||||
instance.destroySurfaceKHR( surfaceData.surface );
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -67,7 +67,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
/* VULKAN_HPP_KEY_END */
|
||||
|
||||
device.destroy();
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -83,7 +83,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
swapChainData.clear( device );
|
||||
device.destroy();
|
||||
instance.destroySurfaceKHR( surfaceData.surface );
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -132,7 +132,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
device.destroyCommandPool( commandPool );
|
||||
device.destroy();
|
||||
instance.destroySurfaceKHR( surfaceData.surface );
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -195,7 +195,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
device.destroyRenderPass( renderPass );
|
||||
device.destroy();
|
||||
instance.destroySurfaceKHR( surfaceData.surface );
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -203,7 +203,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
device.destroyCommandPool( commandPool );
|
||||
device.destroy();
|
||||
instance.destroySurfaceKHR( surfaceData.surface );
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -89,7 +89,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
usingMinorVersion = desiredMinorVersion;
|
||||
}
|
||||
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
|
||||
|
@ -251,7 +251,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
device.destroyCommandPool( commandPool );
|
||||
device.destroy();
|
||||
instance.destroySurfaceKHR( surfaceData.surface );
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -153,7 +153,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
vk::DebugUtilsMessengerEXT debugUtilsMessenger = instance.createDebugUtilsMessengerEXT(
|
||||
vk::DebugUtilsMessengerCreateInfoEXT( {}, severityFlags, messageTypeFlags, &debugMessageFunc ) );
|
||||
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
|
||||
/* VULKAN_KEY_END */
|
||||
|
@ -66,7 +66,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
|
||||
device.destroyImage( image );
|
||||
device.destroy();
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -211,7 +211,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
device.destroyCommandPool( commandPool );
|
||||
device.destroy();
|
||||
instance.destroySurfaceKHR( surfaceData.surface );
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -257,7 +257,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
device.destroyCommandPool( commandPool );
|
||||
device.destroy();
|
||||
instance.destroySurfaceKHR( surfaceData.surface );
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -205,7 +205,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
#endif
|
||||
|
||||
device.destroy();
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
|
||||
/* VULKAN_KEY_END */
|
||||
|
@ -65,7 +65,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
|
||||
/* VULKAN_HPP_KEY_END */
|
||||
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -142,7 +142,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
device.freeCommandBuffers( commandPool, commandBuffer );
|
||||
device.destroyCommandPool( commandPool );
|
||||
device.destroy();
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -227,7 +227,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
device.destroyCommandPool( commandPool );
|
||||
device.destroy();
|
||||
instance.destroySurfaceKHR( surfaceData.surface );
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -213,7 +213,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
device.destroyCommandPool( commandPool );
|
||||
device.destroy();
|
||||
instance.destroySurfaceKHR( surfaceData.surface );
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -306,7 +306,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
device.destroyCommandPool( commandPool );
|
||||
device.destroy();
|
||||
instance.destroySurfaceKHR( surfaceData.surface );
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -294,7 +294,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
device.destroyCommandPool( commandPool );
|
||||
device.destroy();
|
||||
instance.destroySurfaceKHR( surfaceData.surface );
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -273,7 +273,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
device.destroyCommandPool( commandPool );
|
||||
device.destroy();
|
||||
instance.destroySurfaceKHR( surfaceData.surface );
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -60,7 +60,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
|
||||
/* VULKAN_KEY_END */
|
||||
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -810,7 +810,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
|
||||
/* VULKAN_KEY_END */
|
||||
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -87,7 +87,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
|
||||
/* VULKAN_KEY_END */
|
||||
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -1268,7 +1268,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
|
||||
/* VULKAN_KEY_END */
|
||||
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -89,7 +89,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
|
||||
/* VULKAN_KEY_END */
|
||||
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -409,7 +409,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
device.destroyCommandPool( commandPool );
|
||||
device.destroy();
|
||||
instance.destroySurfaceKHR( surfaceData.surface );
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -347,7 +347,9 @@ void main()
|
||||
device.destroyCommandPool( commandPool );
|
||||
device.destroy();
|
||||
instance.destroySurfaceKHR( surfaceData.surface );
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -272,7 +272,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
device.destroyCommandPool( commandPool );
|
||||
device.destroy();
|
||||
instance.destroySurfaceKHR( surfaceData.surface );
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -250,7 +250,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
device.destroyCommandPool( commandPool );
|
||||
device.destroy();
|
||||
instance.destroySurfaceKHR( surfaceData.surface );
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -1407,7 +1407,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
}
|
||||
device.destroy();
|
||||
instance.destroySurfaceKHR( surface );
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
|
||||
glfwDestroyWindow( window );
|
||||
|
@ -279,7 +279,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
device.destroyCommandPool( commandPool );
|
||||
device.destroy();
|
||||
instance.destroySurfaceKHR( surfaceData.surface );
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -296,7 +296,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
device.destroyCommandPool( commandPool );
|
||||
device.destroy();
|
||||
instance.destroySurfaceKHR( surfaceData.surface );
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -167,7 +167,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
/* VULKAN_KEY_END */
|
||||
|
||||
instance.destroySurfaceKHR( surfaceData.surface );
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -62,7 +62,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
/* VULKAN_KEY_END */
|
||||
|
||||
instance.destroySurfaceKHR( surfaceData.surface );
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -208,7 +208,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
device.destroyCommandPool( commandPool );
|
||||
device.destroy();
|
||||
instance.destroySurfaceKHR( surfaceData.surface );
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -238,7 +238,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
device.destroyCommandPool( commandPool );
|
||||
device.destroy();
|
||||
instance.destroySurfaceKHR( surfaceData.surface );
|
||||
#if !defined( NDEBUG )
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
#endif
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
|
@ -51,10 +51,10 @@ namespace vk
|
||||
|
||||
bool contains( std::vector<vk::ExtensionProperties> const & extensionProperties, std::string const & extensionName )
|
||||
{
|
||||
auto propertyIterator = std::find_if(
|
||||
extensionProperties.begin(), extensionProperties.end(), [&extensionName]( vk::ExtensionProperties const & ep ) {
|
||||
return extensionName == ep.extensionName;
|
||||
} );
|
||||
auto propertyIterator = std::find_if( extensionProperties.begin(),
|
||||
extensionProperties.end(),
|
||||
[&extensionName]( vk::ExtensionProperties const & ep )
|
||||
{ return extensionName == ep.extensionName; } );
|
||||
return ( propertyIterator != extensionProperties.end() );
|
||||
}
|
||||
|
||||
@ -75,9 +75,10 @@ namespace vk
|
||||
{
|
||||
assert( !poolSizes.empty() );
|
||||
uint32_t maxSets =
|
||||
std::accumulate( poolSizes.begin(), poolSizes.end(), 0, []( uint32_t sum, vk::DescriptorPoolSize const & dps ) {
|
||||
return sum + dps.descriptorCount;
|
||||
} );
|
||||
std::accumulate( poolSizes.begin(),
|
||||
poolSizes.end(),
|
||||
0,
|
||||
[]( uint32_t sum, vk::DescriptorPoolSize const & dps ) { return sum + dps.descriptorCount; } );
|
||||
assert( 0 < maxSets );
|
||||
|
||||
vk::DescriptorPoolCreateInfo descriptorPoolCreateInfo(
|
||||
@ -273,18 +274,19 @@ namespace vk
|
||||
enabledExtensions.reserve( extensions.size() );
|
||||
for ( auto const & ext : extensions )
|
||||
{
|
||||
assert( std::find_if(
|
||||
extensionProperties.begin(), extensionProperties.end(), [ext]( vk::ExtensionProperties const & ep ) {
|
||||
return ext == ep.extensionName;
|
||||
} ) != extensionProperties.end() );
|
||||
assert( std::find_if( extensionProperties.begin(),
|
||||
extensionProperties.end(),
|
||||
[ext]( vk::ExtensionProperties const & ep )
|
||||
{ return ext == ep.extensionName; } ) != extensionProperties.end() );
|
||||
enabledExtensions.push_back( ext.data() );
|
||||
}
|
||||
#if !defined( NDEBUG )
|
||||
if ( std::find( extensions.begin(), extensions.end(), VK_EXT_DEBUG_UTILS_EXTENSION_NAME ) == extensions.end() &&
|
||||
std::find_if(
|
||||
extensionProperties.begin(), extensionProperties.end(), []( vk::ExtensionProperties const & ep ) {
|
||||
return ( strcmp( VK_EXT_DEBUG_UTILS_EXTENSION_NAME, ep.extensionName ) == 0 );
|
||||
} ) != extensionProperties.end() )
|
||||
std::find_if( extensionProperties.begin(),
|
||||
extensionProperties.end(),
|
||||
[]( vk::ExtensionProperties const & ep ) {
|
||||
return ( strcmp( VK_EXT_DEBUG_UTILS_EXTENSION_NAME, ep.extensionName ) == 0 );
|
||||
} ) != extensionProperties.end() )
|
||||
{
|
||||
enabledExtensions.push_back( VK_EXT_DEBUG_UTILS_EXTENSION_NAME );
|
||||
}
|
||||
@ -303,18 +305,20 @@ namespace vk
|
||||
enabledLayers.reserve( layers.size() );
|
||||
for ( auto const & layer : layers )
|
||||
{
|
||||
assert(
|
||||
std::find_if( layerProperties.begin(), layerProperties.end(), [layer]( vk::LayerProperties const & lp ) {
|
||||
return layer == lp.layerName;
|
||||
} ) != layerProperties.end() );
|
||||
assert( std::find_if( layerProperties.begin(),
|
||||
layerProperties.end(),
|
||||
[layer]( vk::LayerProperties const & lp )
|
||||
{ return layer == lp.layerName; } ) != layerProperties.end() );
|
||||
enabledLayers.push_back( layer.data() );
|
||||
}
|
||||
#if !defined( NDEBUG )
|
||||
// Enable standard validation layer to find as much errors as possible!
|
||||
if ( std::find( layers.begin(), layers.end(), "VK_LAYER_KHRONOS_validation" ) == layers.end() &&
|
||||
std::find_if( layerProperties.begin(), layerProperties.end(), []( vk::LayerProperties const & lp ) {
|
||||
return ( strcmp( "VK_LAYER_KHRONOS_validation", lp.layerName ) == 0 );
|
||||
} ) != layerProperties.end() )
|
||||
std::find_if( layerProperties.begin(),
|
||||
layerProperties.end(),
|
||||
[]( vk::LayerProperties const & lp ) {
|
||||
return ( strcmp( "VK_LAYER_KHRONOS_validation", lp.layerName ) == 0 );
|
||||
} ) != layerProperties.end() )
|
||||
{
|
||||
enabledLayers.push_back( "VK_LAYER_KHRONOS_validation" );
|
||||
}
|
||||
@ -336,9 +340,18 @@ namespace vk
|
||||
#endif
|
||||
|
||||
vk::ApplicationInfo applicationInfo( appName.c_str(), 1, engineName.c_str(), 1, apiVersion );
|
||||
std::vector<char const *> enabledLayers = vk::su::gatherLayers( layers, vk::enumerateInstanceLayerProperties() );
|
||||
std::vector<char const *> enabledExtensions =
|
||||
vk::su::gatherExtensions( extensions, vk::enumerateInstanceExtensionProperties() );
|
||||
std::vector<char const *> enabledLayers = vk::su::gatherLayers( layers
|
||||
#if !defined( NDEBUG )
|
||||
,
|
||||
vk::enumerateInstanceLayerProperties()
|
||||
#endif
|
||||
);
|
||||
std::vector<char const *> enabledExtensions = vk::su::gatherExtensions( extensions
|
||||
#if !defined( NDEBUG )
|
||||
,
|
||||
vk::enumerateInstanceExtensionProperties()
|
||||
#endif
|
||||
);
|
||||
|
||||
#if defined( NDEBUG )
|
||||
// in non-debug mode just use the InstanceCreateInfo for instance creation
|
||||
@ -352,7 +365,7 @@ namespace vk
|
||||
vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance |
|
||||
vk::DebugUtilsMessageTypeFlagBitsEXT::eValidation );
|
||||
# if defined( VULKAN_HPP_UTILS_USE_BEST_PRACTICES )
|
||||
vk::ValidationFeatureEnableEXT validationFeatureEnable = vk::ValidationFeatureEnableEXT::eBestPractices;
|
||||
vk::ValidationFeatureEnableEXT validationFeatureEnable = vk::ValidationFeatureEnableEXT::eBestPractices;
|
||||
vk::StructureChain<vk::InstanceCreateInfo, vk::DebugUtilsMessengerCreateInfoEXT, vk::ValidationFeaturesEXT>
|
||||
instanceCreateInfo( { {}, &applicationInfo, enabledLayers, enabledExtensions },
|
||||
{ {}, severityFlags, messageTypeFlags, &vk::su::debugUtilsMessengerCallback },
|
||||
@ -492,9 +505,9 @@ namespace vk
|
||||
{
|
||||
// get the first index into queueFamiliyProperties which supports graphics
|
||||
std::vector<vk::QueueFamilyProperties>::const_iterator graphicsQueueFamilyProperty = std::find_if(
|
||||
queueFamilyProperties.begin(), queueFamilyProperties.end(), []( vk::QueueFamilyProperties const & qfp ) {
|
||||
return qfp.queueFlags & vk::QueueFlagBits::eGraphics;
|
||||
} );
|
||||
queueFamilyProperties.begin(),
|
||||
queueFamilyProperties.end(),
|
||||
[]( vk::QueueFamilyProperties const & qfp ) { return qfp.queueFlags & vk::QueueFlagBits::eGraphics; } );
|
||||
assert( graphicsQueueFamilyProperty != queueFamilyProperties.end() );
|
||||
return static_cast<uint32_t>( std::distance( queueFamilyProperties.begin(), graphicsQueueFamilyProperty ) );
|
||||
}
|
||||
@ -647,10 +660,11 @@ namespace vk
|
||||
for ( size_t i = 0; i < sizeof( requestedFormats ) / sizeof( requestedFormats[0] ); i++ )
|
||||
{
|
||||
vk::Format requestedFormat = requestedFormats[i];
|
||||
auto it = std::find_if(
|
||||
formats.begin(), formats.end(), [requestedFormat, requestedColorSpace]( vk::SurfaceFormatKHR const & f ) {
|
||||
return ( f.format == requestedFormat ) && ( f.colorSpace == requestedColorSpace );
|
||||
} );
|
||||
auto it = std::find_if( formats.begin(),
|
||||
formats.end(),
|
||||
[requestedFormat, requestedColorSpace]( vk::SurfaceFormatKHR const & f ) {
|
||||
return ( f.format == requestedFormat ) && ( f.colorSpace == requestedColorSpace );
|
||||
} );
|
||||
if ( it != formats.end() )
|
||||
{
|
||||
pickedFormat = *it;
|
||||
@ -1133,10 +1147,12 @@ namespace vk
|
||||
glfwContext()
|
||||
{
|
||||
glfwInit();
|
||||
glfwSetErrorCallback( []( int error, const char * msg ) {
|
||||
std::cerr << "glfw: "
|
||||
<< "(" << error << ") " << msg << std::endl;
|
||||
} );
|
||||
glfwSetErrorCallback(
|
||||
[]( int error, const char * msg )
|
||||
{
|
||||
std::cerr << "glfw: "
|
||||
<< "(" << error << ") " << msg << std::endl;
|
||||
} );
|
||||
}
|
||||
|
||||
~glfwContext()
|
||||
@ -1174,7 +1190,7 @@ namespace vk
|
||||
#if defined( NDEBUG )
|
||||
// in non-debug mode just use the InstanceCreateInfo for instance creation
|
||||
vk::StructureChain<vk::InstanceCreateInfo> instanceCreateInfo(
|
||||
{ {}, &applicationInfo, enabledLayers, enabledExtensions } );
|
||||
{ {}, &applicationInfo, layers, extensions } );
|
||||
#else
|
||||
// in debug mode, addionally use the debugUtilsMessengerCallback in instance creation!
|
||||
vk::DebugUtilsMessageSeverityFlagsEXT severityFlags( vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning |
|
||||
|
Loading…
Reference in New Issue
Block a user