| 1 |
// Copyright 2015-2026 The Khronos Group Inc. |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: Apache-2.0 OR MIT |
| 4 |
// |
| 5 |
|
| 6 |
// This header is generated from the Khronos Vulkan XML API Registry. |
| 7 |
|
| 8 |
#ifndef VULKAN_SHARED_HPP |
| 9 |
#define VULKAN_SHARED_HPP |
| 10 |
|
| 11 |
#include <vulkan/vulkan.hpp> |
| 12 |
|
| 13 |
#if !defined( VULKAN_HPP_CXX_MODULE ) |
| 14 |
# include <atomic> // std::atomic_size_t |
| 15 |
#endif |
| 16 |
|
| 17 |
namespace VULKAN_HPP_NAMESPACE |
| 18 |
{ |
| 19 |
#if !defined( VULKAN_HPP_NO_SMART_HANDLE ) |
| 20 |
template <typename HandleType> |
| 21 |
class SharedHandleTraits; |
| 22 |
|
| 23 |
class NoDestructor |
| 24 |
{ |
| 25 |
}; |
| 26 |
|
| 27 |
template <typename HandleType, typename = void> |
| 28 |
struct HasDestructorType : std::false_type |
| 29 |
{ |
| 30 |
}; |
| 31 |
|
| 32 |
template <typename HandleType> |
| 33 |
struct HasDestructorType<HandleType, decltype( (void)typename SharedHandleTraits<HandleType>::DestructorType() )> : std::true_type |
| 34 |
{ |
| 35 |
}; |
| 36 |
|
| 37 |
template <typename HandleType, typename Enable = void> |
| 38 |
struct GetDestructorType |
| 39 |
{ |
| 40 |
using type = NoDestructor; |
| 41 |
}; |
| 42 |
|
| 43 |
template <typename HandleType> |
| 44 |
struct GetDestructorType<HandleType, typename std::enable_if<HasDestructorType<HandleType>::value>::type> |
| 45 |
{ |
| 46 |
using type = typename SharedHandleTraits<HandleType>::DestructorType; |
| 47 |
}; |
| 48 |
|
| 49 |
template <class HandleType> |
| 50 |
using DestructorTypeOf = typename GetDestructorType<HandleType>::type; |
| 51 |
|
| 52 |
template <class HandleType> |
| 53 |
struct HasDestructor : std::integral_constant<bool, !std::is_same<DestructorTypeOf<HandleType>, NoDestructor>::value> |
| 54 |
{ |
| 55 |
}; |
| 56 |
|
| 57 |
template <typename HandleType, typename = void> |
| 58 |
struct HasPoolType : std::false_type |
| 59 |
{ |
| 60 |
}; |
| 61 |
|
| 62 |
template <typename HandleType> |
| 63 |
struct HasPoolType<HandleType, decltype( (void)typename SharedHandleTraits<HandleType>::deleter::PoolTypeExport() )> : std::true_type |
| 64 |
{ |
| 65 |
}; |
| 66 |
|
| 67 |
template <typename HandleType, typename Enable = void> |
| 68 |
struct GetPoolType |
| 69 |
{ |
| 70 |
using type = NoDestructor; |
| 71 |
}; |
| 72 |
|
| 73 |
template <typename HandleType> |
| 74 |
struct GetPoolType<HandleType, typename std::enable_if<HasPoolType<HandleType>::value>::type> |
| 75 |
{ |
| 76 |
using type = typename SharedHandleTraits<HandleType>::deleter::PoolTypeExport; |
| 77 |
}; |
| 78 |
|
| 79 |
//===================================================================================================================== |
| 80 |
|
| 81 |
template <typename HandleType> |
| 82 |
class SharedHandle; |
| 83 |
|
| 84 |
template <typename DestructorType, typename Deleter> |
| 85 |
struct SharedHeader |
| 86 |
{ |
| 87 |
SharedHeader( SharedHandle<DestructorType> parent, Deleter deleter VULKAN_HPP_DEFAULT_ASSIGNMENT( Deleter() ) ) VULKAN_HPP_NOEXCEPT |
| 88 |
: parent( std::move( parent ) ) |
| 89 |
, deleter( std::move( deleter ) ) |
| 90 |
{ |
| 91 |
} |
| 92 |
|
| 93 |
SharedHandle<DestructorType> parent; |
| 94 |
Deleter deleter; |
| 95 |
}; |
| 96 |
|
| 97 |
template <typename Deleter> |
| 98 |
struct SharedHeader<NoDestructor, Deleter> |
| 99 |
{ |
| 100 |
SharedHeader( Deleter deleter VULKAN_HPP_DEFAULT_ASSIGNMENT( Deleter() ) ) VULKAN_HPP_NOEXCEPT : deleter( std::move( deleter ) ) {} |
| 101 |
|
| 102 |
Deleter deleter; |
| 103 |
}; |
| 104 |
|
| 105 |
//===================================================================================================================== |
| 106 |
|
| 107 |
template <typename HeaderType> |
| 108 |
class ReferenceCounter |
| 109 |
{ |
| 110 |
public: |
| 111 |
template <typename... Args> |
| 112 |
ReferenceCounter( Args &&... control_args ) : m_header( std::forward<Args>( control_args )... ) |
| 113 |
{ |
| 114 |
} |
| 115 |
|
| 116 |
ReferenceCounter( const ReferenceCounter & ) = delete; |
| 117 |
ReferenceCounter & operator=( const ReferenceCounter & ) = delete; |
| 118 |
|
| 119 |
public: |
| 120 |
size_t addRef() VULKAN_HPP_NOEXCEPT |
| 121 |
{ |
| 122 |
// Relaxed memory order is sufficient since this does not impose any ordering on other operations |
| 123 |
return m_ref_cnt.fetch_add( 1, std::memory_order_relaxed ); |
| 124 |
} |
| 125 |
|
| 126 |
size_t release() VULKAN_HPP_NOEXCEPT |
| 127 |
{ |
| 128 |
// A release memory order to ensure that all releases are ordered |
| 129 |
return m_ref_cnt.fetch_sub( 1, std::memory_order_release ); |
| 130 |
} |
| 131 |
|
| 132 |
public: |
| 133 |
std::atomic_size_t m_ref_cnt{ 1 }; |
| 134 |
HeaderType m_header; |
| 135 |
}; |
| 136 |
|
| 137 |
//===================================================================================================================== |
| 138 |
|
| 139 |
template <typename HandleType, typename HeaderType, typename ForwardType = SharedHandle<HandleType>> |
| 140 |
class SharedHandleBase |
| 141 |
{ |
| 142 |
public: |
| 143 |
SharedHandleBase() = default; |
| 144 |
|
| 145 |
template <typename... Args> |
| 146 |
SharedHandleBase( HandleType handle, Args &&... control_args ) |
| 147 |
: m_control( new ReferenceCounter<HeaderType>( std::forward<Args>( control_args )... ) ), m_handle( handle ) |
| 148 |
{ |
| 149 |
} |
| 150 |
|
| 151 |
SharedHandleBase( const SharedHandleBase & o ) VULKAN_HPP_NOEXCEPT |
| 152 |
{ |
| 153 |
o.addRef(); |
| 154 |
m_handle = o.m_handle; |
| 155 |
m_control = o.m_control; |
| 156 |
} |
| 157 |
|
| 158 |
SharedHandleBase( SharedHandleBase && o ) VULKAN_HPP_NOEXCEPT |
| 159 |
: m_control( o.m_control ) |
| 160 |
, m_handle( o.m_handle ) |
| 161 |
{ |
| 162 |
o.m_handle = nullptr; |
| 163 |
o.m_control = nullptr; |
| 164 |
} |
| 165 |
|
| 166 |
SharedHandleBase & operator=( const SharedHandleBase & o ) VULKAN_HPP_NOEXCEPT |
| 167 |
{ |
| 168 |
SharedHandleBase( o ).swap( *this ); |
| 169 |
return *this; |
| 170 |
} |
| 171 |
|
| 172 |
SharedHandleBase & operator=( SharedHandleBase && o ) VULKAN_HPP_NOEXCEPT |
| 173 |
{ |
| 174 |
SharedHandleBase( std::move( o ) ).swap( *this ); |
| 175 |
return *this; |
| 176 |
} |
| 177 |
|
| 178 |
~SharedHandleBase() |
| 179 |
{ |
| 180 |
// only this function owns the last reference to the control block |
| 181 |
// the same principle is used in the default deleter of std::shared_ptr |
| 182 |
if ( m_control && ( m_control->release() == 1 ) ) |
| 183 |
{ |
| 184 |
// noop in x86, but does thread synchronization in ARM |
| 185 |
// it is required to ensure that last thread is getting to destroy the control block |
| 186 |
// by ordering all atomic operations before this fence |
| 187 |
std::atomic_thread_fence( std::memory_order_acquire ); |
| 188 |
ForwardType::internalDestroy( getHeader(), m_handle ); |
| 189 |
delete m_control; |
| 190 |
} |
| 191 |
} |
| 192 |
|
| 193 |
public: |
| 194 |
HandleType get() const VULKAN_HPP_NOEXCEPT |
| 195 |
{ |
| 196 |
return m_handle; |
| 197 |
} |
| 198 |
|
| 199 |
HandleType operator*() const VULKAN_HPP_NOEXCEPT |
| 200 |
{ |
| 201 |
return m_handle; |
| 202 |
} |
| 203 |
|
| 204 |
explicit operator bool() const VULKAN_HPP_NOEXCEPT |
| 205 |
{ |
| 206 |
return bool( m_handle ); |
| 207 |
} |
| 208 |
|
| 209 |
# if defined( VULKAN_HPP_SMART_HANDLE_IMPLICIT_CAST ) |
| 210 |
operator HandleType() const VULKAN_HPP_NOEXCEPT |
| 211 |
{ |
| 212 |
return m_handle; |
| 213 |
} |
| 214 |
# endif |
| 215 |
|
| 216 |
const HandleType * operator->() const VULKAN_HPP_NOEXCEPT |
| 217 |
{ |
| 218 |
return &m_handle; |
| 219 |
} |
| 220 |
|
| 221 |
HandleType * operator->() VULKAN_HPP_NOEXCEPT |
| 222 |
{ |
| 223 |
return &m_handle; |
| 224 |
} |
| 225 |
|
| 226 |
void reset() VULKAN_HPP_NOEXCEPT |
| 227 |
{ |
| 228 |
SharedHandleBase().swap( *this ); |
| 229 |
} |
| 230 |
|
| 231 |
void swap( SharedHandleBase & o ) VULKAN_HPP_NOEXCEPT |
| 232 |
{ |
| 233 |
std::swap( m_handle, o.m_handle ); |
| 234 |
std::swap( m_control, o.m_control ); |
| 235 |
} |
| 236 |
|
| 237 |
template <typename T = HandleType> |
| 238 |
typename std::enable_if<HasDestructor<T>::value, const SharedHandle<DestructorTypeOf<HandleType>> &>::type getDestructorType() const VULKAN_HPP_NOEXCEPT |
| 239 |
{ |
| 240 |
return getHeader().parent; |
| 241 |
} |
| 242 |
|
| 243 |
protected: |
| 244 |
template <typename T = HandleType> |
| 245 |
static typename std::enable_if<!HasDestructor<T>::value, void>::type internalDestroy( const HeaderType & control, HandleType handle ) VULKAN_HPP_NOEXCEPT |
| 246 |
{ |
| 247 |
control.deleter.destroy( handle ); |
| 248 |
} |
| 249 |
|
| 250 |
template <typename T = HandleType> |
| 251 |
static typename std::enable_if<HasDestructor<T>::value, void>::type internalDestroy( const HeaderType & control, HandleType handle ) VULKAN_HPP_NOEXCEPT |
| 252 |
{ |
| 253 |
control.deleter.destroy( control.parent.get(), handle ); |
| 254 |
} |
| 255 |
|
| 256 |
const HeaderType & getHeader() const VULKAN_HPP_NOEXCEPT |
| 257 |
{ |
| 258 |
return m_control->m_header; |
| 259 |
} |
| 260 |
|
| 261 |
private: |
| 262 |
void addRef() const VULKAN_HPP_NOEXCEPT |
| 263 |
{ |
| 264 |
if ( m_control ) |
| 265 |
m_control->addRef(); |
| 266 |
} |
| 267 |
|
| 268 |
protected: |
| 269 |
ReferenceCounter<HeaderType> * m_control = nullptr; |
| 270 |
HandleType m_handle{}; |
| 271 |
}; |
| 272 |
|
| 273 |
template <typename HandleType> |
| 274 |
class SharedHandle : public SharedHandleBase<HandleType, SharedHeader<DestructorTypeOf<HandleType>, typename SharedHandleTraits<HandleType>::deleter>> |
| 275 |
{ |
| 276 |
private: |
| 277 |
using BaseType = SharedHandleBase<HandleType, SharedHeader<DestructorTypeOf<HandleType>, typename SharedHandleTraits<HandleType>::deleter>>; |
| 278 |
using DeleterType = typename SharedHandleTraits<HandleType>::deleter; |
| 279 |
friend BaseType; |
| 280 |
|
| 281 |
public: |
| 282 |
SharedHandle() = default; |
| 283 |
|
| 284 |
template <typename T = HandleType, typename = typename std::enable_if<HasDestructor<T>::value && !HasPoolType<T>::value>::type> |
| 285 |
explicit SharedHandle( HandleType handle, |
| 286 |
SharedHandle<DestructorTypeOf<HandleType>> parent, |
| 287 |
DeleterType deleter VULKAN_HPP_DEFAULT_ASSIGNMENT( DeleterType() ) ) VULKAN_HPP_NOEXCEPT |
| 288 |
: BaseType( handle, std::move( parent ), std::move( deleter ) ) |
| 289 |
{ |
| 290 |
} |
| 291 |
|
| 292 |
template <typename Dispatcher = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE, |
| 293 |
typename T = HandleType, |
| 294 |
typename = typename std::enable_if<HasDestructor<T>::value && HasPoolType<T>::value>::type> |
| 295 |
explicit SharedHandle( HandleType handle, |
| 296 |
SharedHandle<DestructorTypeOf<HandleType>> parent, |
| 297 |
SharedHandle<typename GetPoolType<HandleType>::type> pool, |
| 298 |
const Dispatcher & dispatch VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) VULKAN_HPP_NOEXCEPT |
| 299 |
: BaseType( handle, std::move( parent ), DeleterType{ std::move( pool ), dispatch } ) |
| 300 |
{ |
| 301 |
} |
| 302 |
|
| 303 |
template <typename T = HandleType, typename = typename std::enable_if<!HasDestructor<T>::value>::type> |
| 304 |
explicit SharedHandle( HandleType handle, DeleterType deleter VULKAN_HPP_DEFAULT_ASSIGNMENT( DeleterType() ) ) VULKAN_HPP_NOEXCEPT |
| 305 |
: BaseType( handle, std::move( deleter ) ) |
| 306 |
{ |
| 307 |
} |
| 308 |
|
| 309 |
protected: |
| 310 |
using BaseType::internalDestroy; |
| 311 |
}; |
| 312 |
|
| 313 |
namespace detail |
| 314 |
{ |
| 315 |
// Silence the function cast warnings. |
| 316 |
# if defined( __GNUC__ ) && !defined( __clang__ ) && !defined( __INTEL_COMPILER ) |
| 317 |
# pragma GCC diagnostic push |
| 318 |
# pragma GCC diagnostic ignored "-Wcast-function-type" |
| 319 |
# elif defined( __clang__ ) && ( __clang_major__ >= 13 ) && !defined( __INTEL_COMPILER ) |
| 320 |
# pragma clang diagnostic push |
| 321 |
# pragma clang diagnostic ignored "-Wcast-function-type" |
| 322 |
# endif |
| 323 |
|
| 324 |
template <typename HandleType, typename Dispatcher = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> |
| 325 |
class ObjectDestroyShared |
| 326 |
{ |
| 327 |
public: |
| 328 |
using DestructorType = typename SharedHandleTraits<HandleType>::DestructorType; |
| 329 |
|
| 330 |
using DestroyFunctionPointerType = |
| 331 |
typename std::conditional<HasDestructor<HandleType>::value, |
| 332 |
void ( DestructorType::* )( HandleType, const AllocationCallbacks *, const Dispatcher & ) const, |
| 333 |
void ( HandleType::* )( const AllocationCallbacks *, const Dispatcher & ) const>::type; |
| 334 |
|
| 335 |
using SelectorType = typename std::conditional<HasDestructor<HandleType>::value, DestructorType, HandleType>::type; |
| 336 |
|
| 337 |
ObjectDestroyShared( Optional<const AllocationCallbacks> allocationCallbacks VULKAN_HPP_DEFAULT_ASSIGNMENT( nullptr ), |
| 338 |
const Dispatcher & dispatch VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) |
| 339 |
: m_destroy( reinterpret_cast<decltype( m_destroy )>( static_cast<DestroyFunctionPointerType>( &SelectorType::destroy ) ) ) |
| 340 |
, m_dispatch( &dispatch ) |
| 341 |
, m_allocationCallbacks( allocationCallbacks ) |
| 342 |
{ |
| 343 |
} |
| 344 |
|
| 345 |
public: |
| 346 |
template <typename T = HandleType> |
| 347 |
typename std::enable_if<HasDestructor<T>::value, void>::type destroy( DestructorType parent, HandleType handle ) const VULKAN_HPP_NOEXCEPT |
| 348 |
{ |
| 349 |
VULKAN_HPP_ASSERT( m_destroy && m_dispatch ); |
| 350 |
( parent.*m_destroy )( handle, m_allocationCallbacks, *m_dispatch ); |
| 351 |
} |
| 352 |
|
| 353 |
template <typename T = HandleType> |
| 354 |
typename std::enable_if<!HasDestructor<T>::value, void>::type destroy( HandleType handle ) const VULKAN_HPP_NOEXCEPT |
| 355 |
{ |
| 356 |
VULKAN_HPP_ASSERT( m_destroy && m_dispatch ); |
| 357 |
( handle.*m_destroy )( m_allocationCallbacks, *m_dispatch ); |
| 358 |
} |
| 359 |
|
| 360 |
private: |
| 361 |
DestroyFunctionPointerType m_destroy = nullptr; |
| 362 |
const Dispatcher * m_dispatch = nullptr; |
| 363 |
Optional<const AllocationCallbacks> m_allocationCallbacks = nullptr; |
| 364 |
}; |
| 365 |
|
| 366 |
template <typename HandleType, typename Dispatcher = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> |
| 367 |
class ObjectFreeShared |
| 368 |
{ |
| 369 |
public: |
| 370 |
using DestructorType = typename SharedHandleTraits<HandleType>::DestructorType; |
| 371 |
|
| 372 |
using DestroyFunctionPointerType = void ( DestructorType::* )( HandleType, const AllocationCallbacks *, const Dispatcher & ) const; |
| 373 |
|
| 374 |
ObjectFreeShared( Optional<const AllocationCallbacks> allocationCallbacks VULKAN_HPP_DEFAULT_ASSIGNMENT( nullptr ), |
| 375 |
const Dispatcher & dispatch VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) |
| 376 |
: m_destroy( reinterpret_cast<decltype( m_destroy )>( static_cast<DestroyFunctionPointerType>( &DestructorType::free ) ) ) |
| 377 |
, m_dispatch( &dispatch ) |
| 378 |
, m_allocationCallbacks( allocationCallbacks ) |
| 379 |
{ |
| 380 |
} |
| 381 |
|
| 382 |
public: |
| 383 |
void destroy( DestructorType parent, HandleType handle ) const VULKAN_HPP_NOEXCEPT |
| 384 |
{ |
| 385 |
VULKAN_HPP_ASSERT( m_destroy && m_dispatch ); |
| 386 |
( parent.*m_destroy )( handle, m_allocationCallbacks, *m_dispatch ); |
| 387 |
} |
| 388 |
|
| 389 |
private: |
| 390 |
DestroyFunctionPointerType m_destroy = nullptr; |
| 391 |
const Dispatcher * m_dispatch = nullptr; |
| 392 |
Optional<const AllocationCallbacks> m_allocationCallbacks = nullptr; |
| 393 |
}; |
| 394 |
|
| 395 |
template <typename HandleType, typename Dispatcher = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> |
| 396 |
class ObjectReleaseShared |
| 397 |
{ |
| 398 |
public: |
| 399 |
using DestructorType = typename SharedHandleTraits<HandleType>::DestructorType; |
| 400 |
|
| 401 |
using DestroyFunctionPointerType = void ( DestructorType::* )( HandleType, const Dispatcher & ) const; |
| 402 |
|
| 403 |
ObjectReleaseShared( const Dispatcher & dispatch VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) |
| 404 |
: m_destroy( reinterpret_cast<decltype( m_destroy )>( static_cast<DestroyFunctionPointerType>( &DestructorType::release ) ) ), m_dispatch( &dispatch ) |
| 405 |
{ |
| 406 |
} |
| 407 |
|
| 408 |
public: |
| 409 |
void destroy( DestructorType parent, HandleType handle ) const VULKAN_HPP_NOEXCEPT |
| 410 |
{ |
| 411 |
VULKAN_HPP_ASSERT( m_destroy && m_dispatch ); |
| 412 |
( parent.*m_destroy )( handle, *m_dispatch ); |
| 413 |
} |
| 414 |
|
| 415 |
private: |
| 416 |
DestroyFunctionPointerType m_destroy = nullptr; |
| 417 |
const Dispatcher * m_dispatch = nullptr; |
| 418 |
}; |
| 419 |
|
| 420 |
template <typename HandleType, typename PoolType, typename Dispatcher = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> |
| 421 |
class PoolFreeShared |
| 422 |
{ |
| 423 |
public: |
| 424 |
using DestructorType = typename SharedHandleTraits<HandleType>::DestructorType; |
| 425 |
|
| 426 |
using PoolTypeExport = PoolType; |
| 427 |
|
| 428 |
using ReturnType = decltype( std::declval<DestructorType>().free( PoolType(), 0u, nullptr, Dispatcher() ) ); |
| 429 |
|
| 430 |
using DestroyFunctionPointerType = ReturnType ( DestructorType::* )( PoolType, uint32_t, const HandleType *, const Dispatcher & ) const; |
| 431 |
|
| 432 |
PoolFreeShared() = default; |
| 433 |
|
| 434 |
PoolFreeShared( SharedHandle<PoolType> pool, const Dispatcher & dispatch VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) |
| 435 |
: m_destroy( reinterpret_cast<decltype( m_destroy )>( static_cast<DestroyFunctionPointerType>( &DestructorType::free ) ) ) |
| 436 |
, m_dispatch( &dispatch ) |
| 437 |
, m_pool( std::move( pool ) ) |
| 438 |
{ |
| 439 |
} |
| 440 |
|
| 441 |
public: |
| 442 |
void destroy( DestructorType parent, HandleType handle ) const VULKAN_HPP_NOEXCEPT |
| 443 |
{ |
| 444 |
VULKAN_HPP_ASSERT( m_destroy && m_dispatch && m_pool ); |
| 445 |
( parent.*m_destroy )( m_pool.get(), 1u, &handle, *m_dispatch ); |
| 446 |
} |
| 447 |
|
| 448 |
private: |
| 449 |
DestroyFunctionPointerType m_destroy = nullptr; |
| 450 |
const Dispatcher * m_dispatch = nullptr; |
| 451 |
SharedHandle<PoolType> m_pool{}; |
| 452 |
}; |
| 453 |
|
| 454 |
# if defined( __GNUC__ ) && !defined( __clang__ ) && !defined( __INTEL_COMPILER ) |
| 455 |
# pragma GCC diagnostic pop |
| 456 |
# elif defined( __clang__ ) && ( __clang_major__ >= 13 ) && !defined( __INTEL_COMPILER ) |
| 457 |
# pragma clang diagnostic pop |
| 458 |
# endif |
| 459 |
} // namespace detail |
| 460 |
|
| 461 |
//====================== |
| 462 |
//=== SHARED HANDLEs === |
| 463 |
//====================== |
| 464 |
|
| 465 |
//=== VK_VERSION_1_0 === |
| 466 |
template <> |
| 467 |
class SharedHandleTraits<Instance> |
| 468 |
{ |
| 469 |
public: |
| 470 |
using DestructorType = NoDestructor; |
| 471 |
using deleter = detail::ObjectDestroyShared<Instance>; |
| 472 |
}; |
| 473 |
|
| 474 |
using SharedInstance = SharedHandle<Instance>; |
| 475 |
|
| 476 |
template <> |
| 477 |
class SharedHandleTraits<Device> |
| 478 |
{ |
| 479 |
public: |
| 480 |
using DestructorType = NoDestructor; |
| 481 |
using deleter = detail::ObjectDestroyShared<Device>; |
| 482 |
}; |
| 483 |
|
| 484 |
using SharedDevice = SharedHandle<Device>; |
| 485 |
|
| 486 |
template <> |
| 487 |
class SharedHandleTraits<DeviceMemory> |
| 488 |
{ |
| 489 |
public: |
| 490 |
using DestructorType = Device; |
| 491 |
using deleter = detail::ObjectFreeShared<DeviceMemory>; |
| 492 |
}; |
| 493 |
|
| 494 |
using SharedDeviceMemory = SharedHandle<DeviceMemory>; |
| 495 |
|
| 496 |
template <> |
| 497 |
class SharedHandleTraits<Fence> |
| 498 |
{ |
| 499 |
public: |
| 500 |
using DestructorType = Device; |
| 501 |
using deleter = detail::ObjectDestroyShared<Fence>; |
| 502 |
}; |
| 503 |
|
| 504 |
using SharedFence = SharedHandle<Fence>; |
| 505 |
|
| 506 |
template <> |
| 507 |
class SharedHandleTraits<Semaphore> |
| 508 |
{ |
| 509 |
public: |
| 510 |
using DestructorType = Device; |
| 511 |
using deleter = detail::ObjectDestroyShared<Semaphore>; |
| 512 |
}; |
| 513 |
|
| 514 |
using SharedSemaphore = SharedHandle<Semaphore>; |
| 515 |
|
| 516 |
template <> |
| 517 |
class SharedHandleTraits<QueryPool> |
| 518 |
{ |
| 519 |
public: |
| 520 |
using DestructorType = Device; |
| 521 |
using deleter = detail::ObjectDestroyShared<QueryPool>; |
| 522 |
}; |
| 523 |
|
| 524 |
using SharedQueryPool = SharedHandle<QueryPool>; |
| 525 |
|
| 526 |
template <> |
| 527 |
class SharedHandleTraits<Buffer> |
| 528 |
{ |
| 529 |
public: |
| 530 |
using DestructorType = Device; |
| 531 |
using deleter = detail::ObjectDestroyShared<Buffer>; |
| 532 |
}; |
| 533 |
|
| 534 |
using SharedBuffer = SharedHandle<Buffer>; |
| 535 |
|
| 536 |
template <> |
| 537 |
class SharedHandleTraits<Image> |
| 538 |
{ |
| 539 |
public: |
| 540 |
using DestructorType = Device; |
| 541 |
using deleter = detail::ObjectDestroyShared<Image>; |
| 542 |
}; |
| 543 |
|
| 544 |
using SharedImage = SharedHandle<Image>; |
| 545 |
|
| 546 |
template <> |
| 547 |
class SharedHandleTraits<ImageView> |
| 548 |
{ |
| 549 |
public: |
| 550 |
using DestructorType = Device; |
| 551 |
using deleter = detail::ObjectDestroyShared<ImageView>; |
| 552 |
}; |
| 553 |
|
| 554 |
using SharedImageView = SharedHandle<ImageView>; |
| 555 |
|
| 556 |
template <> |
| 557 |
class SharedHandleTraits<CommandPool> |
| 558 |
{ |
| 559 |
public: |
| 560 |
using DestructorType = Device; |
| 561 |
using deleter = detail::ObjectDestroyShared<CommandPool>; |
| 562 |
}; |
| 563 |
|
| 564 |
using SharedCommandPool = SharedHandle<CommandPool>; |
| 565 |
|
| 566 |
template <> |
| 567 |
class SharedHandleTraits<CommandBuffer> |
| 568 |
{ |
| 569 |
public: |
| 570 |
using DestructorType = Device; |
| 571 |
using deleter = detail::PoolFreeShared<CommandBuffer, CommandPool>; |
| 572 |
}; |
| 573 |
|
| 574 |
using SharedCommandBuffer = SharedHandle<CommandBuffer>; |
| 575 |
|
| 576 |
template <> |
| 577 |
class SharedHandleTraits<Event> |
| 578 |
{ |
| 579 |
public: |
| 580 |
using DestructorType = Device; |
| 581 |
using deleter = detail::ObjectDestroyShared<Event>; |
| 582 |
}; |
| 583 |
|
| 584 |
using SharedEvent = SharedHandle<Event>; |
| 585 |
|
| 586 |
template <> |
| 587 |
class SharedHandleTraits<BufferView> |
| 588 |
{ |
| 589 |
public: |
| 590 |
using DestructorType = Device; |
| 591 |
using deleter = detail::ObjectDestroyShared<BufferView>; |
| 592 |
}; |
| 593 |
|
| 594 |
using SharedBufferView = SharedHandle<BufferView>; |
| 595 |
|
| 596 |
template <> |
| 597 |
class SharedHandleTraits<ShaderModule> |
| 598 |
{ |
| 599 |
public: |
| 600 |
using DestructorType = Device; |
| 601 |
using deleter = detail::ObjectDestroyShared<ShaderModule>; |
| 602 |
}; |
| 603 |
|
| 604 |
using SharedShaderModule = SharedHandle<ShaderModule>; |
| 605 |
|
| 606 |
template <> |
| 607 |
class SharedHandleTraits<PipelineCache> |
| 608 |
{ |
| 609 |
public: |
| 610 |
using DestructorType = Device; |
| 611 |
using deleter = detail::ObjectDestroyShared<PipelineCache>; |
| 612 |
}; |
| 613 |
|
| 614 |
using SharedPipelineCache = SharedHandle<PipelineCache>; |
| 615 |
|
| 616 |
template <> |
| 617 |
class SharedHandleTraits<Pipeline> |
| 618 |
{ |
| 619 |
public: |
| 620 |
using DestructorType = Device; |
| 621 |
using deleter = detail::ObjectDestroyShared<Pipeline>; |
| 622 |
}; |
| 623 |
|
| 624 |
using SharedPipeline = SharedHandle<Pipeline>; |
| 625 |
|
| 626 |
template <> |
| 627 |
class SharedHandleTraits<PipelineLayout> |
| 628 |
{ |
| 629 |
public: |
| 630 |
using DestructorType = Device; |
| 631 |
using deleter = detail::ObjectDestroyShared<PipelineLayout>; |
| 632 |
}; |
| 633 |
|
| 634 |
using SharedPipelineLayout = SharedHandle<PipelineLayout>; |
| 635 |
|
| 636 |
template <> |
| 637 |
class SharedHandleTraits<Sampler> |
| 638 |
{ |
| 639 |
public: |
| 640 |
using DestructorType = Device; |
| 641 |
using deleter = detail::ObjectDestroyShared<Sampler>; |
| 642 |
}; |
| 643 |
|
| 644 |
using SharedSampler = SharedHandle<Sampler>; |
| 645 |
|
| 646 |
template <> |
| 647 |
class SharedHandleTraits<DescriptorPool> |
| 648 |
{ |
| 649 |
public: |
| 650 |
using DestructorType = Device; |
| 651 |
using deleter = detail::ObjectDestroyShared<DescriptorPool>; |
| 652 |
}; |
| 653 |
|
| 654 |
using SharedDescriptorPool = SharedHandle<DescriptorPool>; |
| 655 |
|
| 656 |
template <> |
| 657 |
class SharedHandleTraits<DescriptorSet> |
| 658 |
{ |
| 659 |
public: |
| 660 |
using DestructorType = Device; |
| 661 |
using deleter = detail::PoolFreeShared<DescriptorSet, DescriptorPool>; |
| 662 |
}; |
| 663 |
|
| 664 |
using SharedDescriptorSet = SharedHandle<DescriptorSet>; |
| 665 |
|
| 666 |
template <> |
| 667 |
class SharedHandleTraits<DescriptorSetLayout> |
| 668 |
{ |
| 669 |
public: |
| 670 |
using DestructorType = Device; |
| 671 |
using deleter = detail::ObjectDestroyShared<DescriptorSetLayout>; |
| 672 |
}; |
| 673 |
|
| 674 |
using SharedDescriptorSetLayout = SharedHandle<DescriptorSetLayout>; |
| 675 |
|
| 676 |
template <> |
| 677 |
class SharedHandleTraits<Framebuffer> |
| 678 |
{ |
| 679 |
public: |
| 680 |
using DestructorType = Device; |
| 681 |
using deleter = detail::ObjectDestroyShared<Framebuffer>; |
| 682 |
}; |
| 683 |
|
| 684 |
using SharedFramebuffer = SharedHandle<Framebuffer>; |
| 685 |
|
| 686 |
template <> |
| 687 |
class SharedHandleTraits<RenderPass> |
| 688 |
{ |
| 689 |
public: |
| 690 |
using DestructorType = Device; |
| 691 |
using deleter = detail::ObjectDestroyShared<RenderPass>; |
| 692 |
}; |
| 693 |
|
| 694 |
using SharedRenderPass = SharedHandle<RenderPass>; |
| 695 |
|
| 696 |
//=== VK_VERSION_1_1 === |
| 697 |
template <> |
| 698 |
class SharedHandleTraits<DescriptorUpdateTemplate> |
| 699 |
{ |
| 700 |
public: |
| 701 |
using DestructorType = Device; |
| 702 |
using deleter = detail::ObjectDestroyShared<DescriptorUpdateTemplate>; |
| 703 |
}; |
| 704 |
|
| 705 |
using SharedDescriptorUpdateTemplate = SharedHandle<DescriptorUpdateTemplate>; |
| 706 |
using SharedDescriptorUpdateTemplateKHR = SharedHandle<DescriptorUpdateTemplate>; |
| 707 |
|
| 708 |
template <> |
| 709 |
class SharedHandleTraits<SamplerYcbcrConversion> |
| 710 |
{ |
| 711 |
public: |
| 712 |
using DestructorType = Device; |
| 713 |
using deleter = detail::ObjectDestroyShared<SamplerYcbcrConversion>; |
| 714 |
}; |
| 715 |
|
| 716 |
using SharedSamplerYcbcrConversion = SharedHandle<SamplerYcbcrConversion>; |
| 717 |
using SharedSamplerYcbcrConversionKHR = SharedHandle<SamplerYcbcrConversion>; |
| 718 |
|
| 719 |
//=== VK_VERSION_1_3 === |
| 720 |
template <> |
| 721 |
class SharedHandleTraits<PrivateDataSlot> |
| 722 |
{ |
| 723 |
public: |
| 724 |
using DestructorType = Device; |
| 725 |
using deleter = detail::ObjectDestroyShared<PrivateDataSlot>; |
| 726 |
}; |
| 727 |
|
| 728 |
using SharedPrivateDataSlot = SharedHandle<PrivateDataSlot>; |
| 729 |
using SharedPrivateDataSlotEXT = SharedHandle<PrivateDataSlot>; |
| 730 |
|
| 731 |
//=== VK_KHR_surface === |
| 732 |
template <> |
| 733 |
class SharedHandleTraits<SurfaceKHR> |
| 734 |
{ |
| 735 |
public: |
| 736 |
using DestructorType = Instance; |
| 737 |
using deleter = detail::ObjectDestroyShared<SurfaceKHR>; |
| 738 |
}; |
| 739 |
|
| 740 |
using SharedSurfaceKHR = SharedHandle<SurfaceKHR>; |
| 741 |
|
| 742 |
//=== VK_KHR_swapchain === |
| 743 |
template <> |
| 744 |
class SharedHandleTraits<SwapchainKHR> |
| 745 |
{ |
| 746 |
public: |
| 747 |
using DestructorType = Device; |
| 748 |
using deleter = detail::ObjectDestroyShared<SwapchainKHR>; |
| 749 |
}; |
| 750 |
|
| 751 |
using SharedSwapchainKHR = SharedHandle<SwapchainKHR>; |
| 752 |
|
| 753 |
//=== VK_KHR_display === |
| 754 |
template <> |
| 755 |
class SharedHandleTraits<DisplayKHR> |
| 756 |
{ |
| 757 |
public: |
| 758 |
using DestructorType = PhysicalDevice; |
| 759 |
using deleter = detail::ObjectDestroyShared<DisplayKHR>; |
| 760 |
}; |
| 761 |
|
| 762 |
using SharedDisplayKHR = SharedHandle<DisplayKHR>; |
| 763 |
|
| 764 |
//=== VK_EXT_debug_report === |
| 765 |
template <> |
| 766 |
class SharedHandleTraits<DebugReportCallbackEXT> |
| 767 |
{ |
| 768 |
public: |
| 769 |
using DestructorType = Instance; |
| 770 |
using deleter = detail::ObjectDestroyShared<DebugReportCallbackEXT>; |
| 771 |
}; |
| 772 |
|
| 773 |
using SharedDebugReportCallbackEXT = SharedHandle<DebugReportCallbackEXT>; |
| 774 |
|
| 775 |
//=== VK_KHR_video_queue === |
| 776 |
template <> |
| 777 |
class SharedHandleTraits<VideoSessionKHR> |
| 778 |
{ |
| 779 |
public: |
| 780 |
using DestructorType = Device; |
| 781 |
using deleter = detail::ObjectDestroyShared<VideoSessionKHR>; |
| 782 |
}; |
| 783 |
|
| 784 |
using SharedVideoSessionKHR = SharedHandle<VideoSessionKHR>; |
| 785 |
|
| 786 |
template <> |
| 787 |
class SharedHandleTraits<VideoSessionParametersKHR> |
| 788 |
{ |
| 789 |
public: |
| 790 |
using DestructorType = Device; |
| 791 |
using deleter = detail::ObjectDestroyShared<VideoSessionParametersKHR>; |
| 792 |
}; |
| 793 |
|
| 794 |
using SharedVideoSessionParametersKHR = SharedHandle<VideoSessionParametersKHR>; |
| 795 |
|
| 796 |
//=== VK_NVX_binary_import === |
| 797 |
template <> |
| 798 |
class SharedHandleTraits<CuModuleNVX> |
| 799 |
{ |
| 800 |
public: |
| 801 |
using DestructorType = Device; |
| 802 |
using deleter = detail::ObjectDestroyShared<CuModuleNVX>; |
| 803 |
}; |
| 804 |
|
| 805 |
using SharedCuModuleNVX = SharedHandle<CuModuleNVX>; |
| 806 |
|
| 807 |
template <> |
| 808 |
class SharedHandleTraits<CuFunctionNVX> |
| 809 |
{ |
| 810 |
public: |
| 811 |
using DestructorType = Device; |
| 812 |
using deleter = detail::ObjectDestroyShared<CuFunctionNVX>; |
| 813 |
}; |
| 814 |
|
| 815 |
using SharedCuFunctionNVX = SharedHandle<CuFunctionNVX>; |
| 816 |
|
| 817 |
//=== VK_EXT_debug_utils === |
| 818 |
template <> |
| 819 |
class SharedHandleTraits<DebugUtilsMessengerEXT> |
| 820 |
{ |
| 821 |
public: |
| 822 |
using DestructorType = Instance; |
| 823 |
using deleter = detail::ObjectDestroyShared<DebugUtilsMessengerEXT>; |
| 824 |
}; |
| 825 |
|
| 826 |
using SharedDebugUtilsMessengerEXT = SharedHandle<DebugUtilsMessengerEXT>; |
| 827 |
|
| 828 |
//=== VK_EXT_descriptor_heap === |
| 829 |
template <> |
| 830 |
class SharedHandleTraits<TensorARM> |
| 831 |
{ |
| 832 |
public: |
| 833 |
using DestructorType = Device; |
| 834 |
using deleter = detail::ObjectDestroyShared<TensorARM>; |
| 835 |
}; |
| 836 |
|
| 837 |
using SharedTensorARM = SharedHandle<TensorARM>; |
| 838 |
|
| 839 |
//=== VK_KHR_acceleration_structure === |
| 840 |
template <> |
| 841 |
class SharedHandleTraits<AccelerationStructureKHR> |
| 842 |
{ |
| 843 |
public: |
| 844 |
using DestructorType = Device; |
| 845 |
using deleter = detail::ObjectDestroyShared<AccelerationStructureKHR>; |
| 846 |
}; |
| 847 |
|
| 848 |
using SharedAccelerationStructureKHR = SharedHandle<AccelerationStructureKHR>; |
| 849 |
|
| 850 |
//=== VK_EXT_validation_cache === |
| 851 |
template <> |
| 852 |
class SharedHandleTraits<ValidationCacheEXT> |
| 853 |
{ |
| 854 |
public: |
| 855 |
using DestructorType = Device; |
| 856 |
using deleter = detail::ObjectDestroyShared<ValidationCacheEXT>; |
| 857 |
}; |
| 858 |
|
| 859 |
using SharedValidationCacheEXT = SharedHandle<ValidationCacheEXT>; |
| 860 |
|
| 861 |
//=== VK_NV_ray_tracing === |
| 862 |
template <> |
| 863 |
class SharedHandleTraits<AccelerationStructureNV> |
| 864 |
{ |
| 865 |
public: |
| 866 |
using DestructorType = Device; |
| 867 |
using deleter = detail::ObjectDestroyShared<AccelerationStructureNV>; |
| 868 |
}; |
| 869 |
|
| 870 |
using SharedAccelerationStructureNV = SharedHandle<AccelerationStructureNV>; |
| 871 |
|
| 872 |
//=== VK_INTEL_performance_query === |
| 873 |
template <> |
| 874 |
class SharedHandleTraits<PerformanceConfigurationINTEL> |
| 875 |
{ |
| 876 |
public: |
| 877 |
using DestructorType = Device; |
| 878 |
using deleter = detail::ObjectDestroyShared<PerformanceConfigurationINTEL>; |
| 879 |
}; |
| 880 |
|
| 881 |
using SharedPerformanceConfigurationINTEL = SharedHandle<PerformanceConfigurationINTEL>; |
| 882 |
|
| 883 |
//=== VK_KHR_deferred_host_operations === |
| 884 |
template <> |
| 885 |
class SharedHandleTraits<DeferredOperationKHR> |
| 886 |
{ |
| 887 |
public: |
| 888 |
using DestructorType = Device; |
| 889 |
using deleter = detail::ObjectDestroyShared<DeferredOperationKHR>; |
| 890 |
}; |
| 891 |
|
| 892 |
using SharedDeferredOperationKHR = SharedHandle<DeferredOperationKHR>; |
| 893 |
|
| 894 |
//=== VK_NV_device_generated_commands === |
| 895 |
template <> |
| 896 |
class SharedHandleTraits<IndirectCommandsLayoutNV> |
| 897 |
{ |
| 898 |
public: |
| 899 |
using DestructorType = Device; |
| 900 |
using deleter = detail::ObjectDestroyShared<IndirectCommandsLayoutNV>; |
| 901 |
}; |
| 902 |
|
| 903 |
using SharedIndirectCommandsLayoutNV = SharedHandle<IndirectCommandsLayoutNV>; |
| 904 |
|
| 905 |
# if defined( VK_ENABLE_BETA_EXTENSIONS ) |
| 906 |
//=== VK_NV_cuda_kernel_launch === |
| 907 |
template <> |
| 908 |
class SharedHandleTraits<CudaModuleNV> |
| 909 |
{ |
| 910 |
public: |
| 911 |
using DestructorType = Device; |
| 912 |
using deleter = detail::ObjectDestroyShared<CudaModuleNV>; |
| 913 |
}; |
| 914 |
|
| 915 |
using SharedCudaModuleNV = SharedHandle<CudaModuleNV>; |
| 916 |
|
| 917 |
template <> |
| 918 |
class SharedHandleTraits<CudaFunctionNV> |
| 919 |
{ |
| 920 |
public: |
| 921 |
using DestructorType = Device; |
| 922 |
using deleter = detail::ObjectDestroyShared<CudaFunctionNV>; |
| 923 |
}; |
| 924 |
|
| 925 |
using SharedCudaFunctionNV = SharedHandle<CudaFunctionNV>; |
| 926 |
# endif /*VK_ENABLE_BETA_EXTENSIONS*/ |
| 927 |
|
| 928 |
# if defined( VK_USE_PLATFORM_FUCHSIA ) |
| 929 |
//=== VK_FUCHSIA_buffer_collection === |
| 930 |
template <> |
| 931 |
class SharedHandleTraits<BufferCollectionFUCHSIA> |
| 932 |
{ |
| 933 |
public: |
| 934 |
using DestructorType = Device; |
| 935 |
using deleter = detail::ObjectDestroyShared<BufferCollectionFUCHSIA>; |
| 936 |
}; |
| 937 |
|
| 938 |
using SharedBufferCollectionFUCHSIA = SharedHandle<BufferCollectionFUCHSIA>; |
| 939 |
# endif /*VK_USE_PLATFORM_FUCHSIA*/ |
| 940 |
|
| 941 |
//=== VK_EXT_opacity_micromap === |
| 942 |
template <> |
| 943 |
class SharedHandleTraits<MicromapEXT> |
| 944 |
{ |
| 945 |
public: |
| 946 |
using DestructorType = Device; |
| 947 |
using deleter = detail::ObjectDestroyShared<MicromapEXT>; |
| 948 |
}; |
| 949 |
|
| 950 |
using SharedMicromapEXT = SharedHandle<MicromapEXT>; |
| 951 |
|
| 952 |
//=== VK_ARM_tensors === |
| 953 |
template <> |
| 954 |
class SharedHandleTraits<TensorViewARM> |
| 955 |
{ |
| 956 |
public: |
| 957 |
using DestructorType = Device; |
| 958 |
using deleter = detail::ObjectDestroyShared<TensorViewARM>; |
| 959 |
}; |
| 960 |
|
| 961 |
using SharedTensorViewARM = SharedHandle<TensorViewARM>; |
| 962 |
|
| 963 |
//=== VK_NV_optical_flow === |
| 964 |
template <> |
| 965 |
class SharedHandleTraits<OpticalFlowSessionNV> |
| 966 |
{ |
| 967 |
public: |
| 968 |
using DestructorType = Device; |
| 969 |
using deleter = detail::ObjectDestroyShared<OpticalFlowSessionNV>; |
| 970 |
}; |
| 971 |
|
| 972 |
using SharedOpticalFlowSessionNV = SharedHandle<OpticalFlowSessionNV>; |
| 973 |
|
| 974 |
//=== VK_EXT_shader_object === |
| 975 |
template <> |
| 976 |
class SharedHandleTraits<ShaderEXT> |
| 977 |
{ |
| 978 |
public: |
| 979 |
using DestructorType = Device; |
| 980 |
using deleter = detail::ObjectDestroyShared<ShaderEXT>; |
| 981 |
}; |
| 982 |
|
| 983 |
using SharedShaderEXT = SharedHandle<ShaderEXT>; |
| 984 |
|
| 985 |
//=== VK_KHR_pipeline_binary === |
| 986 |
template <> |
| 987 |
class SharedHandleTraits<PipelineBinaryKHR> |
| 988 |
{ |
| 989 |
public: |
| 990 |
using DestructorType = Device; |
| 991 |
using deleter = detail::ObjectDestroyShared<PipelineBinaryKHR>; |
| 992 |
}; |
| 993 |
|
| 994 |
using SharedPipelineBinaryKHR = SharedHandle<PipelineBinaryKHR>; |
| 995 |
|
| 996 |
//=== VK_ARM_data_graph === |
| 997 |
template <> |
| 998 |
class SharedHandleTraits<DataGraphPipelineSessionARM> |
| 999 |
{ |
| 1000 |
public: |
| 1001 |
using DestructorType = Device; |
| 1002 |
using deleter = detail::ObjectDestroyShared<DataGraphPipelineSessionARM>; |
| 1003 |
}; |
| 1004 |
|
| 1005 |
using SharedDataGraphPipelineSessionARM = SharedHandle<DataGraphPipelineSessionARM>; |
| 1006 |
|
| 1007 |
//=== VK_NV_external_compute_queue === |
| 1008 |
template <> |
| 1009 |
class SharedHandleTraits<ExternalComputeQueueNV> |
| 1010 |
{ |
| 1011 |
public: |
| 1012 |
using DestructorType = Device; |
| 1013 |
using deleter = detail::ObjectDestroyShared<ExternalComputeQueueNV>; |
| 1014 |
}; |
| 1015 |
|
| 1016 |
using SharedExternalComputeQueueNV = SharedHandle<ExternalComputeQueueNV>; |
| 1017 |
|
| 1018 |
//=== VK_EXT_device_generated_commands === |
| 1019 |
template <> |
| 1020 |
class SharedHandleTraits<IndirectCommandsLayoutEXT> |
| 1021 |
{ |
| 1022 |
public: |
| 1023 |
using DestructorType = Device; |
| 1024 |
using deleter = detail::ObjectDestroyShared<IndirectCommandsLayoutEXT>; |
| 1025 |
}; |
| 1026 |
|
| 1027 |
using SharedIndirectCommandsLayoutEXT = SharedHandle<IndirectCommandsLayoutEXT>; |
| 1028 |
|
| 1029 |
template <> |
| 1030 |
class SharedHandleTraits<IndirectExecutionSetEXT> |
| 1031 |
{ |
| 1032 |
public: |
| 1033 |
using DestructorType = Device; |
| 1034 |
using deleter = detail::ObjectDestroyShared<IndirectExecutionSetEXT>; |
| 1035 |
}; |
| 1036 |
|
| 1037 |
using SharedIndirectExecutionSetEXT = SharedHandle<IndirectExecutionSetEXT>; |
| 1038 |
|
| 1039 |
// a number of SharedHandle specializations |
| 1040 |
enum class SwapchainOwns |
| 1041 |
{ |
| 1042 |
no, |
| 1043 |
yes, |
| 1044 |
}; |
| 1045 |
|
| 1046 |
struct ImageHeader : SharedHeader<DestructorTypeOf<Image>, typename SharedHandleTraits<Image>::deleter> |
| 1047 |
{ |
| 1048 |
ImageHeader( SharedHandle<DestructorTypeOf<Image>> parent, |
| 1049 |
typename SharedHandleTraits<Image>::deleter deleter VULKAN_HPP_DEFAULT_ASSIGNMENT( typename SharedHandleTraits<Image>::deleter() ), |
| 1050 |
SwapchainOwns swapchainOwned = SwapchainOwns::no ) VULKAN_HPP_NOEXCEPT |
| 1051 |
: SharedHeader<DestructorTypeOf<Image>, typename SharedHandleTraits<Image>::deleter>( std::move( parent ), std::move( deleter ) ) |
| 1052 |
, swapchainOwned( swapchainOwned ) |
| 1053 |
{ |
| 1054 |
} |
| 1055 |
|
| 1056 |
SwapchainOwns swapchainOwned = SwapchainOwns::no; |
| 1057 |
}; |
| 1058 |
|
| 1059 |
template <> |
| 1060 |
class SharedHandle<Image> : public SharedHandleBase<Image, ImageHeader> |
| 1061 |
{ |
| 1062 |
using BaseType = SharedHandleBase<Image, ImageHeader>; |
| 1063 |
using DeleterType = typename SharedHandleTraits<Image>::deleter; |
| 1064 |
friend BaseType; |
| 1065 |
|
| 1066 |
public: |
| 1067 |
SharedHandle() = default; |
| 1068 |
|
| 1069 |
explicit SharedHandle( Image handle, |
| 1070 |
SharedHandle<DestructorTypeOf<Image>> parent, |
| 1071 |
SwapchainOwns swapchain_owned VULKAN_HPP_DEFAULT_ASSIGNMENT( SwapchainOwns::no ), |
| 1072 |
DeleterType deleter VULKAN_HPP_DEFAULT_ASSIGNMENT( DeleterType() ) ) VULKAN_HPP_NOEXCEPT |
| 1073 |
: BaseType( handle, std::move( parent ), std::move( deleter ), swapchain_owned ) |
| 1074 |
{ |
| 1075 |
} |
| 1076 |
|
| 1077 |
protected: |
| 1078 |
static void internalDestroy( const ImageHeader & control, Image handle ) VULKAN_HPP_NOEXCEPT |
| 1079 |
{ |
| 1080 |
if ( control.swapchainOwned == SwapchainOwns::no ) |
| 1081 |
{ |
| 1082 |
control.deleter.destroy( control.parent.get(), handle ); |
| 1083 |
} |
| 1084 |
} |
| 1085 |
}; |
| 1086 |
|
| 1087 |
struct SwapchainHeader |
| 1088 |
{ |
| 1089 |
SwapchainHeader( SharedHandle<SurfaceKHR> surface, |
| 1090 |
SharedHandle<DestructorTypeOf<SwapchainKHR>> parent, |
| 1091 |
typename SharedHandleTraits<SwapchainKHR>::deleter deleter |
| 1092 |
VULKAN_HPP_DEFAULT_ASSIGNMENT( typename SharedHandleTraits<SwapchainKHR>::deleter() ) ) VULKAN_HPP_NOEXCEPT |
| 1093 |
: surface( std::move( surface ) ) |
| 1094 |
, parent( std::move( parent ) ) |
| 1095 |
, deleter( std::move( deleter ) ) |
| 1096 |
{ |
| 1097 |
} |
| 1098 |
|
| 1099 |
SharedHandle<SurfaceKHR> surface; |
| 1100 |
SharedHandle<DestructorTypeOf<SwapchainKHR>> parent; |
| 1101 |
typename SharedHandleTraits<SwapchainKHR>::deleter deleter; |
| 1102 |
}; |
| 1103 |
|
| 1104 |
template <> |
| 1105 |
class SharedHandle<SwapchainKHR> : public SharedHandleBase<SwapchainKHR, SwapchainHeader> |
| 1106 |
{ |
| 1107 |
using BaseType = SharedHandleBase<SwapchainKHR, SwapchainHeader>; |
| 1108 |
using DeleterType = typename SharedHandleTraits<SwapchainKHR>::deleter; |
| 1109 |
friend BaseType; |
| 1110 |
|
| 1111 |
public: |
| 1112 |
SharedHandle() = default; |
| 1113 |
|
| 1114 |
explicit SharedHandle( SwapchainKHR handle, |
| 1115 |
SharedHandle<DestructorTypeOf<SwapchainKHR>> parent, |
| 1116 |
SharedHandle<SurfaceKHR> surface, |
| 1117 |
DeleterType deleter VULKAN_HPP_DEFAULT_ASSIGNMENT( DeleterType() ) ) VULKAN_HPP_NOEXCEPT |
| 1118 |
: BaseType( handle, std::move( surface ), std::move( parent ), std::move( deleter ) ) |
| 1119 |
{ |
| 1120 |
} |
| 1121 |
|
| 1122 |
public: |
| 1123 |
const SharedHandle<SurfaceKHR> & getSurface() const VULKAN_HPP_NOEXCEPT |
| 1124 |
{ |
| 1125 |
return getHeader().surface; |
| 1126 |
} |
| 1127 |
|
| 1128 |
protected: |
| 1129 |
using BaseType::internalDestroy; |
| 1130 |
}; |
| 1131 |
|
| 1132 |
template <typename HandleType, typename DestructorType> |
| 1133 |
class SharedHandleBaseNoDestroy : public SharedHandleBase<HandleType, DestructorType> |
| 1134 |
{ |
| 1135 |
public: |
| 1136 |
using SharedHandleBase<HandleType, DestructorType>::SharedHandleBase; |
| 1137 |
|
| 1138 |
const DestructorType & getDestructorType() const VULKAN_HPP_NOEXCEPT |
| 1139 |
{ |
| 1140 |
return SharedHandleBase<HandleType, DestructorType>::getHeader(); |
| 1141 |
} |
| 1142 |
|
| 1143 |
protected: |
| 1144 |
static void internalDestroy( const DestructorType &, HandleType ) VULKAN_HPP_NOEXCEPT {} |
| 1145 |
}; |
| 1146 |
|
| 1147 |
//=== VK_VERSION_1_0 === |
| 1148 |
|
| 1149 |
template <> |
| 1150 |
class SharedHandle<PhysicalDevice> : public SharedHandleBaseNoDestroy<PhysicalDevice, SharedInstance> |
| 1151 |
{ |
| 1152 |
friend SharedHandleBase<PhysicalDevice, SharedInstance>; |
| 1153 |
|
| 1154 |
public: |
| 1155 |
SharedHandle() = default; |
| 1156 |
|
| 1157 |
explicit SharedHandle( PhysicalDevice handle, SharedInstance parent ) noexcept |
| 1158 |
: SharedHandleBaseNoDestroy<PhysicalDevice, SharedInstance>( handle, std::move( parent ) ) |
| 1159 |
{ |
| 1160 |
} |
| 1161 |
}; |
| 1162 |
|
| 1163 |
using SharedPhysicalDevice = SharedHandle<PhysicalDevice>; |
| 1164 |
|
| 1165 |
template <> |
| 1166 |
class SharedHandle<Queue> : public SharedHandleBaseNoDestroy<Queue, SharedDevice> |
| 1167 |
{ |
| 1168 |
friend SharedHandleBase<Queue, SharedDevice>; |
| 1169 |
|
| 1170 |
public: |
| 1171 |
SharedHandle() = default; |
| 1172 |
|
| 1173 |
explicit SharedHandle( Queue handle, SharedDevice parent ) noexcept : SharedHandleBaseNoDestroy<Queue, SharedDevice>( handle, std::move( parent ) ) {} |
| 1174 |
}; |
| 1175 |
|
| 1176 |
using SharedQueue = SharedHandle<Queue>; |
| 1177 |
|
| 1178 |
//=== VK_KHR_display === |
| 1179 |
|
| 1180 |
template <> |
| 1181 |
class SharedHandle<DisplayModeKHR> : public SharedHandleBaseNoDestroy<DisplayModeKHR, SharedDisplayKHR> |
| 1182 |
{ |
| 1183 |
friend SharedHandleBase<DisplayModeKHR, SharedDisplayKHR>; |
| 1184 |
|
| 1185 |
public: |
| 1186 |
SharedHandle() = default; |
| 1187 |
|
| 1188 |
explicit SharedHandle( DisplayModeKHR handle, SharedDisplayKHR parent ) noexcept |
| 1189 |
: SharedHandleBaseNoDestroy<DisplayModeKHR, SharedDisplayKHR>( handle, std::move( parent ) ) |
| 1190 |
{ |
| 1191 |
} |
| 1192 |
}; |
| 1193 |
|
| 1194 |
using SharedDisplayModeKHR = SharedHandle<DisplayModeKHR>; |
| 1195 |
#endif // !VULKAN_HPP_NO_SMART_HANDLE |
| 1196 |
} // namespace VULKAN_HPP_NAMESPACE |
| 1197 |
#endif // VULKAN_SHARED_HPP |