mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Merge pull request #638 from asuessenbach/ObjectFree
Provide default arguments in ObjectFree constructor for allocationCallbacks and dispatcher.
This commit is contained in:
commit
328e33dcdc
@ -7305,34 +7305,39 @@ int main( int argc, char ** argv )
|
|||||||
template <typename OwnerType, typename Dispatch>
|
template <typename OwnerType, typename Dispatch>
|
||||||
class ObjectFree
|
class ObjectFree
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ObjectFree()
|
ObjectFree() : m_owner(), m_allocationCallbacks( nullptr ), m_dispatch( nullptr ) {}
|
||||||
: m_owner()
|
|
||||||
, m_allocationCallbacks( nullptr )
|
|
||||||
, m_dispatch( nullptr )
|
|
||||||
{}
|
|
||||||
|
|
||||||
ObjectFree( OwnerType owner, Optional<const AllocationCallbacks> allocationCallbacks, Dispatch const &dispatch ) VULKAN_HPP_NOEXCEPT
|
ObjectFree( OwnerType owner,
|
||||||
: m_owner( owner )
|
Optional<const AllocationCallbacks> allocationCallbacks = nullptr,
|
||||||
, m_allocationCallbacks( allocationCallbacks )
|
Dispatch const & dispatch = VULKAN_HPP_DEFAULT_DISPATCHER ) VULKAN_HPP_NOEXCEPT
|
||||||
, m_dispatch( &dispatch )
|
: m_owner( owner )
|
||||||
{}
|
, m_allocationCallbacks( allocationCallbacks )
|
||||||
|
, m_dispatch( &dispatch )
|
||||||
|
{}
|
||||||
|
|
||||||
OwnerType getOwner() const VULKAN_HPP_NOEXCEPT { return m_owner; }
|
OwnerType getOwner() const VULKAN_HPP_NOEXCEPT
|
||||||
Optional<const AllocationCallbacks> getAllocator() const VULKAN_HPP_NOEXCEPT { return m_allocationCallbacks; }
|
{
|
||||||
|
return m_owner;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
Optional<const AllocationCallbacks> getAllocator() const VULKAN_HPP_NOEXCEPT
|
||||||
template <typename T>
|
{
|
||||||
void destroy(T t) VULKAN_HPP_NOEXCEPT
|
return m_allocationCallbacks;
|
||||||
{
|
}
|
||||||
VULKAN_HPP_ASSERT( m_owner && m_dispatch );
|
|
||||||
m_owner.free( t, m_allocationCallbacks, *m_dispatch );
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
OwnerType m_owner;
|
template <typename T>
|
||||||
Optional<const AllocationCallbacks> m_allocationCallbacks;
|
void destroy( T t ) VULKAN_HPP_NOEXCEPT
|
||||||
Dispatch const* m_dispatch;
|
{
|
||||||
|
VULKAN_HPP_ASSERT( m_owner && m_dispatch );
|
||||||
|
m_owner.free( t, m_allocationCallbacks, *m_dispatch );
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
OwnerType m_owner;
|
||||||
|
Optional<const AllocationCallbacks> m_allocationCallbacks;
|
||||||
|
Dispatch const * m_dispatch;
|
||||||
};
|
};
|
||||||
)";
|
)";
|
||||||
|
|
||||||
|
@ -61,6 +61,12 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
std::vector<vk::UniqueHandle<vk::CommandBuffer, vk::DispatchLoaderDynamic>>::allocator_type dynamicVectorAllocator;
|
std::vector<vk::UniqueHandle<vk::CommandBuffer, vk::DispatchLoaderDynamic>>::allocator_type dynamicVectorAllocator;
|
||||||
vk::UniqueHandle<vk::CommandBuffer, vk::DispatchLoaderDynamic> dynamicCommandBuffer = std::move(
|
vk::UniqueHandle<vk::CommandBuffer, vk::DispatchLoaderDynamic> dynamicCommandBuffer = std::move(
|
||||||
device->allocateCommandBuffersUnique( {}, dynamicVectorAllocator, vk::DispatchLoaderDynamic() ).front() );
|
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 )
|
catch ( vk::SystemError const & err )
|
||||||
{
|
{
|
||||||
|
@ -4615,8 +4615,8 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
ObjectFree() : m_owner(), m_allocationCallbacks( nullptr ), m_dispatch( nullptr ) {}
|
ObjectFree() : m_owner(), m_allocationCallbacks( nullptr ), m_dispatch( nullptr ) {}
|
||||||
|
|
||||||
ObjectFree( OwnerType owner,
|
ObjectFree( OwnerType owner,
|
||||||
Optional<const AllocationCallbacks> allocationCallbacks,
|
Optional<const AllocationCallbacks> allocationCallbacks = nullptr,
|
||||||
Dispatch const & dispatch ) VULKAN_HPP_NOEXCEPT
|
Dispatch const & dispatch = VULKAN_HPP_DEFAULT_DISPATCHER ) VULKAN_HPP_NOEXCEPT
|
||||||
: m_owner( owner )
|
: m_owner( owner )
|
||||||
, m_allocationCallbacks( allocationCallbacks )
|
, m_allocationCallbacks( allocationCallbacks )
|
||||||
, m_dispatch( &dispatch )
|
, m_dispatch( &dispatch )
|
||||||
@ -4626,6 +4626,7 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
{
|
{
|
||||||
return m_owner;
|
return m_owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<const AllocationCallbacks> getAllocator() const VULKAN_HPP_NOEXCEPT
|
Optional<const AllocationCallbacks> getAllocator() const VULKAN_HPP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return m_allocationCallbacks;
|
return m_allocationCallbacks;
|
||||||
|
Loading…
Reference in New Issue
Block a user