|
1501
|
1 // Copyright 2015-2025 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_KHR_acceleration_structure ===
|
|
|
829 template <>
|
|
|
830 class SharedHandleTraits<AccelerationStructureKHR>
|
|
|
831 {
|
|
|
832 public:
|
|
|
833 using DestructorType = Device;
|
|
|
834 using deleter = detail::ObjectDestroyShared<AccelerationStructureKHR>;
|
|
|
835 };
|
|
|
836
|
|
|
837 using SharedAccelerationStructureKHR = SharedHandle<AccelerationStructureKHR>;
|
|
|
838
|
|
|
839 //=== VK_EXT_validation_cache ===
|
|
|
840 template <>
|
|
|
841 class SharedHandleTraits<ValidationCacheEXT>
|
|
|
842 {
|
|
|
843 public:
|
|
|
844 using DestructorType = Device;
|
|
|
845 using deleter = detail::ObjectDestroyShared<ValidationCacheEXT>;
|
|
|
846 };
|
|
|
847
|
|
|
848 using SharedValidationCacheEXT = SharedHandle<ValidationCacheEXT>;
|
|
|
849
|
|
|
850 //=== VK_NV_ray_tracing ===
|
|
|
851 template <>
|
|
|
852 class SharedHandleTraits<AccelerationStructureNV>
|
|
|
853 {
|
|
|
854 public:
|
|
|
855 using DestructorType = Device;
|
|
|
856 using deleter = detail::ObjectDestroyShared<AccelerationStructureNV>;
|
|
|
857 };
|
|
|
858
|
|
|
859 using SharedAccelerationStructureNV = SharedHandle<AccelerationStructureNV>;
|
|
|
860
|
|
|
861 //=== VK_INTEL_performance_query ===
|
|
|
862 template <>
|
|
|
863 class SharedHandleTraits<PerformanceConfigurationINTEL>
|
|
|
864 {
|
|
|
865 public:
|
|
|
866 using DestructorType = Device;
|
|
|
867 using deleter = detail::ObjectDestroyShared<PerformanceConfigurationINTEL>;
|
|
|
868 };
|
|
|
869
|
|
|
870 using SharedPerformanceConfigurationINTEL = SharedHandle<PerformanceConfigurationINTEL>;
|
|
|
871
|
|
|
872 //=== VK_KHR_deferred_host_operations ===
|
|
|
873 template <>
|
|
|
874 class SharedHandleTraits<DeferredOperationKHR>
|
|
|
875 {
|
|
|
876 public:
|
|
|
877 using DestructorType = Device;
|
|
|
878 using deleter = detail::ObjectDestroyShared<DeferredOperationKHR>;
|
|
|
879 };
|
|
|
880
|
|
|
881 using SharedDeferredOperationKHR = SharedHandle<DeferredOperationKHR>;
|
|
|
882
|
|
|
883 //=== VK_NV_device_generated_commands ===
|
|
|
884 template <>
|
|
|
885 class SharedHandleTraits<IndirectCommandsLayoutNV>
|
|
|
886 {
|
|
|
887 public:
|
|
|
888 using DestructorType = Device;
|
|
|
889 using deleter = detail::ObjectDestroyShared<IndirectCommandsLayoutNV>;
|
|
|
890 };
|
|
|
891
|
|
|
892 using SharedIndirectCommandsLayoutNV = SharedHandle<IndirectCommandsLayoutNV>;
|
|
|
893
|
|
|
894 # if defined( VK_ENABLE_BETA_EXTENSIONS )
|
|
|
895 //=== VK_NV_cuda_kernel_launch ===
|
|
|
896 template <>
|
|
|
897 class SharedHandleTraits<CudaModuleNV>
|
|
|
898 {
|
|
|
899 public:
|
|
|
900 using DestructorType = Device;
|
|
|
901 using deleter = detail::ObjectDestroyShared<CudaModuleNV>;
|
|
|
902 };
|
|
|
903
|
|
|
904 using SharedCudaModuleNV = SharedHandle<CudaModuleNV>;
|
|
|
905
|
|
|
906 template <>
|
|
|
907 class SharedHandleTraits<CudaFunctionNV>
|
|
|
908 {
|
|
|
909 public:
|
|
|
910 using DestructorType = Device;
|
|
|
911 using deleter = detail::ObjectDestroyShared<CudaFunctionNV>;
|
|
|
912 };
|
|
|
913
|
|
|
914 using SharedCudaFunctionNV = SharedHandle<CudaFunctionNV>;
|
|
|
915 # endif /*VK_ENABLE_BETA_EXTENSIONS*/
|
|
|
916
|
|
|
917 # if defined( VK_USE_PLATFORM_FUCHSIA )
|
|
|
918 //=== VK_FUCHSIA_buffer_collection ===
|
|
|
919 template <>
|
|
|
920 class SharedHandleTraits<BufferCollectionFUCHSIA>
|
|
|
921 {
|
|
|
922 public:
|
|
|
923 using DestructorType = Device;
|
|
|
924 using deleter = detail::ObjectDestroyShared<BufferCollectionFUCHSIA>;
|
|
|
925 };
|
|
|
926
|
|
|
927 using SharedBufferCollectionFUCHSIA = SharedHandle<BufferCollectionFUCHSIA>;
|
|
|
928 # endif /*VK_USE_PLATFORM_FUCHSIA*/
|
|
|
929
|
|
|
930 //=== VK_EXT_opacity_micromap ===
|
|
|
931 template <>
|
|
|
932 class SharedHandleTraits<MicromapEXT>
|
|
|
933 {
|
|
|
934 public:
|
|
|
935 using DestructorType = Device;
|
|
|
936 using deleter = detail::ObjectDestroyShared<MicromapEXT>;
|
|
|
937 };
|
|
|
938
|
|
|
939 using SharedMicromapEXT = SharedHandle<MicromapEXT>;
|
|
|
940
|
|
|
941 //=== VK_ARM_tensors ===
|
|
|
942 template <>
|
|
|
943 class SharedHandleTraits<TensorARM>
|
|
|
944 {
|
|
|
945 public:
|
|
|
946 using DestructorType = Device;
|
|
|
947 using deleter = detail::ObjectDestroyShared<TensorARM>;
|
|
|
948 };
|
|
|
949
|
|
|
950 using SharedTensorARM = SharedHandle<TensorARM>;
|
|
|
951
|
|
|
952 template <>
|
|
|
953 class SharedHandleTraits<TensorViewARM>
|
|
|
954 {
|
|
|
955 public:
|
|
|
956 using DestructorType = Device;
|
|
|
957 using deleter = detail::ObjectDestroyShared<TensorViewARM>;
|
|
|
958 };
|
|
|
959
|
|
|
960 using SharedTensorViewARM = SharedHandle<TensorViewARM>;
|
|
|
961
|
|
|
962 //=== VK_NV_optical_flow ===
|
|
|
963 template <>
|
|
|
964 class SharedHandleTraits<OpticalFlowSessionNV>
|
|
|
965 {
|
|
|
966 public:
|
|
|
967 using DestructorType = Device;
|
|
|
968 using deleter = detail::ObjectDestroyShared<OpticalFlowSessionNV>;
|
|
|
969 };
|
|
|
970
|
|
|
971 using SharedOpticalFlowSessionNV = SharedHandle<OpticalFlowSessionNV>;
|
|
|
972
|
|
|
973 //=== VK_EXT_shader_object ===
|
|
|
974 template <>
|
|
|
975 class SharedHandleTraits<ShaderEXT>
|
|
|
976 {
|
|
|
977 public:
|
|
|
978 using DestructorType = Device;
|
|
|
979 using deleter = detail::ObjectDestroyShared<ShaderEXT>;
|
|
|
980 };
|
|
|
981
|
|
|
982 using SharedShaderEXT = SharedHandle<ShaderEXT>;
|
|
|
983
|
|
|
984 //=== VK_KHR_pipeline_binary ===
|
|
|
985 template <>
|
|
|
986 class SharedHandleTraits<PipelineBinaryKHR>
|
|
|
987 {
|
|
|
988 public:
|
|
|
989 using DestructorType = Device;
|
|
|
990 using deleter = detail::ObjectDestroyShared<PipelineBinaryKHR>;
|
|
|
991 };
|
|
|
992
|
|
|
993 using SharedPipelineBinaryKHR = SharedHandle<PipelineBinaryKHR>;
|
|
|
994
|
|
|
995 //=== VK_ARM_data_graph ===
|
|
|
996 template <>
|
|
|
997 class SharedHandleTraits<DataGraphPipelineSessionARM>
|
|
|
998 {
|
|
|
999 public:
|
|
|
1000 using DestructorType = Device;
|
|
|
1001 using deleter = detail::ObjectDestroyShared<DataGraphPipelineSessionARM>;
|
|
|
1002 };
|
|
|
1003
|
|
|
1004 using SharedDataGraphPipelineSessionARM = SharedHandle<DataGraphPipelineSessionARM>;
|
|
|
1005
|
|
|
1006 //=== VK_NV_external_compute_queue ===
|
|
|
1007 template <>
|
|
|
1008 class SharedHandleTraits<ExternalComputeQueueNV>
|
|
|
1009 {
|
|
|
1010 public:
|
|
|
1011 using DestructorType = Device;
|
|
|
1012 using deleter = detail::ObjectDestroyShared<ExternalComputeQueueNV>;
|
|
|
1013 };
|
|
|
1014
|
|
|
1015 using SharedExternalComputeQueueNV = SharedHandle<ExternalComputeQueueNV>;
|
|
|
1016
|
|
|
1017 //=== VK_EXT_device_generated_commands ===
|
|
|
1018 template <>
|
|
|
1019 class SharedHandleTraits<IndirectCommandsLayoutEXT>
|
|
|
1020 {
|
|
|
1021 public:
|
|
|
1022 using DestructorType = Device;
|
|
|
1023 using deleter = detail::ObjectDestroyShared<IndirectCommandsLayoutEXT>;
|
|
|
1024 };
|
|
|
1025
|
|
|
1026 using SharedIndirectCommandsLayoutEXT = SharedHandle<IndirectCommandsLayoutEXT>;
|
|
|
1027
|
|
|
1028 template <>
|
|
|
1029 class SharedHandleTraits<IndirectExecutionSetEXT>
|
|
|
1030 {
|
|
|
1031 public:
|
|
|
1032 using DestructorType = Device;
|
|
|
1033 using deleter = detail::ObjectDestroyShared<IndirectExecutionSetEXT>;
|
|
|
1034 };
|
|
|
1035
|
|
|
1036 using SharedIndirectExecutionSetEXT = SharedHandle<IndirectExecutionSetEXT>;
|
|
|
1037
|
|
|
1038 // a number of SharedHandle specializations
|
|
|
1039 enum class SwapchainOwns
|
|
|
1040 {
|
|
|
1041 no,
|
|
|
1042 yes,
|
|
|
1043 };
|
|
|
1044
|
|
|
1045 struct ImageHeader : SharedHeader<DestructorTypeOf<Image>, typename SharedHandleTraits<Image>::deleter>
|
|
|
1046 {
|
|
|
1047 ImageHeader( SharedHandle<DestructorTypeOf<Image>> parent,
|
|
|
1048 typename SharedHandleTraits<Image>::deleter deleter VULKAN_HPP_DEFAULT_ASSIGNMENT( typename SharedHandleTraits<Image>::deleter() ),
|
|
|
1049 SwapchainOwns swapchainOwned = SwapchainOwns::no ) VULKAN_HPP_NOEXCEPT
|
|
|
1050 : SharedHeader<DestructorTypeOf<Image>, typename SharedHandleTraits<Image>::deleter>( std::move( parent ), std::move( deleter ) )
|
|
|
1051 , swapchainOwned( swapchainOwned )
|
|
|
1052 {
|
|
|
1053 }
|
|
|
1054
|
|
|
1055 SwapchainOwns swapchainOwned = SwapchainOwns::no;
|
|
|
1056 };
|
|
|
1057
|
|
|
1058 template <>
|
|
|
1059 class SharedHandle<Image> : public SharedHandleBase<Image, ImageHeader>
|
|
|
1060 {
|
|
|
1061 using BaseType = SharedHandleBase<Image, ImageHeader>;
|
|
|
1062 using DeleterType = typename SharedHandleTraits<Image>::deleter;
|
|
|
1063 friend BaseType;
|
|
|
1064
|
|
|
1065 public:
|
|
|
1066 SharedHandle() = default;
|
|
|
1067
|
|
|
1068 explicit SharedHandle( Image handle,
|
|
|
1069 SharedHandle<DestructorTypeOf<Image>> parent,
|
|
|
1070 SwapchainOwns swapchain_owned VULKAN_HPP_DEFAULT_ASSIGNMENT( SwapchainOwns::no ),
|
|
|
1071 DeleterType deleter VULKAN_HPP_DEFAULT_ASSIGNMENT( DeleterType() ) ) VULKAN_HPP_NOEXCEPT
|
|
|
1072 : BaseType( handle, std::move( parent ), std::move( deleter ), swapchain_owned )
|
|
|
1073 {
|
|
|
1074 }
|
|
|
1075
|
|
|
1076 protected:
|
|
|
1077 static void internalDestroy( const ImageHeader & control, Image handle ) VULKAN_HPP_NOEXCEPT
|
|
|
1078 {
|
|
|
1079 if ( control.swapchainOwned == SwapchainOwns::no )
|
|
|
1080 {
|
|
|
1081 control.deleter.destroy( control.parent.get(), handle );
|
|
|
1082 }
|
|
|
1083 }
|
|
|
1084 };
|
|
|
1085
|
|
|
1086 struct SwapchainHeader
|
|
|
1087 {
|
|
|
1088 SwapchainHeader( SharedHandle<SurfaceKHR> surface,
|
|
|
1089 SharedHandle<DestructorTypeOf<SwapchainKHR>> parent,
|
|
|
1090 typename SharedHandleTraits<SwapchainKHR>::deleter deleter
|
|
|
1091 VULKAN_HPP_DEFAULT_ASSIGNMENT( typename SharedHandleTraits<SwapchainKHR>::deleter() ) ) VULKAN_HPP_NOEXCEPT
|
|
|
1092 : surface( std::move( surface ) )
|
|
|
1093 , parent( std::move( parent ) )
|
|
|
1094 , deleter( std::move( deleter ) )
|
|
|
1095 {
|
|
|
1096 }
|
|
|
1097
|
|
|
1098 SharedHandle<SurfaceKHR> surface;
|
|
|
1099 SharedHandle<DestructorTypeOf<SwapchainKHR>> parent;
|
|
|
1100 typename SharedHandleTraits<SwapchainKHR>::deleter deleter;
|
|
|
1101 };
|
|
|
1102
|
|
|
1103 template <>
|
|
|
1104 class SharedHandle<SwapchainKHR> : public SharedHandleBase<SwapchainKHR, SwapchainHeader>
|
|
|
1105 {
|
|
|
1106 using BaseType = SharedHandleBase<SwapchainKHR, SwapchainHeader>;
|
|
|
1107 using DeleterType = typename SharedHandleTraits<SwapchainKHR>::deleter;
|
|
|
1108 friend BaseType;
|
|
|
1109
|
|
|
1110 public:
|
|
|
1111 SharedHandle() = default;
|
|
|
1112
|
|
|
1113 explicit SharedHandle( SwapchainKHR handle,
|
|
|
1114 SharedHandle<DestructorTypeOf<SwapchainKHR>> parent,
|
|
|
1115 SharedHandle<SurfaceKHR> surface,
|
|
|
1116 DeleterType deleter VULKAN_HPP_DEFAULT_ASSIGNMENT( DeleterType() ) ) VULKAN_HPP_NOEXCEPT
|
|
|
1117 : BaseType( handle, std::move( surface ), std::move( parent ), std::move( deleter ) )
|
|
|
1118 {
|
|
|
1119 }
|
|
|
1120
|
|
|
1121 public:
|
|
|
1122 const SharedHandle<SurfaceKHR> & getSurface() const VULKAN_HPP_NOEXCEPT
|
|
|
1123 {
|
|
|
1124 return getHeader().surface;
|
|
|
1125 }
|
|
|
1126
|
|
|
1127 protected:
|
|
|
1128 using BaseType::internalDestroy;
|
|
|
1129 };
|
|
|
1130
|
|
|
1131 template <typename HandleType, typename DestructorType>
|
|
|
1132 class SharedHandleBaseNoDestroy : public SharedHandleBase<HandleType, DestructorType>
|
|
|
1133 {
|
|
|
1134 public:
|
|
|
1135 using SharedHandleBase<HandleType, DestructorType>::SharedHandleBase;
|
|
|
1136
|
|
|
1137 const DestructorType & getDestructorType() const VULKAN_HPP_NOEXCEPT
|
|
|
1138 {
|
|
|
1139 return SharedHandleBase<HandleType, DestructorType>::getHeader();
|
|
|
1140 }
|
|
|
1141
|
|
|
1142 protected:
|
|
|
1143 static void internalDestroy( const DestructorType &, HandleType ) VULKAN_HPP_NOEXCEPT {}
|
|
|
1144 };
|
|
|
1145
|
|
|
1146 //=== VK_VERSION_1_0 ===
|
|
|
1147
|
|
|
1148 template <>
|
|
|
1149 class SharedHandle<PhysicalDevice> : public SharedHandleBaseNoDestroy<PhysicalDevice, SharedInstance>
|
|
|
1150 {
|
|
|
1151 friend SharedHandleBase<PhysicalDevice, SharedInstance>;
|
|
|
1152
|
|
|
1153 public:
|
|
|
1154 SharedHandle() = default;
|
|
|
1155
|
|
|
1156 explicit SharedHandle( PhysicalDevice handle, SharedInstance parent ) noexcept
|
|
|
1157 : SharedHandleBaseNoDestroy<PhysicalDevice, SharedInstance>( handle, std::move( parent ) )
|
|
|
1158 {
|
|
|
1159 }
|
|
|
1160 };
|
|
|
1161
|
|
|
1162 using SharedPhysicalDevice = SharedHandle<PhysicalDevice>;
|
|
|
1163
|
|
|
1164 template <>
|
|
|
1165 class SharedHandle<Queue> : public SharedHandleBaseNoDestroy<Queue, SharedDevice>
|
|
|
1166 {
|
|
|
1167 friend SharedHandleBase<Queue, SharedDevice>;
|
|
|
1168
|
|
|
1169 public:
|
|
|
1170 SharedHandle() = default;
|
|
|
1171
|
|
|
1172 explicit SharedHandle( Queue handle, SharedDevice parent ) noexcept : SharedHandleBaseNoDestroy<Queue, SharedDevice>( handle, std::move( parent ) ) {}
|
|
|
1173 };
|
|
|
1174
|
|
|
1175 using SharedQueue = SharedHandle<Queue>;
|
|
|
1176
|
|
|
1177 //=== VK_KHR_display ===
|
|
|
1178
|
|
|
1179 template <>
|
|
|
1180 class SharedHandle<DisplayModeKHR> : public SharedHandleBaseNoDestroy<DisplayModeKHR, SharedDisplayKHR>
|
|
|
1181 {
|
|
|
1182 friend SharedHandleBase<DisplayModeKHR, SharedDisplayKHR>;
|
|
|
1183
|
|
|
1184 public:
|
|
|
1185 SharedHandle() = default;
|
|
|
1186
|
|
|
1187 explicit SharedHandle( DisplayModeKHR handle, SharedDisplayKHR parent ) noexcept
|
|
|
1188 : SharedHandleBaseNoDestroy<DisplayModeKHR, SharedDisplayKHR>( handle, std::move( parent ) )
|
|
|
1189 {
|
|
|
1190 }
|
|
|
1191 };
|
|
|
1192
|
|
|
1193 using SharedDisplayModeKHR = SharedHandle<DisplayModeKHR>;
|
|
|
1194 #endif // !VULKAN_HPP_NO_SMART_HANDLE
|
|
|
1195 } // namespace VULKAN_HPP_NAMESPACE
|
|
|
1196 #endif // VULKAN_SHARED_HPP
|