Introduce usage of clang-format to format vulkan.hpp and the other sources.

This commit is contained in:
asuessenbach
2020-04-12 21:49:12 +02:00
parent ce9fd81bd9
commit f5e59484a6
68 changed files with 56064 additions and 35586 deletions

View File

@@ -16,25 +16,26 @@
// Get list of global layers and their associated extensions, if any.
#include "vulkan/vulkan.hpp"
#include <iostream>
#include <sstream>
#include <vector>
static char const* AppName = "InstanceLayerExtensionProperties";
static char const* EngineName = "Vulkan.hpp";
static char const * AppName = "InstanceLayerExtensionProperties";
static char const * EngineName = "Vulkan.hpp";
struct PropertyData
{
PropertyData(vk::LayerProperties const& layerProperties_, std::vector<vk::ExtensionProperties> const& extensionProperties_)
: layerProperties(layerProperties_)
, extensionProperties(extensionProperties_)
PropertyData( vk::LayerProperties const & layerProperties_,
std::vector<vk::ExtensionProperties> const & extensionProperties_ )
: layerProperties( layerProperties_ ), extensionProperties( extensionProperties_ )
{}
vk::LayerProperties layerProperties;
std::vector<vk::ExtensionProperties> extensionProperties;
vk::LayerProperties layerProperties;
std::vector<vk::ExtensionProperties> extensionProperties;
};
int main(int /*argc*/, char ** /*argv*/)
int main( int /*argc*/, char ** /*argv*/ )
{
try
{
@@ -43,35 +44,36 @@ int main(int /*argc*/, char ** /*argv*/)
/* VULKAN_KEY_START */
std::vector<PropertyData> propertyData;
propertyData.reserve(layerProperties.size());
propertyData.reserve( layerProperties.size() );
for (auto const& layerProperty : layerProperties)
for ( auto const & layerProperty : layerProperties )
{
std::vector<vk::ExtensionProperties> extensionProperties = vk::enumerateInstanceExtensionProperties(std::string(layerProperty.layerName));
propertyData.push_back(PropertyData(layerProperty, extensionProperties));
std::vector<vk::ExtensionProperties> extensionProperties =
vk::enumerateInstanceExtensionProperties( std::string( layerProperty.layerName ) );
propertyData.push_back( PropertyData( layerProperty, extensionProperties ) );
}
/* VULKAN_KEY_END */
std::cout << "Instance Layers:" << std::endl;
if (propertyData.empty())
if ( propertyData.empty() )
{
std::cout << "Set the environment variable VK_LAYER_PATH to point to the location of your layers" << std::endl;
}
else
{
for (auto const& pd : propertyData)
for ( auto const & pd : propertyData )
{
std::cout << pd.layerProperties.layerName << std::endl;
if (pd.extensionProperties.empty())
if ( pd.extensionProperties.empty() )
{
std::cout << "Layer Extension: None";
}
else
{
for (auto it = pd.extensionProperties.begin(); it != pd.extensionProperties.end(); ++it)
for ( auto it = pd.extensionProperties.begin(); it != pd.extensionProperties.end(); ++it )
{
if (it != pd.extensionProperties.begin())
if ( it != pd.extensionProperties.begin() )
{
std::cout << ", ";
}
@@ -83,20 +85,20 @@ int main(int /*argc*/, char ** /*argv*/)
}
std::cout << std::endl;
}
catch (vk::SystemError& err)
catch ( vk::SystemError & err )
{
std::cout << "vk::SystemError: " << err.what() << std::endl;
exit(-1);
exit( -1 );
}
catch (std::runtime_error& err)
catch ( std::runtime_error & err )
{
std::cout << "std::runtime_error: " << err.what() << std::endl;
exit(-1);
exit( -1 );
}
catch (...)
catch ( ... )
{
std::cout << "unknown error\n";
exit(-1);
exit( -1 );
}
return 0;
}