Skip to content

Commit

Permalink
Reduce number of included headers
Browse files Browse the repository at this point in the history
  • Loading branch information
asuessenbach committed Jul 27, 2022
1 parent fa62e68 commit b3348f0
Show file tree
Hide file tree
Showing 4 changed files with 489 additions and 466 deletions.
55 changes: 31 additions & 24 deletions VulkanHppGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,13 @@ std::string VulkanHppGenerator::generateEnumsToString() const

VULKAN_HPP_INLINE std::string toHexString( uint32_t value )
{
#if ( VULKAN_HPP_CPP_VERSION < 20 )
std::stringstream stream;
stream << std::hex << value;
return stream.str();
#else
return std::format( "{:x}", value );
#endif
}

${enumsToString}
Expand Down Expand Up @@ -13377,7 +13381,6 @@ std::string toString( tinyxml2::XMLError error )
int main( int argc, char ** argv )
{
static const std::string classArrayProxy = R"(
#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
template <typename T>
class ArrayProxy
{
Expand Down Expand Up @@ -13664,7 +13667,6 @@ int main( int argc, char ** argv )
uint32_t m_count;
T * m_ptr;
};
#endif
)";

static const std::string classArrayWrapper = R"(
Expand Down Expand Up @@ -14592,8 +14594,7 @@ int main( int argc, char ** argv )
uniqueToRaw( std::vector<UniqueType> const & handles )
{
std::vector<typename UniqueType::element_type> newBuffer( handles.size() );
std::transform(
handles.begin(), handles.end(), newBuffer.begin(), []( UniqueType const & handle ) { return handle.get(); } );
std::transform( handles.begin(), handles.end(), newBuffer.begin(), []( UniqueType const & handle ) { return handle.get(); } );
return newBuffer;
}

Expand Down Expand Up @@ -15010,31 +15011,28 @@ int main( int argc, char ** argv )
# error "vulkan.hpp needs at least c++ standard version 11"
#endif

#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <functional>
#include <initializer_list>
#include <sstream>
#include <string>
#include <system_error>
#include <tuple>
#include <type_traits>
#include <utility>
#include <array> // ArrayWrapperND
#include <string> // std::string
#include <vulkan/vulkan.h>
#if 17 <= VULKAN_HPP_CPP_VERSION
# include <string_view>
# include <string_view> // std::string_view
#endif

#if defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
# if !defined( VULKAN_HPP_NO_SMART_HANDLE )
# define VULKAN_HPP_NO_SMART_HANDLE
# endif
#else
# include <memory>
# include <vector>
# include <tuple> // std::tie
# include <vector> // std::vector
#endif

#if !defined( VULKAN_HPP_NO_EXCEPTIONS )
# include <system_error> // std::is_error_code_enum
#endif

#if !defined( VULKAN_HPP_NO_SMART_HANDLE )
# include <algorithm> // std::transform
#endif

#if defined( VULKAN_HPP_NO_CONSTRUCTORS )
Expand Down Expand Up @@ -15366,6 +15364,8 @@ namespace VULKAN_HPP_NAMESPACE
#ifndef VULKAN_STRUCTS_HPP
# define VULKAN_STRUCTS_HPP

#include <cstring> // strcmp

namespace VULKAN_HPP_NAMESPACE
{
)";
Expand Down Expand Up @@ -15408,12 +15408,13 @@ namespace VULKAN_HPP_NAMESPACE
"# define VULKAN_HPP_TYPESAFE_CONVERSION\n"
"# endif\n"
"#endif\n";
str += defines + "\n" + "namespace VULKAN_HPP_NAMESPACE\n" + "{" + classArrayProxy + classArrayWrapper + classFlags + classOptional + classStructureChain +
classUniqueHandle;
str += defines + "\n" + "namespace VULKAN_HPP_NAMESPACE\n" + "{" + classArrayWrapper + classFlags + "#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )\n" +
classArrayProxy + classOptional + classStructureChain + classUniqueHandle + "#endif // VULKAN_HPP_DISABLE_ENHANCED_MODE\n";
str += dispatchLoaderBase;
str += generator.generateDispatchLoaderStatic();
str += dispatchLoaderDefault;
str += classObjectDestroy + classObjectFree + classObjectRelease + classPoolFree + "\n";
str += "#if !defined( VULKAN_HPP_NO_SMART_HANDLE )\n" + classObjectDestroy + classObjectFree + classObjectRelease + classPoolFree + "\n" +
"#endif // !VULKAN_HPP_NO_SMART_HANDLE\n";
str += generator.generateBaseTypes();
str += R"(} // namespace VULKAN_HPP_NAMESPACE

Expand Down Expand Up @@ -15450,7 +15451,7 @@ namespace VULKAN_HPP_NAMESPACE
namespace VULKAN_HPP_NAMESPACE
{
)";
str += generator.generateStructExtendsStructs();
str += "#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )\n" + generator.generateStructExtendsStructs() + "#endif // VULKAN_HPP_DISABLE_ENHANCED_MODE\n";
str += dynamicLoader;
str += generator.generateDispatchLoaderDynamic();
str +=
Expand Down Expand Up @@ -15501,6 +15502,12 @@ namespace std

#include <vulkan/vulkan_enums.hpp>

#if ( ( 20 <= VULKAN_HPP_CPP_VERSION ) && __has_include( <format> ) )
# include <format> // std::format
#else
# include <sstream> // std::stringstream
#endif

namespace VULKAN_HPP_NAMESPACE
{
)";
Expand Down
Loading

0 comments on commit b3348f0

Please sign in to comment.