forked from KhronosGroup/Vulkan-Hpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvulkansc.hpp
8606 lines (7427 loc) · 361 KB
/
vulkansc.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2015-2024 The Khronos Group Inc.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
// This header is generated from the Khronos Vulkan XML API Registry.
#ifndef VULKAN_HPP
#define VULKAN_HPP
#include <vulkan/vulkan_hpp_macros.hpp>
#if defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE )
# include <string.h>
import VULKAN_HPP_STD_MODULE;
#else
# include <algorithm>
# include <array> // ArrayWrapperND
# include <string.h> // strnlen
# include <string> // std::string
# include <utility> // std::exchange
#endif
#include <vulkan/vulkan_sc_core.h>
#if 17 <= VULKAN_HPP_CPP_VERSION && !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <string_view>
#endif
#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE ) && !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <tuple> // std::tie
# include <vector> // std::vector
#endif
#if !defined( VULKAN_HPP_NO_EXCEPTIONS ) && !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <system_error> // std::is_error_code_enum
#endif
#if ( VULKAN_HPP_ASSERT == assert )
# include <cassert>
#endif
#if VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL == 1
# if defined( __unix__ ) || defined( __APPLE__ ) || defined( __QNX__ ) || defined( __Fuchsia__ )
# include <dlfcn.h>
# elif defined( _WIN32 ) && !defined( VULKAN_HPP_NO_WIN32_PROTOTYPES )
using HINSTANCE = struct HINSTANCE__ *;
# if defined( _WIN64 )
using FARPROC = int64_t( __stdcall * )();
# else
using FARPROC = int( __stdcall * )();
# endif
extern "C" __declspec( dllimport ) HINSTANCE __stdcall LoadLibraryA( char const * lpLibFileName );
extern "C" __declspec( dllimport ) int __stdcall FreeLibrary( HINSTANCE hLibModule );
extern "C" __declspec( dllimport ) FARPROC __stdcall GetProcAddress( HINSTANCE hModule, const char * lpProcName );
# endif
#endif
#if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR ) && !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <compare>
#endif
#if defined( VULKAN_HPP_SUPPORT_SPAN ) && !( defined( VULKAN_HPP_ENABLE_STD_MODULE ) && defined( VULKAN_HPP_STD_MODULE ) )
# include <span>
#endif
static_assert( VK_HEADER_VERSION == 16, "Wrong VK_HEADER_VERSION!" );
// <tuple> includes <sys/sysmacros.h> through some other header
// this results in major(x) being resolved to gnu_dev_major(x)
// which is an expression in a constructor initializer list.
#if defined( major )
# undef major
#endif
#if defined( minor )
# undef minor
#endif
// Windows defines MemoryBarrier which is deprecated and collides
// with the VULKAN_HPP_NAMESPACE::MemoryBarrier struct.
#if defined( MemoryBarrier )
# undef MemoryBarrier
#endif
// XLib.h defines True/False, which collides with our vk::True/vk::False
// -> undef them and provide some namepace-secure constexpr
#if defined( True )
# undef True
constexpr int True = 1;
#endif
#if defined( False )
# undef False
constexpr int False = 0;
#endif
namespace VULKAN_HPP_NAMESPACE
{
template <typename T, size_t N>
class ArrayWrapper1D : public std::array<T, N>
{
public:
VULKAN_HPP_CONSTEXPR ArrayWrapper1D() VULKAN_HPP_NOEXCEPT : std::array<T, N>() {}
VULKAN_HPP_CONSTEXPR ArrayWrapper1D( std::array<T, N> const & data ) VULKAN_HPP_NOEXCEPT : std::array<T, N>( data ) {}
template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>
VULKAN_HPP_CONSTEXPR_14 ArrayWrapper1D( std::string const & data ) VULKAN_HPP_NOEXCEPT
{
copy( data.data(), data.length() );
}
#if 17 <= VULKAN_HPP_CPP_VERSION
template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>
VULKAN_HPP_CONSTEXPR_14 ArrayWrapper1D( std::string_view data ) VULKAN_HPP_NOEXCEPT
{
copy( data.data(), data.length() );
}
#endif
#if ( VK_USE_64_BIT_PTR_DEFINES == 0 )
// on 32 bit compiles, needs overloads on index type int to resolve ambiguities
VULKAN_HPP_CONSTEXPR T const & operator[]( int index ) const VULKAN_HPP_NOEXCEPT
{
return std::array<T, N>::operator[]( index );
}
T & operator[]( int index ) VULKAN_HPP_NOEXCEPT
{
return std::array<T, N>::operator[]( index );
}
#endif
operator T const *() const VULKAN_HPP_NOEXCEPT
{
return this->data();
}
operator T *() VULKAN_HPP_NOEXCEPT
{
return this->data();
}
template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>
operator std::string() const
{
return std::string( this->data(), strnlen( this->data(), N ) );
}
#if 17 <= VULKAN_HPP_CPP_VERSION
template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>
operator std::string_view() const
{
return std::string_view( this->data(), strnlen( this->data(), N ) );
}
#endif
private:
VULKAN_HPP_CONSTEXPR_14 void copy( char const * data, size_t len ) VULKAN_HPP_NOEXCEPT
{
size_t n = ( std::min )( N - 1, len );
for ( size_t i = 0; i < n; ++i )
{
( *this )[i] = data[i];
}
( *this )[n] = 0;
}
};
// relational operators between ArrayWrapper1D of chars with potentially different sizes
#if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR )
template <size_t N, size_t M>
std::strong_ordering operator<=>( ArrayWrapper1D<char, N> const & lhs, ArrayWrapper1D<char, M> const & rhs ) VULKAN_HPP_NOEXCEPT
{
int result = strcmp( lhs.data(), rhs.data() );
return ( result < 0 ) ? std::strong_ordering::less : ( ( result > 0 ) ? std::strong_ordering::greater : std::strong_ordering::equal );
}
#else
template <size_t N, size_t M>
bool operator<( ArrayWrapper1D<char, N> const & lhs, ArrayWrapper1D<char, M> const & rhs ) VULKAN_HPP_NOEXCEPT
{
return strcmp( lhs.data(), rhs.data() ) < 0;
}
template <size_t N, size_t M>
bool operator<=( ArrayWrapper1D<char, N> const & lhs, ArrayWrapper1D<char, M> const & rhs ) VULKAN_HPP_NOEXCEPT
{
return strcmp( lhs.data(), rhs.data() ) <= 0;
}
template <size_t N, size_t M>
bool operator>( ArrayWrapper1D<char, N> const & lhs, ArrayWrapper1D<char, M> const & rhs ) VULKAN_HPP_NOEXCEPT
{
return strcmp( lhs.data(), rhs.data() ) > 0;
}
template <size_t N, size_t M>
bool operator>=( ArrayWrapper1D<char, N> const & lhs, ArrayWrapper1D<char, M> const & rhs ) VULKAN_HPP_NOEXCEPT
{
return strcmp( lhs.data(), rhs.data() ) >= 0;
}
#endif
template <size_t N, size_t M>
bool operator==( ArrayWrapper1D<char, N> const & lhs, ArrayWrapper1D<char, M> const & rhs ) VULKAN_HPP_NOEXCEPT
{
return strcmp( lhs.data(), rhs.data() ) == 0;
}
template <size_t N, size_t M>
bool operator!=( ArrayWrapper1D<char, N> const & lhs, ArrayWrapper1D<char, M> const & rhs ) VULKAN_HPP_NOEXCEPT
{
return strcmp( lhs.data(), rhs.data() ) != 0;
}
// specialization of relational operators between std::string and arrays of chars
#if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR )
template <size_t N>
std::strong_ordering operator<=>( std::string const & lhs, ArrayWrapper1D<char, N> const & rhs ) VULKAN_HPP_NOEXCEPT
{
return lhs <=> rhs.data();
}
#else
template <size_t N>
bool operator<( std::string const & lhs, ArrayWrapper1D<char, N> const & rhs ) VULKAN_HPP_NOEXCEPT
{
return lhs < rhs.data();
}
template <size_t N>
bool operator<=( std::string const & lhs, ArrayWrapper1D<char, N> const & rhs ) VULKAN_HPP_NOEXCEPT
{
return lhs <= rhs.data();
}
template <size_t N>
bool operator>( std::string const & lhs, ArrayWrapper1D<char, N> const & rhs ) VULKAN_HPP_NOEXCEPT
{
return lhs > rhs.data();
}
template <size_t N>
bool operator>=( std::string const & lhs, ArrayWrapper1D<char, N> const & rhs ) VULKAN_HPP_NOEXCEPT
{
return lhs >= rhs.data();
}
#endif
template <size_t N>
bool operator==( std::string const & lhs, ArrayWrapper1D<char, N> const & rhs ) VULKAN_HPP_NOEXCEPT
{
return lhs == rhs.data();
}
template <size_t N>
bool operator!=( std::string const & lhs, ArrayWrapper1D<char, N> const & rhs ) VULKAN_HPP_NOEXCEPT
{
return lhs != rhs.data();
}
template <typename T, size_t N, size_t M>
class ArrayWrapper2D : public std::array<ArrayWrapper1D<T, M>, N>
{
public:
VULKAN_HPP_CONSTEXPR ArrayWrapper2D() VULKAN_HPP_NOEXCEPT : std::array<ArrayWrapper1D<T, M>, N>() {}
VULKAN_HPP_CONSTEXPR ArrayWrapper2D( std::array<std::array<T, M>, N> const & data ) VULKAN_HPP_NOEXCEPT
: std::array<ArrayWrapper1D<T, M>, N>( *reinterpret_cast<std::array<ArrayWrapper1D<T, M>, N> const *>( &data ) )
{
}
};
#if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
template <typename T>
class ArrayProxy
{
public:
VULKAN_HPP_CONSTEXPR ArrayProxy() VULKAN_HPP_NOEXCEPT
: m_count( 0 )
, m_ptr( nullptr )
{
}
VULKAN_HPP_CONSTEXPR ArrayProxy( std::nullptr_t ) VULKAN_HPP_NOEXCEPT
: m_count( 0 )
, m_ptr( nullptr )
{
}
ArrayProxy( T const & value ) VULKAN_HPP_NOEXCEPT
: m_count( 1 )
, m_ptr( &value )
{
}
ArrayProxy( uint32_t count, T const * ptr ) VULKAN_HPP_NOEXCEPT
: m_count( count )
, m_ptr( ptr )
{
}
template <std::size_t C>
ArrayProxy( T const ( &ptr )[C] ) VULKAN_HPP_NOEXCEPT
: m_count( C )
, m_ptr( ptr )
{
}
# if __GNUC__ >= 9
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Winit-list-lifetime"
# endif
ArrayProxy( std::initializer_list<T> const & list ) VULKAN_HPP_NOEXCEPT
: m_count( static_cast<uint32_t>( list.size() ) )
, m_ptr( list.begin() )
{
}
template <typename B = T, typename std::enable_if<std::is_const<B>::value, int>::type = 0>
ArrayProxy( std::initializer_list<typename std::remove_const<T>::type> const & list ) VULKAN_HPP_NOEXCEPT
: m_count( static_cast<uint32_t>( list.size() ) )
, m_ptr( list.begin() )
{
}
# if __GNUC__ >= 9
# pragma GCC diagnostic pop
# endif
// Any type with a .data() return type implicitly convertible to T*, and a .size() return type implicitly
// convertible to size_t. The const version can capture temporaries, with lifetime ending at end of statement.
template <typename V,
typename std::enable_if<std::is_convertible<decltype( std::declval<V>().data() ), T *>::value &&
std::is_convertible<decltype( std::declval<V>().size() ), std::size_t>::value>::type * = nullptr>
ArrayProxy( V const & v ) VULKAN_HPP_NOEXCEPT
: m_count( static_cast<uint32_t>( v.size() ) )
, m_ptr( v.data() )
{
}
const T * begin() const VULKAN_HPP_NOEXCEPT
{
return m_ptr;
}
const T * end() const VULKAN_HPP_NOEXCEPT
{
return m_ptr + m_count;
}
const T & front() const VULKAN_HPP_NOEXCEPT
{
VULKAN_HPP_ASSERT( m_count && m_ptr );
return *m_ptr;
}
const T & back() const VULKAN_HPP_NOEXCEPT
{
VULKAN_HPP_ASSERT( m_count && m_ptr );
return *( m_ptr + m_count - 1 );
}
bool empty() const VULKAN_HPP_NOEXCEPT
{
return ( m_count == 0 );
}
uint32_t size() const VULKAN_HPP_NOEXCEPT
{
return m_count;
}
T const * data() const VULKAN_HPP_NOEXCEPT
{
return m_ptr;
}
private:
uint32_t m_count;
T const * m_ptr;
};
template <typename T>
class ArrayProxyNoTemporaries
{
public:
VULKAN_HPP_CONSTEXPR ArrayProxyNoTemporaries() VULKAN_HPP_NOEXCEPT
: m_count( 0 )
, m_ptr( nullptr )
{
}
VULKAN_HPP_CONSTEXPR ArrayProxyNoTemporaries( std::nullptr_t ) VULKAN_HPP_NOEXCEPT
: m_count( 0 )
, m_ptr( nullptr )
{
}
template <typename B = T, typename std::enable_if<std::is_convertible<B, T>::value && std::is_lvalue_reference<B>::value, int>::type = 0>
ArrayProxyNoTemporaries( B && value ) VULKAN_HPP_NOEXCEPT
: m_count( 1 )
, m_ptr( &value )
{
}
ArrayProxyNoTemporaries( uint32_t count, T * ptr ) VULKAN_HPP_NOEXCEPT
: m_count( count )
, m_ptr( ptr )
{
}
template <std::size_t C>
ArrayProxyNoTemporaries( T ( &ptr )[C] ) VULKAN_HPP_NOEXCEPT
: m_count( C )
, m_ptr( ptr )
{
}
template <std::size_t C>
ArrayProxyNoTemporaries( T ( &&ptr )[C] ) = delete;
// Any l-value reference with a .data() return type implicitly convertible to T*, and a .size() return type implicitly convertible to size_t.
template <typename V,
typename std::enable_if<!std::is_convertible<decltype( std::declval<V>().begin() ), T *>::value &&
std::is_convertible<decltype( std::declval<V>().data() ), T *>::value &&
std::is_convertible<decltype( std::declval<V>().size() ), std::size_t>::value && std::is_lvalue_reference<V>::value,
int>::type = 0>
ArrayProxyNoTemporaries( V && v ) VULKAN_HPP_NOEXCEPT
: m_count( static_cast<uint32_t>( v.size() ) )
, m_ptr( v.data() )
{
}
// Any l-value reference with a .begin() return type implicitly convertible to T*, and a .size() return type implicitly convertible to size_t.
template <typename V,
typename std::enable_if<std::is_convertible<decltype( std::declval<V>().begin() ), T *>::value &&
std::is_convertible<decltype( std::declval<V>().size() ), std::size_t>::value && std::is_lvalue_reference<V>::value,
int>::type = 0>
ArrayProxyNoTemporaries( V && v ) VULKAN_HPP_NOEXCEPT
: m_count( static_cast<uint32_t>( v.size() ) )
, m_ptr( v.begin() )
{
}
const T * begin() const VULKAN_HPP_NOEXCEPT
{
return m_ptr;
}
const T * end() const VULKAN_HPP_NOEXCEPT
{
return m_ptr + m_count;
}
const T & front() const VULKAN_HPP_NOEXCEPT
{
VULKAN_HPP_ASSERT( m_count && m_ptr );
return *m_ptr;
}
const T & back() const VULKAN_HPP_NOEXCEPT
{
VULKAN_HPP_ASSERT( m_count && m_ptr );
return *( m_ptr + m_count - 1 );
}
bool empty() const VULKAN_HPP_NOEXCEPT
{
return ( m_count == 0 );
}
uint32_t size() const VULKAN_HPP_NOEXCEPT
{
return m_count;
}
T * data() const VULKAN_HPP_NOEXCEPT
{
return m_ptr;
}
private:
uint32_t m_count;
T * m_ptr;
};
template <typename T>
class StridedArrayProxy : protected ArrayProxy<T>
{
public:
using ArrayProxy<T>::ArrayProxy;
StridedArrayProxy( uint32_t count, T const * ptr, uint32_t stride ) VULKAN_HPP_NOEXCEPT
: ArrayProxy<T>( count, ptr )
, m_stride( stride )
{
VULKAN_HPP_ASSERT( sizeof( T ) <= stride );
}
using ArrayProxy<T>::begin;
const T * end() const VULKAN_HPP_NOEXCEPT
{
return reinterpret_cast<T const *>( static_cast<uint8_t const *>( begin() ) + size() * m_stride );
}
using ArrayProxy<T>::front;
const T & back() const VULKAN_HPP_NOEXCEPT
{
VULKAN_HPP_ASSERT( begin() && size() );
return *reinterpret_cast<T const *>( static_cast<uint8_t const *>( begin() ) + ( size() - 1 ) * m_stride );
}
using ArrayProxy<T>::empty;
using ArrayProxy<T>::size;
using ArrayProxy<T>::data;
uint32_t stride() const
{
return m_stride;
}
private:
uint32_t m_stride = sizeof( T );
};
template <typename RefType>
class Optional
{
public:
Optional( RefType & reference ) VULKAN_HPP_NOEXCEPT
{
m_ptr = &reference;
}
Optional( RefType * ptr ) VULKAN_HPP_NOEXCEPT
{
m_ptr = ptr;
}
Optional( std::nullptr_t ) VULKAN_HPP_NOEXCEPT
{
m_ptr = nullptr;
}
operator RefType *() const VULKAN_HPP_NOEXCEPT
{
return m_ptr;
}
RefType const * operator->() const VULKAN_HPP_NOEXCEPT
{
return m_ptr;
}
explicit operator bool() const VULKAN_HPP_NOEXCEPT
{
return !!m_ptr;
}
private:
RefType * m_ptr;
};
template <typename X, typename Y>
struct StructExtends
{
enum
{
value = false
};
};
template <typename Type, class...>
struct IsPartOfStructureChain
{
static const bool valid = false;
};
template <typename Type, typename Head, typename... Tail>
struct IsPartOfStructureChain<Type, Head, Tail...>
{
static const bool valid = std::is_same<Type, Head>::value || IsPartOfStructureChain<Type, Tail...>::valid;
};
template <size_t Index, typename T, typename... ChainElements>
struct StructureChainContains
{
static const bool value = std::is_same<T, typename std::tuple_element<Index, std::tuple<ChainElements...>>::type>::value ||
StructureChainContains<Index - 1, T, ChainElements...>::value;
};
template <typename T, typename... ChainElements>
struct StructureChainContains<0, T, ChainElements...>
{
static const bool value = std::is_same<T, typename std::tuple_element<0, std::tuple<ChainElements...>>::type>::value;
};
template <size_t Index, typename... ChainElements>
struct StructureChainValidation
{
using TestType = typename std::tuple_element<Index, std::tuple<ChainElements...>>::type;
static const bool valid = StructExtends<TestType, typename std::tuple_element<0, std::tuple<ChainElements...>>::type>::value &&
( TestType::allowDuplicate || !StructureChainContains<Index - 1, TestType, ChainElements...>::value ) &&
StructureChainValidation<Index - 1, ChainElements...>::valid;
};
template <typename... ChainElements>
struct StructureChainValidation<0, ChainElements...>
{
static const bool valid = true;
};
template <typename... ChainElements>
class StructureChain : public std::tuple<ChainElements...>
{
// Note: StructureChain has no move constructor or move assignment operator, as it is not supposed to contain movable containers.
// In order to get a copy-operation on a move-operations, those functions are neither deleted nor defaulted.
public:
StructureChain() VULKAN_HPP_NOEXCEPT
{
static_assert( StructureChainValidation<sizeof...( ChainElements ) - 1, ChainElements...>::valid, "The structure chain is not valid!" );
link<sizeof...( ChainElements ) - 1>();
}
StructureChain( StructureChain const & rhs ) VULKAN_HPP_NOEXCEPT : std::tuple<ChainElements...>( rhs )
{
static_assert( StructureChainValidation<sizeof...( ChainElements ) - 1, ChainElements...>::valid, "The structure chain is not valid!" );
link( &std::get<0>( *this ),
&std::get<0>( rhs ),
reinterpret_cast<VkBaseOutStructure *>( &std::get<0>( *this ) ),
reinterpret_cast<VkBaseInStructure const *>( &std::get<0>( rhs ) ) );
}
StructureChain( ChainElements const &... elems ) VULKAN_HPP_NOEXCEPT : std::tuple<ChainElements...>( elems... )
{
static_assert( StructureChainValidation<sizeof...( ChainElements ) - 1, ChainElements...>::valid, "The structure chain is not valid!" );
link<sizeof...( ChainElements ) - 1>();
}
StructureChain & operator=( StructureChain const & rhs ) VULKAN_HPP_NOEXCEPT
{
std::tuple<ChainElements...>::operator=( rhs );
link( &std::get<0>( *this ),
&std::get<0>( rhs ),
reinterpret_cast<VkBaseOutStructure *>( &std::get<0>( *this ) ),
reinterpret_cast<VkBaseInStructure const *>( &std::get<0>( rhs ) ) );
return *this;
}
template <typename T = typename std::tuple_element<0, std::tuple<ChainElements...>>::type, size_t Which = 0>
T & get() VULKAN_HPP_NOEXCEPT
{
return std::get<ChainElementIndex<0, T, Which, void, ChainElements...>::value>( static_cast<std::tuple<ChainElements...> &>( *this ) );
}
template <typename T = typename std::tuple_element<0, std::tuple<ChainElements...>>::type, size_t Which = 0>
T const & get() const VULKAN_HPP_NOEXCEPT
{
return std::get<ChainElementIndex<0, T, Which, void, ChainElements...>::value>( static_cast<std::tuple<ChainElements...> const &>( *this ) );
}
template <typename T0, typename T1, typename... Ts>
std::tuple<T0 &, T1 &, Ts &...> get() VULKAN_HPP_NOEXCEPT
{
return std::tie( get<T0>(), get<T1>(), get<Ts>()... );
}
template <typename T0, typename T1, typename... Ts>
std::tuple<T0 const &, T1 const &, Ts const &...> get() const VULKAN_HPP_NOEXCEPT
{
return std::tie( get<T0>(), get<T1>(), get<Ts>()... );
}
// assign a complete structure to the StructureChain without modifying the chaining
template <typename T = typename std::tuple_element<0, std::tuple<ChainElements...>>::type, size_t Which = 0>
StructureChain & assign( const T & rhs ) VULKAN_HPP_NOEXCEPT
{
T & lhs = get<T, Which>();
auto pNext = lhs.pNext;
lhs = rhs;
lhs.pNext = pNext;
return *this;
}
template <typename ClassType, size_t Which = 0>
typename std::enable_if<std::is_same<ClassType, typename std::tuple_element<0, std::tuple<ChainElements...>>::type>::value && ( Which == 0 ), bool>::type
isLinked() const VULKAN_HPP_NOEXCEPT
{
return true;
}
template <typename ClassType, size_t Which = 0>
typename std::enable_if<!std::is_same<ClassType, typename std::tuple_element<0, std::tuple<ChainElements...>>::type>::value || ( Which != 0 ), bool>::type
isLinked() const VULKAN_HPP_NOEXCEPT
{
static_assert( IsPartOfStructureChain<ClassType, ChainElements...>::valid, "Can't unlink Structure that's not part of this StructureChain!" );
return isLinked( reinterpret_cast<VkBaseInStructure const *>( &get<ClassType, Which>() ) );
}
template <typename ClassType, size_t Which = 0>
typename std::enable_if<!std::is_same<ClassType, typename std::tuple_element<0, std::tuple<ChainElements...>>::type>::value || ( Which != 0 ), void>::type
relink() VULKAN_HPP_NOEXCEPT
{
static_assert( IsPartOfStructureChain<ClassType, ChainElements...>::valid, "Can't relink Structure that's not part of this StructureChain!" );
auto pNext = reinterpret_cast<VkBaseInStructure *>( &get<ClassType, Which>() );
VULKAN_HPP_ASSERT( !isLinked( pNext ) );
auto & headElement = std::get<0>( static_cast<std::tuple<ChainElements...> &>( *this ) );
pNext->pNext = reinterpret_cast<VkBaseInStructure const *>( headElement.pNext );
headElement.pNext = pNext;
}
template <typename ClassType, size_t Which = 0>
typename std::enable_if<!std::is_same<ClassType, typename std::tuple_element<0, std::tuple<ChainElements...>>::type>::value || ( Which != 0 ), void>::type
unlink() VULKAN_HPP_NOEXCEPT
{
static_assert( IsPartOfStructureChain<ClassType, ChainElements...>::valid, "Can't unlink Structure that's not part of this StructureChain!" );
unlink( reinterpret_cast<VkBaseOutStructure const *>( &get<ClassType, Which>() ) );
}
private:
template <int Index, typename T, int Which, typename, class First, class... Types>
struct ChainElementIndex : ChainElementIndex<Index + 1, T, Which, void, Types...>
{
};
template <int Index, typename T, int Which, class First, class... Types>
struct ChainElementIndex<Index, T, Which, typename std::enable_if<!std::is_same<T, First>::value, void>::type, First, Types...>
: ChainElementIndex<Index + 1, T, Which, void, Types...>
{
};
template <int Index, typename T, int Which, class First, class... Types>
struct ChainElementIndex<Index, T, Which, typename std::enable_if<std::is_same<T, First>::value, void>::type, First, Types...>
: ChainElementIndex<Index + 1, T, Which - 1, void, Types...>
{
};
template <int Index, typename T, class First, class... Types>
struct ChainElementIndex<Index, T, 0, typename std::enable_if<std::is_same<T, First>::value, void>::type, First, Types...>
: std::integral_constant<int, Index>
{
};
bool isLinked( VkBaseInStructure const * pNext ) const VULKAN_HPP_NOEXCEPT
{
VkBaseInStructure const * elementPtr =
reinterpret_cast<VkBaseInStructure const *>( &std::get<0>( static_cast<std::tuple<ChainElements...> const &>( *this ) ) );
while ( elementPtr )
{
if ( elementPtr->pNext == pNext )
{
return true;
}
elementPtr = elementPtr->pNext;
}
return false;
}
template <size_t Index>
typename std::enable_if<Index != 0, void>::type link() VULKAN_HPP_NOEXCEPT
{
auto & x = std::get<Index - 1>( static_cast<std::tuple<ChainElements...> &>( *this ) );
x.pNext = &std::get<Index>( static_cast<std::tuple<ChainElements...> &>( *this ) );
link<Index - 1>();
}
template <size_t Index>
typename std::enable_if<Index == 0, void>::type link() VULKAN_HPP_NOEXCEPT
{
}
void link( void * dstBase, void const * srcBase, VkBaseOutStructure * dst, VkBaseInStructure const * src )
{
while ( src->pNext )
{
std::ptrdiff_t offset = reinterpret_cast<char const *>( src->pNext ) - reinterpret_cast<char const *>( srcBase );
dst->pNext = reinterpret_cast<VkBaseOutStructure *>( reinterpret_cast<char *>( dstBase ) + offset );
dst = dst->pNext;
src = src->pNext;
}
dst->pNext = nullptr;
}
void unlink( VkBaseOutStructure const * pNext ) VULKAN_HPP_NOEXCEPT
{
VkBaseOutStructure * elementPtr = reinterpret_cast<VkBaseOutStructure *>( &std::get<0>( static_cast<std::tuple<ChainElements...> &>( *this ) ) );
while ( elementPtr && ( elementPtr->pNext != pNext ) )
{
elementPtr = elementPtr->pNext;
}
if ( elementPtr )
{
elementPtr->pNext = pNext->pNext;
}
else
{
VULKAN_HPP_ASSERT( false ); // fires, if the ClassType member has already been unlinked !
}
}
};
// interupt the VULKAN_HPP_NAMESPACE for a moment to add specializations of std::tuple_size and std::tuple_element for the StructureChain!
}
namespace std
{
template <typename... Elements>
struct tuple_size<VULKAN_HPP_NAMESPACE::StructureChain<Elements...>>
{
static constexpr size_t value = std::tuple_size<std::tuple<Elements...>>::value;
};
template <std::size_t Index, typename... Elements>
struct tuple_element<Index, VULKAN_HPP_NAMESPACE::StructureChain<Elements...>>
{
using type = typename std::tuple_element<Index, std::tuple<Elements...>>::type;
};
} // namespace std
namespace VULKAN_HPP_NAMESPACE
{
# if !defined( VULKAN_HPP_NO_SMART_HANDLE )
template <typename Type, typename Dispatch>
class UniqueHandleTraits;
template <typename Type, typename Dispatch>
class UniqueHandle : public UniqueHandleTraits<Type, Dispatch>::deleter
{
private:
using Deleter = typename UniqueHandleTraits<Type, Dispatch>::deleter;
public:
using element_type = Type;
UniqueHandle() : Deleter(), m_value() {}
explicit UniqueHandle( Type const & value, Deleter const & deleter = Deleter() ) VULKAN_HPP_NOEXCEPT
: Deleter( deleter )
, m_value( value )
{
}
UniqueHandle( UniqueHandle const & ) = delete;
UniqueHandle( UniqueHandle && other ) VULKAN_HPP_NOEXCEPT
: Deleter( std::move( static_cast<Deleter &>( other ) ) )
, m_value( other.release() )
{
}
~UniqueHandle() VULKAN_HPP_NOEXCEPT
{
if ( m_value )
{
this->destroy( m_value );
}
}
UniqueHandle & operator=( UniqueHandle const & ) = delete;
UniqueHandle & operator=( UniqueHandle && other ) VULKAN_HPP_NOEXCEPT
{
reset( other.release() );
*static_cast<Deleter *>( this ) = std::move( static_cast<Deleter &>( other ) );
return *this;
}
explicit operator bool() const VULKAN_HPP_NOEXCEPT
{
return m_value.operator bool();
}
# if defined( VULKAN_HPP_SMART_HANDLE_IMPLICIT_CAST )
operator Type() const VULKAN_HPP_NOEXCEPT
{
return m_value;
}
# endif
Type const * operator->() const VULKAN_HPP_NOEXCEPT
{
return &m_value;
}
Type * operator->() VULKAN_HPP_NOEXCEPT
{
return &m_value;
}
Type const & operator*() const VULKAN_HPP_NOEXCEPT
{
return m_value;
}
Type & operator*() VULKAN_HPP_NOEXCEPT
{
return m_value;
}
const Type & get() const VULKAN_HPP_NOEXCEPT
{
return m_value;
}
Type & get() VULKAN_HPP_NOEXCEPT
{
return m_value;
}
void reset( Type const & value = Type() ) VULKAN_HPP_NOEXCEPT
{
if ( m_value != value )
{
if ( m_value )
{
this->destroy( m_value );
}
m_value = value;
}
}
Type release() VULKAN_HPP_NOEXCEPT
{
Type value = m_value;
m_value = nullptr;
return value;
}
void swap( UniqueHandle<Type, Dispatch> & rhs ) VULKAN_HPP_NOEXCEPT
{
std::swap( m_value, rhs.m_value );
std::swap( static_cast<Deleter &>( *this ), static_cast<Deleter &>( rhs ) );
}
private:
Type m_value;
};
template <typename UniqueType>
VULKAN_HPP_INLINE std::vector<typename UniqueType::element_type> uniqueToRaw( std::vector<UniqueType> const & handles )
{
std::vector<typename UniqueType::element_type> newBuffer( handles.size() );
std::transform( handles.begin(), handles.end(), newBuffer.begin(), []( UniqueType const & handle ) { return handle.get(); } );
return newBuffer;
}
template <typename Type, typename Dispatch>
VULKAN_HPP_INLINE void swap( UniqueHandle<Type, Dispatch> & lhs, UniqueHandle<Type, Dispatch> & rhs ) VULKAN_HPP_NOEXCEPT
{
lhs.swap( rhs );
}
# endif
#endif // VULKAN_HPP_DISABLE_ENHANCED_MODE
namespace detail
{
class DispatchLoaderBase
{
public:
DispatchLoaderBase() = default;
DispatchLoaderBase( std::nullptr_t )
#if !defined( NDEBUG )
: m_valid( false )
#endif
{
}
#if !defined( NDEBUG )
size_t getVkHeaderVersion() const
{
VULKAN_HPP_ASSERT( m_valid );
return vkHeaderVersion;
}
private:
size_t vkHeaderVersion = VK_HEADER_VERSION;
bool m_valid = true;
#endif
};
#if !defined( VK_NO_PROTOTYPES )
class DispatchLoaderStatic : public DispatchLoaderBase
{
public:
//=== VK_VERSION_1_0 ===
VkResult
vkCreateInstance( const VkInstanceCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkInstance * pInstance ) const VULKAN_HPP_NOEXCEPT
{
return ::vkCreateInstance( pCreateInfo, pAllocator, pInstance );
}
void vkDestroyInstance( VkInstance instance, const VkAllocationCallbacks * pAllocator ) const VULKAN_HPP_NOEXCEPT
{
return ::vkDestroyInstance( instance, pAllocator );
}
VkResult vkEnumeratePhysicalDevices( VkInstance instance, uint32_t * pPhysicalDeviceCount, VkPhysicalDevice * pPhysicalDevices ) const VULKAN_HPP_NOEXCEPT