mirror of
https://github.com/KhronosGroup/Vulkan-Hpp
synced 2024-11-23 12:40:05 +00:00
Merge pull request #1276 from asuessenbach/allocator
Add missing allocator template argument in createResultValue helper functions working on std::vector<UniqueHandle> types.
This commit is contained in:
commit
23e13c1a9a
@ -16875,14 +16875,14 @@ extern "C" __declspec( dllimport ) FARPROC __stdcall GetProcAddress( HINSTANCE h
|
||||
return ResultValue<UniqueHandle<T, D>>( result, UniqueHandle<T, D>( data, deleter ) );
|
||||
}
|
||||
|
||||
template <typename T, typename D>
|
||||
VULKAN_HPP_INLINE typename ResultValueType<std::vector<UniqueHandle<T, D>>>::type
|
||||
createResultValue( Result result, std::vector<UniqueHandle<T, D>> && data, char const * message )
|
||||
template <typename T, typename D, typename Allocator = std::allocator<UniqueHandle<T, D>>>
|
||||
VULKAN_HPP_INLINE typename ResultValueType<std::vector<UniqueHandle<T, D>, Allocator>>::type
|
||||
createResultValue( Result result, std::vector<UniqueHandle<T, D>, Allocator> && data, char const * message )
|
||||
{
|
||||
# ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||
ignore( message );
|
||||
VULKAN_HPP_ASSERT_ON_RESULT( result == Result::eSuccess );
|
||||
return ResultValue<std::vector<UniqueHandle<T, D>>>( result, std::move( data ) );
|
||||
return ResultValue<std::vector<UniqueHandle<T, D>, Allocator>>( result, std::move( data ) );
|
||||
# else
|
||||
if ( result != Result::eSuccess )
|
||||
{
|
||||
@ -16892,16 +16892,13 @@ extern "C" __declspec( dllimport ) FARPROC __stdcall GetProcAddress( HINSTANCE h
|
||||
# endif
|
||||
}
|
||||
|
||||
template <typename T, typename D>
|
||||
VULKAN_HPP_INLINE ResultValue<std::vector<UniqueHandle<T, D>>>
|
||||
createResultValue( Result result,
|
||||
std::vector<UniqueHandle<T, D>> && data,
|
||||
char const * message,
|
||||
std::initializer_list<Result> successCodes )
|
||||
template <typename T, typename D, typename Allocator = std::allocator<UniqueHandle<T, D>>>
|
||||
VULKAN_HPP_INLINE ResultValue<std::vector<UniqueHandle<T, D>, Allocator>>
|
||||
createResultValue( Result result, std::vector<UniqueHandle<T, D>, Allocator> && data, char const * message, std::initializer_list<Result> successCodes )
|
||||
{
|
||||
# ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||
ignore( message );
|
||||
ignore(successCodes); // just in case VULKAN_HPP_ASSERT_ON_RESULT is empty
|
||||
ignore( successCodes ); // just in case VULKAN_HPP_ASSERT_ON_RESULT is empty
|
||||
VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
|
||||
# else
|
||||
if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() )
|
||||
@ -16909,7 +16906,7 @@ extern "C" __declspec( dllimport ) FARPROC __stdcall GetProcAddress( HINSTANCE h
|
||||
throwResultException( result, message );
|
||||
}
|
||||
# endif
|
||||
return ResultValue<std::vector<UniqueHandle<T, D>>>( result, std::move( data ) );
|
||||
return ResultValue<std::vector<UniqueHandle<T, D>, Allocator>>( result, std::move( data ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -16984,16 +16981,8 @@ extern "C" __declspec( dllimport ) FARPROC __stdcall GetProcAddress( HINSTANCE h
|
||||
|
||||
std::string filename = ( argc == 1 ) ? VK_SPEC : argv[1];
|
||||
|
||||
std::cout << "VulkanHppGenerator: Loading " << filename << std::endl;
|
||||
tinyxml2::XMLError error = doc.LoadFile( filename.c_str() );
|
||||
if ( error != tinyxml2::XML_SUCCESS )
|
||||
{
|
||||
std::cout << "VulkanHppGenerator: failed to load file " << filename << " with error <" << toString( error ) << ">" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if defined( CLANG_FORMAT_EXECUTABLE )
|
||||
std::cout << "VulkanHppGenerator: Formatting using ";
|
||||
std::cout << "VulkanHppGenerator: Found ";
|
||||
std::string commandString = "\"" CLANG_FORMAT_EXECUTABLE "\" --version ";
|
||||
int ret = std::system( commandString.c_str() );
|
||||
if ( ret != 0 )
|
||||
@ -17002,6 +16991,14 @@ extern "C" __declspec( dllimport ) FARPROC __stdcall GetProcAddress( HINSTANCE h
|
||||
}
|
||||
#endif
|
||||
|
||||
std::cout << "VulkanHppGenerator: Loading " << filename << std::endl;
|
||||
tinyxml2::XMLError error = doc.LoadFile( filename.c_str() );
|
||||
if ( error != tinyxml2::XML_SUCCESS )
|
||||
{
|
||||
std::cout << "VulkanHppGenerator: failed to load file " << filename << " with error <" << toString( error ) << ">" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::cout << "VulkanHppGenerator: Parsing " << filename << std::endl;
|
||||
VulkanHppGenerator generator( doc );
|
||||
|
||||
|
@ -25,6 +25,11 @@
|
||||
static std::string AppName = "UniqueHandle";
|
||||
static std::string EngineName = "Vulkan.hpp";
|
||||
|
||||
template <typename T>
|
||||
class MyAllocator : public std::allocator<T>
|
||||
{
|
||||
};
|
||||
|
||||
vk::UniqueDescriptorSetLayout createDescriptorSetLayoutUnique( vk::Device const & device,
|
||||
std::vector<std::tuple<vk::DescriptorType, uint32_t, vk::ShaderStageFlags>> const & bindingData,
|
||||
vk::DescriptorSetLayoutCreateFlags flags = {} )
|
||||
@ -260,6 +265,13 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
// create a GraphicsPipeline
|
||||
vk::UniquePipeline graphicsPipeline = device->createGraphicsPipelineUnique( *pipelineCache, graphicsPipelineCreateInfo ).value;
|
||||
|
||||
vk::UniquePipeline graphicsPipeline2 =
|
||||
std::move( device->createGraphicsPipelinesUnique<vk::DispatchLoaderDynamic, MyAllocator<vk::UniquePipeline>>( *pipelineCache, graphicsPipelineCreateInfo )
|
||||
.value[0] );
|
||||
|
||||
vk::UniquePipeline graphicsPipeline3 =
|
||||
std::move( device->createGraphicsPipelinesUnique<vk::DispatchLoaderDynamic>( *pipelineCache, graphicsPipelineCreateInfo ).value[0] );
|
||||
|
||||
// destroy the non-Unique surface used here
|
||||
instance->destroySurfaceKHR( surfaceData.surface );
|
||||
}
|
||||
|
@ -6034,14 +6034,14 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
return ResultValue<UniqueHandle<T, D>>( result, UniqueHandle<T, D>( data, deleter ) );
|
||||
}
|
||||
|
||||
template <typename T, typename D>
|
||||
VULKAN_HPP_INLINE typename ResultValueType<std::vector<UniqueHandle<T, D>>>::type
|
||||
createResultValue( Result result, std::vector<UniqueHandle<T, D>> && data, char const * message )
|
||||
template <typename T, typename D, typename Allocator = std::allocator<UniqueHandle<T, D>>>
|
||||
VULKAN_HPP_INLINE typename ResultValueType<std::vector<UniqueHandle<T, D>, Allocator>>::type
|
||||
createResultValue( Result result, std::vector<UniqueHandle<T, D>, Allocator> && data, char const * message )
|
||||
{
|
||||
# ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||
ignore( message );
|
||||
VULKAN_HPP_ASSERT_ON_RESULT( result == Result::eSuccess );
|
||||
return ResultValue<std::vector<UniqueHandle<T, D>>>( result, std::move( data ) );
|
||||
return ResultValue<std::vector<UniqueHandle<T, D>, Allocator>>( result, std::move( data ) );
|
||||
# else
|
||||
if ( result != Result::eSuccess )
|
||||
{
|
||||
@ -6051,9 +6051,9 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
# endif
|
||||
}
|
||||
|
||||
template <typename T, typename D>
|
||||
VULKAN_HPP_INLINE ResultValue<std::vector<UniqueHandle<T, D>>>
|
||||
createResultValue( Result result, std::vector<UniqueHandle<T, D>> && data, char const * message, std::initializer_list<Result> successCodes )
|
||||
template <typename T, typename D, typename Allocator = std::allocator<UniqueHandle<T, D>>>
|
||||
VULKAN_HPP_INLINE ResultValue<std::vector<UniqueHandle<T, D>, Allocator>>
|
||||
createResultValue( Result result, std::vector<UniqueHandle<T, D>, Allocator> && data, char const * message, std::initializer_list<Result> successCodes )
|
||||
{
|
||||
# ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||
ignore( message );
|
||||
@ -6065,7 +6065,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
throwResultException( result, message );
|
||||
}
|
||||
# endif
|
||||
return ResultValue<std::vector<UniqueHandle<T, D>>>( result, std::move( data ) );
|
||||
return ResultValue<std::vector<UniqueHandle<T, D>, Allocator>>( result, std::move( data ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user