Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce number of included headers #1366

Merged
merged 1 commit into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 ( ( 20 <= VULKAN_HPP_CPP_VERSION ) && __has_include( <format> ) )
return std::format( "{:x}", value );
#else
std::stringstream stream;
stream << std::hex << value;
return stream.str();
#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
1 change: 1 addition & 0 deletions samples/utils/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <iostream>
#include <limits>
#include <map>
#include <memory> // std::unique_ptr

namespace vk
{
Expand Down
Loading