Provide default arguments in ObjectFree constructor for allocationCallbacks and dispatcher.

This commit is contained in:
asuessenbach 2020-06-18 11:00:22 +02:00
parent 5bee99f228
commit 92bc17981b
3 changed files with 38 additions and 26 deletions

View File

@ -7306,20 +7306,25 @@ int main( int argc, char ** argv )
class ObjectFree
{
public:
ObjectFree()
: m_owner()
, m_allocationCallbacks( nullptr )
, m_dispatch( nullptr )
{}
ObjectFree() : m_owner(), m_allocationCallbacks( nullptr ), m_dispatch( nullptr ) {}
ObjectFree( OwnerType owner, Optional<const AllocationCallbacks> allocationCallbacks, Dispatch const &dispatch ) VULKAN_HPP_NOEXCEPT
ObjectFree( OwnerType owner,
Optional<const AllocationCallbacks> allocationCallbacks = nullptr,
Dispatch const & dispatch = VULKAN_HPP_DEFAULT_DISPATCHER ) VULKAN_HPP_NOEXCEPT
: m_owner( owner )
, m_allocationCallbacks( allocationCallbacks )
, m_dispatch( &dispatch )
{}
OwnerType getOwner() const VULKAN_HPP_NOEXCEPT { return m_owner; }
Optional<const AllocationCallbacks> getAllocator() const VULKAN_HPP_NOEXCEPT { return m_allocationCallbacks; }
OwnerType getOwner() const VULKAN_HPP_NOEXCEPT
{
return m_owner;
}
Optional<const AllocationCallbacks> getAllocator() const VULKAN_HPP_NOEXCEPT
{
return m_allocationCallbacks;
}
protected:
template <typename T>

View File

@ -61,6 +61,12 @@ int main( int /*argc*/, char ** /*argv*/ )
std::vector<vk::UniqueHandle<vk::CommandBuffer, vk::DispatchLoaderDynamic>>::allocator_type dynamicVectorAllocator;
vk::UniqueHandle<vk::CommandBuffer, vk::DispatchLoaderDynamic> dynamicCommandBuffer = std::move(
device->allocateCommandBuffersUnique( {}, dynamicVectorAllocator, vk::DispatchLoaderDynamic() ).front() );
vk::Buffer buffer = device->createBuffer( {} );
vk::UniqueBuffer uniqueBuffer = vk::UniqueBuffer( buffer, *device );
vk::DeviceMemory deviceMemory = device->allocateMemory( {} );
vk::UniqueDeviceMemory uniqueDeviceMemory = vk::UniqueDeviceMemory( deviceMemory, *device );
}
catch ( vk::SystemError const & err )
{

View File

@ -4615,8 +4615,8 @@ namespace VULKAN_HPP_NAMESPACE
ObjectFree() : m_owner(), m_allocationCallbacks( nullptr ), m_dispatch( nullptr ) {}
ObjectFree( OwnerType owner,
Optional<const AllocationCallbacks> allocationCallbacks,
Dispatch const & dispatch ) VULKAN_HPP_NOEXCEPT
Optional<const AllocationCallbacks> allocationCallbacks = nullptr,
Dispatch const & dispatch = VULKAN_HPP_DEFAULT_DISPATCHER ) VULKAN_HPP_NOEXCEPT
: m_owner( owner )
, m_allocationCallbacks( allocationCallbacks )
, m_dispatch( &dispatch )
@ -4626,6 +4626,7 @@ namespace VULKAN_HPP_NAMESPACE
{
return m_owner;
}
Optional<const AllocationCallbacks> getAllocator() const VULKAN_HPP_NOEXCEPT
{
return m_allocationCallbacks;