Compare commits
395 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
afed5bc758 | |
|
|
126ab7501e | |
|
|
9d55db6621 | |
|
|
cbf8b58154 | |
|
|
f4fd11e2b6 | |
|
|
cb5783d49d | |
|
|
73121db60b | |
|
|
6bbd8ccd68 | |
|
|
bdda01dc49 | |
|
|
21d217d163 | |
|
|
8e79f71c15 | |
|
|
9747e68285 | |
|
|
7c480ca5aa | |
|
|
5cd5bcf6de | |
|
|
c75dcdc0bb | |
|
|
15f4b3024f | |
|
|
1491456a64 | |
|
|
9423ad7f69 | |
|
|
63a3afa9b2 | |
|
|
36b276f0a2 | |
|
|
b4d30a5fb5 | |
|
|
cda66a2513 | |
|
|
e511715fce | |
|
|
d0b04b733a | |
|
|
3a948949cc | |
|
|
95d69172ba | |
|
|
6f9677513d | |
|
|
4bc2057ad8 | |
|
|
053269201d | |
|
|
878fb0d390 | |
|
|
0a7333161d | |
|
|
1958615077 | |
|
|
f25993be90 | |
|
|
3c1a2e5f10 | |
|
|
9ab0f0602b | |
|
|
75e7718add | |
|
|
aab9fc1ada | |
|
|
767fce85b7 | |
|
|
ed449ac36f | |
|
|
7adfc34c5f | |
|
|
608f95fb9f | |
|
|
d7f08491dc | |
|
|
af898d1c28 | |
|
|
9e9b735e35 | |
|
|
2d30af554e | |
|
|
07a9e8911c | |
|
|
34acbf0712 | |
|
|
fda19f0bb3 | |
|
|
4ff98ef7a8 | |
|
|
2c17c62600 | |
|
|
ed9a0a586b | |
|
|
10578463ae | |
|
|
e0f4656f23 | |
|
|
f522d73454 | |
|
|
40596212e8 | |
|
|
202f053855 | |
|
|
1a9644fbda | |
|
|
938a2c36d2 | |
|
|
857bb352ea | |
|
|
e418dd91fb | |
|
|
7519cc05ad | |
|
|
8578ac94d5 | |
|
|
4bbdbb434d | |
|
|
db104e1c01 | |
|
|
8f2955ba0d | |
|
|
df7099a77e | |
|
|
88d2ac296b | |
|
|
16fa896427 | |
|
|
af5c6fd693 | |
|
|
4c3b729686 | |
|
|
f42eadae3d | |
|
|
fb20f4b27c | |
|
|
ee89dd16ea | |
|
|
1f871772e4 | |
|
|
60e99671c7 | |
|
|
6cfec828f6 | |
|
|
7fcd4522e0 | |
|
|
aaf0cb61c4 | |
|
|
c97b7ff82d | |
|
|
c17f7f47cb | |
|
|
c90a5bac97 | |
|
|
7beac182b2 | |
|
|
6bd3b4652c | |
|
|
618759b9d6 | |
|
|
114936cae2 | |
|
|
d996a13dfd | |
|
|
0113967b2b | |
|
|
6b28af9f1f | |
|
|
a33145af43 | |
|
|
621c713cf8 | |
|
|
d6eb36b132 | |
|
|
32bd2b7ab7 | |
|
|
d16c62670b | |
|
|
cc01933661 | |
|
|
167bb6afe0 | |
|
|
7dfe7d3ad9 | |
|
|
e6d0135c57 | |
|
|
d82ba7c2a0 | |
|
|
11bab25e31 | |
|
|
b59d87d696 | |
|
|
d3a3c6321f | |
|
|
8e34112311 | |
|
|
7740791eef | |
|
|
fb5fd75ee8 | |
|
|
605be52aa0 | |
|
|
0771d2657c | |
|
|
da67e807a8 | |
|
|
13da06128f | |
|
|
e04460f454 | |
|
|
daeae97daf | |
|
|
68baf3c00f | |
|
|
7824358518 | |
|
|
2010d85fb4 | |
|
|
de8730fd22 | |
|
|
fe0190241c | |
|
|
3444a16cfb | |
|
|
a20b4d4438 | |
|
|
9807eb5164 | |
|
|
de509342b4 | |
|
|
32f2957efc | |
|
|
d6a9738739 | |
|
|
4a6293e749 | |
|
|
4ccc5d34ba | |
|
|
1c6215ddfd | |
|
|
05f5b9a060 | |
|
|
76be2e0fdf | |
|
|
a31d678939 | |
|
|
dfed90530b | |
|
|
c143eb293c | |
|
|
3514683079 | |
|
|
01c4ae2211 | |
|
|
8ee3f2fabd | |
|
|
5bac8fc8fc | |
|
|
87eaf785f8 | |
|
|
7fc625d3ce | |
|
|
30eef2d002 | |
|
|
ae6f3c1184 | |
|
|
81b2f2f950 | |
|
|
ad71cabe2c | |
|
|
64b72c4612 | |
|
|
51a648fa9a | |
|
|
d5b553d969 | |
|
|
54cc539ab5 | |
|
|
715aab1337 | |
|
|
9e748f985b | |
|
|
557e25cdd9 | |
|
|
91109e1e2f | |
|
|
02b78071f1 | |
|
|
ca00bfad9e | |
|
|
2cadbd617e | |
|
|
9a2cd93085 | |
|
|
448026b9c5 | |
|
|
87f930b684 | |
|
|
38bdc9400f | |
|
|
ee121fe6a4 | |
|
|
3f281b80b4 | |
|
|
a804eaa9b2 | |
|
|
6dc0a4e2cf | |
|
|
66da6f2b87 | |
|
|
bdf1304837 | |
|
|
028a01abfc | |
|
|
ee361cf520 | |
|
|
16915b3fa4 | |
|
|
ce7006b096 | |
|
|
bdc97d096b | |
|
|
fda93ae3fb | |
|
|
a428958b7f | |
|
|
ce1ffedb70 | |
|
|
595f21ae1a | |
|
|
387ae87201 | |
|
|
7eb8eacec5 | |
|
|
893cc80cf9 | |
|
|
450a047750 | |
|
|
3f84a60581 | |
|
|
63eff3a2e0 | |
|
|
566e770a3b | |
|
|
6f7fcdfbc7 | |
|
|
624143e366 | |
|
|
abe7295190 | |
|
|
97e60d04f3 | |
|
|
c86d00a898 | |
|
|
fd6e74416c | |
|
|
e3ea28320d | |
|
|
1fd397b801 | |
|
|
efa6cf3a25 | |
|
|
053eb2d62c | |
|
|
8fa7cf094d | |
|
|
f9c5bfde49 | |
|
|
04727f6695 | |
|
|
4266ef3040 | |
|
|
b19b7d7afb | |
|
|
538fa5d529 | |
|
|
fd13995952 | |
|
|
2c6d6c29b8 | |
|
|
1ce3fcac8b | |
|
|
fe203f86d0 | |
|
|
da9db0c8a0 | |
|
|
325602c26a | |
|
|
8f9db1bad6 | |
|
|
f03a052717 | |
|
|
16da8bd29e | |
|
|
be9459f9c3 | |
|
|
0236fbad7d | |
|
|
6922436d90 | |
|
|
2860728579 | |
|
|
4c8fe92a96 | |
|
|
8ab6cb5d8b | |
|
|
5f4583c500 | |
|
|
03f07338be | |
|
|
ed5993af83 | |
|
|
85036c964c | |
|
|
74a2ce1e91 | |
|
|
9dbf676cdb | |
|
|
4dc27d82a4 | |
|
|
7d7c25f9be | |
|
|
0ff63e9dc6 | |
|
|
a854add3d8 | |
|
|
c5c8642d2a | |
|
|
3e53a5804a | |
|
|
3ec3e1c8d1 | |
|
|
3f2fe22281 | |
|
|
8672aa4aaa | |
|
|
d9c7a3b836 | |
|
|
ad9104d2b4 | |
|
|
6b05ffe121 | |
|
|
1bfa987bf4 | |
|
|
bc11a75f32 | |
|
|
4ff2cb7c95 | |
|
|
16bfa65a59 | |
|
|
f8704c9a4e | |
|
|
8703963422 | |
|
|
2a19ddd7e4 | |
|
|
6578bfcc88 | |
|
|
e7a8252006 | |
|
|
ce439adae2 | |
|
|
9790cf00ed | |
|
|
03c775461b | |
|
|
8ca59e086c | |
|
|
ed47b1d9ad | |
|
|
752778463e | |
|
|
264d35b58c | |
|
|
d5f49e5a7b | |
|
|
0d89df69b3 | |
|
|
1055cb5e78 | |
|
|
d5a18dc87e | |
|
|
07cdcb909d | |
|
|
22a2be853c | |
|
|
bdd57b78fa | |
|
|
a29adc0147 | |
|
|
3e09217b97 | |
|
|
c2c49478e9 | |
|
|
20ecea9574 | |
|
|
ab53607248 | |
|
|
efd575e884 | |
|
|
265b317356 | |
|
|
1e92bf4fcd | |
|
|
06b91cfdc2 | |
|
|
ab4a7ced0f | |
|
|
cdfa83ab79 | |
|
|
d433715af0 | |
|
|
a4d53f4a22 | |
|
|
4fb483e6a0 | |
|
|
43f7a18b02 | |
|
|
6902b578be | |
|
|
eaf912017f | |
|
|
ab5eb71025 | |
|
|
17a245e6ec | |
|
|
6e5489fcd9 | |
|
|
ed3cf7ac51 | |
|
|
24dee1ce75 | |
|
|
e80b3fae8a | |
|
|
eecf79d57f | |
|
|
eacba56dc5 | |
|
|
8444972909 | |
|
|
64f5bbf55c | |
|
|
8592ed9743 | |
|
|
56fdc0b070 | |
|
|
00dac1bd21 | |
|
|
b8e4e70adf | |
|
|
3b9d6cced3 | |
|
|
26cf5590cb | |
|
|
2af53173c8 | |
|
|
31aac24adb | |
|
|
e12c05d628 | |
|
|
4e6e8d3fda | |
|
|
6abd3f42a8 | |
|
|
7d423e64bf | |
|
|
fbb62163a0 | |
|
|
2fcbcfbefe | |
|
|
0262bef5cd | |
|
|
98ea600e1f | |
|
|
bd70384cd4 | |
|
|
ecd4b59328 | |
|
|
1069a086a6 | |
|
|
3ab9238e91 | |
|
|
d86b49ca04 | |
|
|
61bc93f955 | |
|
|
b2c409dd31 | |
|
|
fde7e0fc84 | |
|
|
6a11b182e1 | |
|
|
dd0785dbc1 | |
|
|
003cf8e090 | |
|
|
0f4e59bd95 | |
|
|
763e5bf88f | |
|
|
ae1eb5f449 | |
|
|
cdcde2bd0b | |
|
|
f7f0d8ccaa | |
|
|
77f6a638a7 | |
|
|
a4cbf9c027 | |
|
|
e3b0737d57 | |
|
|
096e555640 | |
|
|
6f72ceca51 | |
|
|
630d8da8c6 | |
|
|
620cf05ac2 | |
|
|
3b0d995a82 | |
|
|
aac0b4d3ac | |
|
|
dceddb7e31 | |
|
|
6604f5a1d9 | |
|
|
3be51fe651 | |
|
|
bfb16c9781 | |
|
|
b7b92b1e45 | |
|
|
842406f2a6 | |
|
|
45d90067ee | |
|
|
66af8942cb | |
|
|
235b1a2f85 | |
|
|
71031df10a | |
|
|
dc6501456a | |
|
|
600e6d67a2 | |
|
|
b35470b05f | |
|
|
d507727fd7 | |
|
|
6fb0c202be | |
|
|
4d12a28006 | |
|
|
a64aeb648b | |
|
|
4557f02974 | |
|
|
eb1f4cfb58 | |
|
|
83b289da71 | |
|
|
56fb4452c6 | |
|
|
b2810ca912 | |
|
|
c8dd4fb5ea | |
|
|
d3f062dd68 | |
|
|
8d46db6965 | |
|
|
5c9e9edf07 | |
|
|
1bbd615b15 | |
|
|
2518f528c0 | |
|
|
c1fb25264d | |
|
|
2d42465f64 | |
|
|
48b5595082 | |
|
|
da28afe109 | |
|
|
79307b6253 | |
|
|
1de6e89eb2 | |
|
|
42a688eb5f | |
|
|
7bd57c7290 | |
|
|
2fbc146fee | |
|
|
0eafe7e55a | |
|
|
4bf2835dd1 | |
|
|
11121e142a | |
|
|
df42194eec | |
|
|
3134b1b42a | |
|
|
ed5b48b517 | |
|
|
bb66ad3b04 | |
|
|
4e9c7ec4c3 | |
|
|
d111d68be8 | |
|
|
8c9901c072 | |
|
|
268fb77fb5 | |
|
|
a7ac08b8d2 | |
|
|
88d508b32f | |
|
|
89dd8393db | |
|
|
ce84c37abf | |
|
|
194708b54c | |
|
|
d058397410 | |
|
|
19f90f043f | |
|
|
695de1bc3a | |
|
|
e35acfe752 | |
|
|
17226363e7 | |
|
|
80826e4001 | |
|
|
2b35399a73 | |
|
|
5e7649dcb5 | |
|
|
6fb8def272 | |
|
|
85daa22a04 | |
|
|
73f210a604 | |
|
|
789c215e74 | |
|
|
29723f90a1 | |
|
|
4c130b9051 | |
|
|
38e3e8f800 | |
|
|
f1a38ff729 | |
|
|
982afd2929 | |
|
|
7a048a0cc7 | |
|
|
c74c22fb77 | |
|
|
9a8dda30d5 | |
|
|
525429d181 | |
|
|
a3ecb02131 | |
|
|
1b6ea3c295 | |
|
|
9fa4459c50 | |
|
|
6bdba3ef31 | |
|
|
fdf975364b |
|
|
@ -44,6 +44,7 @@ BraceWrapping :
|
|||
SplitEmptyNamespace : true
|
||||
BreakBeforeBinaryOperators : None
|
||||
BreakBeforeBraces : Custom
|
||||
BreakBeforeConceptDeclarations : Always
|
||||
BreakBeforeTernaryOperators : true
|
||||
BreakConstructorInitializers : BeforeComma
|
||||
BreakInheritanceList : BeforeComma
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ BraceWrapping :
|
|||
SplitEmptyNamespace : true
|
||||
BreakBeforeBinaryOperators : None
|
||||
BreakBeforeBraces : Custom
|
||||
BreakBeforeConceptDeclarations : Always
|
||||
BreakBeforeTernaryOperators : true
|
||||
BreakConstructorInitializers : BeforeComma
|
||||
BreakInheritanceList : BeforeComma
|
||||
|
|
|
|||
|
|
@ -44,6 +44,8 @@ BraceWrapping :
|
|||
SplitEmptyNamespace : true
|
||||
BreakBeforeBinaryOperators : None
|
||||
BreakBeforeBraces : Custom
|
||||
# BreakBeforeConceptDeclarations seems to be a boolean with clang-format 14 ?!?
|
||||
BreakBeforeConceptDeclarations : true
|
||||
BreakBeforeTernaryOperators : true
|
||||
BreakConstructorInitializers : BeforeComma
|
||||
BreakInheritanceList : BeforeComma
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ BraceWrapping :
|
|||
SplitEmptyNamespace : true
|
||||
BreakBeforeBinaryOperators : None
|
||||
BreakBeforeBraces : Custom
|
||||
BreakBeforeConceptDeclarations : Always
|
||||
BreakBeforeTernaryOperators : true
|
||||
BreakConstructorInitializers : BeforeComma
|
||||
BreakInheritanceList : BeforeComma
|
||||
|
|
|
|||
|
|
@ -0,0 +1,122 @@
|
|||
---
|
||||
AccessModifierOffset : -2
|
||||
AlignAfterOpenBracket : Align
|
||||
AlignArrayOfStructures : None
|
||||
AlignConsecutiveAssignments : Consecutive
|
||||
AlignConsecutiveBitFields : Consecutive
|
||||
AlignConsecutiveDeclarations : Consecutive
|
||||
AlignConsecutiveMacros : Consecutive
|
||||
AlignEscapedNewlines : Left
|
||||
AlignOperands : AlignAfterOperator
|
||||
AlignTrailingComments :
|
||||
Kind : Always
|
||||
OverEmptyLines : 0
|
||||
AllowAllArgumentsOnNextLine : true
|
||||
AllowAllParametersOfDeclarationOnNextLine : true
|
||||
AllowShortBlocksOnASingleLine : Empty
|
||||
AllowShortCaseLabelsOnASingleLine : true
|
||||
AllowShortEnumsOnASingleLine : true
|
||||
AllowShortFunctionsOnASingleLine : Empty
|
||||
AllowShortIfStatementsOnASingleLine : Never
|
||||
AllowShortLambdasOnASingleLine : All
|
||||
AllowShortLoopsOnASingleLine : false
|
||||
AlwaysBreakAfterReturnType : None
|
||||
AlwaysBreakBeforeMultilineStrings : true
|
||||
AlwaysBreakTemplateDeclarations : Yes
|
||||
BinPackArguments : false
|
||||
BinPackParameters : false
|
||||
BitFieldColonSpacing : Both
|
||||
BraceWrapping :
|
||||
AfterCaseLabel : true
|
||||
AfterClass : true
|
||||
AfterControlStatement : Always
|
||||
AfterEnum : true
|
||||
AfterFunction : true
|
||||
AfterNamespace : true
|
||||
AfterStruct : true
|
||||
AfterUnion : true
|
||||
AfterExternBlock : true
|
||||
BeforeCatch : true
|
||||
BeforeElse : true
|
||||
BeforeLambdaBody : true
|
||||
BeforeWhile : false
|
||||
IndentBraces : false
|
||||
SplitEmptyFunction : true
|
||||
SplitEmptyRecord : true
|
||||
SplitEmptyNamespace : true
|
||||
BreakAfterAttributes: Leave
|
||||
BreakBeforeBinaryOperators : None
|
||||
BreakBeforeBraces : Custom
|
||||
BreakBeforeConceptDeclarations : Always
|
||||
BreakBeforeInlineASMColon : OnlyMultiline
|
||||
BreakBeforeTernaryOperators : true
|
||||
BreakConstructorInitializers : BeforeComma
|
||||
BreakInheritanceList : BeforeComma
|
||||
BreakStringLiterals : false
|
||||
ColumnLimit : 160
|
||||
CompactNamespaces : false
|
||||
ConstructorInitializerIndentWidth : 2
|
||||
ContinuationIndentWidth : 2
|
||||
Cpp11BracedListStyle : false
|
||||
EmptyLineAfterAccessModifier : Never
|
||||
EmptyLineBeforeAccessModifier : LogicalBlock
|
||||
FixNamespaceComments : true
|
||||
IncludeBlocks : Regroup
|
||||
IndentAccessModifiers : false
|
||||
IndentCaseBlocks : true
|
||||
IndentCaseLabels : true
|
||||
IndentExternBlock : true
|
||||
IndentPPDirectives : AfterHash
|
||||
IndentRequiresClause : false
|
||||
IndentWidth : 2
|
||||
IndentWrappedFunctionNames : true
|
||||
InsertBraces : false
|
||||
InsertNewlineAtEOF : true
|
||||
IntegerLiteralSeparator :
|
||||
Binary : 4
|
||||
Decimal : 0
|
||||
Hex : 0
|
||||
KeepEmptyLinesAtTheStartOfBlocks : false
|
||||
LambdaBodyIndentation : Signature
|
||||
MaxEmptyLinesToKeep : 1
|
||||
NamespaceIndentation : All
|
||||
PackConstructorInitializers : NextLine
|
||||
PPIndentWidth : -1
|
||||
PointerAlignment : Middle
|
||||
ReferenceAlignment : Pointer
|
||||
ReflowComments : true
|
||||
RemoveBracesLLVM : false
|
||||
RequiresClausePosition : OwnLine
|
||||
RequiresExpressionIndentation : Keyword
|
||||
SeparateDefinitionBlocks : Always
|
||||
ShortNamespaceLines : 0
|
||||
SortIncludes : true
|
||||
SortUsingDeclarations : true
|
||||
SpaceAfterCStyleCast : false
|
||||
SpaceAfterLogicalNot : false
|
||||
SpaceAfterTemplateKeyword : true
|
||||
SpaceAroundPointerQualifiers : Both
|
||||
SpaceBeforeAssignmentOperators : true
|
||||
SpaceBeforeCaseColon : false
|
||||
SpaceBeforeCpp11BracedList : false
|
||||
SpaceBeforeCtorInitializerColon : true
|
||||
SpaceBeforeInheritanceColon : true
|
||||
SpaceBeforeParens : ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon : true
|
||||
SpaceBeforeSquareBrackets : false
|
||||
SpaceInEmptyBlock : false
|
||||
SpaceInEmptyParentheses : false
|
||||
SpacesBeforeTrailingComments : 2
|
||||
SpacesInAngles : false
|
||||
SpacesInCStyleCastParentheses : false
|
||||
SpacesInConditionalStatement : true
|
||||
SpacesInContainerLiterals : false
|
||||
SpacesInLineCommentPrefix :
|
||||
Minimum : 1
|
||||
Maximum : -1
|
||||
SpacesInParentheses : true
|
||||
SpacesInSquareBrackets : false
|
||||
Standard : Latest
|
||||
UseCRLF : true
|
||||
UseTab : Never
|
||||
...
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
---
|
||||
AccessModifierOffset : -2
|
||||
AlignAfterOpenBracket : Align
|
||||
AlignArrayOfStructures : None
|
||||
AlignConsecutiveAssignments : Consecutive
|
||||
AlignConsecutiveBitFields : Consecutive
|
||||
AlignConsecutiveShortCaseStatements :
|
||||
Enabled : true
|
||||
AcrossEmptyLines : false
|
||||
AcrossComments : true
|
||||
AlignCaseColons : true
|
||||
AlignConsecutiveDeclarations : Consecutive
|
||||
AlignConsecutiveMacros : Consecutive
|
||||
AlignEscapedNewlines : Left
|
||||
AlignOperands : AlignAfterOperator
|
||||
AlignTrailingComments :
|
||||
Kind : Always
|
||||
OverEmptyLines : 0
|
||||
AllowAllArgumentsOnNextLine : true
|
||||
AllowAllParametersOfDeclarationOnNextLine : true
|
||||
AllowShortBlocksOnASingleLine : Empty
|
||||
AllowShortCaseLabelsOnASingleLine : true
|
||||
AllowShortEnumsOnASingleLine : true
|
||||
AllowShortFunctionsOnASingleLine : Empty
|
||||
AllowShortIfStatementsOnASingleLine : Never
|
||||
AllowShortLambdasOnASingleLine : All
|
||||
AllowShortLoopsOnASingleLine : false
|
||||
AlwaysBreakAfterReturnType : None
|
||||
AlwaysBreakBeforeMultilineStrings : true
|
||||
AlwaysBreakTemplateDeclarations : Yes
|
||||
BinPackArguments : false
|
||||
BinPackParameters : false
|
||||
BitFieldColonSpacing : Both
|
||||
BracedInitializerIndentWidth : 2
|
||||
BraceWrapping :
|
||||
AfterCaseLabel : true
|
||||
AfterClass : true
|
||||
AfterControlStatement : Always
|
||||
AfterEnum : true
|
||||
AfterFunction : true
|
||||
AfterNamespace : true
|
||||
AfterStruct : true
|
||||
AfterUnion : true
|
||||
AfterExternBlock : true
|
||||
BeforeCatch : true
|
||||
BeforeElse : true
|
||||
BeforeLambdaBody : true
|
||||
BeforeWhile : false
|
||||
IndentBraces : false
|
||||
SplitEmptyFunction : true
|
||||
SplitEmptyRecord : true
|
||||
SplitEmptyNamespace : true
|
||||
BreakAfterAttributes: Leave
|
||||
BreakBeforeBinaryOperators : None
|
||||
BreakBeforeBraces : Custom
|
||||
BreakBeforeConceptDeclarations : Always
|
||||
BreakBeforeInlineASMColon : OnlyMultiline
|
||||
BreakBeforeTernaryOperators : true
|
||||
BreakConstructorInitializers : BeforeComma
|
||||
BreakInheritanceList : BeforeComma
|
||||
BreakStringLiterals : false
|
||||
ColumnLimit : 160
|
||||
CompactNamespaces : false
|
||||
ConstructorInitializerIndentWidth : 2
|
||||
ContinuationIndentWidth : 2
|
||||
Cpp11BracedListStyle : false
|
||||
EmptyLineAfterAccessModifier : Never
|
||||
EmptyLineBeforeAccessModifier : LogicalBlock
|
||||
FixNamespaceComments : true
|
||||
IncludeBlocks : Regroup
|
||||
IndentAccessModifiers : false
|
||||
IndentCaseBlocks : true
|
||||
IndentCaseLabels : true
|
||||
IndentExternBlock : true
|
||||
IndentPPDirectives : AfterHash
|
||||
IndentRequiresClause : false
|
||||
IndentWidth : 2
|
||||
IndentWrappedFunctionNames : true
|
||||
InsertBraces : false
|
||||
InsertNewlineAtEOF : true
|
||||
IntegerLiteralSeparator :
|
||||
Binary : 4
|
||||
Decimal : 0
|
||||
Hex : 0
|
||||
KeepEmptyLinesAtTheStartOfBlocks : false
|
||||
LambdaBodyIndentation : Signature
|
||||
MaxEmptyLinesToKeep : 1
|
||||
NamespaceIndentation : All
|
||||
PackConstructorInitializers : NextLine
|
||||
PPIndentWidth : -1
|
||||
PointerAlignment : Middle
|
||||
ReferenceAlignment : Pointer
|
||||
ReflowComments : true
|
||||
RemoveBracesLLVM : false
|
||||
RequiresClausePosition : OwnLine
|
||||
RequiresExpressionIndentation : Keyword
|
||||
SeparateDefinitionBlocks : Always
|
||||
ShortNamespaceLines : 0
|
||||
SortIncludes : true
|
||||
SortUsingDeclarations : true
|
||||
SpaceAfterCStyleCast : false
|
||||
SpaceAfterLogicalNot : false
|
||||
SpaceAfterTemplateKeyword : true
|
||||
SpaceAroundPointerQualifiers : Both
|
||||
SpaceBeforeAssignmentOperators : true
|
||||
SpaceBeforeCaseColon : false
|
||||
SpaceBeforeCpp11BracedList : false
|
||||
SpaceBeforeCtorInitializerColon : true
|
||||
SpaceBeforeInheritanceColon : true
|
||||
SpaceBeforeParens : ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon : true
|
||||
SpaceBeforeSquareBrackets : false
|
||||
SpaceInEmptyBlock : false
|
||||
SpaceInEmptyParentheses : false
|
||||
SpacesBeforeTrailingComments : 2
|
||||
SpacesInAngles : false
|
||||
SpacesInContainerLiterals : false
|
||||
SpacesInLineCommentPrefix :
|
||||
Minimum : 1
|
||||
Maximum : -1
|
||||
SpacesInParens : Custom
|
||||
SpacesInParensOptions :
|
||||
InConditionalStatements : true
|
||||
InCStyleCasts : false
|
||||
InEmptyParentheses : false
|
||||
Other : true
|
||||
SpacesInSquareBrackets : false
|
||||
Standard : Latest
|
||||
UseCRLF : true
|
||||
UseTab : Never
|
||||
...
|
||||
|
|
@ -0,0 +1,134 @@
|
|||
---
|
||||
AccessModifierOffset : -2
|
||||
AlignAfterOpenBracket : Align
|
||||
AlignArrayOfStructures : None
|
||||
AlignConsecutiveAssignments : Consecutive
|
||||
AlignConsecutiveBitFields : Consecutive
|
||||
AlignConsecutiveShortCaseStatements :
|
||||
Enabled : true
|
||||
AcrossEmptyLines : false
|
||||
AcrossComments : true
|
||||
AlignCaseColons : true
|
||||
AlignConsecutiveDeclarations : Consecutive
|
||||
AlignConsecutiveMacros : Consecutive
|
||||
AlignEscapedNewlines : Left
|
||||
AlignOperands : AlignAfterOperator
|
||||
AlignTrailingComments :
|
||||
Kind : Always
|
||||
OverEmptyLines : 0
|
||||
AllowAllArgumentsOnNextLine : true
|
||||
AllowAllParametersOfDeclarationOnNextLine : true
|
||||
AllowBreakBeforeNoexceptSpecifier : Always
|
||||
AllowShortBlocksOnASingleLine : Empty
|
||||
AllowShortCaseLabelsOnASingleLine : true
|
||||
AllowShortCompoundRequirementOnASingleLine : true
|
||||
AllowShortEnumsOnASingleLine : true
|
||||
AllowShortFunctionsOnASingleLine : Empty
|
||||
AllowShortIfStatementsOnASingleLine : Never
|
||||
AllowShortLambdasOnASingleLine : All
|
||||
AllowShortLoopsOnASingleLine : false
|
||||
AlwaysBreakAfterReturnType : None
|
||||
AlwaysBreakBeforeMultilineStrings : true
|
||||
AlwaysBreakTemplateDeclarations : Yes
|
||||
BinPackArguments : false
|
||||
BinPackParameters : false
|
||||
BitFieldColonSpacing : Both
|
||||
BracedInitializerIndentWidth : 2
|
||||
BraceWrapping :
|
||||
AfterCaseLabel : true
|
||||
AfterClass : true
|
||||
AfterControlStatement : Always
|
||||
AfterEnum : true
|
||||
AfterFunction : true
|
||||
AfterNamespace : true
|
||||
AfterStruct : true
|
||||
AfterUnion : true
|
||||
AfterExternBlock : true
|
||||
BeforeCatch : true
|
||||
BeforeElse : true
|
||||
BeforeLambdaBody : true
|
||||
BeforeWhile : false
|
||||
IndentBraces : false
|
||||
SplitEmptyFunction : true
|
||||
SplitEmptyRecord : true
|
||||
SplitEmptyNamespace : true
|
||||
BreakAdjacentStringLiterals : false
|
||||
BreakAfterAttributes: Leave
|
||||
BreakBeforeBinaryOperators : None
|
||||
BreakBeforeBraces : Custom
|
||||
BreakBeforeConceptDeclarations : Always
|
||||
BreakBeforeInlineASMColon : OnlyMultiline
|
||||
BreakBeforeTernaryOperators : true
|
||||
BreakConstructorInitializers : BeforeComma
|
||||
BreakInheritanceList : BeforeComma
|
||||
BreakStringLiterals : false
|
||||
ColumnLimit : 160
|
||||
CompactNamespaces : false
|
||||
ConstructorInitializerIndentWidth : 2
|
||||
ContinuationIndentWidth : 2
|
||||
Cpp11BracedListStyle : false
|
||||
EmptyLineAfterAccessModifier : Never
|
||||
EmptyLineBeforeAccessModifier : LogicalBlock
|
||||
FixNamespaceComments : true
|
||||
IncludeBlocks : Regroup
|
||||
IndentAccessModifiers : false
|
||||
IndentCaseBlocks : true
|
||||
IndentCaseLabels : true
|
||||
IndentExternBlock : true
|
||||
IndentPPDirectives : AfterHash
|
||||
IndentRequiresClause : false
|
||||
IndentWidth : 2
|
||||
IndentWrappedFunctionNames : true
|
||||
InsertBraces : false
|
||||
InsertNewlineAtEOF : true
|
||||
IntegerLiteralSeparator :
|
||||
Binary : 4
|
||||
Decimal : 0
|
||||
Hex : 0
|
||||
KeepEmptyLinesAtTheStartOfBlocks : false
|
||||
LambdaBodyIndentation : Signature
|
||||
MaxEmptyLinesToKeep : 1
|
||||
NamespaceIndentation : All
|
||||
PackConstructorInitializers : NextLine
|
||||
PPIndentWidth : -1
|
||||
PointerAlignment : Middle
|
||||
ReferenceAlignment : Pointer
|
||||
ReflowComments : true
|
||||
RemoveBracesLLVM : false
|
||||
RequiresClausePosition : OwnLine
|
||||
RequiresExpressionIndentation : Keyword
|
||||
SeparateDefinitionBlocks : Always
|
||||
ShortNamespaceLines : 0
|
||||
SortIncludes : true
|
||||
SortUsingDeclarations : true
|
||||
SpaceAfterCStyleCast : false
|
||||
SpaceAfterLogicalNot : false
|
||||
SpaceAfterTemplateKeyword : true
|
||||
SpaceAroundPointerQualifiers : Both
|
||||
SpaceBeforeAssignmentOperators : true
|
||||
SpaceBeforeCaseColon : false
|
||||
SpaceBeforeCpp11BracedList : false
|
||||
SpaceBeforeCtorInitializerColon : true
|
||||
SpaceBeforeInheritanceColon : true
|
||||
SpaceBeforeParens : ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon : true
|
||||
SpaceBeforeSquareBrackets : false
|
||||
SpaceInEmptyBlock : false
|
||||
SpaceInEmptyParentheses : false
|
||||
SpacesBeforeTrailingComments : 2
|
||||
SpacesInAngles : false
|
||||
SpacesInContainerLiterals : false
|
||||
SpacesInLineCommentPrefix :
|
||||
Minimum : 1
|
||||
Maximum : -1
|
||||
SpacesInParens : Custom
|
||||
SpacesInParensOptions :
|
||||
InConditionalStatements : true
|
||||
InCStyleCasts : false
|
||||
InEmptyParentheses : false
|
||||
Other : true
|
||||
SpacesInSquareBrackets : false
|
||||
Standard : Latest
|
||||
UseCRLF : true
|
||||
UseTab : Never
|
||||
...
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
|
||||
name: Self-hosted Linux
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: [self-hosted, linux]
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
compiler: [clang++-16, clang++-17, clang++-18, g++-12, g++-13, g++-14]
|
||||
cpp_standard: [11, 14, 17, 20, 23]
|
||||
build_type: [Debug, Release]
|
||||
exclude:
|
||||
- cpp_standard: 23
|
||||
compiler: clang++-17 # clang++-17 gives some strange errors in std::tuple !
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install libraries
|
||||
run: sudo apt update && sudo apt install libgl-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev
|
||||
|
||||
- name: Install Ninja
|
||||
uses: ashutoshvarma/setup-ninja@master
|
||||
with:
|
||||
version: 1.11.0
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
modules_flag=${{(contains(fromJSON('["clang++-16", "g++-12", "g++-13", "g++-14"]'), matrix.compiler) || matrix.cpp_standard < 20) && 'OFF' || 'ON'}}
|
||||
cmake -B build/${{matrix.cpp_standard}}/${{matrix.build_type}} -GNinja \
|
||||
-DVULKAN_HPP_SAMPLES_BUILD=ON \
|
||||
-DVULKAN_HPP_TESTS_BUILD=ON \
|
||||
-DVULKAN_HPP_ENABLE_CPP20_MODULES=$modules_flag \
|
||||
-DVULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
|
||||
-DVULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
|
||||
-DVULKAN_HPP_PRECOMPILE=OFF \
|
||||
-DVULKAN_HPP_RUN_GENERATOR=ON \
|
||||
-DCMAKE_CXX_COMPILER=${{matrix.compiler}} \
|
||||
-DCMAKE_CXX_STANDARD=${{matrix.cpp_standard}} \
|
||||
-DCMAKE_BUILD_TYPE=${{matrix.build_type}}
|
||||
cmake --build build/${{matrix.cpp_standard}}/${{matrix.build_type}} --parallel
|
||||
|
|
@ -7,11 +7,12 @@ on:
|
|||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: macos-latest
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
compiler: [clang++, g++-11]
|
||||
os: [macos-14, macos-15]
|
||||
compiler: [clang++]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
|
@ -26,24 +27,91 @@ jobs:
|
|||
uses: ashutoshvarma/setup-ninja@master
|
||||
with:
|
||||
version: 1.11.0
|
||||
|
||||
- name: Loop over cpp_standards (11, 14, ...) and build_types (Debug, Release)
|
||||
|
||||
- name: Install glm, glfw and glslang
|
||||
run: |
|
||||
for cpp_standard in 11 14 17 20 23
|
||||
do
|
||||
for build_type in Debug Release
|
||||
do
|
||||
cmake -B build/$cpp_standard/$build_type -GNinja \
|
||||
-DVULKAN_HPP_SAMPLES_BUILD=ON \
|
||||
-DVULKAN_HPP_SAMPLES_BUILD_ONLY_DYNAMIC=ON \
|
||||
-DVULKAN_HPP_TESTS_BUILD=ON \
|
||||
-DVULKAN_HPP_TESTS_BUILD_ONLY_DYNAMIC=ON \
|
||||
-DVULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
|
||||
-DVULKAN_HPP_PRECOMPILE=OFF \
|
||||
-DVULKAN_HPP_RUN_GENERATOR=ON \
|
||||
-DCMAKE_CXX_COMPILER=${{matrix.compiler}} \
|
||||
-DCMAKE_CXX_STANDARD=$cpp_standard \
|
||||
-DCMAKE_BUILD_TYPE=$build_type
|
||||
cmake --build build/$cpp_standard/$build_type --parallel
|
||||
cd glm
|
||||
cmake -B build -G Ninja \
|
||||
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
|
||||
-D CMAKE_CXX_STANDARD=11 \
|
||||
-D CMAKE_BUILD_TYPE=Release \
|
||||
-D GLM_BUILD_LIBRARY=ON \
|
||||
-D GLM_BUILD_INSTALL=ON \
|
||||
-D GLM_BUILD_TESTS=OFF
|
||||
cmake --build build --parallel
|
||||
sudo cmake --install build
|
||||
|
||||
cd ../glfw
|
||||
cmake -B build -G Ninja \
|
||||
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
|
||||
-D CMAKE_CXX_STANDARD=11 \
|
||||
-D CMAKE_BUILD_TYPE=Release \
|
||||
-D GLFW_BUILD_EXAMPLES=OFF \
|
||||
-D GLFW_BUILD_TESTS=OFF \
|
||||
-D GLFW_BUILD_DOCS=OFF \
|
||||
-D GLFW_INSTALL=ON
|
||||
cmake --build build --parallel
|
||||
sudo cmake --install build
|
||||
|
||||
cd ../glslang
|
||||
cmake -B build -G Ninja \
|
||||
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
|
||||
-D CMAKE_CXX_STANDARD=11 \
|
||||
-D CMAKE_BUILD_TYPE=Release \
|
||||
-D ENABLE_OPT=OFF \
|
||||
-D GLSLANG_TESTS_DEFAULT=OFF \
|
||||
-D GLSLANG_ENABLE_INSTALL_DEFAULT=ON
|
||||
cmake --build build --parallel
|
||||
sudo cmake --install build
|
||||
cd ..
|
||||
|
||||
- name: Generate headers
|
||||
run: |
|
||||
cmake -B build -G Ninja \
|
||||
-D VULKAN_HPP_GENERATOR_BUILD=ON \
|
||||
-D VULKAN_HPP_RUN_GENERATOR=OFF \
|
||||
-D VULKAN_HPP_SAMPLES_BUILD=OFF \
|
||||
-D VULKAN_HPP_TESTS_BUILD=OFF \
|
||||
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
|
||||
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
|
||||
-D VULKAN_HPP_PRECOMPILE=OFF \
|
||||
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
|
||||
-D CMAKE_CXX_STANDARD=20 \
|
||||
-D CMAKE_BUILD_TYPE=Debug
|
||||
cmake --build build --parallel
|
||||
|
||||
cmake -B build -G Ninja --fresh \
|
||||
-D VULKAN_HPP_GENERATOR_BUILD=ON \
|
||||
-D VULKAN_HPP_RUN_GENERATOR=ON \
|
||||
-D VULKAN_HPP_SAMPLES_BUILD=OFF \
|
||||
-D VULKAN_HPP_TESTS_BUILD=OFF \
|
||||
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
|
||||
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
|
||||
-D VULKAN_HPP_PRECOMPILE=OFF \
|
||||
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
|
||||
-D CMAKE_CXX_STANDARD=20 \
|
||||
-D CMAKE_BUILD_TYPE=Release
|
||||
cmake --build build --parallel --clean-first
|
||||
|
||||
- name: Build samples and tests
|
||||
run: |
|
||||
for CXX_STANDARD in 11 14 17 20 23; do
|
||||
for BUILD_TYPE in Debug Release; do
|
||||
echo "================================================================================="
|
||||
echo "Building C++$CXX_STANDARD in $BUILD_TYPE"
|
||||
echo "================================================================================="
|
||||
|
||||
cmake -B build -G Ninja --fresh \
|
||||
-D VULKAN_HPP_GENERATOR_BUILD=OFF \
|
||||
-D VULKAN_HPP_RUN_GENERATOR=OFF \
|
||||
-D VULKAN_HPP_SAMPLES_BUILD=ON \
|
||||
-D VULKAN_HPP_TESTS_BUILD=ON \
|
||||
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
|
||||
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
|
||||
-D VULKAN_HPP_PRECOMPILE=OFF \
|
||||
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
|
||||
-D CMAKE_CXX_STANDARD=$CXX_STANDARD \
|
||||
-D CMAKE_BUILD_TYPE=$BUILD_TYPE
|
||||
cmake --build build --parallel --clean-first
|
||||
done
|
||||
done
|
||||
|
|
|
|||
|
|
@ -0,0 +1,125 @@
|
|||
|
||||
name: CI Ubuntu 22
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
compiler: [clang++-13, clang++-14, clang++-15, g++-10, g++-11]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install libraries
|
||||
run: sudo apt update && sudo apt install libgl-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev
|
||||
|
||||
- name: Install Ninja
|
||||
uses: ashutoshvarma/setup-ninja@master
|
||||
with:
|
||||
version: 1.11.0
|
||||
|
||||
- name: Install glm, glfw and glslang
|
||||
run: |
|
||||
cd glm
|
||||
cmake -B build -G Ninja \
|
||||
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
|
||||
-D CMAKE_CXX_STANDARD=11 \
|
||||
-D CMAKE_BUILD_TYPE=Release \
|
||||
-D GLM_BUILD_LIBRARY=ON \
|
||||
-D GLM_BUILD_INSTALL=ON \
|
||||
-D GLM_BUILD_TESTS=OFF
|
||||
cmake --build build --parallel
|
||||
sudo cmake --install build
|
||||
|
||||
cd ../glfw
|
||||
cmake -B build -G Ninja \
|
||||
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
|
||||
-D CMAKE_CXX_STANDARD=11 \
|
||||
-D CMAKE_BUILD_TYPE=Release \
|
||||
-D GLFW_BUILD_EXAMPLES=OFF \
|
||||
-D GLFW_BUILD_TESTS=OFF \
|
||||
-D GLFW_BUILD_DOCS=OFF \
|
||||
-D GLFW_INSTALL=ON
|
||||
cmake --build build --parallel
|
||||
sudo cmake --install build
|
||||
|
||||
cd ../glslang
|
||||
cmake -B build -G Ninja \
|
||||
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
|
||||
-D CMAKE_CXX_STANDARD=11 \
|
||||
-D CMAKE_BUILD_TYPE=Release \
|
||||
-D ENABLE_OPT=OFF \
|
||||
-D GLSLANG_TESTS_DEFAULT=OFF \
|
||||
-D GLSLANG_ENABLE_INSTALL_DEFAULT=ON
|
||||
cmake --build build --parallel
|
||||
sudo cmake --install build
|
||||
cd ..
|
||||
|
||||
- name: Generate headers
|
||||
run: |
|
||||
cmake -B build -G Ninja \
|
||||
-D VULKAN_HPP_GENERATOR_BUILD=ON \
|
||||
-D VULKAN_HPP_RUN_GENERATOR=OFF \
|
||||
-D VULKAN_HPP_SAMPLES_BUILD=OFF \
|
||||
-D VULKAN_HPP_TESTS_BUILD=OFF \
|
||||
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
|
||||
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
|
||||
-D VULKAN_HPP_PRECOMPILE=OFF \
|
||||
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
|
||||
-D CMAKE_CXX_STANDARD=20 \
|
||||
-D CMAKE_BUILD_TYPE=Debug
|
||||
cmake --build build --parallel
|
||||
|
||||
cmake -B build -G Ninja --fresh \
|
||||
-D VULKAN_HPP_GENERATOR_BUILD=ON \
|
||||
-D VULKAN_HPP_RUN_GENERATOR=ON \
|
||||
-D VULKAN_HPP_SAMPLES_BUILD=OFF \
|
||||
-D VULKAN_HPP_TESTS_BUILD=OFF \
|
||||
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
|
||||
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
|
||||
-D VULKAN_HPP_PRECOMPILE=OFF \
|
||||
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
|
||||
-D CMAKE_CXX_STANDARD=20 \
|
||||
-D CMAKE_BUILD_TYPE=Release
|
||||
cmake --build build --parallel --clean-first
|
||||
|
||||
- name: Build samples and tests
|
||||
run: |
|
||||
for CXX_STANDARD in 11 14 17 20 23; do
|
||||
for BUILD_TYPE in Debug Release; do
|
||||
if [ ${{matrix.compiler}} == g++-10 ]; then
|
||||
if [ $CXX_STANDARD == 20 ] || [ $CXX_STANDARD == 23 ]; then
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "================================================================================="
|
||||
echo "Building C++$CXX_STANDARD in $BUILD_TYPE"
|
||||
echo "================================================================================="
|
||||
|
||||
cmake -B build -G Ninja --fresh \
|
||||
-D VULKAN_HPP_GENERATOR_BUILD=OFF \
|
||||
-D VULKAN_HPP_RUN_GENERATOR=OFF \
|
||||
-D VULKAN_HPP_SAMPLES_BUILD=ON \
|
||||
-D VULKAN_HPP_TESTS_BUILD=ON \
|
||||
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
|
||||
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
|
||||
-D VULKAN_HPP_PRECOMPILE=OFF \
|
||||
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
|
||||
-D CMAKE_CXX_STANDARD=$CXX_STANDARD \
|
||||
-D CMAKE_BUILD_TYPE=$BUILD_TYPE
|
||||
cmake --build build --parallel --clean-first
|
||||
done
|
||||
done
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
|
||||
name: CI Ubuntu 24
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
compiler: [clang++-16, clang++-17, clang++-18, g++-12, g++-13, g++-14]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install libraries
|
||||
run: sudo apt update && sudo apt install libgl-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev
|
||||
|
||||
- name: Install Ninja
|
||||
uses: ashutoshvarma/setup-ninja@master
|
||||
with:
|
||||
version: 1.11.0
|
||||
|
||||
- name: Install glm, glfw and glslang
|
||||
run: |
|
||||
cd glm
|
||||
cmake -B build -G Ninja \
|
||||
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
|
||||
-D CMAKE_CXX_STANDARD=11 \
|
||||
-D CMAKE_BUILD_TYPE=Release \
|
||||
-D GLM_BUILD_LIBRARY=ON \
|
||||
-D GLM_BUILD_INSTALL=ON \
|
||||
-D GLM_BUILD_TESTS=OFF
|
||||
cmake --build build --parallel
|
||||
sudo cmake --install build
|
||||
|
||||
cd ../glfw
|
||||
cmake -B build -G Ninja \
|
||||
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
|
||||
-D CMAKE_CXX_STANDARD=11 \
|
||||
-D CMAKE_BUILD_TYPE=Release \
|
||||
-D GLFW_BUILD_EXAMPLES=OFF \
|
||||
-D GLFW_BUILD_TESTS=OFF \
|
||||
-D GLFW_BUILD_DOCS=OFF \
|
||||
-D GLFW_INSTALL=ON
|
||||
cmake --build build --parallel
|
||||
sudo cmake --install build
|
||||
|
||||
cd ../glslang
|
||||
cmake -B build -G Ninja \
|
||||
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
|
||||
-D CMAKE_CXX_STANDARD=11 \
|
||||
-D CMAKE_BUILD_TYPE=Release \
|
||||
-D ENABLE_OPT=OFF \
|
||||
-D GLSLANG_TESTS_DEFAULT=OFF \
|
||||
-D GLSLANG_ENABLE_INSTALL_DEFAULT=ON
|
||||
cmake --build build --parallel
|
||||
sudo cmake --install build
|
||||
cd ..
|
||||
|
||||
- name: Generate headers
|
||||
run: |
|
||||
cmake -B build -G Ninja \
|
||||
-D VULKAN_HPP_GENERATOR_BUILD=ON \
|
||||
-D VULKAN_HPP_RUN_GENERATOR=OFF \
|
||||
-D VULKAN_HPP_SAMPLES_BUILD=OFF \
|
||||
-D VULKAN_HPP_TESTS_BUILD=OFF \
|
||||
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
|
||||
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
|
||||
-D VULKAN_HPP_PRECOMPILE=OFF \
|
||||
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
|
||||
-D CMAKE_CXX_STANDARD=20 \
|
||||
-D CMAKE_BUILD_TYPE=Debug
|
||||
cmake --build build --parallel
|
||||
|
||||
cmake -B build -G Ninja --fresh \
|
||||
-D VULKAN_HPP_GENERATOR_BUILD=ON \
|
||||
-D VULKAN_HPP_RUN_GENERATOR=ON \
|
||||
-D VULKAN_HPP_SAMPLES_BUILD=OFF \
|
||||
-D VULKAN_HPP_TESTS_BUILD=OFF \
|
||||
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
|
||||
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
|
||||
-D VULKAN_HPP_PRECOMPILE=OFF \
|
||||
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
|
||||
-D CMAKE_CXX_STANDARD=20 \
|
||||
-D CMAKE_BUILD_TYPE=Release
|
||||
cmake --build build --parallel --clean-first
|
||||
|
||||
- name: Build samples and tests
|
||||
run: |
|
||||
for CXX_STANDARD in 11 14 17 20 23; do
|
||||
for BUILD_TYPE in Debug Release; do
|
||||
if [ ${{matrix.compiler}} == clang++-17 ] && [ $CXX_STANDARD == 23 ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
CXX_MODULES=ON
|
||||
for compiler in "clang++-16" "g++-12" "g++-13" "g++-14"; do
|
||||
if [ ${{matrix.compiler}} == $compiler ] || [ $CXX_STANDARD -lt 20 ]; then
|
||||
CXX_MODULES=OFF
|
||||
fi
|
||||
done
|
||||
|
||||
echo "================================================================================="
|
||||
echo "Building C++$CXX_STANDARD in $BUILD_TYPE"
|
||||
echo "================================================================================="
|
||||
|
||||
cmake -B build -G Ninja --fresh \
|
||||
-D VULKAN_HPP_GENERATOR_BUILD=OFF \
|
||||
-D VULKAN_HPP_RUN_GENERATOR=OFF \
|
||||
-D VULKAN_HPP_SAMPLES_BUILD=ON \
|
||||
-D VULKAN_HPP_TESTS_BUILD=ON \
|
||||
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
|
||||
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
|
||||
-D VULKAN_HPP_PRECOMPILE=OFF \
|
||||
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} \
|
||||
-D CMAKE_CXX_STANDARD=$CXX_STANDARD \
|
||||
-D CMAKE_BUILD_TYPE=$BUILD_TYPE
|
||||
cmake --build build --parallel --clean-first
|
||||
done
|
||||
done
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
|
||||
name: CI Ubuntu EXT
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
clang_version: [19, 20]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install libraries
|
||||
run: sudo apt update && sudo apt install libgl-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev
|
||||
|
||||
- name: Install Ninja
|
||||
uses: ashutoshvarma/setup-ninja@master
|
||||
with:
|
||||
version: 1.11.0
|
||||
- name: Install Clang and CMake
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install lsb-release gpg software-properties-common wget
|
||||
wget https://apt.llvm.org/llvm.sh
|
||||
chmod +x llvm.sh
|
||||
sudo ./llvm.sh ${{matrix.clang_version}} all
|
||||
|
||||
sudo apt purge --auto-remove cmake
|
||||
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
|
||||
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ noble main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null
|
||||
sudo apt update && sudo apt install cmake
|
||||
|
||||
- name: Install glm, glfw and glslang
|
||||
run: |
|
||||
cd glm
|
||||
cmake -B build -G Ninja \
|
||||
-D CMAKE_CXX_COMPILER=clang++-${{matrix.clang_version}} \
|
||||
-D CMAKE_CXX_STANDARD=11 \
|
||||
-D CMAKE_BUILD_TYPE=Release \
|
||||
-D GLM_BUILD_LIBRARY=ON \
|
||||
-D GLM_BUILD_INSTALL=ON \
|
||||
-D GLM_BUILD_TESTS=OFF
|
||||
cmake --build build --parallel
|
||||
sudo cmake --install build
|
||||
|
||||
cd ../glfw
|
||||
cmake -B build -G Ninja \
|
||||
-D CMAKE_CXX_COMPILER=clang++-${{matrix.clang_version}} \
|
||||
-D CMAKE_CXX_STANDARD=11 \
|
||||
-D CMAKE_BUILD_TYPE=Release \
|
||||
-D GLFW_BUILD_EXAMPLES=OFF \
|
||||
-D GLFW_BUILD_TESTS=OFF \
|
||||
-D GLFW_BUILD_DOCS=OFF \
|
||||
-D GLFW_INSTALL=ON
|
||||
cmake --build build --parallel
|
||||
sudo cmake --install build
|
||||
|
||||
cd ../glslang
|
||||
cmake -B build -G Ninja \
|
||||
-D CMAKE_CXX_COMPILER=clang++-${{matrix.clang_version}} \
|
||||
-D CMAKE_CXX_STANDARD=11 \
|
||||
-D CMAKE_BUILD_TYPE=Release \
|
||||
-D ENABLE_OPT=OFF \
|
||||
-D GLSLANG_TESTS_DEFAULT=OFF \
|
||||
-D GLSLANG_ENABLE_INSTALL_DEFAULT=ON
|
||||
cmake --build build --parallel
|
||||
sudo cmake --install build
|
||||
cd ..
|
||||
|
||||
- name: Generate headers
|
||||
run: |
|
||||
cmake -B build -G Ninja \
|
||||
-D VULKAN_HPP_GENERATOR_BUILD=ON \
|
||||
-D VULKAN_HPP_RUN_GENERATOR=OFF \
|
||||
-D VULKAN_HPP_SAMPLES_BUILD=OFF \
|
||||
-D VULKAN_HPP_TESTS_BUILD=OFF \
|
||||
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
|
||||
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
|
||||
-D VULKAN_HPP_PRECOMPILE=OFF \
|
||||
-D CMAKE_CXX_COMPILER=clang++-${{matrix.clang_version}} \
|
||||
-D CMAKE_CXX_STANDARD=20 \
|
||||
-D CMAKE_BUILD_TYPE=Debug
|
||||
cmake --build build --parallel
|
||||
|
||||
cmake -B build -G Ninja --fresh \
|
||||
-D VULKAN_HPP_GENERATOR_BUILD=ON \
|
||||
-D VULKAN_HPP_RUN_GENERATOR=ON \
|
||||
-D VULKAN_HPP_SAMPLES_BUILD=OFF \
|
||||
-D VULKAN_HPP_TESTS_BUILD=OFF \
|
||||
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
|
||||
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
|
||||
-D VULKAN_HPP_PRECOMPILE=OFF \
|
||||
-D CMAKE_CXX_COMPILER=clang++-${{matrix.clang_version}} \
|
||||
-D CMAKE_CXX_STANDARD=20 \
|
||||
-D CMAKE_BUILD_TYPE=Release
|
||||
cmake --build build --parallel --clean-first
|
||||
|
||||
- name: Build samples and tests
|
||||
run: |
|
||||
for CXX_STANDARD in 11 14 17 20 23; do
|
||||
for BUILD_TYPE in Debug Release; do
|
||||
|
||||
CXX_MODULES=ON
|
||||
if [ $CXX_STANDARD -lt 20 ]; then
|
||||
CXX_MODULES=OFF
|
||||
fi
|
||||
|
||||
echo "================================================================================="
|
||||
echo "Building C++$CXX_STANDARD in $BUILD_TYPE"
|
||||
echo "================================================================================="
|
||||
|
||||
cmake -B build -G Ninja --fresh \
|
||||
-D VULKAN_HPP_GENERATOR_BUILD=OFF \
|
||||
-D VULKAN_HPP_RUN_GENERATOR=OFF \
|
||||
-D VULKAN_HPP_SAMPLES_BUILD=ON \
|
||||
-D VULKAN_HPP_TESTS_BUILD=ON \
|
||||
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
|
||||
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
|
||||
-D VULKAN_HPP_PRECOMPILE=OFF \
|
||||
-D CMAKE_CXX_COMPILER=clang++-${{matrix.clang_version}} \
|
||||
-D CMAKE_CXX_STANDARD=$CXX_STANDARD \
|
||||
-D CMAKE_BUILD_TYPE=$BUILD_TYPE
|
||||
cmake --build build --parallel --clean-first
|
||||
done
|
||||
done
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
|
||||
name: CI Ubuntu
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
compiler: [clang++-13, clang++-14, g++-9, g++-10, g++-11]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install libraries
|
||||
run: sudo apt update && sudo apt install libgl-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev
|
||||
|
||||
- name: Install Ninja
|
||||
uses: ashutoshvarma/setup-ninja@master
|
||||
with:
|
||||
version: 1.11.0
|
||||
|
||||
- name: Loop over cpp_standards (11, 14, ...) and build_types (Debug, Release)
|
||||
run: |
|
||||
for cpp_standard in 11 14 17 20
|
||||
do
|
||||
for build_type in Debug Release
|
||||
do
|
||||
cmake -B build/$cpp_standard/$build_type -GNinja \
|
||||
-DVULKAN_HPP_SAMPLES_BUILD=ON \
|
||||
-DVULKAN_HPP_SAMPLES_BUILD_ONLY_DYNAMIC=ON \
|
||||
-DVULKAN_HPP_TESTS_BUILD=ON \
|
||||
-DVULKAN_HPP_TESTS_BUILD_ONLY_DYNAMIC=ON \
|
||||
-DVULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
|
||||
-DVULKAN_HPP_PRECOMPILE=OFF \
|
||||
-DVULKAN_HPP_RUN_GENERATOR=ON \
|
||||
-DCMAKE_CXX_COMPILER=${{matrix.compiler}} \
|
||||
-DCMAKE_CXX_STANDARD=$cpp_standard \
|
||||
-DCMAKE_BUILD_TYPE=$build_type
|
||||
cmake --build build/$cpp_standard/$build_type --parallel
|
||||
done
|
||||
done
|
||||
|
||||
- name: Loop over build_types (Debug, Release) with cpp_standard 23 for g++-11 only
|
||||
run: |
|
||||
if [ ${{matrix.compiler}} == g++-11 ]
|
||||
then
|
||||
cpp_standard=23
|
||||
for build_type in Debug Release
|
||||
do
|
||||
cmake -B build/$cpp_standard/$build_type -GNinja \
|
||||
-DVULKAN_HPP_SAMPLES_BUILD=ON \
|
||||
-DVULKAN_HPP_SAMPLES_BUILD_ONLY_DYNAMIC=ON \
|
||||
-DVULKAN_HPP_TESTS_BUILD=ON \
|
||||
-DVULKAN_HPP_TESTS_BUILD_ONLY_DYNAMIC=ON \
|
||||
-DVULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
|
||||
-DVULKAN_HPP_PRECOMPILE=OFF \
|
||||
-DVULKAN_HPP_RUN_GENERATOR=ON \
|
||||
-DCMAKE_CXX_COMPILER=${{matrix.compiler}} \
|
||||
-DCMAKE_CXX_STANDARD=$cpp_standard \
|
||||
-DCMAKE_BUILD_TYPE=$build_type
|
||||
cmake --build build/$cpp_standard/$build_type --parallel
|
||||
done
|
||||
fi
|
||||
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
|
||||
name: CI Windows Clang
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
os: [windows-2022, windows-2025]
|
||||
architecture: [x64]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup MSVC
|
||||
uses: TheMrMilchmann/setup-msvc-dev@v2
|
||||
with:
|
||||
arch: ${{matrix.architecture}}
|
||||
|
||||
# - name: Install glm, glfw and glslang
|
||||
# run: |
|
||||
# cd glm
|
||||
# cmake -B build -G Ninja \
|
||||
# -D CMAKE_CXX_COMPILER=clang-cl \
|
||||
# -D CMAKE_CXX_STANDARD=11 \
|
||||
# -D CMAKE_BUILD_TYPE=Release \
|
||||
# -D GLM_BUILD_LIBRARY=ON \
|
||||
# -D GLM_BUILD_INSTALL=ON \
|
||||
# -D GLM_BUILD_TESTS=OFF
|
||||
# cmake --build build --parallel
|
||||
# cmake --install build
|
||||
|
||||
# cd ../glfw
|
||||
# cmake -B build -G Ninja \
|
||||
# -D CMAKE_C_COMPILER=clang-cl \
|
||||
# -D CMAKE_BUILD_TYPE=Release \
|
||||
# -D GLFW_BUILD_EXAMPLES=OFF \
|
||||
# -D GLFW_BUILD_TESTS=OFF \
|
||||
# -D GLFW_BUILD_DOCS=OFF \
|
||||
# -D GLFW_INSTALL=ON
|
||||
# cmake --build build --parallel
|
||||
# cmake --install build
|
||||
|
||||
# cd ../glslang
|
||||
# cmake -B build -G Ninja \
|
||||
# -D CMAKE_C_COMPILER=clang-cl \
|
||||
# -D CMAKE_CXX_COMPILER=clang-cl \
|
||||
# -D CMAKE_CXX_STANDARD=11 \
|
||||
# -D CMAKE_BUILD_TYPE=Release \
|
||||
# -D ENABLE_OPT=OFF \
|
||||
# -D GLSLANG_TESTS_DEFAULT=OFF \
|
||||
# -D GLSLANG_ENABLE_INSTALL_DEFAULT=ON
|
||||
# cmake --build build --parallel
|
||||
# cmake --install build
|
||||
# cd ..
|
||||
|
||||
- name: Generate headers
|
||||
run: |
|
||||
cmake -B build -G Ninja \
|
||||
-D VULKAN_HPP_GENERATOR_BUILD=ON \
|
||||
-D VULKAN_HPP_RUN_GENERATOR=OFF \
|
||||
-D VULKAN_HPP_SAMPLES_BUILD=OFF \
|
||||
-D VULKAN_HPP_TESTS_BUILD=OFF \
|
||||
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
|
||||
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
|
||||
-D VULKAN_HPP_PRECOMPILE=OFF \
|
||||
-D CMAKE_BUILD_TYPE=Debug \
|
||||
-D CMAKE_CXX_COMPILER=clang-cl \
|
||||
-D CMAKE_CXX_STANDARD=20
|
||||
cmake --build build --parallel
|
||||
|
||||
cmake -B build -G Ninja --fresh \
|
||||
-D VULKAN_HPP_GENERATOR_BUILD=ON \
|
||||
-D VULKAN_HPP_RUN_GENERATOR=ON \
|
||||
-D VULKAN_HPP_SAMPLES_BUILD=OFF \
|
||||
-D VULKAN_HPP_TESTS_BUILD=OFF \
|
||||
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
|
||||
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
|
||||
-D VULKAN_HPP_PRECOMPILE=OFF \
|
||||
-D CMAKE_BUILD_TYPE=Release \
|
||||
-D CMAKE_CXX_COMPILER=clang-cl \
|
||||
-D CMAKE_CXX_STANDARD=20
|
||||
cmake --build build --parallel --clean-first
|
||||
|
||||
- name: Build samples and tests
|
||||
run: |
|
||||
for CXX_STANDARD in 11 14 17 20 23; do
|
||||
for BUILD_TYPE in Debug Release; do
|
||||
echo "================================================================================="
|
||||
echo "Building C++$CXX_STANDARD in $BUILD_TYPE with architecture ${{matrix.architecture}}"
|
||||
echo "================================================================================="
|
||||
|
||||
cmake -B build -G Ninja --fresh \
|
||||
-D VULKAN_HPP_GENERATOR_BUILD=OFF \
|
||||
-D VULKAN_HPP_RUN_GENERATOR=OFF \
|
||||
-D VULKAN_HPP_SAMPLES_BUILD=ON \
|
||||
-D VULKAN_HPP_TESTS_BUILD=ON \
|
||||
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
|
||||
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
|
||||
-D VULKAN_HPP_PRECOMPILE=OFF \
|
||||
-D CMAKE_BUILD_TYPE=$BUILD_TYPE \
|
||||
-D CMAKE_C_COMPILER=clang-cl \
|
||||
-D CMAKE_CXX_COMPILER=clang-cl \
|
||||
-D CMAKE_CXX_STANDARD=$CXX_STANDARD
|
||||
cmake --build build --parallel --clean-first
|
||||
done
|
||||
done
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
|
||||
name: CI Windows MSVC
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
os: [windows-2022, windows-2025]
|
||||
architecture: [x86, x64]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup MSVC
|
||||
uses: TheMrMilchmann/setup-msvc-dev@v2
|
||||
with:
|
||||
arch: ${{matrix.architecture}}
|
||||
|
||||
# - name: Install glm, glfw and glslang
|
||||
# run: |
|
||||
# cd glm
|
||||
# cmake -B build \
|
||||
# -D CMAKE_CXX_STANDARD=11 \
|
||||
# -D GLM_BUILD_LIBRARY=ON \
|
||||
# -D GLM_BUILD_INSTALL=ON \
|
||||
# -D GLM_BUILD_TESTS=OFF
|
||||
# cmake --build build --parallel --config Release
|
||||
# cmake --install build --config Release
|
||||
|
||||
# cd ../glfw
|
||||
# cmake -B build \
|
||||
# -D CMAKE_CXX_STANDARD=11 \
|
||||
# -D GLFW_BUILD_EXAMPLES=OFF \
|
||||
# -D GLFW_BUILD_TESTS=OFF \
|
||||
# -D GLFW_BUILD_DOCS=OFF \
|
||||
# -D GLFW_INSTALL=ON
|
||||
# cmake --build build --parallel --config Release
|
||||
# cmake --install build --config Release
|
||||
|
||||
# cd ../glslang
|
||||
# cmake -B build \
|
||||
# -D CMAKE_CXX_STANDARD=11 \
|
||||
# -D ENABLE_OPT=OFF \
|
||||
# -D GLSLANG_TESTS_DEFAULT=OFF \
|
||||
# -D GLSLANG_ENABLE_INSTALL_DEFAULT=ON
|
||||
# cmake --build build --parallel --config Release
|
||||
# cmake --install build --config Release
|
||||
# cd ..
|
||||
|
||||
- name: Generate headers
|
||||
run: |
|
||||
cmake -B build \
|
||||
-D VULKAN_HPP_GENERATOR_BUILD=ON \
|
||||
-D VULKAN_HPP_RUN_GENERATOR=OFF \
|
||||
-D VULKAN_HPP_SAMPLES_BUILD=OFF \
|
||||
-D VULKAN_HPP_TESTS_BUILD=OFF \
|
||||
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
|
||||
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
|
||||
-D VULKAN_HPP_PRECOMPILE=OFF \
|
||||
-D CMAKE_CXX_STANDARD=20
|
||||
cmake --build build --parallel --config Debug
|
||||
cmake --build build --parallel --config Release
|
||||
|
||||
- name: Build samples and tests
|
||||
run: |
|
||||
for CXX_STANDARD in 11 14 17 20 23; do
|
||||
echo "================================================================================="
|
||||
echo "Building C++$CXX_STANDARD in Debug with architecture ${{matrix.architecture}}"
|
||||
echo "================================================================================="
|
||||
cmake -B build --fresh \
|
||||
-D VULKAN_HPP_GENERATOR_BUILD=OFF \
|
||||
-D VULKAN_HPP_RUN_GENERATOR=OFF \
|
||||
-D VULKAN_HPP_SAMPLES_BUILD=ON \
|
||||
-D VULKAN_HPP_TESTS_BUILD=ON \
|
||||
-D VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=ON \
|
||||
-D VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
|
||||
-D VULKAN_HPP_PRECOMPILE=OFF \
|
||||
-D CMAKE_CXX_STANDARD=$CXX_STANDARD
|
||||
cmake --build build --parallel --clean-first --config Debug
|
||||
|
||||
echo "================================================================================="
|
||||
echo "Building C++$CXX_STANDARD in Release with architecture ${{matrix.architecture}}"
|
||||
echo "================================================================================="
|
||||
cmake --build build --parallel --config Release
|
||||
done
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
|
||||
name: CI Windows
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
os: [windows-latest, windows-2019]
|
||||
architecture: [x86, x64]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup MSVC
|
||||
uses: TheMrMilchmann/setup-msvc-dev@v2
|
||||
with:
|
||||
arch: ${{matrix.architecture}}
|
||||
|
||||
- name: Loop over cpp_standards (11, 14, ...) and build_types (Debug, Release)
|
||||
run: |
|
||||
for cpp_standard in 11 14 17 20 23
|
||||
do
|
||||
for build_type in Debug Release
|
||||
do
|
||||
cmake -B build/$cpp_standard/$build_type \
|
||||
-DVULKAN_HPP_SAMPLES_BUILD=ON \
|
||||
-DVULKAN_HPP_SAMPLES_BUILD_ONLY_DYNAMIC=ON \
|
||||
-DVULKAN_HPP_TESTS_BUILD=ON \
|
||||
-DVULKAN_HPP_TESTS_BUILD_ONLY_DYNAMIC=ON \
|
||||
-DVULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP=ON \
|
||||
-DVULKAN_HPP_PRECOMPILE=OFF \
|
||||
-DVULKAN_HPP_RUN_GENERATOR=ON \
|
||||
-DCMAKE_CXX_STANDARD=$cpp_standard \
|
||||
-DCMAKE_BUILD_TYPE=$build_type
|
||||
cmake --build build/$cpp_standard/$build_type --parallel
|
||||
done
|
||||
done
|
||||
|
|
@ -11,7 +11,6 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
build_type: [Debug]
|
||||
cxx_compiler: [g++-9]
|
||||
cxx_standard: [11]
|
||||
|
||||
steps:
|
||||
|
|
@ -41,7 +40,6 @@ jobs:
|
|||
-DVULKAN_HPP_SAMPLES_BUILD=OFF
|
||||
-DVULKAN_HPP_TESTS_BUILD=OFF
|
||||
-DVULKAN_HPP_RUN_GENERATOR=ON
|
||||
-DCMAKE_CXX_COMPILER=${{matrix.cxx_compiler}}
|
||||
-DCMAKE_CXX_STANDARD=${{matrix.cxx_standard}}
|
||||
|
||||
- name: Build
|
||||
|
|
|
|||
596
CMakeLists.txt
596
CMakeLists.txt
|
|
@ -24,63 +24,47 @@
|
|||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
if ( NOT CMAKE_CXX_STANDARD )
|
||||
cmake_minimum_required( VERSION 3.22 )
|
||||
include( CMakeDependentOption )
|
||||
project( VulkanHppGenerator LANGUAGES CXX )
|
||||
|
||||
if ( NOT DEFINED CMAKE_CXX_STANDARD AND PROJECT_IS_TOP_LEVEL )
|
||||
set( CMAKE_CXX_STANDARD 11 )
|
||||
endif()
|
||||
|
||||
# all the options for this project
|
||||
option( VULKAN_HPP_PRECOMPILE "Precompile vulkan.hpp and vulkan_raii.hpp for sample builds" ON )
|
||||
option( VULKAN_HPP_RUN_GENERATOR "Run the HPP generator" OFF )
|
||||
option( VULKAN_HPP_GENERATOR_BUILD "Build the HPP generator" ${PROJECT_IS_TOP_LEVEL} )
|
||||
option( VULKAN_HPP_SAMPLES_BUILD "Build samples" OFF )
|
||||
option( VULKAN_HPP_TESTS_BUILD "Build tests" OFF )
|
||||
option( VULKAN_HPP_SAMPLES_BUILD_ONLY_DYNAMIC "Build only dynamic. Required in case the Vulkan SDK is not available" OFF )
|
||||
option( VULKAN_HPP_TESTS_BUILD_ONLY_DYNAMIC "Build only dynamic" OFF )
|
||||
option( VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP "Build with local Vulkan headers" ON )
|
||||
option( VULKAN_HPP_ENABLE_CPP20_MODULES "Build Vulkan-Hpp as C++20 module; requires minimum CMake version 3.28" OFF )
|
||||
option( VULKAN_HPP_CPP20_MODULE_DYNAMIC_DISPATCHER "Build C++20 module with dynamic Dispatcher" ON )
|
||||
cmake_dependent_option( VULKAN_HPP_BUILD_CXX_MODULE "Build and test the C++ named module." ON [[ TARGET __CMAKE::CXX23 ]] OFF)
|
||||
|
||||
if ( VULKAN_HPP_ENABLE_CPP20_MODULES )
|
||||
cmake_minimum_required( VERSION 3.28 )
|
||||
else()
|
||||
cmake_minimum_required( VERSION 3.12 )
|
||||
# options for vulkan hpp compile definitions (see https://github.com/KhronosGroup/Vulkan-Hpp/tree/main?tab=readme-ov-file#configuration-options for details)
|
||||
option( VULKAN_HPP_DISABLE_ENHANCED_MODE "Disable all enhanced functionality apart from scoped enums, bitmasks, default initialization and vk::StructureChain" OFF )
|
||||
option( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC "Select the dynamic (ON) or static (OFF) dispatch loader (defaults to VK_NO_PROTOTYPES)" ${VK_NO_PROTOTYPES} )
|
||||
option( VULKAN_HPP_FLAGS_MASK_TYPE_AS_PUBLIC "Change the m_mask access modifier in vk::Flags to public" OFF )
|
||||
option( VULKAN_HPP_HANDLE_ERROR_OUT_OF_DATE_AS_SUCCESS "Handles VK_ERROR_OUT_OF_DATE_KHR like a success code" OFF )
|
||||
option( VULKAN_HPP_HANDLES_MOVE_EXCHANGE "Enable 'm_handle = exchange( rhs.m_handle, {} )' in move constructors" OFF )
|
||||
option( VULKAN_HPP_NO_CONSTRUCTORS "Remove constructors from structs and unions to enable C++20 designated initializers" OFF )
|
||||
option( VULKAN_HPP_NO_EXCEPTIONS "Do not throw exceptions when vulkan functions return an error code" OFF )
|
||||
option( VULKAN_HPP_NO_NODISCARD_WARNINGS "Remove C++17 [[nodiscard]] from function signatures that return something" OFF )
|
||||
option( VULKAN_HPP_NO_SETTERS "Remove setters for structs and unions" OFF )
|
||||
option( VULKAN_HPP_NO_SMART_HANDLE "Remove the vk::UniqueHandle helper class" OFF )
|
||||
option( VULKAN_HPP_NO_SPACESHIP_OPERATOR "Remove the C++20 <=> (spaceship) operator" OFF )
|
||||
option( VULKAN_HPP_NO_TO_STRING "Remove inclusion of vulkan_to_string.hpp from vulkan.hpp" OFF )
|
||||
option( VULKAN_HPP_NO_WIN32_PROTOTYPES "Remove HINSTANCE, LoadLibraryA and other symbols, which are declared if VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL is enabled on Win32" OFF )
|
||||
option( VULKAN_HPP_RAII_NO_EXCEPTIONS "Do not throw exceptions when vulkan functions from vk::raii return an error code." OFF )
|
||||
option( VULKAN_HPP_SMART_HANDLE_IMPLICIT_CAST "Enable implicit casts from vk::UniqueHandle and vk::SharedHandle to their matching vk::Handle" OFF )
|
||||
option( VULKAN_HPP_TYPESAFE_CONVERSION "Enable copy constructors for non-dispatchable handles" ON )
|
||||
option( VULKAN_HPP_USE_REFLECT "Adds reflect function to structures, which returns an iterable tuple" OFF )
|
||||
|
||||
# manually set VK_NO_PROTOTYPES if undefined
|
||||
if ( NOT DEFINED VK_NO_PROTOTYPES )
|
||||
set ( VK_NO_PROTOTYPES ${VULKAN_HPP_DISPATCH_LOADER_DYNAMIC} )
|
||||
endif()
|
||||
|
||||
project( VulkanHppGenerator LANGUAGES CXX )
|
||||
|
||||
function( vulkan_hpp__setup_platform )
|
||||
set( options )
|
||||
set( oneValueArgs NAME )
|
||||
set( multiValueArgs )
|
||||
cmake_parse_arguments( TARGET "{options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
|
||||
if( WIN32 )
|
||||
target_compile_definitions( ${TARGET_NAME} PUBLIC NOMINMAX VK_USE_PLATFORM_WIN32_KHR )
|
||||
elseif( APPLE )
|
||||
target_compile_definitions( ${TARGET_NAME} PUBLIC VK_USE_PLATFORM_MACOS_MVK )
|
||||
elseif( UNIX )
|
||||
target_compile_definitions( ${TARGET_NAME} PUBLIC VK_USE_PLATFORM_XCB_KHR )
|
||||
else()
|
||||
message( FATAL_ERROR, "Vulkan-Hpp: unhandled platform!" )
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function( vulkan_hpp__setup_vulkan_include )
|
||||
set( options )
|
||||
set( oneValueArgs NAME )
|
||||
set( multiValueArgs )
|
||||
cmake_parse_arguments( TARGET "{options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
|
||||
if( VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP )
|
||||
target_include_directories( ${TARGET_NAME} PUBLIC "${CMAKE_CURRENT_FUNCTION_LIST_DIR}" )
|
||||
target_include_directories( ${TARGET_NAME} PUBLIC "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/Vulkan-Headers/include" )
|
||||
if( VULKAN_HPP_RUN_GENERATOR )
|
||||
add_dependencies( ${TARGET_NAME} build_vulkan_hpp )
|
||||
endif()
|
||||
else()
|
||||
target_include_directories( ${TARGET_NAME} PUBLIC "${Vulkan_INCLUDE_DIRS}" )
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function( vulkan_hpp__setup_warning_level )
|
||||
set( options )
|
||||
set( oneValueArgs NAME )
|
||||
|
|
@ -93,7 +77,293 @@ function( vulkan_hpp__setup_warning_level )
|
|||
target_compile_options( ${TARGET_NAME} PRIVATE /permissive- )
|
||||
endif()
|
||||
else()
|
||||
target_compile_options( ${TARGET_NAME} PRIVATE -Wall -Wextra -pedantic -Werror )
|
||||
target_compile_options( ${TARGET_NAME} PRIVATE -Wall -Wextra -Wpedantic -Werror )
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Build Vulkan-Hpp and Video-Hpp generators
|
||||
if ( VULKAN_HPP_GENERATOR_BUILD )
|
||||
set_property( GLOBAL PROPERTY USE_FOLDERS ON )
|
||||
|
||||
# look for the file vk.xml, the ultimate source of truth for vulkan, to generate the headers from
|
||||
if( NOT DEFINED VulkanRegistry_DIR )
|
||||
if( DEFINED VULKAN_HPP_VULKAN_HEADERS_SRC_DIR )
|
||||
set( VulkanRegistry_DIR "${VULKAN_HPP_VULKAN_HEADERS_SRC_DIR}/registry" )
|
||||
else()
|
||||
set( VulkanRegistry_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Headers/registry" )
|
||||
endif()
|
||||
endif()
|
||||
file( TO_NATIVE_PATH ${VulkanRegistry_DIR}/vk.xml vk_spec )
|
||||
string( REPLACE "\\" "\\\\" vk_spec ${vk_spec} )
|
||||
|
||||
# gather the tinyxml2 sources, to be used directly in the generator project
|
||||
if( NOT DEFINED VULKAN_HPP_TINYXML2_SRC_DIR )
|
||||
set( VULKAN_HPP_TINYXML2_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tinyxml2" )
|
||||
endif()
|
||||
set( TINYXML2_SOURCES ${VULKAN_HPP_TINYXML2_SRC_DIR}/tinyxml2.cpp )
|
||||
set( TINYXML2_HEADERS ${VULKAN_HPP_TINYXML2_SRC_DIR}/tinyxml2.h )
|
||||
source_group( TinyXML2 FILES ${TINYXML2_HEADERS} ${TINYXML2_SOURCES} )
|
||||
|
||||
# The generator executable
|
||||
add_executable( VulkanHppGenerator VulkanHppGenerator.cpp VulkanHppGenerator.hpp XMLHelper.hpp ${TINYXML2_SOURCES} ${TINYXML2_HEADERS} )
|
||||
vulkan_hpp__setup_warning_level( NAME VulkanHppGenerator )
|
||||
target_compile_definitions( VulkanHppGenerator PUBLIC BASE_PATH="${CMAKE_CURRENT_SOURCE_DIR}" VK_SPEC="${vk_spec}" )
|
||||
target_include_directories( VulkanHppGenerator PRIVATE ${VULKAN_HPP_TINYXML2_SRC_DIR} )
|
||||
set_target_properties( VulkanHppGenerator PROPERTIES CXX_STANDARD 20 CXX_STANDARD_REQUIRED ON )
|
||||
if( UNIX )
|
||||
target_link_libraries( VulkanHppGenerator PUBLIC pthread )
|
||||
endif()
|
||||
|
||||
# The video generator executable
|
||||
add_executable( VideoHppGenerator VideoHppGenerator.cpp VideoHppGenerator.hpp XMLHelper.hpp ${TINYXML2_SOURCES} ${TINYXML2_HEADERS} )
|
||||
vulkan_hpp__setup_warning_level( NAME VideoHppGenerator )
|
||||
file( TO_NATIVE_PATH ${VulkanRegistry_DIR}/video.xml video_spec )
|
||||
string( REPLACE "\\" "\\\\" video_spec ${video_spec} )
|
||||
target_compile_definitions( VideoHppGenerator PUBLIC BASE_PATH="${CMAKE_CURRENT_SOURCE_DIR}" VIDEO_SPEC="${video_spec}" )
|
||||
target_include_directories( VideoHppGenerator PRIVATE ${VULKAN_HPP_TINYXML2_SRC_DIR} )
|
||||
set_target_properties( VideoHppGenerator PROPERTIES CXX_STANDARD 20 CXX_STANDARD_REQUIRED ON )
|
||||
|
||||
# find a clang-format version to format the generated header files
|
||||
find_program(CLANG_FORMAT_EXECUTABLE NAMES clang-format)
|
||||
if( CLANG_FORMAT_EXECUTABLE )
|
||||
# get the clang-format version string
|
||||
execute_process( COMMAND ${CLANG_FORMAT_EXECUTABLE} "--version" OUTPUT_VARIABLE clangFormatVersion )
|
||||
# filter out the actual version
|
||||
string( REGEX MATCH [0123456789.]+ clangFormatVersion "${clangFormatVersion}" )
|
||||
# we need at least version 7.0.0 !
|
||||
if( clangFormatVersion VERSION_LESS 7.0.0 )
|
||||
message( WARNING " Found too old clang-format version <" ${clangFormatVersion} ">, we need version 7 and up to nicely format vulkan.hpp and vulkan_raii.hpp" )
|
||||
else()
|
||||
message( STATUS " Found clang-format version <" ${clangFormatVersion} ">." )
|
||||
if( clangFormatVersion VERSION_LESS 11.0.0 )
|
||||
message( STATUS " Using .clang-format version 7." )
|
||||
file( READ ".clang-format_7" clangFormat )
|
||||
elseif( clangFormatVersion VERSION_LESS 12.0.0 )
|
||||
message( STATUS " Using .clang-format version 11." )
|
||||
file( READ ".clang-format_11" clangFormat )
|
||||
elseif( clangFormatVersion VERSION_LESS 13.0.0 )
|
||||
message( STATUS " Using .clang-format version 12." )
|
||||
file( READ ".clang-format_12" clangFormat )
|
||||
elseif( clangFormatVersion VERSION_LESS 14.0.0 )
|
||||
message( STATUS " Using .clang-format version 13." )
|
||||
file( READ ".clang-format_13" clangFormat )
|
||||
elseif( clangFormatVersion VERSION_LESS 15.0.0 )
|
||||
message( STATUS " Using .clang-format version 14." )
|
||||
file( READ ".clang-format_14" clangFormat )
|
||||
elseif( clangFormatVersion VERSION_LESS 16.0.0 )
|
||||
message( STATUS " Using .clang-format version 15." )
|
||||
file( READ ".clang-format_15" clangFormat )
|
||||
elseif( clangFormatVersion VERSION_LESS 17.0.0 )
|
||||
message( STATUS " Using .clang-format version 16." )
|
||||
file( READ ".clang-format_16" clangFormat )
|
||||
elseif( clangFormatVersion VERSION_LESS 18.0.0 )
|
||||
message( STATUS " Using .clang-format version 17." )
|
||||
file( READ ".clang-format_17" clangFormat )
|
||||
else()
|
||||
message(STATUS " Using .clang-format version 18." )
|
||||
file( READ ".clang-format_18" clangFormat )
|
||||
endif()
|
||||
file( WRITE ".clang-format" ${clangFormat} )
|
||||
target_compile_definitions( VulkanHppGenerator PUBLIC CLANG_FORMAT_EXECUTABLE="${CLANG_FORMAT_EXECUTABLE}" )
|
||||
target_compile_definitions( VideoHppGenerator PUBLIC CLANG_FORMAT_EXECUTABLE="${CLANG_FORMAT_EXECUTABLE}" )
|
||||
endif()
|
||||
else()
|
||||
message( WARNING " Could not find clang-format. Generated vulkan.hpp and vulkan_raii.hpp will not be nicely formatted." )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# if the generators are to be run, add a custom commands and targets
|
||||
if( VULKAN_HPP_RUN_GENERATOR )
|
||||
if( NOT DEFINED VulkanHeaders_INCLUDE_DIR )
|
||||
if( DEFINED VULKAN_HPP_PATH )
|
||||
set( VulkanHeaders_INCLUDE_DIR ${VULKAN_HPP_PATH} )
|
||||
else()
|
||||
set( VulkanHeaders_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
file( TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan.hpp vulkan_hpp )
|
||||
string( REPLACE "\\" "\\\\" vulkan_hpp ${vulkan_hpp} )
|
||||
|
||||
add_custom_command(
|
||||
COMMAND VulkanHppGenerator
|
||||
OUTPUT "${vulkan_hpp}"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
COMMENT "run VulkanHppGenerator"
|
||||
DEPENDS VulkanHppGenerator "${vk_spec}" )
|
||||
add_custom_target( build_vulkan_hpp ALL DEPENDS "${vulkan_hpp}" "${vk_spec}" )
|
||||
|
||||
file( TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_video.hpp vulkan_video_hpp )
|
||||
string( REPLACE "\\" "\\\\" vulkan_video_hpp ${vulkan_video_hpp} )
|
||||
|
||||
add_custom_command(
|
||||
COMMAND VideoHppGenerator
|
||||
OUTPUT "${vulkan_video_hpp}"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
COMMENT "run VideoHppGenerator"
|
||||
DEPENDS VideoHppGenerator "${video_spec}" )
|
||||
add_custom_target( build_video_hpp ALL DEPENDS "${vulkan_video_hpp}" "${video_spec}" )
|
||||
endif()
|
||||
|
||||
# Create Vulkan-Hpp interface target
|
||||
add_library( VulkanHpp INTERFACE )
|
||||
add_library( Vulkan::Hpp ALIAS VulkanHpp )
|
||||
target_include_directories( VulkanHpp INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}" )
|
||||
if( VULKAN_HPP_RUN_GENERATOR )
|
||||
add_dependencies( VulkanHpp build_vulkan_hpp build_video_hpp )
|
||||
endif()
|
||||
|
||||
# set up compile definitions
|
||||
if( VULKAN_HPP_DISABLE_ENHANCED_MODE )
|
||||
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_DISABLE_ENHANCED_MODE" )
|
||||
endif()
|
||||
if( VK_NO_PROTOTYPES )
|
||||
target_compile_definitions(VulkanHpp INTERFACE "VK_NO_PROTOTYPES" )
|
||||
endif()
|
||||
if( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC )
|
||||
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_DISPATCH_LOADER_DYNAMIC" )
|
||||
if( UNIX )
|
||||
target_link_libraries( VulkanHpp INTERFACE ${CMAKE_DL_LIBS} )
|
||||
endif()
|
||||
else()
|
||||
find_package( Vulkan )
|
||||
if ( Vulkan_FOUND )
|
||||
target_link_libraries( VulkanHpp INTERFACE ${Vulkan_LIBRARIES} )
|
||||
else()
|
||||
message(WARNING "Could not link to vulkan-1 libraries, consider using VULKAN_HPP_DISPATCH_LOADER_DYNAMIC")
|
||||
endif()
|
||||
endif()
|
||||
if( VULKAN_HPP_USE_REFLECT )
|
||||
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_USE_REFLECT" )
|
||||
endif()
|
||||
if( NOT VULKAN_HPP_TYPESAFE_CONVERSION )
|
||||
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_TYPESAFE_CONVERSION=0" )
|
||||
endif()
|
||||
if( VULKAN_HPP_HANDLES_MOVE_EXCHANGE )
|
||||
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_HANDLES_MOVE_EXCHANGE" )
|
||||
endif()
|
||||
if( VULKAN_HPP_FLAGS_MASK_TYPE_AS_PUBLIC )
|
||||
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_FLAGS_MASK_TYPE_AS_PUBLIC" )
|
||||
endif()
|
||||
if( VULKAN_HPP_HANDLE_ERROR_OUT_OF_DATE_AS_SUCCESS )
|
||||
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_HANDLE_ERROR_OUT_OF_DATE_AS_SUCCESS" )
|
||||
endif()
|
||||
if( VULKAN_HPP_SMART_HANDLE_IMPLICIT_CAST )
|
||||
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_SMART_HANDLE_IMPLICIT_CAST" )
|
||||
endif()
|
||||
if( VULKAN_HPP_NO_SETTERS )
|
||||
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_NO_SETTERS" )
|
||||
endif()
|
||||
if( VULKAN_HPP_NO_TO_STRING )
|
||||
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_NO_TO_STRING" )
|
||||
endif()
|
||||
if( VULKAN_HPP_NO_EXCEPTIONS )
|
||||
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_NO_EXCEPTIONS" )
|
||||
endif()
|
||||
if( VULKAN_HPP_NO_CONSTRUCTORS )
|
||||
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_NO_CONSTRUCTORS" )
|
||||
endif()
|
||||
if( VULKAN_HPP_NO_SMART_HANDLE )
|
||||
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_NO_SMART_HANDLE" )
|
||||
endif()
|
||||
if( VULKAN_HPP_RAII_NO_EXCEPTIONS )
|
||||
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_RAII_NO_EXCEPTIONS" )
|
||||
endif()
|
||||
if( VULKAN_HPP_NO_WIN32_PROTOTYPES )
|
||||
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_NO_WIN32_PROTOTYPES" )
|
||||
endif()
|
||||
if( VULKAN_HPP_NO_NODISCARD_WARNINGS )
|
||||
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_NO_NODISCARD_WARNINGS" )
|
||||
endif()
|
||||
if( VULKAN_HPP_NO_SPACESHIP_OPERATOR )
|
||||
target_compile_definitions(VulkanHpp INTERFACE "VULKAN_HPP_NO_SPACESHIP_OPERATOR" )
|
||||
endif()
|
||||
|
||||
function( vulkan_hpp__setup_vulkan_include )
|
||||
set( options )
|
||||
set( oneValueArgs NAME )
|
||||
set( multiValueArgs )
|
||||
cmake_parse_arguments( TARGET "{options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
|
||||
if( VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP )
|
||||
# Vulkan C++ headers
|
||||
target_link_libraries( ${TARGET_NAME} PUBLIC Vulkan::Hpp )
|
||||
|
||||
# Vulkan C headers
|
||||
if ( EXISTS "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/Vulkan-Headers/include" )
|
||||
target_include_directories( VulkanHpp INTERFACE "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/Vulkan-Headers/include" )
|
||||
else()
|
||||
message( WARNING "Could not find vulkan C headers locally, pull the Vulkan-Headers submodule or disable VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP" )
|
||||
endif()
|
||||
else()
|
||||
find_package( Vulkan REQUIRED )
|
||||
target_include_directories( ${TARGET_NAME} PUBLIC "${Vulkan_INCLUDE_DIRS}" )
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function( vulkan_hpp__setup_vulkan_module )
|
||||
set( options )
|
||||
set( oneValueArgs NAME FILE_SET_NAME )
|
||||
set( multiValueArgs FILE_SET ALIAS )
|
||||
cmake_parse_arguments( TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
|
||||
if ( NOT TARGET_NAME )
|
||||
message( FATAL_ERROR "NAME must be defined in vulkan_hpp__setup_module" )
|
||||
endif()
|
||||
|
||||
add_library( ${TARGET_NAME} )
|
||||
foreach( TARGET_ALIAS_NAME IN LISTS TARGET_ALIAS )
|
||||
add_library(${TARGET_ALIAS_NAME} ALIAS ${TARGET_NAME})
|
||||
endforeach()
|
||||
|
||||
target_compile_features( ${TARGET_NAME} PUBLIC cxx_std_23 )
|
||||
set_target_properties( ${TARGET_NAME} PROPERTIES CXX_MODULE_STD ON )
|
||||
|
||||
if ( NOT TARGET_FILE_SET )
|
||||
message( FATAL_ERROR "FILE_SET must be defined in vulkan_hpp__setup_module" )
|
||||
endif()
|
||||
|
||||
list(LENGTH TARGET_FILE_SET TARGET_FILE_SET_LENGTH)
|
||||
if ( TARGET_FILE_SET_LENGTH LESS 1 )
|
||||
message(FATAL_ERROR "FILE_SET in vulkan_hpp__setup_module must at least one source file")
|
||||
endif()
|
||||
|
||||
target_sources( ${TARGET_NAME} PUBLIC
|
||||
FILE_SET ${TARGET_FILE_SET_NAME}
|
||||
BASE_DIRS ${CMAKE_CURRENT_FUNCTION_LIST_DIR}
|
||||
TYPE CXX_MODULES
|
||||
FILES ${TARGET_FILE_SET} )
|
||||
vulkan_hpp__setup_vulkan_include( NAME ${TARGET_NAME} )
|
||||
endfunction()
|
||||
|
||||
# Build Vulkan-Hpp as a module
|
||||
if( VULKAN_HPP_BUILD_CXX_MODULE )
|
||||
# create targets providing VulkanHpp and VulkanVideoHpp as C++ named modules
|
||||
vulkan_hpp__setup_vulkan_module( NAME VulkanHppModule
|
||||
FILE_SET_NAME vulkan_module_file
|
||||
FILE_SET
|
||||
vulkan/vulkan.cppm
|
||||
vulkan/vulkan_video.cppm
|
||||
ALIAS Vulkan::HppModule ) # TODO: respect VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP
|
||||
endif()
|
||||
|
||||
function( vulkan_hpp__setup_platform )
|
||||
set( options )
|
||||
set( oneValueArgs NAME )
|
||||
set( multiValueArgs )
|
||||
cmake_parse_arguments( TARGET "{options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
|
||||
if( WIN32 )
|
||||
target_compile_definitions( ${TARGET_NAME} PUBLIC VK_USE_PLATFORM_WIN32_KHR )
|
||||
elseif( APPLE )
|
||||
target_compile_definitions( ${TARGET_NAME} PUBLIC VK_USE_PLATFORM_METAL_EXT )
|
||||
elseif( UNIX )
|
||||
target_compile_definitions( ${TARGET_NAME} PUBLIC VK_USE_PLATFORM_XCB_KHR )
|
||||
else()
|
||||
message( FATAL_ERROR, "Vulkan-Hpp: unhandled platform!" )
|
||||
endif()
|
||||
if( !MSVC )
|
||||
target_compile_options( ${TARGET_NAME} PRIVATE -fno-strict-aliasing )
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
|
@ -133,10 +403,10 @@ endfunction()
|
|||
function( vulkan_hpp__setup_sample )
|
||||
set( options )
|
||||
set( oneValueArgs FOLDER NAME PCH_REUSE )
|
||||
set( multiValueArgs HEADERS INCLUDE_DIRS LIBS PCH SOURCES )
|
||||
set( multiValueArgs HEADERS LIBS PCH SOURCES )
|
||||
cmake_parse_arguments( TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
|
||||
if( NOT (VULKAN_HPP_SAMPLES_BUILD_ONLY_DYNAMIC AND VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP) )
|
||||
if( NOT VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP )
|
||||
find_package( Vulkan REQUIRED )
|
||||
endif()
|
||||
|
||||
|
|
@ -154,10 +424,6 @@ function( vulkan_hpp__setup_sample )
|
|||
set_target_properties( ${TARGET_NAME} PROPERTIES FOLDER "${TARGET_FOLDER}" )
|
||||
endif()
|
||||
|
||||
if( TARGET_INCLUDE_DIRS )
|
||||
target_include_directories( ${TARGET_NAME} PUBLIC ${TARGET_INCLUDE_DIRS} )
|
||||
endif()
|
||||
|
||||
if( TARGET_LIBS )
|
||||
target_link_libraries( ${TARGET_NAME} PRIVATE "${TARGET_LIBS}" )
|
||||
endif()
|
||||
|
|
@ -177,28 +443,26 @@ function( vulkan_hpp__setup_sample_static )
|
|||
set( multiValueArgs )
|
||||
cmake_parse_arguments( TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
|
||||
if( NOT VULKAN_HPP_SAMPLES_BUILD_ONLY_DYNAMIC )
|
||||
if( NOT TARGET_NAME )
|
||||
message( FATAL_ERROR "NAME must be defined in vulkan_hpp__setup_sample_static" )
|
||||
endif()
|
||||
|
||||
find_package( Vulkan REQUIRED )
|
||||
|
||||
vulkan_hpp__setup_sample(
|
||||
NAME ${TARGET_NAME}
|
||||
FOLDER Samples
|
||||
PCH <vulkan/vulkan.hpp>
|
||||
SOURCES ${TARGET_NAME}.cpp
|
||||
LIBS ${Vulkan_LIBRARIES} )
|
||||
|
||||
target_compile_definitions( ${TARGET_NAME} PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=0 )
|
||||
if( NOT TARGET_NAME )
|
||||
message( FATAL_ERROR "NAME must be defined in vulkan_hpp__setup_sample_static" )
|
||||
endif()
|
||||
|
||||
find_package( Vulkan REQUIRED )
|
||||
|
||||
vulkan_hpp__setup_sample(
|
||||
NAME ${TARGET_NAME}
|
||||
FOLDER Samples
|
||||
PCH <vulkan/vulkan.hpp>
|
||||
SOURCES ${TARGET_NAME}.cpp
|
||||
LIBS ${Vulkan_LIBRARIES} )
|
||||
|
||||
target_compile_definitions( ${TARGET_NAME} PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=0 )
|
||||
endfunction()
|
||||
|
||||
function( vulkan_hpp__setup_sample_dynamic )
|
||||
set( options )
|
||||
set( oneValueArgs NAME )
|
||||
set( multiValueArgs HEADERS INCLUDE_DIRS SOURCES )
|
||||
set( multiValueArgs HEADERS SOURCES )
|
||||
cmake_parse_arguments( TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
|
||||
if( NOT TARGET_NAME )
|
||||
|
|
@ -212,7 +476,6 @@ function( vulkan_hpp__setup_sample_dynamic )
|
|||
NAME ${TARGET_NAME}
|
||||
FOLDER Samples
|
||||
PCH_REUSE utils
|
||||
INCLUDE_DIRS ${TARGET_INCLUDE_DIRS}
|
||||
HEADERS ${TARGET_HEADERS}
|
||||
SOURCES ${TARGET_SOURCES}
|
||||
LIBS utils )
|
||||
|
|
@ -221,7 +484,7 @@ endfunction()
|
|||
function( vulkan_hpp__setup_sample_raii )
|
||||
set( options )
|
||||
set( oneValueArgs NAME )
|
||||
set( multiValueArgs HEADERS INCLUDE_DIRS SOURCES )
|
||||
set( multiValueArgs HEADERS SOURCES )
|
||||
cmake_parse_arguments( TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
|
||||
if( NOT TARGET_NAME )
|
||||
|
|
@ -235,179 +498,84 @@ function( vulkan_hpp__setup_sample_raii )
|
|||
NAME RAII_${TARGET_NAME}
|
||||
FOLDER RAII_Samples
|
||||
PCH_REUSE utils
|
||||
INCLUDE_DIRS ${TARGET_INCLUDE_DIRS}
|
||||
HEADERS ${TARGET_HEADERS}
|
||||
SOURCES ${TARGET_SOURCES}
|
||||
LIBS utils )
|
||||
endfunction()
|
||||
|
||||
function( vulkan_hpp__setup_test )
|
||||
set( options NO_UTILS )
|
||||
set( oneValueArgs CXX_STANDARD NAME )
|
||||
set( multiValueArgs LIBRARIES )
|
||||
set( options CXX_MODULE )
|
||||
set( oneValueArgs NAME )
|
||||
set( multiValueArgs LIBRARIES COMPILE_DEFINITIONS )
|
||||
cmake_parse_arguments( TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
|
||||
if( NOT (VULKAN_HPP_TESTS_BUILD_ONLY_DYNAMIC AND VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP) )
|
||||
find_package( Vulkan REQUIRED )
|
||||
endif()
|
||||
|
||||
if( NOT TARGET_NAME )
|
||||
message( FATAL_ERROR "NAME must be defined in vulkan_hpp__setup_test" )
|
||||
endif()
|
||||
if( NOT TARGET_CXX_STANDARD )
|
||||
set( TARGET_CXX_STANDARD ${CMAKE_CXX_STANDARD} )
|
||||
|
||||
set( CPP_FILE ${TARGET_NAME}.cpp )
|
||||
if ( TARGET_CXX_MODULE )
|
||||
set( TARGET_NAME ${TARGET_NAME}_module )
|
||||
endif()
|
||||
|
||||
vulkan_hpp__setup_project( NAME ${TARGET_NAME} )
|
||||
add_executable( ${TARGET_NAME} ${CPP_FILE} )
|
||||
|
||||
add_executable( ${TARGET_NAME} ${TARGET_NAME}.cpp )
|
||||
# use a variant for the module version
|
||||
if( TARGET_CXX_MODULE )
|
||||
set_target_properties( ${TARGET_NAME} PROPERTIES CXX_SCAN_FOR_MODULES ON )
|
||||
|
||||
# set up new vulkan module when custom compile definitions are needed
|
||||
list( LENGTH TARGET_COMPILE_DEFINITIONS COMPILE_DEFINITIONS_LENGTH )
|
||||
if ( COMPILE_DEFINITIONS_LENGTH GREATER 0 )
|
||||
vulkan_hpp__setup_vulkan_module( NAME ${TARGET_NAME}_VulkanHppModule
|
||||
FILE_SET_NAME vulkan_module_file
|
||||
FILE_SET "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/vulkan/vulkan.cppm" ) # TODO: respect VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP
|
||||
target_compile_definitions( ${TARGET_NAME}_VulkanHppModule PUBLIC ${TARGET_COMPILE_DEFINITIONS} )
|
||||
set_target_properties( ${TARGET_NAME}_VulkanHppModule PROPERTIES CXX_STANDARD_REQUIRED ON FOLDER "Tests" )
|
||||
target_link_libraries( ${TARGET_NAME} PRIVATE ${TARGET_NAME}_VulkanHppModule )
|
||||
else()
|
||||
target_link_libraries( ${TARGET_NAME} PRIVATE Vulkan::HppModule )
|
||||
endif()
|
||||
# set macro to hint usage of the vulkan module, it is up to the test source file to respect this
|
||||
target_compile_definitions( ${TARGET_NAME} PUBLIC VULKAN_HPP_USE_CXX_MODULE )
|
||||
else()
|
||||
vulkan_hpp__setup_vulkan_include( NAME ${TARGET_NAME} )
|
||||
target_compile_definitions( ${TARGET_NAME} PUBLIC ${TARGET_COMPILE_DEFINITIONS} )
|
||||
endif()
|
||||
|
||||
vulkan_hpp__setup_platform( NAME ${TARGET_NAME} )
|
||||
vulkan_hpp__setup_vulkan_include( NAME ${TARGET_NAME} )
|
||||
vulkan_hpp__setup_warning_level( NAME ${TARGET_NAME} )
|
||||
|
||||
set_target_properties( ${TARGET_NAME} PROPERTIES CXX_STANDARD ${TARGET_CXX_STANDARD} CXX_STANDARD_REQUIRED ON FOLDER "Tests" )
|
||||
target_include_directories( ${TARGET_NAME} PUBLIC ${VulkanHeaders_INCLUDE_DIR} )
|
||||
target_include_directories( ${TARGET_NAME} PUBLIC "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/glm" )
|
||||
if ( NOT ${TARGET_NO_UTILS} )
|
||||
target_link_libraries( ${TARGET_NAME} PRIVATE utils )
|
||||
endif()
|
||||
set_target_properties( ${TARGET_NAME} PROPERTIES CXX_STANDARD_REQUIRED ON FOLDER "Tests" )
|
||||
target_link_libraries( ${TARGET_NAME} PRIVATE ${TARGET_LIBRARIES} )
|
||||
endfunction()
|
||||
|
||||
set_property( GLOBAL PROPERTY USE_FOLDERS ON )
|
||||
|
||||
# find a clang-format version to format the generated header files
|
||||
find_program(CLANG_FORMAT_EXECUTABLE NAMES clang-format)
|
||||
if( CLANG_FORMAT_EXECUTABLE )
|
||||
# get the clang-format version string
|
||||
execute_process( COMMAND ${CLANG_FORMAT_EXECUTABLE} "--version" OUTPUT_VARIABLE clangFormatVersion )
|
||||
# filter out the actual version
|
||||
string( REGEX MATCH [0123456789.]+ clangFormatVersion "${clangFormatVersion}" )
|
||||
# we need at least version 7.0.0 !
|
||||
if( clangFormatVersion VERSION_LESS 7.0.0 )
|
||||
message( WARNING " Found too old clang-format version <" ${clangFormatVersion} ">, we need version 7 and up to nicely format vulkan.hpp and vulkan_raii.hpp" )
|
||||
else()
|
||||
message( STATUS " Found clang-format version <" ${clangFormatVersion} ">." )
|
||||
add_definitions( -DCLANG_FORMAT_EXECUTABLE="${CLANG_FORMAT_EXECUTABLE}" )
|
||||
if( clangFormatVersion VERSION_LESS 11.0.0 )
|
||||
message( STATUS " Using .clang-format version 7." )
|
||||
file( READ ".clang-format_7" clangFormat )
|
||||
elseif( clangFormatVersion VERSION_LESS 12.0.0 )
|
||||
message( STATUS " Using .clang-format version 11." )
|
||||
file( READ ".clang-format_11" clangFormat )
|
||||
elseif( clangFormatVersion VERSION_LESS 13.0.0 )
|
||||
message( STATUS " Using .clang-format version 12." )
|
||||
file( READ ".clang-format_12" clangFormat )
|
||||
elseif( clangFormatVersion VERSION_LESS 14.0.0 )
|
||||
message( STATUS " Using .clang-format version 13." )
|
||||
file( READ ".clang-format_13" clangFormat )
|
||||
elseif( clangFormatVersion VERSION_LESS 15.0.0 )
|
||||
message( STATUS " Using .clang-format version 14." )
|
||||
file( READ ".clang-format_14" clangFormat )
|
||||
else()
|
||||
message(STATUS " Using .clang-format version 15." )
|
||||
file( READ ".clang-format_15" clangFormat )
|
||||
endif()
|
||||
file( WRITE ".clang-format" ${clangFormat} )
|
||||
if( VULKAN_HPP_SAMPLES_BUILD OR VULKAN_HPP_TESTS_BUILD )
|
||||
# external libraries
|
||||
find_package( glm QUIET )
|
||||
if( NOT glm_FOUND )
|
||||
add_subdirectory( glm )
|
||||
endif()
|
||||
else()
|
||||
message( WARNING " Could not find clang-format. Generated vulkan.hpp and vulkan_raii.hpp will not be nicely formatted." )
|
||||
endif()
|
||||
|
||||
# look for the file vk.xml, the ultimate source of truth for vulkan, to generate the headers from
|
||||
if( NOT DEFINED VulkanRegistry_DIR )
|
||||
if( DEFINED VULKAN_HPP_VULKAN_HEADERS_SRC_DIR )
|
||||
set( VulkanRegistry_DIR "${VULKAN_HPP_VULKAN_HEADERS_SRC_DIR}/registry" )
|
||||
else()
|
||||
set( VulkanRegistry_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Headers/registry" )
|
||||
find_package( glfw3 QUIET )
|
||||
if( NOT glfw3_FOUND )
|
||||
set( GLFW_BUILD_EXAMPLES OFF )
|
||||
set( GLFW_BUILD_TESTS OFF )
|
||||
add_subdirectory( glfw )
|
||||
endif()
|
||||
endif()
|
||||
file( TO_NATIVE_PATH ${VulkanRegistry_DIR}/vk.xml vk_spec )
|
||||
string( REPLACE "\\" "\\\\" vk_spec ${vk_spec} )
|
||||
|
||||
# gather the tinyxml2 sources, to be used directly in the generator project
|
||||
if( NOT DEFINED VULKAN_HPP_TINYXML2_SRC_DIR )
|
||||
set( VULKAN_HPP_TINYXML2_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tinyxml2" )
|
||||
endif()
|
||||
set( TINYXML2_SOURCES ${VULKAN_HPP_TINYXML2_SRC_DIR}/tinyxml2.cpp )
|
||||
set( TINYXML2_HEADERS ${VULKAN_HPP_TINYXML2_SRC_DIR}/tinyxml2.h )
|
||||
source_group( TinyXML2 FILES ${TINYXML2_HEADERS} ${TINYXML2_SOURCES} )
|
||||
|
||||
# Build Vulkan-Hpp as a module
|
||||
if( VULKAN_HPP_ENABLE_CPP20_MODULES )
|
||||
# create a target to provide VulkanHpp as C++20 module
|
||||
add_library( VulkanHppModule )
|
||||
set_target_properties( VulkanHppModule PROPERTIES
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
CXX_EXTENSIONS OFF )
|
||||
if ( VULKAN_HPP_CPP20_MODULE_DYNAMIC_DISPATCHER )
|
||||
target_compile_definitions( VulkanHppModule PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1 )
|
||||
else()
|
||||
target_compile_definitions( VulkanHppModule PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=0 )
|
||||
find_package( glslang QUIET )
|
||||
if( NOT glslang_FOUND )
|
||||
set( ENABLE_OPT OFF ) # could use ALLOW_EXTERNAL_SPIRV_TOOLS=ON instead
|
||||
add_subdirectory( glslang )
|
||||
endif()
|
||||
target_compile_features( VulkanHppModule PUBLIC cxx_std_20 )
|
||||
target_sources( VulkanHppModule
|
||||
PUBLIC
|
||||
FILE_SET vulkan_module_file BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} TYPE CXX_MODULES FILES vulkan/vulkan.cppm )
|
||||
target_include_directories( VulkanHppModule PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} )
|
||||
target_include_directories( VulkanHppModule PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Headers/include" )
|
||||
endif()
|
||||
|
||||
# The generator executable
|
||||
add_executable( VulkanHppGenerator VulkanHppGenerator.cpp VulkanHppGenerator.hpp XMLHelper.hpp ${TINYXML2_SOURCES} ${TINYXML2_HEADERS} )
|
||||
vulkan_hpp__setup_warning_level( NAME VulkanHppGenerator )
|
||||
target_compile_definitions( VulkanHppGenerator PUBLIC BASE_PATH="${CMAKE_CURRENT_SOURCE_DIR}" VK_SPEC="${vk_spec}" )
|
||||
target_include_directories( VulkanHppGenerator PRIVATE ${VULKAN_HPP_TINYXML2_SRC_DIR} )
|
||||
set_target_properties( VulkanHppGenerator PROPERTIES CXX_STANDARD 20 CXX_STANDARD_REQUIRED ON )
|
||||
|
||||
# The video generator executable
|
||||
add_executable( VideoHppGenerator VideoHppGenerator.cpp VideoHppGenerator.hpp XMLHelper.hpp ${TINYXML2_SOURCES} ${TINYXML2_HEADERS} )
|
||||
vulkan_hpp__setup_warning_level( NAME VideoHppGenerator )
|
||||
file( TO_NATIVE_PATH ${VulkanRegistry_DIR}/video.xml video_spec )
|
||||
string( REPLACE "\\" "\\\\" video_spec ${video_spec} )
|
||||
target_compile_definitions( VideoHppGenerator PUBLIC BASE_PATH="${CMAKE_CURRENT_SOURCE_DIR}" VIDEO_SPEC="${video_spec}" )
|
||||
target_include_directories( VideoHppGenerator PRIVATE ${VULKAN_HPP_TINYXML2_SRC_DIR} )
|
||||
set_target_properties( VideoHppGenerator PROPERTIES CXX_STANDARD 20 CXX_STANDARD_REQUIRED ON )
|
||||
|
||||
|
||||
# if the generators are to be run, add a custom commands and targets
|
||||
if( VULKAN_HPP_RUN_GENERATOR )
|
||||
if( NOT DEFINED VulkanHeaders_INCLUDE_DIR )
|
||||
if( DEFINED VULKAN_HPP_PATH )
|
||||
set( VulkanHeaders_INCLUDE_DIR ${VULKAN_HPP_PATH} )
|
||||
else()
|
||||
set( VulkanHeaders_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" )
|
||||
endif()
|
||||
endif()
|
||||
file( TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan.hpp vulkan_hpp )
|
||||
string( REPLACE "\\" "\\\\" vulkan_hpp ${vulkan_hpp} )
|
||||
|
||||
add_custom_command(
|
||||
COMMAND VulkanHppGenerator
|
||||
COMMAND VulkanHppGenerator -api vulkansc
|
||||
OUTPUT "${vulkan_hpp}"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
COMMENT "run VulkanHppGenerator"
|
||||
DEPENDS VulkanHppGenerator "${vk_spec}" )
|
||||
add_custom_target( build_vulkan_hpp ALL DEPENDS "${vulkan_hpp}" "${vk_spec}" )
|
||||
|
||||
add_custom_command(
|
||||
COMMAND VideoHppGenerator
|
||||
OUTPUT "${vulkan_video_hpp}"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
COMMENT "run VulkanVideoGenerator"
|
||||
DEPENDS VulkanVideoGenerator "${video_spec}" )
|
||||
add_custom_target( build_vulkan_video ALL DEPENDS "${vulkan_video_hpp}" "${video_spec}" )
|
||||
add_subdirectory( samples/utils )
|
||||
add_subdirectory( RAII_Samples/utils )
|
||||
endif()
|
||||
|
||||
if( VULKAN_HPP_SAMPLES_BUILD )
|
||||
# external libraries
|
||||
add_subdirectory( glm )
|
||||
set( GLFW_BUILD_EXAMPLES OFF )
|
||||
set( GLFW_BUILD_TESTS OFF )
|
||||
add_subdirectory( glfw )
|
||||
add_subdirectory( glslang )
|
||||
# samples
|
||||
add_subdirectory( samples )
|
||||
add_subdirectory( RAII_Samples )
|
||||
|
|
@ -427,12 +595,14 @@ if( ${VULKAN_HPP_INSTALL} )
|
|||
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_handles.hpp
|
||||
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_hash.hpp
|
||||
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_hpp_macros.hpp
|
||||
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan.hpp
|
||||
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_raii.hpp
|
||||
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_static_assertions.hpp
|
||||
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_structs.hpp
|
||||
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_to_string.hpp
|
||||
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_video.hpp
|
||||
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan.cppm
|
||||
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan_video.cppm
|
||||
${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan.hpp
|
||||
)
|
||||
install( FILES ${VK_GENERATED_VULKAN_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/vulkan )
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
uint32_t height = 64;
|
||||
vk::su::WindowData window = vk::su::createWindow( AppName, { width, height } );
|
||||
VkSurfaceKHR _surface;
|
||||
glfwCreateWindowSurface( static_cast<VkInstance>( *instance ), window.handle, nullptr, &_surface );
|
||||
glfwCreateWindowSurface( *instance, window.handle, nullptr, &_surface );
|
||||
vk::raii::SurfaceKHR surface( instance, _surface );
|
||||
|
||||
// determine a queueFamilyIndex that suports present
|
||||
|
|
@ -93,7 +93,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
|
||||
vk::SurfaceCapabilitiesKHR surfaceCapabilities = physicalDevice.getSurfaceCapabilitiesKHR( surface );
|
||||
vk::Extent2D swapchainExtent;
|
||||
if ( surfaceCapabilities.currentExtent.width == std::numeric_limits<uint32_t>::max() )
|
||||
if ( surfaceCapabilities.currentExtent.width == (std::numeric_limits<uint32_t>::max)() )
|
||||
{
|
||||
// If the surface size is undefined, the size is set to the size of the images requested.
|
||||
swapchainExtent.width = vk::su::clamp( width, surfaceCapabilities.minImageExtent.width, surfaceCapabilities.maxImageExtent.width );
|
||||
|
|
@ -120,7 +120,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
|
||||
vk::SwapchainCreateInfoKHR swapChainCreateInfo( vk::SwapchainCreateFlagsKHR(),
|
||||
surface,
|
||||
vk::su::clamp( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
|
||||
vk::su::clampSurfaceImageCount( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
|
||||
format,
|
||||
vk::ColorSpaceKHR::eSrgbNonlinear,
|
||||
swapchainExtent,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
if ( loader_major_version > desiredMajorVersion || ( loader_major_version == desiredMajorVersion && loader_minor_version >= desiredMinorVersion ) )
|
||||
{
|
||||
// Create the instance
|
||||
vk::raii::Instance instance = vk::raii::su::makeInstance( context, AppName, EngineName, {}, vk::su::getInstanceExtensions() );
|
||||
vk::raii::Instance instance = vk::raii::su::makeInstance( context, AppName, EngineName, {}, vk::su::getInstanceExtensions(), desiredVersion );
|
||||
#if !defined( NDEBUG )
|
||||
vk::raii::DebugUtilsMessengerEXT debugUtilsMessenger( instance, vk::su::makeDebugUtilsMessengerCreateInfoEXT() );
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
add_subdirectory( utils )
|
||||
add_subdirectory( 01_InitInstance )
|
||||
add_subdirectory( 02_EnumerateDevices )
|
||||
add_subdirectory( 03_InitDevice )
|
||||
|
|
|
|||
|
|
@ -78,11 +78,8 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
assert( imageIndex < swapChainData.images.size() );
|
||||
|
||||
commandBuffer.begin( vk::CommandBufferBeginInfo() );
|
||||
vk::raii::su::setImageLayout( commandBuffer,
|
||||
static_cast<vk::Image>( swapChainData.images[imageIndex] ),
|
||||
swapChainData.colorFormat,
|
||||
vk::ImageLayout::eUndefined,
|
||||
vk::ImageLayout::eTransferDstOptimal );
|
||||
vk::raii::su::setImageLayout(
|
||||
commandBuffer, swapChainData.images[imageIndex], swapChainData.colorFormat, vk::ImageLayout::eUndefined, vk::ImageLayout::eTransferDstOptimal );
|
||||
|
||||
// in order to get a clean desctruction sequence, instantiate the DeviceMemory for the image first
|
||||
vk::raii::DeviceMemory deviceMemory( nullptr );
|
||||
|
|
@ -150,7 +147,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
// Intend to blit from this image, set the layout accordingly
|
||||
vk::raii::su::setImageLayout( commandBuffer, blitSourceImage, swapChainData.colorFormat, vk::ImageLayout::eGeneral, vk::ImageLayout::eTransferSrcOptimal );
|
||||
|
||||
vk::Image blitDestinationImage = static_cast<vk::Image>( swapChainData.images[imageIndex] );
|
||||
vk::Image blitDestinationImage = swapChainData.images[imageIndex];
|
||||
|
||||
// Do a 32x32 blit to all of the dst image - should get big squares
|
||||
vk::ImageSubresourceLayers imageSubresourceLayers( vk::ImageAspectFlagBits::eColor, 0, 0, 1 );
|
||||
|
|
@ -203,9 +200,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
result = presentQueue.presentKHR( presentInfoKHR );
|
||||
switch ( result )
|
||||
{
|
||||
case vk::Result::eSuccess: break;
|
||||
case vk::Result::eSuccess : break;
|
||||
case vk::Result::eSuboptimalKHR: std::cout << "vk::Queue::presentKHR returned vk::Result::eSuboptimalKHR !\n"; break;
|
||||
default: assert( false ); // an unexpected result is returned !
|
||||
default : assert( false ); // an unexpected result is returned !
|
||||
}
|
||||
std::this_thread::sleep_for( std::chrono::milliseconds( 1000 ) );
|
||||
|
||||
|
|
|
|||
|
|
@ -24,15 +24,14 @@
|
|||
static char const * AppName = "CreateDebugReportMessenger";
|
||||
static char const * EngineName = "Vulkan.hpp";
|
||||
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
|
||||
VkDebugUtilsMessageTypeFlagsEXT messageTypes,
|
||||
VkDebugUtilsMessengerCallbackDataEXT const * pCallbackData,
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( vk::DebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
|
||||
vk::DebugUtilsMessageTypeFlagsEXT messageTypes,
|
||||
vk::DebugUtilsMessengerCallbackDataEXT const * pCallbackData,
|
||||
void * /*pUserData*/ )
|
||||
{
|
||||
std::ostringstream message;
|
||||
|
||||
message << vk::to_string( static_cast<vk::DebugUtilsMessageSeverityFlagBitsEXT>( messageSeverity ) ) << ": "
|
||||
<< vk::to_string( static_cast<vk::DebugUtilsMessageTypeFlagsEXT>( messageTypes ) ) << ":\n";
|
||||
message << vk::to_string( messageSeverity ) << ": " << vk::to_string( messageTypes ) << ":\n";
|
||||
message << std::string( "\t" ) << "messageIDName = <" << pCallbackData->pMessageIdName << ">\n";
|
||||
message << std::string( "\t" ) << "messageIdNumber = " << pCallbackData->messageIdNumber << "\n";
|
||||
message << std::string( "\t" ) << "message = <" << pCallbackData->pMessage << ">\n";
|
||||
|
|
@ -58,7 +57,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( VkDebugUtilsMessageSeverityFlag
|
|||
for ( uint32_t i = 0; i < pCallbackData->objectCount; i++ )
|
||||
{
|
||||
message << std::string( "\t\t" ) << "Object " << i << "\n";
|
||||
message << std::string( "\t\t\t" ) << "objectType = " << vk::to_string( static_cast<vk::ObjectType>( pCallbackData->pObjects[i].objectType ) ) << "\n";
|
||||
message << std::string( "\t\t\t" ) << "objectType = " << vk::to_string( pCallbackData->pObjects[i].objectType ) << "\n";
|
||||
message << std::string( "\t\t\t" ) << "objectHandle = " << pCallbackData->pObjects[i].objectHandle << "\n";
|
||||
if ( pCallbackData->pObjects[i].pObjectName )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -47,9 +47,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
|
||||
/* VULKAN_KEY_START */
|
||||
|
||||
vk::DebugUtilsObjectNameInfoEXT debugUtilsObjectNameInfo(
|
||||
vk::ObjectType::eImage, NON_DISPATCHABLE_HANDLE_TO_UINT64_CAST( VkImage, static_cast<vk ::Image>( image ) ), "Image name" );
|
||||
device.setDebugUtilsObjectNameEXT( debugUtilsObjectNameInfo );
|
||||
device.setDebugUtilsObjectNameEXT( *image, "Image name" );
|
||||
|
||||
/* VULKAN_KEY_END */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@
|
|||
|
||||
#if defined( _MSC_VER )
|
||||
// no need to ignore any warnings with MSVC
|
||||
#elif defined( __clang__ )
|
||||
#endif
|
||||
#if defined( __clang__ )
|
||||
# pragma clang diagnostic ignored "-Wunused-variable"
|
||||
#elif defined( __GNUC__ )
|
||||
# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
|
||||
|
|
@ -51,15 +52,14 @@ VKAPI_ATTR void VKAPI_CALL vkDestroyDebugUtilsMessengerEXT( VkInstance instance,
|
|||
return pfnVkDestroyDebugUtilsMessengerEXT( instance, messenger, pAllocator );
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
|
||||
VkDebugUtilsMessageTypeFlagsEXT messageTypes,
|
||||
VkDebugUtilsMessengerCallbackDataEXT const * pCallbackData,
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( vk::DebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
|
||||
vk::DebugUtilsMessageTypeFlagsEXT messageTypes,
|
||||
vk::DebugUtilsMessengerCallbackDataEXT const * pCallbackData,
|
||||
void * /*pUserData*/ )
|
||||
{
|
||||
std::string message;
|
||||
|
||||
message += vk::to_string( static_cast<vk::DebugUtilsMessageSeverityFlagBitsEXT>( messageSeverity ) ) + ": " +
|
||||
vk::to_string( static_cast<vk::DebugUtilsMessageTypeFlagsEXT>( messageTypes ) ) + ":\n";
|
||||
message += vk::to_string( messageSeverity ) + ": " + vk::to_string( messageTypes ) + ":\n";
|
||||
message += std::string( "\t" ) + "messageIDName = <" + pCallbackData->pMessageIdName + ">\n";
|
||||
message += std::string( "\t" ) + "messageIdNumber = " + std::to_string( pCallbackData->messageIdNumber ) + "\n";
|
||||
message += std::string( "\t" ) + "message = <" + pCallbackData->pMessage + ">\n";
|
||||
|
|
@ -84,7 +84,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( VkDebugUtilsMessageSeverityFlag
|
|||
for ( uint32_t i = 0; i < pCallbackData->objectCount; i++ )
|
||||
{
|
||||
message += std::string( "\t" ) + "Object " + std::to_string( i ) + "\n";
|
||||
message += std::string( "\t\t" ) + "objectType = " + vk::to_string( static_cast<vk::ObjectType>( pCallbackData->pObjects[i].objectType ) ) + "\n";
|
||||
message += std::string( "\t\t" ) + "objectType = " + vk::to_string( pCallbackData->pObjects[i].objectType ) + "\n";
|
||||
message += std::string( "\t\t" ) + "objectHandle = " + std::to_string( pCallbackData->pObjects[i].objectHandle ) + "\n";
|
||||
if ( pCallbackData->pObjects[i].pObjectName )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
int timeouts = -1;
|
||||
do
|
||||
{
|
||||
result = device.waitForFences( { fence }, true, vk::su::FenceTimeout );
|
||||
result = device.waitForFences( *fence, true, vk::su::FenceTimeout );
|
||||
timeouts++;
|
||||
} while ( result == vk::Result::eTimeout );
|
||||
assert( result == vk::Result::eSuccess );
|
||||
|
|
@ -75,16 +75,16 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
commandPool.reset();
|
||||
|
||||
commandBuffer.begin( vk::CommandBufferBeginInfo() );
|
||||
commandBuffer.waitEvents( { event }, vk::PipelineStageFlagBits::eHost, vk::PipelineStageFlagBits::eBottomOfPipe, nullptr, nullptr, nullptr );
|
||||
commandBuffer.waitEvents( *event, vk::PipelineStageFlagBits::eHost, vk::PipelineStageFlagBits::eBottomOfPipe, nullptr, nullptr, nullptr );
|
||||
commandBuffer.end();
|
||||
device.resetFences( { fence } );
|
||||
device.resetFences( *fence );
|
||||
|
||||
// Note that stepping through this code in the debugger is a bad idea because the GPU can TDR waiting for the event.
|
||||
// Execute the code from vk::Queue::submit() through vk::Device::setEvent() without breakpoints
|
||||
graphicsQueue.submit( submitInfo, fence );
|
||||
|
||||
// We should timeout waiting for the fence because the GPU should be waiting on the event
|
||||
result = device.waitForFences( { fence }, true, vk::su::FenceTimeout );
|
||||
result = device.waitForFences( *fence, true, vk::su::FenceTimeout );
|
||||
if ( result != vk::Result::eTimeout )
|
||||
{
|
||||
std::cout << "Didn't get expected timeout in vk::Device::waitForFences, exiting\n";
|
||||
|
|
@ -96,11 +96,11 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
event.set();
|
||||
do
|
||||
{
|
||||
result = device.waitForFences( { fence }, true, vk::su::FenceTimeout );
|
||||
result = device.waitForFences( *fence, true, vk::su::FenceTimeout );
|
||||
} while ( result == vk::Result::eTimeout );
|
||||
assert( result == vk::Result::eSuccess );
|
||||
|
||||
device.resetFences( { fence } );
|
||||
device.resetFences( *fence );
|
||||
event.reset();
|
||||
|
||||
// reset the command buffer by resetting the complete command pool
|
||||
|
|
@ -116,7 +116,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
assert( result == vk::Result::eEventReset );
|
||||
|
||||
// Send the command buffer and loop waiting for the event
|
||||
graphicsQueue.submit( submitInfo, fence );
|
||||
graphicsQueue.submit( submitInfo, *fence );
|
||||
|
||||
int polls = 0;
|
||||
do
|
||||
|
|
@ -128,7 +128,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
|
||||
do
|
||||
{
|
||||
result = device.waitForFences( { fence }, true, vk::su::FenceTimeout );
|
||||
result = device.waitForFences( *fence, true, vk::su::FenceTimeout );
|
||||
} while ( result == vk::Result::eTimeout );
|
||||
assert( result == vk::Result::eSuccess );
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@
|
|||
|
||||
#if defined( _MSC_VER )
|
||||
// no need to ignore any warnings with MSVC
|
||||
#elif defined( __clang__ )
|
||||
#endif
|
||||
#if defined( __clang__ )
|
||||
# pragma clang diagnostic ignored "-Wunused-variable"
|
||||
#elif defined( __GNUC__ )
|
||||
# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
|
||||
|
|
@ -25,11 +26,11 @@
|
|||
// unknow compiler... just ignore the warnings for yourselves ;)
|
||||
#endif
|
||||
|
||||
#include "../samples/utils/geometries.hpp"
|
||||
#include "../samples/utils/math.hpp"
|
||||
#include "../../samples/utils/geometries.hpp"
|
||||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
|
|||
|
|
@ -40,22 +40,19 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
for ( size_t i = 0; i < groupProperties.size(); i++ )
|
||||
{
|
||||
std::cout << "Group Properties " << i << " :\n";
|
||||
std::cout << "\t"
|
||||
<< "physicalDeviceCount = " << groupProperties[i].physicalDeviceCount << "\n";
|
||||
std::cout << "\t"
|
||||
<< "physicalDevices:\n";
|
||||
std::cout << "\t" << "physicalDeviceCount = " << groupProperties[i].physicalDeviceCount << "\n";
|
||||
std::cout << "\t" << "physicalDevices:\n";
|
||||
for ( size_t j = 0; j < groupProperties[i].physicalDeviceCount; j++ )
|
||||
{
|
||||
vk::raii::PhysicalDevice physicalDevice( instance, static_cast<VkPhysicalDevice>( groupProperties[i].physicalDevices[j] ) );
|
||||
vk::raii::PhysicalDevice physicalDevice( instance, groupProperties[i].physicalDevices[j] );
|
||||
std::cout << "\t\t" << j << " : " << physicalDevice.getProperties().deviceName << "\n";
|
||||
}
|
||||
std::cout << "\t"
|
||||
<< "subsetAllocation = " << !!groupProperties[i].subsetAllocation << "\n";
|
||||
std::cout << "\t" << "subsetAllocation = " << !!groupProperties[i].subsetAllocation << "\n";
|
||||
std::cout << "\n";
|
||||
|
||||
if ( 1 < groupProperties[i].physicalDeviceCount )
|
||||
{
|
||||
vk::raii::PhysicalDevice physicalDevice( instance, static_cast<VkPhysicalDevice>( groupProperties[i].physicalDevices[0] ) );
|
||||
vk::raii::PhysicalDevice physicalDevice( instance, groupProperties[i].physicalDevices[0] );
|
||||
|
||||
// get the QueueFamilyProperties of the first PhysicalDevice
|
||||
std::vector<vk::QueueFamilyProperties> queueFamilyProperties = physicalDevice.getQueueFamilyProperties();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -48,7 +48,6 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
|
||||
std::cout << "PhysicalDevice " << i << " :" << std::endl;
|
||||
|
||||
// need to explicitly specify all the template arguments for getQueueFamilyProperties2 to make the compiler happy
|
||||
using Chain = vk::StructureChain<vk::QueueFamilyProperties2, vk::QueueFamilyCheckpointPropertiesNV>;
|
||||
auto queueFamilyProperties2 = physicalDevices[i].getQueueFamilyProperties2<Chain>();
|
||||
for ( size_t j = 0; j < queueFamilyProperties2.size(); j++ )
|
||||
|
|
|
|||
|
|
@ -28,14 +28,14 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <thread>
|
||||
|
||||
// For timestamp code (getMilliseconds)
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
# include <Windows.h>
|
||||
#else
|
||||
# include <sys/time.h>
|
||||
|
|
@ -45,7 +45,7 @@ typedef unsigned long long timestamp_t;
|
|||
|
||||
timestamp_t getMilliseconds()
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
LARGE_INTEGER frequency;
|
||||
BOOL useQPC = QueryPerformanceFrequency( &frequency );
|
||||
if ( useQPC )
|
||||
|
|
@ -142,8 +142,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
/* VULKAN_KEY_START */
|
||||
|
||||
// Check disk for existing cache data
|
||||
size_t startCacheSize = 0;
|
||||
char * startCacheData = nullptr;
|
||||
std::vector<char> startCacheData;
|
||||
|
||||
std::string cacheFileName = "pipeline_cache_data.bin";
|
||||
std::ifstream readCacheStream( cacheFileName, std::ios_base::in | std::ios_base::binary );
|
||||
|
|
@ -151,14 +150,14 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
{
|
||||
// Determine cache size
|
||||
readCacheStream.seekg( 0, readCacheStream.end );
|
||||
startCacheSize = static_cast<size_t>( readCacheStream.tellg() );
|
||||
size_t startCacheSize = static_cast<size_t>( readCacheStream.tellg() );
|
||||
readCacheStream.seekg( 0, readCacheStream.beg );
|
||||
|
||||
// Allocate memory to hold the initial cache data
|
||||
startCacheData = (char *)std::malloc( startCacheSize );
|
||||
startCacheData.resize( startCacheSize );
|
||||
|
||||
// Read the data into our buffer
|
||||
readCacheStream.read( startCacheData, startCacheSize );
|
||||
readCacheStream.read( startCacheData.data(), startCacheData.size() );
|
||||
|
||||
// Clean up and print results
|
||||
readCacheStream.close();
|
||||
|
|
@ -171,7 +170,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
std::cout << " Pipeline cache miss!\n";
|
||||
}
|
||||
|
||||
if ( startCacheData != nullptr )
|
||||
if ( !startCacheData.empty() )
|
||||
{
|
||||
// Check for cache validity
|
||||
//
|
||||
|
|
@ -207,11 +206,12 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
uint32_t deviceID = 0;
|
||||
uint8_t pipelineCacheUUID[VK_UUID_SIZE] = {};
|
||||
|
||||
memcpy( &headerLength, (uint8_t *)startCacheData + 0, 4 );
|
||||
memcpy( &cacheHeaderVersion, (uint8_t *)startCacheData + 4, 4 );
|
||||
memcpy( &vendorID, (uint8_t *)startCacheData + 8, 4 );
|
||||
memcpy( &deviceID, (uint8_t *)startCacheData + 12, 4 );
|
||||
memcpy( pipelineCacheUUID, (uint8_t *)startCacheData + 16, VK_UUID_SIZE );
|
||||
uint8_t * startCacheDataPtr = reinterpret_cast<uint8_t *>( startCacheData.data() );
|
||||
memcpy( &headerLength, startCacheDataPtr + 0, 4 );
|
||||
memcpy( &cacheHeaderVersion, startCacheDataPtr + 4, 4 );
|
||||
memcpy( &vendorID, startCacheDataPtr + 8, 4 );
|
||||
memcpy( &deviceID, startCacheDataPtr + 12, 4 );
|
||||
memcpy( pipelineCacheUUID, startCacheDataPtr + 16, VK_UUID_SIZE );
|
||||
|
||||
// Check each field and report bad values before freeing existing cache
|
||||
bool badCache = false;
|
||||
|
|
@ -257,9 +257,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
if ( badCache )
|
||||
{
|
||||
// Don't submit initial cache data if any version info is incorrect
|
||||
free( startCacheData );
|
||||
startCacheSize = 0;
|
||||
startCacheData = nullptr;
|
||||
startCacheData.clear();
|
||||
|
||||
// And clear out the old cache file for use in next run
|
||||
std::cout << " Deleting cache entry " << cacheFileName << " to repopulate.\n";
|
||||
|
|
@ -272,12 +270,11 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
}
|
||||
|
||||
// Feed the initial cache data into cache creation
|
||||
vk::PipelineCacheCreateInfo pipelineCacheCreateInfo( {}, startCacheSize, startCacheData );
|
||||
vk::PipelineCacheCreateInfo pipelineCacheCreateInfo( {}, startCacheData.size(), startCacheData.data() );
|
||||
vk::raii::PipelineCache pipelineCache( device, pipelineCacheCreateInfo );
|
||||
|
||||
// Free our initialData now that pipeline cache has been created
|
||||
free( startCacheData );
|
||||
startCacheData = NULL;
|
||||
startCacheData.clear();
|
||||
|
||||
// Time (roughly) taken to create the graphics pipeline
|
||||
timestamp_t start = getMilliseconds();
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <thread>
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
|
|||
|
|
@ -14,11 +14,6 @@
|
|||
|
||||
vulkan_hpp__setup_sample_raii(
|
||||
NAME RayTracing
|
||||
INCLUDE_DIRS
|
||||
${CMAKE_SOURCE_DIR}/samples/RayTracing/common
|
||||
${CMAKE_SOURCE_DIR}/samples/RayTracing/vulkannv
|
||||
${CMAKE_SOURCE_DIR}/stb
|
||||
${CMAKE_SOURCE_DIR}/tinyobjloader
|
||||
HEADERS
|
||||
CameraManipulator.hpp
|
||||
SOURCES
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "CameraManipulator.hpp"
|
||||
|
||||
#define GLM_ENABLE_EXPERIMENTAL
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtx/rotate_vector.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "CameraManipulator.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_inverse.hpp>
|
||||
|
|
@ -580,7 +580,7 @@ static void keyCallback( GLFWwindow * window, int key, int /*scancode*/, int act
|
|||
switch ( key )
|
||||
{
|
||||
case GLFW_KEY_ESCAPE:
|
||||
case 'Q': glfwSetWindowShouldClose( window, 1 ); break;
|
||||
case 'Q' : glfwSetWindowShouldClose( window, 1 ); break;
|
||||
case 'R':
|
||||
{
|
||||
AppInfo * appInfo = reinterpret_cast<AppInfo *>( glfwGetWindowUserPointer( window ) );
|
||||
|
|
@ -724,7 +724,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
|
||||
// Create Window Surface (using glfw)
|
||||
VkSurfaceKHR glfwSurface;
|
||||
VkResult err = glfwCreateWindowSurface( static_cast<VkInstance>( *instance ), window, nullptr, &glfwSurface );
|
||||
VkResult err = glfwCreateWindowSurface( *instance, window, nullptr, &glfwSurface );
|
||||
check_vk_result( err );
|
||||
vk::raii::SurfaceKHR surface( instance, glfwSurface );
|
||||
|
||||
|
|
@ -1151,9 +1151,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
swapChainData.swapChain.acquireNextImage( vk::su::FenceTimeout, *perFrameData[frameIndex].presentCompleteSemaphore );
|
||||
assert( result == vk::Result::eSuccess );
|
||||
|
||||
while ( vk::Result::eTimeout == device.waitForFences( { *perFrameData[frameIndex].fence }, VK_TRUE, vk::su::FenceTimeout ) )
|
||||
while ( vk::Result::eTimeout == device.waitForFences( *perFrameData[frameIndex].fence, VK_TRUE, vk::su::FenceTimeout ) )
|
||||
;
|
||||
device.resetFences( { *perFrameData[frameIndex].fence } );
|
||||
device.resetFences( *perFrameData[frameIndex].fence );
|
||||
|
||||
// reset the command buffer by resetting the complete command pool of this frame
|
||||
perFrameData[frameIndex].commandPool.reset();
|
||||
|
|
@ -1187,11 +1187,8 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
vk::WriteDescriptorSet writeDescriptorSet( *rayTracingDescriptorSets[backBufferIndex], 1, 0, bindings[1].descriptorType, imageInfo );
|
||||
device.updateDescriptorSets( writeDescriptorSet, nullptr );
|
||||
|
||||
vk::raii::su::setImageLayout( commandBuffer,
|
||||
static_cast<vk::Image>( swapChainData.images[backBufferIndex] ),
|
||||
surfaceFormat.format,
|
||||
vk::ImageLayout::eUndefined,
|
||||
vk::ImageLayout::eGeneral );
|
||||
vk::raii::su::setImageLayout(
|
||||
commandBuffer, swapChainData.images[backBufferIndex], surfaceFormat.format, vk::ImageLayout::eUndefined, vk::ImageLayout::eGeneral );
|
||||
|
||||
commandBuffer.bindPipeline( vk::PipelineBindPoint::eRayTracingNV, *rayTracingPipeline );
|
||||
|
||||
|
|
@ -1213,11 +1210,8 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
windowExtent.height,
|
||||
1 );
|
||||
|
||||
vk::raii::su::setImageLayout( commandBuffer,
|
||||
static_cast<vk::Image>( swapChainData.images[backBufferIndex] ),
|
||||
surfaceFormat.format,
|
||||
vk::ImageLayout::eGeneral,
|
||||
vk::ImageLayout::ePresentSrcKHR );
|
||||
vk::raii::su::setImageLayout(
|
||||
commandBuffer, swapChainData.images[backBufferIndex], surfaceFormat.format, vk::ImageLayout::eGeneral, vk::ImageLayout::ePresentSrcKHR );
|
||||
}
|
||||
|
||||
// frame end
|
||||
|
|
@ -1235,9 +1229,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
result = presentQueue.presentKHR( presentInfoKHR );
|
||||
switch ( result )
|
||||
{
|
||||
case vk::Result::eSuccess: break;
|
||||
case vk::Result::eSuccess : break;
|
||||
case vk::Result::eSuboptimalKHR: std::cout << "vk::Queue::presentKHR returned vk::Result::eSuboptimalKHR !\n"; break;
|
||||
default: assert( false ); // an unexpected result is returned !
|
||||
default : assert( false ); // an unexpected result is returned !
|
||||
}
|
||||
frameIndex = ( frameIndex + 1 ) % IMGUI_VK_QUEUED_FRAMES;
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
@ -146,11 +146,8 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
assert( result == vk::Result::eSuccess );
|
||||
assert( imageIndex < swapChainData.images.size() );
|
||||
|
||||
vk::raii::su::setImageLayout( commandBuffer,
|
||||
static_cast<vk::Image>( swapChainData.images[imageIndex] ),
|
||||
swapChainData.colorFormat,
|
||||
vk::ImageLayout::eUndefined,
|
||||
vk::ImageLayout::eColorAttachmentOptimal );
|
||||
vk::raii::su::setImageLayout(
|
||||
commandBuffer, swapChainData.images[imageIndex], swapChainData.colorFormat, vk::ImageLayout::eUndefined, vk::ImageLayout::eColorAttachmentOptimal );
|
||||
|
||||
const vk::DeviceSize offset = 0;
|
||||
vk::Viewport viewport( 0.0f, 0.0f, 200.0f, 200.0f, 0.0f, 1.0f );
|
||||
|
|
@ -197,7 +194,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
vk::ImageLayout::ePresentSrcKHR,
|
||||
VK_QUEUE_FAMILY_IGNORED,
|
||||
VK_QUEUE_FAMILY_IGNORED,
|
||||
static_cast<vk::Image>( swapChainData.images[imageIndex] ),
|
||||
swapChainData.images[imageIndex],
|
||||
imageSubresourceRange );
|
||||
commandBuffer.pipelineBarrier(
|
||||
vk::PipelineStageFlagBits::eColorAttachmentOutput, vk::PipelineStageFlagBits::eBottomOfPipe, vk::DependencyFlags(), nullptr, nullptr, prePresentBarrier );
|
||||
|
|
@ -215,9 +212,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
result = presentQueue.presentKHR( vk::PresentInfoKHR( {}, *swapChainData.swapChain, imageIndex, {} ) );
|
||||
switch ( result )
|
||||
{
|
||||
case vk::Result::eSuccess: break;
|
||||
case vk::Result::eSuccess : break;
|
||||
case vk::Result::eSuboptimalKHR: std::cout << "vk::Queue::presentKHR returned vk::Result::eSuboptimalKHR !\n"; break;
|
||||
default: assert( false ); // an unexpected result is returned !
|
||||
default : assert( false ); // an unexpected result is returned !
|
||||
}
|
||||
std::this_thread::sleep_for( std::chrono::milliseconds( 1000 ) );
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
|
|||
|
|
@ -84,12 +84,11 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
std::cout << "PhysicalDevice " << i << "\n";
|
||||
if ( supportsGetSurfaceCapabilities2 )
|
||||
{
|
||||
auto surfaceCapabilities2 =
|
||||
physicalDevices[i]
|
||||
.getSurfaceCapabilities2KHR<vk::SurfaceCapabilities2KHR,
|
||||
vk::DisplayNativeHdrSurfaceCapabilitiesAMD,
|
||||
vk::SharedPresentSurfaceCapabilitiesKHR,
|
||||
vk::SurfaceProtectedCapabilitiesKHR>( { static_cast<vk::SurfaceKHR>( surfaceData.surface ) } );
|
||||
auto surfaceCapabilities2 = physicalDevices[i]
|
||||
.getSurfaceCapabilities2KHR<vk::SurfaceCapabilities2KHR,
|
||||
vk::DisplayNativeHdrSurfaceCapabilitiesAMD,
|
||||
vk::SharedPresentSurfaceCapabilitiesKHR,
|
||||
vk::SurfaceProtectedCapabilitiesKHR>( { *surfaceData.surface } );
|
||||
|
||||
vk::SurfaceCapabilitiesKHR const & surfaceCapabilities = surfaceCapabilities2.get<vk::SurfaceCapabilities2KHR>().surfaceCapabilities;
|
||||
cout( surfaceCapabilities );
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
|
|||
|
|
@ -101,20 +101,20 @@ namespace vk
|
|||
switch ( oldImageLayout )
|
||||
{
|
||||
case vk::ImageLayout::eTransferDstOptimal: sourceAccessMask = vk::AccessFlagBits::eTransferWrite; break;
|
||||
case vk::ImageLayout::ePreinitialized: sourceAccessMask = vk::AccessFlagBits::eHostWrite; break;
|
||||
case vk::ImageLayout::eGeneral: // sourceAccessMask is empty
|
||||
case vk::ImageLayout::eUndefined: break;
|
||||
default: assert( false ); break;
|
||||
case vk::ImageLayout::ePreinitialized : sourceAccessMask = vk::AccessFlagBits::eHostWrite; break;
|
||||
case vk::ImageLayout::eGeneral : // sourceAccessMask is empty
|
||||
case vk::ImageLayout::eUndefined : break;
|
||||
default : assert( false ); break;
|
||||
}
|
||||
|
||||
vk::PipelineStageFlags sourceStage;
|
||||
switch ( oldImageLayout )
|
||||
{
|
||||
case vk::ImageLayout::eGeneral:
|
||||
case vk::ImageLayout::ePreinitialized: sourceStage = vk::PipelineStageFlagBits::eHost; break;
|
||||
case vk::ImageLayout::ePreinitialized : sourceStage = vk::PipelineStageFlagBits::eHost; break;
|
||||
case vk::ImageLayout::eTransferDstOptimal: sourceStage = vk::PipelineStageFlagBits::eTransfer; break;
|
||||
case vk::ImageLayout::eUndefined: sourceStage = vk::PipelineStageFlagBits::eTopOfPipe; break;
|
||||
default: assert( false ); break;
|
||||
case vk::ImageLayout::eUndefined : sourceStage = vk::PipelineStageFlagBits::eTopOfPipe; break;
|
||||
default : assert( false ); break;
|
||||
}
|
||||
|
||||
vk::AccessFlags destinationAccessMask;
|
||||
|
|
@ -125,24 +125,24 @@ namespace vk
|
|||
destinationAccessMask = vk::AccessFlagBits::eDepthStencilAttachmentRead | vk::AccessFlagBits::eDepthStencilAttachmentWrite;
|
||||
break;
|
||||
case vk::ImageLayout::eGeneral: // empty destinationAccessMask
|
||||
case vk::ImageLayout::ePresentSrcKHR: break;
|
||||
case vk::ImageLayout::ePresentSrcKHR : break;
|
||||
case vk::ImageLayout::eShaderReadOnlyOptimal: destinationAccessMask = vk::AccessFlagBits::eShaderRead; break;
|
||||
case vk::ImageLayout::eTransferSrcOptimal: destinationAccessMask = vk::AccessFlagBits::eTransferRead; break;
|
||||
case vk::ImageLayout::eTransferDstOptimal: destinationAccessMask = vk::AccessFlagBits::eTransferWrite; break;
|
||||
default: assert( false ); break;
|
||||
case vk::ImageLayout::eTransferSrcOptimal : destinationAccessMask = vk::AccessFlagBits::eTransferRead; break;
|
||||
case vk::ImageLayout::eTransferDstOptimal : destinationAccessMask = vk::AccessFlagBits::eTransferWrite; break;
|
||||
default : assert( false ); break;
|
||||
}
|
||||
|
||||
vk::PipelineStageFlags destinationStage;
|
||||
switch ( newImageLayout )
|
||||
{
|
||||
case vk::ImageLayout::eColorAttachmentOptimal: destinationStage = vk::PipelineStageFlagBits::eColorAttachmentOutput; break;
|
||||
case vk::ImageLayout::eColorAttachmentOptimal : destinationStage = vk::PipelineStageFlagBits::eColorAttachmentOutput; break;
|
||||
case vk::ImageLayout::eDepthStencilAttachmentOptimal: destinationStage = vk::PipelineStageFlagBits::eEarlyFragmentTests; break;
|
||||
case vk::ImageLayout::eGeneral: destinationStage = vk::PipelineStageFlagBits::eHost; break;
|
||||
case vk::ImageLayout::ePresentSrcKHR: destinationStage = vk::PipelineStageFlagBits::eBottomOfPipe; break;
|
||||
case vk::ImageLayout::eShaderReadOnlyOptimal: destinationStage = vk::PipelineStageFlagBits::eFragmentShader; break;
|
||||
case vk::ImageLayout::eTransferDstOptimal:
|
||||
case vk::ImageLayout::eTransferSrcOptimal: destinationStage = vk::PipelineStageFlagBits::eTransfer; break;
|
||||
default: assert( false ); break;
|
||||
case vk::ImageLayout::eGeneral : destinationStage = vk::PipelineStageFlagBits::eHost; break;
|
||||
case vk::ImageLayout::ePresentSrcKHR : destinationStage = vk::PipelineStageFlagBits::eBottomOfPipe; break;
|
||||
case vk::ImageLayout::eShaderReadOnlyOptimal : destinationStage = vk::PipelineStageFlagBits::eFragmentShader; break;
|
||||
case vk::ImageLayout::eTransferDstOptimal :
|
||||
case vk::ImageLayout::eTransferSrcOptimal : destinationStage = vk::PipelineStageFlagBits::eTransfer; break;
|
||||
default : assert( false ); break;
|
||||
}
|
||||
|
||||
vk::ImageAspectFlags aspectMask;
|
||||
|
|
@ -246,9 +246,9 @@ namespace vk
|
|||
vk::raii::Buffer buffer = nullptr;
|
||||
#if !defined( NDEBUG )
|
||||
private:
|
||||
vk::DeviceSize m_size;
|
||||
vk::BufferUsageFlags m_usage;
|
||||
vk::MemoryPropertyFlags m_propertyFlags;
|
||||
vk::DeviceSize m_size = 0;
|
||||
vk::BufferUsageFlags m_usage = {};
|
||||
vk::MemoryPropertyFlags m_propertyFlags = {};
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
@ -315,7 +315,7 @@ namespace vk
|
|||
: extent( extent_ ), window( vk::su::createWindow( windowName, extent ) )
|
||||
{
|
||||
VkSurfaceKHR _surface;
|
||||
VkResult err = glfwCreateWindowSurface( static_cast<VkInstance>( *instance ), window.handle, nullptr, &_surface );
|
||||
VkResult err = glfwCreateWindowSurface( *instance, window.handle, nullptr, &_surface );
|
||||
if ( err != VK_SUCCESS )
|
||||
throw std::runtime_error( "Failed to create window!" );
|
||||
surface = vk::raii::SurfaceKHR( instance, _surface );
|
||||
|
|
@ -342,7 +342,7 @@ namespace vk
|
|||
|
||||
vk::SurfaceCapabilitiesKHR surfaceCapabilities = physicalDevice.getSurfaceCapabilitiesKHR( surface );
|
||||
vk::Extent2D swapchainExtent;
|
||||
if ( surfaceCapabilities.currentExtent.width == std::numeric_limits<uint32_t>::max() )
|
||||
if ( surfaceCapabilities.currentExtent.width == ( std::numeric_limits<uint32_t>::max )() )
|
||||
{
|
||||
// If the surface size is undefined, the size is set to the size of the images requested.
|
||||
swapchainExtent.width = vk::su::clamp( extent.width, surfaceCapabilities.minImageExtent.width, surfaceCapabilities.maxImageExtent.width );
|
||||
|
|
@ -364,7 +364,7 @@ namespace vk
|
|||
vk::PresentModeKHR presentMode = vk::su::pickPresentMode( physicalDevice.getSurfacePresentModesKHR( surface ) );
|
||||
vk::SwapchainCreateInfoKHR swapChainCreateInfo( {},
|
||||
surface,
|
||||
vk::su::clamp( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
|
||||
vk::su::clampSurfaceImageCount( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
|
||||
colorFormat,
|
||||
surfaceFormat.colorSpace,
|
||||
swapchainExtent,
|
||||
|
|
@ -509,7 +509,7 @@ namespace vk
|
|||
vk::raii::SurfaceKHR const & surface )
|
||||
{
|
||||
std::vector<vk::QueueFamilyProperties> queueFamilyProperties = physicalDevice.getQueueFamilyProperties();
|
||||
assert( queueFamilyProperties.size() < std::numeric_limits<uint32_t>::max() );
|
||||
assert( queueFamilyProperties.size() < ( std::numeric_limits<uint32_t>::max )() );
|
||||
|
||||
uint32_t graphicsQueueFamilyIndex = vk::su::findGraphicsQueueFamilyIndex( queueFamilyProperties );
|
||||
if ( physicalDevice.getSurfaceSupportKHR( graphicsQueueFamilyIndex, surface ) )
|
||||
|
|
@ -749,7 +749,7 @@ namespace vk
|
|||
#else
|
||||
vk::StructureChain<vk::InstanceCreateInfo, vk::DebugUtilsMessengerCreateInfoEXT>
|
||||
#endif
|
||||
instanceCreateInfoChain = vk::su::makeInstanceCreateInfoChain( applicationInfo, enabledLayers, enabledExtensions );
|
||||
instanceCreateInfoChain = vk::su::makeInstanceCreateInfoChain( {}, applicationInfo, enabledLayers, enabledExtensions );
|
||||
|
||||
return vk::raii::Instance( context, instanceCreateInfoChain.get<vk::InstanceCreateInfo>() );
|
||||
}
|
||||
|
|
@ -896,5 +896,5 @@ namespace vk
|
|||
}
|
||||
|
||||
} // namespace su
|
||||
} // namespace raii
|
||||
} // namespace raii
|
||||
} // namespace vk
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "XMLHelper.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
|
|
@ -32,44 +33,21 @@ VideoHppGenerator::VideoHppGenerator( tinyxml2::XMLDocument const & document )
|
|||
checkCorrectness();
|
||||
}
|
||||
|
||||
void VideoHppGenerator::generateCppmFile() const
|
||||
{
|
||||
generateFileFromTemplate(
|
||||
"vulkan_video.cppm", "VideoCppmTemplate.hpp", { { "copyrightMessage", m_copyrightMessage }, { "usings", generateCppModuleUsings() } } );
|
||||
}
|
||||
|
||||
void VideoHppGenerator::generateHppFile() const
|
||||
{
|
||||
std::string const video_hpp = std::string( BASE_PATH ) + "/vulkan/" + "vulkan_video.hpp";
|
||||
std::cout << "VideoHppGenerator: Generating " << video_hpp << " ... " << std::endl;
|
||||
|
||||
std::string const videoHppTemplate = R"(${copyrightMessage}
|
||||
|
||||
#ifndef VULKAN_VIDEO_HPP
|
||||
#define VULKAN_VIDEO_HPP
|
||||
|
||||
#include <vk_video/vulkan_video_codecs_common.h>
|
||||
#include <vk_video/vulkan_video_codec_h264std.h>
|
||||
#include <vk_video/vulkan_video_codec_h264std_decode.h>
|
||||
#include <vk_video/vulkan_video_codec_h264std_encode.h>
|
||||
#include <vk_video/vulkan_video_codec_h265std.h>
|
||||
#include <vk_video/vulkan_video_codec_h265std_decode.h>
|
||||
#include <vk_video/vulkan_video_codec_h265std_encode.h>
|
||||
#include <vulkan/vulkan.hpp>
|
||||
|
||||
#if !defined( VULKAN_HPP_VIDEO_NAMESPACE )
|
||||
# define VULKAN_HPP_VIDEO_NAMESPACE video
|
||||
#endif
|
||||
|
||||
namespace VULKAN_HPP_NAMESPACE
|
||||
{
|
||||
namespace VULKAN_HPP_VIDEO_NAMESPACE
|
||||
{
|
||||
${enums}
|
||||
${structs}
|
||||
} // namespace VULKAN_HPP_VIDEO_NAMESPACE
|
||||
} // namespace VULKAN_HPP_NAMESPACE
|
||||
#endif
|
||||
)";
|
||||
|
||||
std::string str =
|
||||
replaceWithMap( videoHppTemplate, { { "copyrightMessage", m_copyrightMessage }, { "enums", generateEnums() }, { "structs", generateStructs() } } );
|
||||
|
||||
writeToFile( str, video_hpp );
|
||||
generateFileFromTemplate( "vulkan_video.hpp",
|
||||
"VideoHppTemplate.hpp",
|
||||
{ { "constants", generateConstants() },
|
||||
{ "copyrightMessage", m_copyrightMessage },
|
||||
{ "enums", generateEnums() },
|
||||
{ "includes", generateIncludes() },
|
||||
{ "structs", generateStructs() } } );
|
||||
}
|
||||
|
||||
void VideoHppGenerator::addImplicitlyRequiredTypes()
|
||||
|
|
@ -114,6 +92,14 @@ std::vector<std::string>::iterator VideoHppGenerator::addImplicitlyRequiredTypes
|
|||
return reqIt;
|
||||
}
|
||||
|
||||
void VideoHppGenerator::checkAttributes( int line,
|
||||
std::map<std::string, std::string> const & attributes,
|
||||
std::map<std::string, std::set<std::string>> const & required,
|
||||
std::map<std::string, std::set<std::string>> const & optional ) const
|
||||
{
|
||||
::checkAttributes( "VideoHppGenerator", line, attributes, required, optional );
|
||||
}
|
||||
|
||||
void VideoHppGenerator::checkCorrectness() const
|
||||
{
|
||||
// only structs to check here!
|
||||
|
|
@ -126,8 +112,7 @@ void VideoHppGenerator::checkCorrectness() const
|
|||
checkForError( !typeIt->second.requiredBy.empty(), structure.second.xmlLine, "structure <" + structure.first + "> not required by any extension" );
|
||||
|
||||
assert( typeIt->second.requiredBy.size() == 1 );
|
||||
auto extIt =
|
||||
std::find_if( m_extensions.begin(), m_extensions.end(), [&typeIt]( ExtensionData const & ed ) { return ed.name == *typeIt->second.requiredBy.begin(); } );
|
||||
auto extIt = std::ranges::find_if( m_extensions, [&typeIt]( ExtensionData const & ed ) { return ed.name == *typeIt->second.requiredBy.begin(); } );
|
||||
assert( extIt != m_extensions.end() );
|
||||
|
||||
// checks on the members of a struct
|
||||
|
|
@ -156,7 +141,7 @@ void VideoHppGenerator::checkCorrectness() const
|
|||
{
|
||||
checkForError(
|
||||
!extIt->depends.empty(), extIt->xmlLine, "struct member <" + member.name + "> uses unknown constant <" + arraySize + "> as array size" );
|
||||
auto depIt = std::find_if( m_extensions.begin(), m_extensions.end(), [&extIt]( ExtensionData const & ed ) { return ed.name == extIt->depends; } );
|
||||
auto depIt = std::ranges::find_if( m_extensions, [&extIt]( ExtensionData const & ed ) { return ed.name == extIt->depends; } );
|
||||
assert( depIt != m_extensions.end() );
|
||||
checkForError( depIt->requireData.constants.contains( arraySize ),
|
||||
member.xmlLine,
|
||||
|
|
@ -168,6 +153,60 @@ void VideoHppGenerator::checkCorrectness() const
|
|||
}
|
||||
}
|
||||
|
||||
void VideoHppGenerator::checkElements( int line,
|
||||
std::vector<tinyxml2::XMLElement const *> const & elements,
|
||||
std::map<std::string, bool> const & required,
|
||||
std::set<std::string> const & optional ) const
|
||||
{
|
||||
::checkElements( "VideoHppGenerator", line, elements, required, optional );
|
||||
}
|
||||
|
||||
void VideoHppGenerator::checkForError( bool condition, int line, std::string const & message ) const
|
||||
{
|
||||
::checkForError( "VideoHppGenerator", condition, line, message );
|
||||
}
|
||||
|
||||
void VideoHppGenerator::checkForWarning( bool condition, int line, std::string const & message ) const
|
||||
{
|
||||
::checkForWarning( "VideoHppGenerator", condition, line, message );
|
||||
}
|
||||
|
||||
std::string VideoHppGenerator::generateConstants() const
|
||||
{
|
||||
{
|
||||
const std::string enumsTemplate = R"(
|
||||
//=================
|
||||
//=== CONSTANTs ===
|
||||
//=================
|
||||
|
||||
${constants}
|
||||
)";
|
||||
|
||||
std::string constants;
|
||||
for ( auto const & extension : m_extensions )
|
||||
{
|
||||
constants += generateConstants( extension );
|
||||
}
|
||||
|
||||
return replaceWithMap( enumsTemplate, { { "constants", constants } } );
|
||||
}
|
||||
}
|
||||
|
||||
std::string VideoHppGenerator::generateConstants( ExtensionData const & extensionData ) const
|
||||
{
|
||||
std::string str;
|
||||
for ( auto const & constant : extensionData.requireData.constants )
|
||||
{
|
||||
str += "VULKAN_HPP_CONSTEXPR_INLINE " + constant.second.type + " " + toCamelCase( stripPrefix( constant.first, "STD_VIDEO_" ), true ) + " = " +
|
||||
constant.second.value + ";\n";
|
||||
}
|
||||
if ( !str.empty() )
|
||||
{
|
||||
str = "\n#if defined( " + extensionData.protect + " )\n //=== " + extensionData.name + " ===\n" + str + "#endif\n";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string VideoHppGenerator::generateEnum( std::pair<std::string, EnumData> const & enumData ) const
|
||||
{
|
||||
std::string enumValues;
|
||||
|
|
@ -182,6 +221,14 @@ std::string VideoHppGenerator::generateEnum( std::pair<std::string, EnumData> co
|
|||
std::string valueName = "e" + toCamelCase( stripPrefix( value.name, prefix ), true );
|
||||
assert( valueToNameMap.insert( { valueName, value.name } ).second );
|
||||
enumValues += " " + valueName + " = " + value.name + ",\n";
|
||||
|
||||
for ( auto const & alias : value.aliases )
|
||||
{
|
||||
std::string aliasName = "e" + toCamelCase( stripPrefix( alias.first, prefix ), true );
|
||||
assert( valueToNameMap.insert( { aliasName, alias.first } ).second );
|
||||
enumValues += " " + aliasName + " VULKAN_HPP_DEPRECATED_17( \"" + aliasName + " is deprecated, " + valueName +
|
||||
" should be used instead.\" ) = " + alias.first + ",\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ( !enumValues.empty() )
|
||||
|
|
@ -213,17 +260,17 @@ ${enums}
|
|||
std::string enums;
|
||||
for ( auto const & extension : m_extensions )
|
||||
{
|
||||
enums += generateEnums( extension.requireData, extension.name );
|
||||
enums += generateEnums( extension );
|
||||
}
|
||||
|
||||
return replaceWithMap( enumsTemplate, { { "enums", enums } } );
|
||||
}
|
||||
}
|
||||
|
||||
std::string VideoHppGenerator::generateEnums( RequireData const & requireData, std::string const & title ) const
|
||||
std::string VideoHppGenerator::generateEnums( ExtensionData const & extensionData ) const
|
||||
{
|
||||
std::string str;
|
||||
for ( auto const & type : requireData.types )
|
||||
for ( auto const & type : extensionData.requireData.types )
|
||||
{
|
||||
auto enumIt = m_enums.find( type );
|
||||
if ( enumIt != m_enums.end() )
|
||||
|
|
@ -233,11 +280,91 @@ std::string VideoHppGenerator::generateEnums( RequireData const & requireData, s
|
|||
}
|
||||
if ( !str.empty() )
|
||||
{
|
||||
str = "\n //=== " + title + " ===\n" + str;
|
||||
str = "\n#if defined( " + extensionData.protect + " )\n //=== " + extensionData.name + " ===\n" + str + "#endif\n";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string VideoHppGenerator::generateIncludes() const
|
||||
{
|
||||
std::string includes;
|
||||
for ( auto const & extension : m_extensions )
|
||||
{
|
||||
std::string include = "<vk_video/" + extension.name + ".h>";
|
||||
includes += "#if __has_include( " + include + " )\n";
|
||||
includes += "# include <vk_video/" + extension.name + ".h>\n";
|
||||
includes += "#endif\n";
|
||||
}
|
||||
|
||||
return includes;
|
||||
}
|
||||
|
||||
std::string VideoHppGenerator::generateCppModuleConstantUsings() const
|
||||
{
|
||||
const std::string enumsTemplate = R"(
|
||||
//=================
|
||||
//=== CONSTANTs ===
|
||||
//=================
|
||||
|
||||
${constants}
|
||||
)";
|
||||
|
||||
std::string constants;
|
||||
for ( auto const & extension : m_extensions )
|
||||
{
|
||||
std::string constantsPerExtension;
|
||||
for ( auto const & type : extension.requireData.constants )
|
||||
{
|
||||
constantsPerExtension +=
|
||||
"using VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE::" + toCamelCase( stripPrefix( type.first, "STD_VIDEO_" ), true ) + ";\n";
|
||||
}
|
||||
if ( !constantsPerExtension.empty() )
|
||||
{
|
||||
constantsPerExtension = "\n#if defined( " + extension.protect + " )\n //=== " + extension.name + " ===\n" + constantsPerExtension + "#endif\n";
|
||||
}
|
||||
constants += constantsPerExtension;
|
||||
}
|
||||
|
||||
return replaceWithMap( enumsTemplate, { { "constants", constants } } );
|
||||
}
|
||||
|
||||
std::string VideoHppGenerator::generateCppModuleEnumUsings() const
|
||||
{
|
||||
auto const usingTemplate = std::string{
|
||||
R"( using VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE::${enumName};
|
||||
)"
|
||||
};
|
||||
|
||||
const std::string enumsTemplate = R"(
|
||||
//=============
|
||||
//=== ENUMs ===
|
||||
//=============
|
||||
|
||||
${enums}
|
||||
)";
|
||||
|
||||
std::string enums;
|
||||
for ( auto const & extension : m_extensions )
|
||||
{
|
||||
std::string enumsPerExtension;
|
||||
for ( auto const & type : extension.requireData.types )
|
||||
{
|
||||
auto enumIt = m_enums.find( type );
|
||||
if ( enumIt != m_enums.end() )
|
||||
{
|
||||
enumsPerExtension += replaceWithMap( usingTemplate, { { "enumName", stripPrefix( enumIt->first, "StdVideo" ) } } );
|
||||
}
|
||||
}
|
||||
if ( !enumsPerExtension.empty() )
|
||||
{
|
||||
enumsPerExtension = "\n#if defined( " + extension.protect + " )\n //=== " + extension.name + " ===\n" + enumsPerExtension + "#endif\n";
|
||||
}
|
||||
enums += enumsPerExtension;
|
||||
}
|
||||
|
||||
return replaceWithMap( enumsTemplate, { { "enums", enums } } );
|
||||
}
|
||||
|
||||
std::string VideoHppGenerator::generateStruct( std::pair<std::string, StructureData> const & structData ) const
|
||||
{
|
||||
static const std::string structureTemplate = R"( struct ${structureType}
|
||||
|
|
@ -253,6 +380,16 @@ std::string VideoHppGenerator::generateStruct( std::pair<std::string, StructureD
|
|||
{
|
||||
return *reinterpret_cast<StdVideo${structureType}*>( this );
|
||||
}
|
||||
|
||||
operator StdVideo${structureType} const *() const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return reinterpret_cast<const StdVideo${structureType}*>( this );
|
||||
}
|
||||
|
||||
operator StdVideo${structureType} *() VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return reinterpret_cast<StdVideo${structureType}*>( this );
|
||||
}
|
||||
${compareOperators}
|
||||
public:
|
||||
${members}
|
||||
|
|
@ -322,12 +459,12 @@ std::string VideoHppGenerator::generateStructMembers( std::pair<std::string, Str
|
|||
}
|
||||
else if ( member.arraySizes.empty() )
|
||||
{
|
||||
type = member.type.compose( "VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE", "StdVideo" );
|
||||
type = member.type.compose( "StdVideo", "VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE" );
|
||||
}
|
||||
else
|
||||
{
|
||||
assert( member.type.prefix.empty() && member.type.postfix.empty() );
|
||||
type = generateStandardArrayWrapper( member.type.compose( "VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE" ), member.arraySizes );
|
||||
type = generateStandardArrayWrapper( member.type.compose( "" ), member.arraySizes );
|
||||
}
|
||||
members += type + " " + member.name;
|
||||
|
||||
|
|
@ -374,15 +511,15 @@ ${structs}
|
|||
std::string structs;
|
||||
for ( auto const & extension : m_extensions )
|
||||
{
|
||||
structs += generateStructs( extension.requireData, extension.name );
|
||||
structs += generateStructs( extension );
|
||||
}
|
||||
return replaceWithMap( structsTemplate, { { "structs", structs } } );
|
||||
}
|
||||
|
||||
std::string VideoHppGenerator::generateStructs( RequireData const & requireData, std::string const & title ) const
|
||||
std::string VideoHppGenerator::generateStructs( ExtensionData const & extensionData ) const
|
||||
{
|
||||
std::string str;
|
||||
for ( auto const & type : requireData.types )
|
||||
for ( auto const & type : extensionData.requireData.types )
|
||||
{
|
||||
auto structIt = m_structs.find( type );
|
||||
if ( structIt != m_structs.end() )
|
||||
|
|
@ -392,25 +529,72 @@ std::string VideoHppGenerator::generateStructs( RequireData const & requireData,
|
|||
}
|
||||
if ( !str.empty() )
|
||||
{
|
||||
str = "\n //=== " + title + " ===\n" + str;
|
||||
str = "\n#if defined( " + extensionData.protect + " )\n //=== " + extensionData.name + " ===\n" + str + "#endif\n";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string VideoHppGenerator::generateCppModuleStructUsings() const
|
||||
{
|
||||
auto const usingTemplate = std::string{
|
||||
R"( using VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE::${structName};
|
||||
)"
|
||||
};
|
||||
|
||||
const std::string structsTemplate = R"(
|
||||
//===============
|
||||
//=== STRUCTS ===
|
||||
//===============
|
||||
|
||||
${structs}
|
||||
)";
|
||||
|
||||
std::string structs;
|
||||
for ( auto const & extension : m_extensions )
|
||||
{
|
||||
std::string structsPerExtension;
|
||||
for ( auto const & type : extension.requireData.types )
|
||||
{
|
||||
auto structIt = m_structs.find( type );
|
||||
if ( structIt != m_structs.end() )
|
||||
{
|
||||
structsPerExtension += replaceWithMap( usingTemplate, { { "structName", stripPrefix( structIt->first, "StdVideo" ) } } );
|
||||
}
|
||||
}
|
||||
if ( !structsPerExtension.empty() )
|
||||
{
|
||||
structsPerExtension = "\n#if defined( " + extension.protect + " )\n //=== " + extension.name + " ===\n" + structsPerExtension + "#endif\n";
|
||||
}
|
||||
structs += structsPerExtension;
|
||||
}
|
||||
|
||||
return replaceWithMap( structsTemplate, { { "structs", structs } } );
|
||||
}
|
||||
|
||||
std::string VideoHppGenerator::generateCppModuleUsings() const
|
||||
{
|
||||
return generateCppModuleConstantUsings() + generateCppModuleEnumUsings() + generateCppModuleStructUsings();
|
||||
}
|
||||
|
||||
bool VideoHppGenerator::isExtension( std::string const & name ) const
|
||||
{
|
||||
return std::any_of( m_extensions.begin(), m_extensions.end(), [&name]( ExtensionData const & ed ) { return ed.name == name; } );
|
||||
return std::ranges::any_of( m_extensions, [&name]( ExtensionData const & ed ) { return ed.name == name; } );
|
||||
}
|
||||
|
||||
std::string VideoHppGenerator::readComment( tinyxml2::XMLElement const * element ) const
|
||||
{
|
||||
return ::readComment( "VideoHppGenerator", element );
|
||||
}
|
||||
|
||||
void VideoHppGenerator::readEnums( tinyxml2::XMLElement const * element )
|
||||
{
|
||||
int line = element->GetLineNum();
|
||||
std::map<std::string, std::string> attributes = getAttributes( element );
|
||||
checkAttributes( line, attributes, { { "name", {} }, { "type", { "enum" } } }, {} );
|
||||
checkAttributes( line, attributes, { { "name", {} } }, { { "type", { "enum" } } } );
|
||||
std::vector<tinyxml2::XMLElement const *> children = getChildElements( element );
|
||||
checkElements( line, children, { { "enum", {} } }, { "comment" } );
|
||||
|
||||
std::string name, type;
|
||||
std::string name;
|
||||
for ( auto const & attribute : attributes )
|
||||
{
|
||||
if ( attribute.first == "name" )
|
||||
|
|
@ -419,7 +603,8 @@ void VideoHppGenerator::readEnums( tinyxml2::XMLElement const * element )
|
|||
}
|
||||
else if ( attribute.first == "type" )
|
||||
{
|
||||
type = attribute.second;
|
||||
assert( !name.empty() );
|
||||
checkForError( attribute.second == "enum", line, "unknown type <" + attribute.second + "> for enum <" + name + ">" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -443,30 +628,60 @@ void VideoHppGenerator::readEnumsEnum( tinyxml2::XMLElement const * element, std
|
|||
{
|
||||
int line = element->GetLineNum();
|
||||
std::map<std::string, std::string> attributes = getAttributes( element );
|
||||
checkAttributes( line, attributes, { { "name", {} }, { "value", {} } }, { { "comment", {} } } );
|
||||
checkElements( line, getChildElements( element ), {} );
|
||||
|
||||
std::string name, value;
|
||||
for ( auto const & attribute : attributes )
|
||||
if ( attributes.contains( "alias" ) )
|
||||
{
|
||||
if ( attribute.first == "name" )
|
||||
checkAttributes( line, attributes, { { "alias", {} }, { "deprecated", { "aliased" } }, { "name", {} } }, {} );
|
||||
checkElements( line, getChildElements( element ), {} );
|
||||
|
||||
std::string alias, name;
|
||||
for ( auto const & attribute : attributes )
|
||||
{
|
||||
name = attribute.second;
|
||||
}
|
||||
else if ( attribute.first == "value" )
|
||||
{
|
||||
value = attribute.second;
|
||||
if ( attribute.first == "alias" )
|
||||
{
|
||||
alias = attribute.second;
|
||||
}
|
||||
else if ( attribute.first == "name" )
|
||||
{
|
||||
name = attribute.second;
|
||||
}
|
||||
}
|
||||
assert( !name.empty() );
|
||||
|
||||
auto valueIt = std::ranges::find_if( enumIt->second.values, [&alias]( EnumValueData const & evd ) { return evd.name == alias; } );
|
||||
checkForError( valueIt != enumIt->second.values.end(), line, "enum value <" + name + "> uses unknown alias <" + alias + ">" );
|
||||
checkForError( std::ranges::find_if( valueIt->aliases, [&name]( auto const & alias ) { return alias.first == name; } ) == valueIt->aliases.end(),
|
||||
line,
|
||||
"enum alias <" + name + "> already listed for enum value <" + alias + ">" );
|
||||
|
||||
valueIt->aliases.push_back( { name, line } );
|
||||
}
|
||||
else
|
||||
{
|
||||
checkAttributes( line, attributes, { { "name", {} }, { "value", {} } }, { { "comment", {} } } );
|
||||
checkElements( line, getChildElements( element ), {} );
|
||||
|
||||
std::string prefix = toUpperCase( enumIt->first ) + "_";
|
||||
checkForError( name.starts_with( prefix ), line, "encountered enum value <" + name + "> that does not begin with expected prefix <" + prefix + ">" );
|
||||
checkForError( isNumber( value ) || isHexNumber( value ), line, "enum value uses unknown constant <" + value + ">" );
|
||||
std::string name, value;
|
||||
for ( auto const & attribute : attributes )
|
||||
{
|
||||
if ( attribute.first == "name" )
|
||||
{
|
||||
name = attribute.second;
|
||||
}
|
||||
else if ( attribute.first == "value" )
|
||||
{
|
||||
value = attribute.second;
|
||||
}
|
||||
}
|
||||
|
||||
checkForError( std::none_of( enumIt->second.values.begin(), enumIt->second.values.end(), [&name]( EnumValueData const & evd ) { return evd.name == name; } ),
|
||||
line,
|
||||
"enum value <" + name + "> already part of enum <" + enumIt->first + ">" );
|
||||
enumIt->second.values.push_back( { name, value, line } );
|
||||
std::string prefix = toUpperCase( enumIt->first ) + "_";
|
||||
checkForError( name.starts_with( prefix ), line, "encountered enum value <" + name + "> that does not begin with expected prefix <" + prefix + ">" );
|
||||
checkForError( isNumber( value ) || isHexNumber( value ), line, "enum value uses unknown constant <" + value + ">" );
|
||||
|
||||
checkForError( std::ranges::none_of( enumIt->second.values, [&name]( EnumValueData const & evd ) { return evd.name == name; } ),
|
||||
line,
|
||||
"enum value <" + name + "> already part of enum <" + enumIt->first + ">" );
|
||||
enumIt->second.values.push_back( { {}, name, value, line } );
|
||||
}
|
||||
}
|
||||
|
||||
void VideoHppGenerator::readExtension( tinyxml2::XMLElement const * element )
|
||||
|
|
@ -475,18 +690,32 @@ void VideoHppGenerator::readExtension( tinyxml2::XMLElement const * element )
|
|||
std::map<std::string, std::string> attributes = getAttributes( element );
|
||||
std::vector<tinyxml2::XMLElement const *> children = getChildElements( element );
|
||||
|
||||
checkAttributes( line, attributes, { { "name", {} }, { "comment", {} }, { "supported", { "vulkan" } } }, {} );
|
||||
checkAttributes( line, attributes, { { "name", {} }, { "comment", {} }, { "number", {} }, { "supported", { "vulkan" } } }, {} );
|
||||
checkElements( line, children, { { "require", false } } );
|
||||
|
||||
ExtensionData extensionData{ .xmlLine = line };
|
||||
std::string supported;
|
||||
for ( auto const & attribute : attributes )
|
||||
{
|
||||
if ( attribute.first == "name" )
|
||||
if ( attribute.first == "comment" )
|
||||
{
|
||||
checkForError(
|
||||
attribute.second.starts_with( "protect with VULKAN_VIDEO_CODEC" ), line, "unexpected content of attribute <comment>: \"" + attribute.second + "\"" );
|
||||
extensionData.protect = attribute.second.substr( strlen( "protect with " ) );
|
||||
}
|
||||
else if ( attribute.first == "name" )
|
||||
{
|
||||
extensionData.name = attribute.second;
|
||||
checkForError( !isExtension( extensionData.name ), line, "already encountered extension <" + extensionData.name + ">" );
|
||||
}
|
||||
else if ( attribute.first == "number" )
|
||||
{
|
||||
extensionData.number = attribute.second;
|
||||
checkForError( isNumber( extensionData.number ), line, "extension number <" + extensionData.number + "> is not a number" );
|
||||
checkForError( std::ranges::none_of( m_extensions, [&extensionData]( auto const & extension ) { return extension.number == extensionData.number; } ),
|
||||
line,
|
||||
"extension number <" + extensionData.number + "> already encountered" );
|
||||
}
|
||||
else if ( attribute.first == "supported" )
|
||||
{
|
||||
supported = attribute.second;
|
||||
|
|
@ -544,6 +773,11 @@ void VideoHppGenerator::readExtensions( tinyxml2::XMLElement const * element )
|
|||
}
|
||||
}
|
||||
|
||||
std::pair<std::vector<std::string>, std::string> VideoHppGenerator::readModifiers( tinyxml2::XMLNode const * node ) const
|
||||
{
|
||||
return ::readModifiers( "VulkanHppGenerator", node );
|
||||
}
|
||||
|
||||
void VideoHppGenerator::readRegistry( tinyxml2::XMLElement const * element )
|
||||
{
|
||||
int line = element->GetLineNum();
|
||||
|
|
@ -584,15 +818,19 @@ void VideoHppGenerator::readRequireEnum( tinyxml2::XMLElement const * element, s
|
|||
int line = element->GetLineNum();
|
||||
std::map<std::string, std::string> attributes = getAttributes( element );
|
||||
checkElements( line, getChildElements( element ), {} );
|
||||
checkAttributes( line, attributes, { { "name", {} }, { "value", {} } }, {} );
|
||||
checkAttributes( line, attributes, { { "name", {} }, { "value", {} } }, { { "type", { "uint32_t", "uint8_t" } } } );
|
||||
|
||||
std::string name, value;
|
||||
std::string name, type, value;
|
||||
for ( auto const & attribute : attributes )
|
||||
{
|
||||
if ( attribute.first == "name" )
|
||||
{
|
||||
name = attribute.second;
|
||||
}
|
||||
else if ( attribute.first == "type" )
|
||||
{
|
||||
type = attribute.second;
|
||||
}
|
||||
else if ( attribute.first == "value" )
|
||||
{
|
||||
value = attribute.second;
|
||||
|
|
@ -601,8 +839,9 @@ void VideoHppGenerator::readRequireEnum( tinyxml2::XMLElement const * element, s
|
|||
|
||||
if ( !name.ends_with( "_SPEC_VERSION" ) && !name.ends_with( "_EXTENSION_NAME" ) )
|
||||
{
|
||||
checkForError( !type.empty(), line, "constant <" + name + "> has no type specified" );
|
||||
checkForError( isNumber( value ) || isHexNumber( value ), line, "enum value uses unknown constant <" + value + ">" );
|
||||
checkForError( constants.insert( { name, { value, line } } ).second, line, "required enum <" + name + "> already specified" );
|
||||
checkForError( constants.insert( { name, { type, value, line } } ).second, line, "required enum <" + name + "> already specified" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -634,13 +873,26 @@ void VideoHppGenerator::readStructMember( tinyxml2::XMLElement const * element,
|
|||
(void)members;
|
||||
int line = element->GetLineNum();
|
||||
std::map<std::string, std::string> attributes = getAttributes( element );
|
||||
checkAttributes( line, attributes, {}, {} );
|
||||
checkAttributes( line, attributes, {}, { { "len", {} }, { "optional", { "false", "true" } } } );
|
||||
std::vector<tinyxml2::XMLElement const *> children = getChildElements( element );
|
||||
checkElements( line, children, { { "name", true }, { "type", true } }, { "comment", "enum" } );
|
||||
|
||||
MemberData memberData;
|
||||
memberData.xmlLine = line;
|
||||
|
||||
for ( auto const & attribute : attributes )
|
||||
{
|
||||
if ( attribute.first == "len" )
|
||||
{
|
||||
memberData.len = attribute.second;
|
||||
// the "len" attribute can be something completely unrelated to this struct!! Can't to a checkForError whatsoever.
|
||||
}
|
||||
else if ( attribute.first == "optional" )
|
||||
{
|
||||
memberData.optional = attribute.second;
|
||||
}
|
||||
}
|
||||
|
||||
std::string name;
|
||||
for ( auto child : children )
|
||||
{
|
||||
|
|
@ -672,9 +924,8 @@ void VideoHppGenerator::readStructMember( tinyxml2::XMLElement const * element,
|
|||
}
|
||||
assert( !name.empty() );
|
||||
|
||||
checkForError( std::none_of( members.begin(), members.end(), [&name]( MemberData const & md ) { return md.name == name; } ),
|
||||
line,
|
||||
"struct member name <" + name + "> already used" );
|
||||
checkForError(
|
||||
std::ranges::none_of( members, [&name]( MemberData const & md ) { return md.name == name; } ), line, "struct member name <" + name + "> already used" );
|
||||
memberData.name = name;
|
||||
members.push_back( memberData );
|
||||
}
|
||||
|
|
@ -816,7 +1067,7 @@ void VideoHppGenerator::readTypeStruct( tinyxml2::XMLElement const * element, st
|
|||
checkForError( require.empty() || m_types.contains( require ), line, "struct <" + name + "> requires unknown type <" + require + ">" );
|
||||
checkForError( m_types.insert( { name, TypeData{ TypeCategory::Struct, {}, line } } ).second, line, "struct <" + name + "> already specified" );
|
||||
assert( !m_structs.contains( name ) );
|
||||
std::map<std::string, StructureData>::iterator it = m_structs.insert( std::make_pair( name, structureData ) ).first;
|
||||
std::map<std::string, StructureData>::iterator it = m_structs.insert( { name, structureData } ).first;
|
||||
|
||||
for ( auto child : children )
|
||||
{
|
||||
|
|
@ -899,10 +1150,9 @@ void VideoHppGenerator::sortStructs()
|
|||
#if !defined( NDEBUG )
|
||||
else
|
||||
{
|
||||
auto depIt = std::find_if( m_extensions.begin(), m_extensions.end(), [&ext]( ExtensionData const & ed ) { return ed.name == ext.depends; } );
|
||||
assert( ( depIt != m_extensions.end() ) && std::any_of( depIt->requireData.types.begin(),
|
||||
depIt->requireData.types.end(),
|
||||
[&member]( std::string const & type ) { return type == member.type.type; } ) );
|
||||
auto depIt = std::ranges::find_if( m_extensions, [&ext]( ExtensionData const & ed ) { return ed.name == ext.depends; } );
|
||||
assert( ( depIt != m_extensions.end() ) &&
|
||||
std::ranges::any_of( depIt->requireData.types, [&member]( std::string const & type ) { return type == member.type.type; } ) );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -959,6 +1209,7 @@ int main( int argc, char ** argv )
|
|||
std::cout << "VideoHppGenerator: Parsing " << filename << std::endl;
|
||||
VideoHppGenerator generator( doc );
|
||||
|
||||
generator.generateCppmFile();
|
||||
generator.generateHppFile();
|
||||
|
||||
#if !defined( CLANG_FORMAT_EXECUTABLE )
|
||||
|
|
|
|||
|
|
@ -25,11 +25,13 @@ class VideoHppGenerator
|
|||
public:
|
||||
VideoHppGenerator( tinyxml2::XMLDocument const & document );
|
||||
|
||||
void generateCppmFile() const;
|
||||
void generateHppFile() const;
|
||||
|
||||
private:
|
||||
struct ConstantData
|
||||
{
|
||||
std::string type = {};
|
||||
std::string value = {};
|
||||
int xmlLine = {};
|
||||
};
|
||||
|
|
@ -42,9 +44,10 @@ private:
|
|||
|
||||
struct EnumValueData
|
||||
{
|
||||
std::string name = {};
|
||||
std::string value = {};
|
||||
int xmlLine = {};
|
||||
std::vector<std::pair<std::string, int>> aliases = {};
|
||||
std::string name = {};
|
||||
std::string value = {};
|
||||
int xmlLine = {};
|
||||
};
|
||||
|
||||
struct EnumData
|
||||
|
|
@ -64,6 +67,8 @@ private:
|
|||
{
|
||||
std::string depends = {};
|
||||
std::string name = {};
|
||||
std::string number = {};
|
||||
std::string protect = {};
|
||||
RequireData requireData = {};
|
||||
int xmlLine = 0;
|
||||
};
|
||||
|
|
@ -74,6 +79,8 @@ private:
|
|||
std::string name = {};
|
||||
std::vector<std::string> arraySizes = {};
|
||||
std::string bitCount = {};
|
||||
std::string len = {};
|
||||
std::string optional = {};
|
||||
int xmlLine = {};
|
||||
};
|
||||
|
||||
|
|
@ -87,33 +94,52 @@ private:
|
|||
void addImplicitlyRequiredTypes();
|
||||
std::vector<std::string>::iterator
|
||||
addImplicitlyRequiredTypes( std::map<std::string, TypeData>::iterator typeIt, ExtensionData & extensionData, std::vector<std::string>::iterator reqIt );
|
||||
void checkAttributes( int line,
|
||||
std::map<std::string, std::string> const & attributes,
|
||||
std::map<std::string, std::set<std::string>> const & required,
|
||||
std::map<std::string, std::set<std::string>> const & optional = {} ) const;
|
||||
void checkCorrectness() const;
|
||||
std::string generateEnum( std::pair<std::string, EnumData> const & enumData ) const;
|
||||
std::string generateEnums() const;
|
||||
std::string generateEnums( RequireData const & requireData, std::string const & title ) const;
|
||||
std::string generateStruct( std::pair<std::string, StructureData> const & structData ) const;
|
||||
std::string generateStructCompareOperators( std::pair<std::string, StructureData> const & structData ) const;
|
||||
std::string generateStructMembers( std::pair<std::string, StructureData> const & structData ) const;
|
||||
std::string generateStructs() const;
|
||||
std::string generateStructs( RequireData const & requireData, std::string const & title ) const;
|
||||
bool isExtension( std::string const & name ) const;
|
||||
void readEnums( tinyxml2::XMLElement const * element );
|
||||
void readEnumsEnum( tinyxml2::XMLElement const * element, std::map<std::string, EnumData>::iterator enumIt );
|
||||
void readExtension( tinyxml2::XMLElement const * element );
|
||||
void readExtensionRequire( tinyxml2::XMLElement const * element, ExtensionData & extensionData );
|
||||
void readExtensions( tinyxml2::XMLElement const * element );
|
||||
void readRegistry( tinyxml2::XMLElement const * element );
|
||||
void readRequireEnum( tinyxml2::XMLElement const * element, std::map<std::string, ConstantData> & constants );
|
||||
void readRequireType( tinyxml2::XMLElement const * element, ExtensionData & extensionData );
|
||||
void readStructMember( tinyxml2::XMLElement const * element, std::vector<MemberData> & members );
|
||||
void readTypeDefine( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
|
||||
void readTypeEnum( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
|
||||
void readTypeInclude( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
|
||||
void readTypeRequires( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
|
||||
void readTypes( tinyxml2::XMLElement const * element );
|
||||
void readTypeStruct( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
|
||||
void readTypesType( tinyxml2::XMLElement const * element );
|
||||
void sortStructs();
|
||||
void checkElements( int line,
|
||||
std::vector<tinyxml2::XMLElement const *> const & elements,
|
||||
std::map<std::string, bool> const & required,
|
||||
std::set<std::string> const & optional = {} ) const;
|
||||
void checkForError( bool condition, int line, std::string const & message ) const;
|
||||
void checkForWarning( bool condition, int line, std::string const & message ) const;
|
||||
std::string generateConstants() const;
|
||||
std::string generateConstants( ExtensionData const & extensionData ) const;
|
||||
std::string generateEnum( std::pair<std::string, EnumData> const & enumData ) const;
|
||||
std::string generateEnums() const;
|
||||
std::string generateEnums( ExtensionData const & extensionData ) const;
|
||||
std::string generateIncludes() const;
|
||||
std::string generateStruct( std::pair<std::string, StructureData> const & structData ) const;
|
||||
std::string generateStructCompareOperators( std::pair<std::string, StructureData> const & structData ) const;
|
||||
std::string generateStructMembers( std::pair<std::string, StructureData> const & structData ) const;
|
||||
std::string generateStructs() const;
|
||||
std::string generateStructs( ExtensionData const & extensionData ) const;
|
||||
std::string generateCppModuleConstantUsings() const;
|
||||
std::string generateCppModuleEnumUsings() const;
|
||||
std::string generateCppModuleStructUsings() const;
|
||||
std::string generateCppModuleUsings() const;
|
||||
bool isExtension( std::string const & name ) const;
|
||||
std::string readComment( tinyxml2::XMLElement const * element ) const;
|
||||
void readEnums( tinyxml2::XMLElement const * element );
|
||||
void readEnumsEnum( tinyxml2::XMLElement const * element, std::map<std::string, EnumData>::iterator enumIt );
|
||||
void readExtension( tinyxml2::XMLElement const * element );
|
||||
void readExtensionRequire( tinyxml2::XMLElement const * element, ExtensionData & extensionData );
|
||||
void readExtensions( tinyxml2::XMLElement const * element );
|
||||
std::pair<std::vector<std::string>, std::string> readModifiers( tinyxml2::XMLNode const * node ) const;
|
||||
void readRegistry( tinyxml2::XMLElement const * element );
|
||||
void readRequireEnum( tinyxml2::XMLElement const * element, std::map<std::string, ConstantData> & constants );
|
||||
void readRequireType( tinyxml2::XMLElement const * element, ExtensionData & extensionData );
|
||||
void readStructMember( tinyxml2::XMLElement const * element, std::vector<MemberData> & members );
|
||||
void readTypeDefine( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
|
||||
void readTypeEnum( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
|
||||
void readTypeInclude( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
|
||||
void readTypeRequires( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
|
||||
void readTypes( tinyxml2::XMLElement const * element );
|
||||
void readTypeStruct( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
|
||||
void readTypesType( tinyxml2::XMLElement const * element );
|
||||
void sortStructs();
|
||||
|
||||
private:
|
||||
std::string m_copyrightMessage;
|
||||
|
|
@ -124,4 +150,4 @@ private:
|
|||
std::map<std::string, IncludeData> m_includes;
|
||||
std::map<std::string, StructureData> m_structs;
|
||||
std::map<std::string, TypeData> m_types;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 5a5c9a643484d888873e32c5d7d484fae8e71d3d
|
||||
Subproject commit 2fa203425eb4af9dfc6b03f97ef72b0b5bcb8350
|
||||
10341
VulkanHppGenerator.cpp
10341
VulkanHppGenerator.cpp
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
202
XMLHelper.hpp
202
XMLHelper.hpp
|
|
@ -14,37 +14,44 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <regex>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <tinyxml2.h>
|
||||
#include <vector>
|
||||
|
||||
struct TypeInfo;
|
||||
|
||||
void checkAttributes( int line,
|
||||
std::map<std::string, std::string> const & attributes,
|
||||
std::map<std::string, std::set<std::string>> const & required,
|
||||
std::map<std::string, std::set<std::string>> const & optional );
|
||||
void checkElements( int line,
|
||||
std::vector<tinyxml2::XMLElement const *> const & elements,
|
||||
std::map<std::string, bool> const & required,
|
||||
std::set<std::string> const & optional = {} );
|
||||
void checkForError( bool condition, int line, std::string const & message );
|
||||
void checkForWarning( bool condition, int line, std::string const & message );
|
||||
std::string generateCopyrightMessage( std::string const & comment );
|
||||
std::string generateStandardArrayWrapper( std::string const & type, std::vector<std::string> const & sizes );
|
||||
void checkAttributes( std::string const & intro,
|
||||
int line,
|
||||
std::map<std::string, std::string> const & attributes,
|
||||
std::map<std::string, std::set<std::string>> const & required,
|
||||
std::map<std::string, std::set<std::string>> const & optional );
|
||||
void checkElements( std::string const & intro,
|
||||
int line,
|
||||
std::vector<tinyxml2::XMLElement const *> const & elements,
|
||||
std::map<std::string, bool> const & required,
|
||||
std::set<std::string> const & optional = {} );
|
||||
void checkForError( std::string const & intro, bool condition, int line, std::string const & message );
|
||||
void checkForWarning( std::string const & intro, bool condition, int line, std::string const & message );
|
||||
std::string generateCopyrightMessage( std::string const & comment );
|
||||
void generateFileFromTemplate( std::string const & fileName, std::string const & snippetFile, std::map<std::string, std::string> const & replacements );
|
||||
std::string generateStandardArrayWrapper( std::string const & type, std::vector<std::string> const & sizes );
|
||||
std::map<std::string, std::string> getAttributes( tinyxml2::XMLElement const * element );
|
||||
template <typename ElementContainer>
|
||||
std::vector<tinyxml2::XMLElement const *> getChildElements( ElementContainer const * element );
|
||||
std::string readComment( tinyxml2::XMLElement const * element );
|
||||
std::pair<std::vector<std::string>, std::string> readModifiers( tinyxml2::XMLNode const * node );
|
||||
std::string readComment( std::string const & intro, tinyxml2::XMLElement const * element );
|
||||
std::pair<std::vector<std::string>, std::string> readModifiers( std::string const & intro, tinyxml2::XMLNode const * node );
|
||||
std::string readSnippet( std::string const & snippetFile );
|
||||
TypeInfo readTypeInfo( tinyxml2::XMLElement const * element );
|
||||
std::string replaceWithMap( std::string const & input, std::map<std::string, std::string> replacements );
|
||||
std::string replaceWithMap( std::string const & input, std::map<std::string, std::string> const & replacements );
|
||||
std::string stripPostfix( std::string const & value, std::string const & postfix );
|
||||
std::string stripPrefix( std::string const & value, std::string const & prefix );
|
||||
std::string toCamelCase( std::string const & value, bool keepSeparatedNumbersSeparated = false );
|
||||
|
|
@ -56,12 +63,29 @@ std::string trimEnd( std::string const & in
|
|||
std::string trimStars( std::string const & input );
|
||||
void writeToFile( std::string const & str, std::string const & fileName );
|
||||
|
||||
class SyncedMessageHandler
|
||||
{
|
||||
public:
|
||||
void message( std::string const & m )
|
||||
{
|
||||
std::lock_guard<std::mutex> guard( m_messageMutex );
|
||||
std::cout << m;
|
||||
}
|
||||
|
||||
private:
|
||||
std::mutex m_messageMutex;
|
||||
};
|
||||
|
||||
SyncedMessageHandler messager;
|
||||
|
||||
struct TypeInfo
|
||||
{
|
||||
std::string compose( std::string const & nameSpace, std::string const & prefix_ = "Vk" ) const
|
||||
std::string compose( std::string const & prefixToStrip, std::string const & nameSpace = "" ) const
|
||||
{
|
||||
return prefix + ( prefix.empty() ? "" : " " ) +
|
||||
( nameSpace.empty() ? type : ( ( ( type.starts_with( prefix_ ) ) ? ( nameSpace + "::" ) : "" ) + stripPrefix( type, prefix_ ) ) ) +
|
||||
( prefixToStrip.empty()
|
||||
? type
|
||||
: ( ( ( type.starts_with( prefixToStrip ) && !nameSpace.empty() ) ? ( nameSpace + "::" ) : "" ) + stripPrefix( type, prefixToStrip ) ) ) +
|
||||
( postfix.empty() ? "" : " " ) + postfix;
|
||||
}
|
||||
|
||||
|
|
@ -140,11 +164,13 @@ struct TypeData
|
|||
};
|
||||
|
||||
// check the validity of an attributes map
|
||||
// intro : an intro to any warning or error message
|
||||
// line : the line in the xml file where the attributes are listed
|
||||
// attributes : the map of name/value pairs of the encountered attributes
|
||||
// required : the required attributes, with a set of allowed values per attribute
|
||||
// optional : the optional attributes, with a set of allowed values per attribute
|
||||
inline void checkAttributes( int line,
|
||||
inline void checkAttributes( std::string const & intro,
|
||||
int line,
|
||||
std::map<std::string, std::string> const & attributes,
|
||||
std::map<std::string, std::set<std::string>> const & required,
|
||||
std::map<std::string, std::set<std::string>> const & optional )
|
||||
|
|
@ -154,13 +180,13 @@ inline void checkAttributes( int
|
|||
for ( auto const & r : required )
|
||||
{
|
||||
auto attributesIt = attributes.find( r.first );
|
||||
checkForError( attributesIt != attributes.end(), line, "missing attribute <" + r.first + ">" );
|
||||
checkForError( intro, attributesIt != attributes.end(), line, "missing attribute <" + r.first + ">" );
|
||||
if ( !r.second.empty() )
|
||||
{
|
||||
std::vector<std::string> values = tokenize( attributesIt->second, "," );
|
||||
for ( auto const & v : values )
|
||||
{
|
||||
checkForError( r.second.find( v ) != r.second.end(), line, "unexpected attribute value <" + v + "> in attribute <" + attributesIt->first + ">" );
|
||||
checkForError( intro, r.second.find( v ) != r.second.end(), line, "unexpected attribute value <" + v + "> in attribute <" + attributesIt->first + ">" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -173,7 +199,7 @@ inline void checkAttributes( int
|
|||
auto optionalIt = optional.find( a.first );
|
||||
if ( optionalIt == optional.end() )
|
||||
{
|
||||
checkForWarning( false, line, "unknown attribute <" + a.first + ">" );
|
||||
checkForWarning( intro, false, line, "unknown attribute <" + a.first + ">" );
|
||||
continue;
|
||||
}
|
||||
else if ( !optionalIt->second.empty() )
|
||||
|
|
@ -181,15 +207,16 @@ inline void checkAttributes( int
|
|||
std::vector<std::string> values = tokenize( a.second, "," );
|
||||
for ( auto const & v : values )
|
||||
{
|
||||
checkForWarning(
|
||||
optionalIt->second.find( v ) != optionalIt->second.end(), line, "unexpected attribute value <" + v + "> in attribute <" + a.first + ">" );
|
||||
checkForError(
|
||||
intro, optionalIt->second.find( v ) != optionalIt->second.end(), line, "unexpected attribute value <" + v + "> in attribute <" + a.first + ">" );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void checkElements( int line,
|
||||
inline void checkElements( std::string const & intro,
|
||||
int line,
|
||||
std::vector<tinyxml2::XMLElement const *> const & elements,
|
||||
std::map<std::string, bool> const & required,
|
||||
std::set<std::string> const & optional )
|
||||
|
|
@ -200,32 +227,34 @@ inline void checkElements( int lin
|
|||
std::string value = e->Value();
|
||||
encountered[value]++;
|
||||
checkForWarning(
|
||||
( required.find( value ) != required.end() ) || ( optional.find( value ) != optional.end() ), e->GetLineNum(), "unknown element <" + value + ">" );
|
||||
intro, ( required.find( value ) != required.end() ) || ( optional.find( value ) != optional.end() ), e->GetLineNum(), "unknown element <" + value + ">" );
|
||||
}
|
||||
for ( auto const & r : required )
|
||||
{
|
||||
auto encounteredIt = encountered.find( r.first );
|
||||
checkForError( encounteredIt != encountered.end(), line, "missing required element <" + r.first + ">" );
|
||||
checkForError( intro, encounteredIt != encountered.end(), line, "missing required element <" + r.first + ">" );
|
||||
// check: r.second (means: required excactly once) => (encouteredIt->second == 1)
|
||||
checkForError( !r.second || ( encounteredIt->second == 1 ),
|
||||
checkForError( intro,
|
||||
!r.second || ( encounteredIt->second == 1 ),
|
||||
line,
|
||||
"required element <" + r.first + "> is supposed to be listed exactly once, but is listed " + std::to_string( encounteredIt->second ) );
|
||||
"required element <" + r.first + "> is supposed to be listed exactly once, but is listed " + std::to_string( encounteredIt->second ) +
|
||||
" times" );
|
||||
}
|
||||
}
|
||||
|
||||
inline void checkForError( bool condition, int line, std::string const & message )
|
||||
inline void checkForError( std::string const & intro, bool condition, int line, std::string const & message )
|
||||
{
|
||||
if ( !condition )
|
||||
{
|
||||
throw std::runtime_error( "VulkanHppGenerator: Spec error on line " + std::to_string( line ) + ": " + message );
|
||||
throw std::runtime_error( intro + ": Spec error on line " + std::to_string( line ) + ": " + message );
|
||||
}
|
||||
}
|
||||
|
||||
inline void checkForWarning( bool condition, int line, std::string const & message )
|
||||
inline void checkForWarning( std::string const & intro, bool condition, int line, std::string const & message )
|
||||
{
|
||||
if ( !condition )
|
||||
{
|
||||
std::cerr << "VulkanHppGenerator: Spec warning on line " << std::to_string( line ) << ": " << message << "!" << std::endl;
|
||||
std::cerr << intro << ": Spec warning on line " << std::to_string( line ) << ": " << message << "!" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -246,9 +275,16 @@ inline std::string generateCopyrightMessage( std::string const & comment )
|
|||
return trim( copyrightMessage ) + "\n";
|
||||
}
|
||||
|
||||
inline void generateFileFromTemplate( std::string const & fileName, std::string const & snippetFile, std::map<std::string, std::string> const & replacements )
|
||||
{
|
||||
std::string const completeFileName = std::string( BASE_PATH ) + "/vulkan/" + fileName;
|
||||
messager.message( "VulkanHppGenerator: Generating " + completeFileName + " ...\n" );
|
||||
writeToFile( replaceWithMap( readSnippet( snippetFile ), replacements ), completeFileName );
|
||||
}
|
||||
|
||||
inline std::string generateStandardArrayWrapper( std::string const & type, std::vector<std::string> const & sizes )
|
||||
{
|
||||
std::string arrayString = "VULKAN_HPP_NAMESPACE::ArrayWrapper" + std::to_string( sizes.size() ) + "D<" + type;
|
||||
std::string arrayString = "ArrayWrapper" + std::to_string( sizes.size() ) + "D<" + type;
|
||||
for ( auto const & size : sizes )
|
||||
{
|
||||
arrayString += ", " + size;
|
||||
|
|
@ -290,15 +326,15 @@ inline bool isNumber( std::string const & name ) noexcept
|
|||
return name.find_first_not_of( "0123456789" ) == std::string::npos;
|
||||
}
|
||||
|
||||
inline std::string readComment( tinyxml2::XMLElement const * element )
|
||||
inline std::string readComment( std::string const & intro, tinyxml2::XMLElement const * element )
|
||||
{
|
||||
const int line = element->GetLineNum();
|
||||
checkAttributes( line, getAttributes( element ), {}, {} );
|
||||
checkElements( line, getChildElements( element ), {} );
|
||||
checkAttributes( intro, line, getAttributes( element ), {}, {} );
|
||||
checkElements( intro, line, getChildElements( element ), {} );
|
||||
return element->GetText();
|
||||
}
|
||||
|
||||
inline std::pair<std::vector<std::string>, std::string> readModifiers( tinyxml2::XMLNode const * node )
|
||||
inline std::pair<std::vector<std::string>, std::string> readModifiers( std::string const & intro, tinyxml2::XMLNode const * node )
|
||||
{
|
||||
std::vector<std::string> arraySizes;
|
||||
std::string bitCount;
|
||||
|
|
@ -313,10 +349,10 @@ inline std::pair<std::vector<std::string>, std::string> readModifiers( tinyxml2:
|
|||
while ( endPos + 1 != value.length() )
|
||||
{
|
||||
const std::string::size_type startPos = value.find( '[', endPos );
|
||||
checkForError( startPos != std::string::npos, node->GetLineNum(), "could not find '[' in <" + value + ">" );
|
||||
checkForError( intro, startPos != std::string::npos, node->GetLineNum(), "could not find '[' in <" + value + ">" );
|
||||
endPos = value.find( ']', startPos );
|
||||
checkForError( endPos != std::string::npos, node->GetLineNum(), "could not find ']' in <" + value + ">" );
|
||||
checkForError( startPos + 2 <= endPos, node->GetLineNum(), "missing content between '[' and ']' in <" + value + ">" );
|
||||
checkForError( intro, endPos != std::string::npos, node->GetLineNum(), "could not find ']' in <" + value + ">" );
|
||||
checkForError( intro, startPos + 2 <= endPos, node->GetLineNum(), "missing content between '[' and ']' in <" + value + ">" );
|
||||
arraySizes.push_back( value.substr( startPos + 1, endPos - startPos - 1 ) );
|
||||
}
|
||||
}
|
||||
|
|
@ -326,10 +362,19 @@ inline std::pair<std::vector<std::string>, std::string> readModifiers( tinyxml2:
|
|||
}
|
||||
else
|
||||
{
|
||||
checkForError( ( value[0] == ';' ) || ( value[0] == ')' ), node->GetLineNum(), "unknown modifier <" + value + ">" );
|
||||
checkForError( intro, ( value[0] == ';' ) || ( value[0] == ')' ), node->GetLineNum(), "unknown modifier <" + value + ">" );
|
||||
}
|
||||
}
|
||||
return std::make_pair( arraySizes, bitCount );
|
||||
return { arraySizes, bitCount };
|
||||
}
|
||||
|
||||
inline std::string readSnippet( std::string const & snippetFile )
|
||||
{
|
||||
std::ifstream ifs( std::string( BASE_PATH ) + "/snippets/" + snippetFile );
|
||||
assert( !ifs.fail() );
|
||||
std::ostringstream oss;
|
||||
oss << ifs.rdbuf();
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
inline TypeInfo readTypeInfo( tinyxml2::XMLElement const * element )
|
||||
|
|
@ -349,7 +394,7 @@ inline TypeInfo readTypeInfo( tinyxml2::XMLElement const * element )
|
|||
return typeInfo;
|
||||
}
|
||||
|
||||
inline std::string replaceWithMap( std::string const & input, std::map<std::string, std::string> replacements )
|
||||
inline std::string replaceWithMap( std::string const & input, std::map<std::string, std::string> const & replacements )
|
||||
{
|
||||
// This will match ${someVariable} and contain someVariable in match group 1
|
||||
std::regex re( R"(\$\{([^\}]+)\})" );
|
||||
|
|
@ -422,7 +467,7 @@ inline std::string stripPrefix( std::string const & value, std::string const & p
|
|||
|
||||
inline std::string toCamelCase( std::string const & value, bool keepSeparatedNumbersSeparated )
|
||||
{
|
||||
assert( !value.empty() && ( isupper( value[0] ) || isdigit( value[0] ) ) );
|
||||
assert( value.empty() || isupper( value[0] ) || isdigit( value[0] ) );
|
||||
std::string result;
|
||||
result.reserve( value.size() );
|
||||
for ( size_t i = 0; i < value.size(); ++i )
|
||||
|
|
@ -439,30 +484,6 @@ inline std::string toCamelCase( std::string const & value, bool keepSeparatedNum
|
|||
result.push_back( ( ( 0 == i ) || ( value[i - 1] == '_' ) || isdigit( value[i - 1] ) ) ? value[i] : static_cast<char>( tolower( value[i] ) ) );
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
bool keepUpper = true;
|
||||
for ( auto c : value )
|
||||
{
|
||||
if ( c == '_' )
|
||||
{
|
||||
keepUpper = true;
|
||||
}
|
||||
else if ( isdigit( c ) )
|
||||
{
|
||||
keepUpper = true;
|
||||
result.push_back( c );
|
||||
}
|
||||
else if ( keepUpper )
|
||||
{
|
||||
result.push_back( c );
|
||||
keepUpper = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.push_back( static_cast<char>( tolower( c ) ) );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -489,25 +510,25 @@ inline std::string toString( tinyxml2::XMLError error )
|
|||
{
|
||||
switch ( error )
|
||||
{
|
||||
case tinyxml2::XML_SUCCESS: return "XML_SUCCESS";
|
||||
case tinyxml2::XML_NO_ATTRIBUTE: return "XML_NO_ATTRIBUTE";
|
||||
case tinyxml2::XML_WRONG_ATTRIBUTE_TYPE: return "XML_WRONG_ATTRIBUTE_TYPE";
|
||||
case tinyxml2::XML_ERROR_FILE_NOT_FOUND: return "XML_ERROR_FILE_NOT_FOUND";
|
||||
case tinyxml2::XML_SUCCESS : return "XML_SUCCESS";
|
||||
case tinyxml2::XML_NO_ATTRIBUTE : return "XML_NO_ATTRIBUTE";
|
||||
case tinyxml2::XML_WRONG_ATTRIBUTE_TYPE : return "XML_WRONG_ATTRIBUTE_TYPE";
|
||||
case tinyxml2::XML_ERROR_FILE_NOT_FOUND : return "XML_ERROR_FILE_NOT_FOUND";
|
||||
case tinyxml2::XML_ERROR_FILE_COULD_NOT_BE_OPENED: return "XML_ERROR_FILE_COULD_NOT_BE_OPENED";
|
||||
case tinyxml2::XML_ERROR_FILE_READ_ERROR: return "XML_ERROR_FILE_READ_ERROR";
|
||||
case tinyxml2::XML_ERROR_PARSING_ELEMENT: return "XML_ERROR_PARSING_ELEMENT";
|
||||
case tinyxml2::XML_ERROR_PARSING_ATTRIBUTE: return "XML_ERROR_PARSING_ATTRIBUTE";
|
||||
case tinyxml2::XML_ERROR_PARSING_TEXT: return "XML_ERROR_PARSING_TEXT";
|
||||
case tinyxml2::XML_ERROR_PARSING_CDATA: return "XML_ERROR_PARSING_CDATA";
|
||||
case tinyxml2::XML_ERROR_PARSING_COMMENT: return "XML_ERROR_PARSING_COMMENT";
|
||||
case tinyxml2::XML_ERROR_PARSING_DECLARATION: return "XML_ERROR_PARSING_DECLARATION";
|
||||
case tinyxml2::XML_ERROR_PARSING_UNKNOWN: return "XML_ERROR_PARSING_UNKNOWN";
|
||||
case tinyxml2::XML_ERROR_EMPTY_DOCUMENT: return "XML_ERROR_EMPTY_DOCUMENT";
|
||||
case tinyxml2::XML_ERROR_MISMATCHED_ELEMENT: return "XML_ERROR_MISMATCHED_ELEMENT";
|
||||
case tinyxml2::XML_ERROR_PARSING: return "XML_ERROR_PARSING";
|
||||
case tinyxml2::XML_CAN_NOT_CONVERT_TEXT: return "XML_CAN_NOT_CONVERT_TEXT";
|
||||
case tinyxml2::XML_NO_TEXT_NODE: return "XML_NO_TEXT_NODE";
|
||||
default: return "unknown error code <" + std::to_string( error ) + ">";
|
||||
case tinyxml2::XML_ERROR_FILE_READ_ERROR : return "XML_ERROR_FILE_READ_ERROR";
|
||||
case tinyxml2::XML_ERROR_PARSING_ELEMENT : return "XML_ERROR_PARSING_ELEMENT";
|
||||
case tinyxml2::XML_ERROR_PARSING_ATTRIBUTE : return "XML_ERROR_PARSING_ATTRIBUTE";
|
||||
case tinyxml2::XML_ERROR_PARSING_TEXT : return "XML_ERROR_PARSING_TEXT";
|
||||
case tinyxml2::XML_ERROR_PARSING_CDATA : return "XML_ERROR_PARSING_CDATA";
|
||||
case tinyxml2::XML_ERROR_PARSING_COMMENT : return "XML_ERROR_PARSING_COMMENT";
|
||||
case tinyxml2::XML_ERROR_PARSING_DECLARATION : return "XML_ERROR_PARSING_DECLARATION";
|
||||
case tinyxml2::XML_ERROR_PARSING_UNKNOWN : return "XML_ERROR_PARSING_UNKNOWN";
|
||||
case tinyxml2::XML_ERROR_EMPTY_DOCUMENT : return "XML_ERROR_EMPTY_DOCUMENT";
|
||||
case tinyxml2::XML_ERROR_MISMATCHED_ELEMENT : return "XML_ERROR_MISMATCHED_ELEMENT";
|
||||
case tinyxml2::XML_ERROR_PARSING : return "XML_ERROR_PARSING";
|
||||
case tinyxml2::XML_CAN_NOT_CONVERT_TEXT : return "XML_CAN_NOT_CONVERT_TEXT";
|
||||
case tinyxml2::XML_NO_TEXT_NODE : return "XML_NO_TEXT_NODE";
|
||||
default : return "unknown error code <" + std::to_string( error ) + ">";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -532,7 +553,7 @@ std::string toUpperCase( std::string const & name )
|
|||
inline std::string trim( std::string const & input )
|
||||
{
|
||||
std::string result = input;
|
||||
result.erase( result.begin(), std::find_if( result.begin(), result.end(), []( char c ) noexcept { return !std::isspace( c ); } ) );
|
||||
result.erase( result.begin(), std::ranges::find_if( result, []( char c ) noexcept { return !std::isspace( c ); } ) );
|
||||
result.erase( std::find_if( result.rbegin(), result.rend(), []( char c ) noexcept { return !std::isspace( c ); } ).base(), result.end() );
|
||||
return result;
|
||||
}
|
||||
|
|
@ -572,12 +593,15 @@ void writeToFile( std::string const & str, std::string const & fileName )
|
|||
ofs.close();
|
||||
|
||||
#if defined( CLANG_FORMAT_EXECUTABLE )
|
||||
std::cout << "VulkanHppGenerator: Formatting " << fileName << " ..." << std::endl;
|
||||
// explicitly flush std::cout, as std::system spawns a sub-process
|
||||
std::cout.flush();
|
||||
|
||||
messager.message( "VulkanHppGenerator: Formatting " + fileName + " ...\n" );
|
||||
const std::string commandString = "\"" CLANG_FORMAT_EXECUTABLE "\" -i --style=file " + fileName;
|
||||
const int ret = std::system( commandString.c_str() );
|
||||
if ( ret != 0 )
|
||||
{
|
||||
std::cout << "VulkanHppGenerator: failed to format file " << fileName << " with error <" << ret << ">\n";
|
||||
throw std::runtime_error( "VulkanHppGenerator: failed to format file " + fileName + " with error <" + std::to_string( ret ) + ">" );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
2
glslang
2
glslang
|
|
@ -1 +1 @@
|
|||
Subproject commit f1cb8608b390a7f51b4ae0d62cd415ba47a59b86
|
||||
Subproject commit fc9889c889561c5882e83819dcaffef5ed45529b
|
||||
|
|
@ -12,4 +12,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
vulkan_hpp__setup_sample_static( NAME 01_InitInstance )
|
||||
find_package( Vulkan QUIET )
|
||||
if ( Vulkan_FOUND )
|
||||
vulkan_hpp__setup_sample_static( NAME 01_InitInstance )
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@
|
|||
|
||||
#if defined( _MSC_VER )
|
||||
// no need to ignore any warnings with MSVC
|
||||
#elif defined( __clang__ )
|
||||
#endif
|
||||
#if defined( __clang__ )
|
||||
# pragma clang diagnostic ignored "-Wunused-variable"
|
||||
#elif defined( __GNUC__ )
|
||||
# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
vk::SurfaceKHR surface;
|
||||
{
|
||||
VkSurfaceKHR _surface;
|
||||
glfwCreateWindowSurface( static_cast<VkInstance>( instance ), window.handle, nullptr, &_surface );
|
||||
glfwCreateWindowSurface( instance, window.handle, nullptr, &_surface );
|
||||
surface = vk::SurfaceKHR( _surface );
|
||||
}
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
|
||||
vk::SurfaceCapabilitiesKHR surfaceCapabilities = physicalDevice.getSurfaceCapabilitiesKHR( surface );
|
||||
vk::Extent2D swapchainExtent;
|
||||
if ( surfaceCapabilities.currentExtent.width == std::numeric_limits<uint32_t>::max() )
|
||||
if ( surfaceCapabilities.currentExtent.width == (std::numeric_limits<uint32_t>::max)() )
|
||||
{
|
||||
// If the surface size is undefined, the size is set to the size of the images requested.
|
||||
swapchainExtent.width = vk::su::clamp( width, surfaceCapabilities.minImageExtent.width, surfaceCapabilities.maxImageExtent.width );
|
||||
|
|
@ -123,7 +123,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
|
||||
vk::SwapchainCreateInfoKHR swapChainCreateInfo( vk::SwapchainCreateFlagsKHR(),
|
||||
surface,
|
||||
vk::su::clamp( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
|
||||
vk::su::clampSurfaceImageCount( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
|
||||
format,
|
||||
vk::ColorSpaceKHR::eSrgbNonlinear,
|
||||
swapchainExtent,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
add_subdirectory( utils )
|
||||
add_subdirectory( 01_InitInstance )
|
||||
add_subdirectory( 02_EnumerateDevices )
|
||||
add_subdirectory( 03_InitDevice )
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
// limitations under the License.
|
||||
//
|
||||
// VulkanHpp Samples : CopyBlitImage
|
||||
// Draw a cube
|
||||
// Perform an image blit operation
|
||||
|
||||
#include "../utils/utils.hpp"
|
||||
|
||||
|
|
|
|||
|
|
@ -12,4 +12,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
vulkan_hpp__setup_sample_static( NAME CreateDebugUtilsMessenger )
|
||||
find_package( Vulkan QUIET )
|
||||
if ( Vulkan_FOUND )
|
||||
vulkan_hpp__setup_sample_static( NAME CreateDebugUtilsMessenger )
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
// limitations under the License.
|
||||
//
|
||||
// VulkanHpp Samples : CreateDebugReportMessenger
|
||||
// Draw a cube
|
||||
// Set up a debug messenger
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
|
@ -39,15 +39,14 @@ VKAPI_ATTR void VKAPI_CALL vkDestroyDebugUtilsMessengerEXT( VkInstance instance,
|
|||
return pfnVkDestroyDebugUtilsMessengerEXT( instance, messenger, pAllocator );
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
|
||||
VkDebugUtilsMessageTypeFlagsEXT messageTypes,
|
||||
VkDebugUtilsMessengerCallbackDataEXT const * pCallbackData,
|
||||
void * /*pUserData*/ )
|
||||
VKAPI_ATTR vk::Bool32 VKAPI_CALL debugMessageFunc( vk::DebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
|
||||
vk::DebugUtilsMessageTypeFlagsEXT messageTypes,
|
||||
vk::DebugUtilsMessengerCallbackDataEXT const * pCallbackData,
|
||||
void * /*pUserData*/ )
|
||||
{
|
||||
std::ostringstream message;
|
||||
|
||||
message << vk::to_string( static_cast<vk::DebugUtilsMessageSeverityFlagBitsEXT>( messageSeverity ) ) << ": "
|
||||
<< vk::to_string( static_cast<vk::DebugUtilsMessageTypeFlagsEXT>( messageTypes ) ) << ":\n";
|
||||
message << vk::to_string( messageSeverity ) << ": " << vk::to_string( messageTypes ) << ":\n";
|
||||
message << std::string( "\t" ) << "messageIDName = <" << pCallbackData->pMessageIdName << ">\n";
|
||||
message << std::string( "\t" ) << "messageIdNumber = " << pCallbackData->messageIdNumber << "\n";
|
||||
message << std::string( "\t" ) << "message = <" << pCallbackData->pMessage << ">\n";
|
||||
|
|
@ -73,7 +72,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( VkDebugUtilsMessageSeverityFlag
|
|||
for ( uint32_t i = 0; i < pCallbackData->objectCount; i++ )
|
||||
{
|
||||
message << std::string( "\t\t" ) << "Object " << i << "\n";
|
||||
message << std::string( "\t\t\t" ) << "objectType = " << vk::to_string( static_cast<vk::ObjectType>( pCallbackData->pObjects[i].objectType ) ) << "\n";
|
||||
message << std::string( "\t\t\t" ) << "objectType = " << vk::to_string( pCallbackData->pObjects[i].objectType ) << "\n";
|
||||
message << std::string( "\t\t\t" ) << "objectHandle = " << pCallbackData->pObjects[i].objectHandle << "\n";
|
||||
if ( pCallbackData->pObjects[i].pObjectName )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -55,8 +55,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
|
||||
/* VULKAN_KEY_START */
|
||||
|
||||
vk::DebugUtilsObjectNameInfoEXT debugUtilsObjectNameInfo( vk::ObjectType::eImage, NON_DISPATCHABLE_HANDLE_TO_UINT64_CAST( VkImage, image ), "Image name" );
|
||||
device.setDebugUtilsObjectNameEXT( debugUtilsObjectNameInfo );
|
||||
device.setDebugUtilsObjectNameEXT( image, "Image name" );
|
||||
|
||||
/* VULKAN_KEY_END */
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
# pragma warning( disable : 4100 ) // unreferenced formal parameter (glslang)
|
||||
#endif // endif (_MSC_VER )
|
||||
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#if defined( _MSC_VER )
|
||||
# pragma warning( pop )
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@
|
|||
|
||||
#if defined( _MSC_VER )
|
||||
// no need to ignore any warnings with MSVC
|
||||
#elif defined( __clang__ )
|
||||
#endif
|
||||
#if defined( __clang__ )
|
||||
# pragma clang diagnostic ignored "-Wunused-variable"
|
||||
#elif defined( __GNUC__ )
|
||||
# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
|
||||
|
|
@ -51,15 +52,14 @@ VKAPI_ATTR void VKAPI_CALL vkDestroyDebugUtilsMessengerEXT( VkInstance instance,
|
|||
return pfnVkDestroyDebugUtilsMessengerEXT( instance, messenger, pAllocator );
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
|
||||
VkDebugUtilsMessageTypeFlagsEXT messageTypes,
|
||||
VkDebugUtilsMessengerCallbackDataEXT const * pCallbackData,
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( vk::DebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
|
||||
vk::DebugUtilsMessageTypeFlagsEXT messageTypes,
|
||||
vk::DebugUtilsMessengerCallbackDataEXT const * pCallbackData,
|
||||
void * /*pUserData*/ )
|
||||
{
|
||||
std::string message;
|
||||
|
||||
message += vk::to_string( static_cast<vk::DebugUtilsMessageSeverityFlagBitsEXT>( messageSeverity ) ) + ": " +
|
||||
vk::to_string( static_cast<vk::DebugUtilsMessageTypeFlagsEXT>( messageTypes ) ) + ":\n";
|
||||
message += vk::to_string( messageSeverity ) + ": " + vk::to_string( messageTypes ) + ":\n";
|
||||
message += std::string( "\t" ) + "messageIDName = <" + pCallbackData->pMessageIdName + ">\n";
|
||||
message += std::string( "\t" ) + "messageIdNumber = " + std::to_string( pCallbackData->messageIdNumber ) + "\n";
|
||||
message += std::string( "\t" ) + "message = <" + pCallbackData->pMessage + ">\n";
|
||||
|
|
@ -84,7 +84,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageFunc( VkDebugUtilsMessageSeverityFlag
|
|||
for ( uint32_t i = 0; i < pCallbackData->objectCount; i++ )
|
||||
{
|
||||
message += std::string( "\t" ) + "Object " + std::to_string( i ) + "\n";
|
||||
message += std::string( "\t\t" ) + "objectType = " + vk::to_string( static_cast<vk::ObjectType>( pCallbackData->pObjects[i].objectType ) ) + "\n";
|
||||
message += std::string( "\t\t" ) + "objectType = " + vk::to_string( pCallbackData->pObjects[i].objectType ) + "\n";
|
||||
message += std::string( "\t\t" ) + "objectHandle = " + std::to_string( pCallbackData->pObjects[i].objectHandle ) + "\n";
|
||||
if ( pCallbackData->pObjects[i].pObjectName )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@
|
|||
|
||||
#if defined( _MSC_VER )
|
||||
// no need to ignore any warnings with MSVC
|
||||
#elif defined( __clang__ )
|
||||
#endif
|
||||
#if defined( __clang__ )
|
||||
# pragma clang diagnostic ignored "-Wunused-variable"
|
||||
#elif defined( __GNUC__ )
|
||||
# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
|
||||
|
|
@ -29,7 +30,7 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
|
|||
|
|
@ -12,4 +12,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
vulkan_hpp__setup_sample_static( NAME InstanceExtensionProperties )
|
||||
find_package( Vulkan QUIET )
|
||||
if ( Vulkan_FOUND )
|
||||
vulkan_hpp__setup_sample_static( NAME InstanceExtensionProperties )
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -12,4 +12,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
vulkan_hpp__setup_sample_static( NAME InstanceLayerExtensionProperties )
|
||||
find_package( Vulkan QUIET )
|
||||
if ( Vulkan_FOUND )
|
||||
vulkan_hpp__setup_sample_static( NAME InstanceLayerExtensionProperties )
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -12,4 +12,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
vulkan_hpp__setup_sample_static( NAME InstanceLayerProperties )
|
||||
find_package( Vulkan QUIET )
|
||||
if ( Vulkan_FOUND )
|
||||
vulkan_hpp__setup_sample_static( NAME InstanceLayerProperties )
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -12,4 +12,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
vulkan_hpp__setup_sample_static( NAME InstanceVersion )
|
||||
find_package( Vulkan QUIET )
|
||||
if ( Vulkan_FOUND )
|
||||
vulkan_hpp__setup_sample_static( NAME InstanceVersion )
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -47,9 +47,8 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
|
||||
std::cout << "PhysicalDevice " << i << "\n";
|
||||
|
||||
// need to explicitly specify all the template arguments for getQueueFamilyProperties2 to make the compiler happy
|
||||
using Chain = vk::StructureChain<vk::QueueFamilyProperties2, vk::QueueFamilyCheckpointPropertiesNV>;
|
||||
auto queueFamilyProperties2 = physicalDevices[i].getQueueFamilyProperties2<Chain, std::allocator<Chain>, vk::DispatchLoaderDynamic>();
|
||||
auto queueFamilyProperties2 = physicalDevices[i].getQueueFamilyProperties2<Chain>();
|
||||
for ( size_t j = 0; j < queueFamilyProperties2.size(); j++ )
|
||||
{
|
||||
std::cout << std::string( "\t" ) << "QueueFamily " << j << "\n";
|
||||
|
|
|
|||
|
|
@ -28,14 +28,14 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <thread>
|
||||
|
||||
// For timestamp code (getMilliseconds)
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
# include <Windows.h>
|
||||
#else
|
||||
# include <sys/time.h>
|
||||
|
|
@ -44,7 +44,7 @@
|
|||
typedef unsigned long long timestamp_t;
|
||||
timestamp_t getMilliseconds()
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
LARGE_INTEGER frequency;
|
||||
BOOL useQPC = QueryPerformanceFrequency( &frequency );
|
||||
if ( useQPC )
|
||||
|
|
@ -140,8 +140,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
/* VULKAN_KEY_START */
|
||||
|
||||
// Check disk for existing cache data
|
||||
size_t startCacheSize = 0;
|
||||
char * startCacheData = nullptr;
|
||||
std::vector<char> startCacheData;
|
||||
|
||||
std::string cacheFileName = "pipeline_cache_data.bin";
|
||||
std::ifstream readCacheStream( cacheFileName, std::ios_base::in | std::ios_base::binary );
|
||||
|
|
@ -149,14 +148,14 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
{
|
||||
// Determine cache size
|
||||
readCacheStream.seekg( 0, readCacheStream.end );
|
||||
startCacheSize = static_cast<size_t>( readCacheStream.tellg() );
|
||||
size_t startCacheSize = static_cast<size_t>( readCacheStream.tellg() );
|
||||
readCacheStream.seekg( 0, readCacheStream.beg );
|
||||
|
||||
// Allocate memory to hold the initial cache data
|
||||
startCacheData = (char *)std::malloc( startCacheSize );
|
||||
startCacheData.resize( startCacheSize );
|
||||
|
||||
// Read the data into our buffer
|
||||
readCacheStream.read( startCacheData, startCacheSize );
|
||||
readCacheStream.read( startCacheData.data(), startCacheData.size() );
|
||||
|
||||
// Clean up and print results
|
||||
readCacheStream.close();
|
||||
|
|
@ -169,7 +168,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
std::cout << " Pipeline cache miss!\n";
|
||||
}
|
||||
|
||||
if ( startCacheData != nullptr )
|
||||
if ( !startCacheData.empty() )
|
||||
{
|
||||
// Check for cache validity
|
||||
//
|
||||
|
|
@ -205,11 +204,12 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
uint32_t deviceID = 0;
|
||||
uint8_t pipelineCacheUUID[VK_UUID_SIZE] = {};
|
||||
|
||||
memcpy( &headerLength, (uint8_t *)startCacheData + 0, 4 );
|
||||
memcpy( &cacheHeaderVersion, (uint8_t *)startCacheData + 4, 4 );
|
||||
memcpy( &vendorID, (uint8_t *)startCacheData + 8, 4 );
|
||||
memcpy( &deviceID, (uint8_t *)startCacheData + 12, 4 );
|
||||
memcpy( pipelineCacheUUID, (uint8_t *)startCacheData + 16, VK_UUID_SIZE );
|
||||
uint8_t * startCacheDataPtr = reinterpret_cast<uint8_t *>( startCacheData.data() );
|
||||
memcpy( &headerLength, startCacheDataPtr + 0, 4 );
|
||||
memcpy( &cacheHeaderVersion, startCacheDataPtr + 4, 4 );
|
||||
memcpy( &vendorID, startCacheDataPtr + 8, 4 );
|
||||
memcpy( &deviceID, startCacheDataPtr + 12, 4 );
|
||||
memcpy( pipelineCacheUUID, startCacheDataPtr + 16, VK_UUID_SIZE );
|
||||
|
||||
// Check each field and report bad values before freeing existing cache
|
||||
bool badCache = false;
|
||||
|
|
@ -255,9 +255,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
if ( badCache )
|
||||
{
|
||||
// Don't submit initial cache data if any version info is incorrect
|
||||
free( startCacheData );
|
||||
startCacheSize = 0;
|
||||
startCacheData = nullptr;
|
||||
startCacheData.clear();
|
||||
|
||||
// And clear out the old cache file for use in next run
|
||||
std::cout << " Deleting cache entry " << cacheFileName << " to repopulate.\n";
|
||||
|
|
@ -271,11 +269,10 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
|
||||
// Feed the initial cache data into cache creation
|
||||
vk::PipelineCache pipelineCache =
|
||||
device.createPipelineCache( vk::PipelineCacheCreateInfo( vk::PipelineCacheCreateFlags(), startCacheSize, startCacheData ) );
|
||||
device.createPipelineCache( vk::PipelineCacheCreateInfo( vk::PipelineCacheCreateFlags(), startCacheData.size(), startCacheData.data() ) );
|
||||
|
||||
// Free our initialData now that pipeline cache has been created
|
||||
free( startCacheData );
|
||||
startCacheData = NULL;
|
||||
startCacheData.clear();
|
||||
|
||||
// Time (roughly) taken to create the graphics pipeline
|
||||
timestamp_t start = getMilliseconds();
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <thread>
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
|
|||
|
|
@ -14,11 +14,6 @@
|
|||
|
||||
vulkan_hpp__setup_sample_dynamic(
|
||||
NAME RayTracing
|
||||
INCLUDE_DIRS
|
||||
${CMAKE_SOURCE_DIR}/samples/RayTracing/common
|
||||
${CMAKE_SOURCE_DIR}/samples/RayTracing/vulkannv
|
||||
${CMAKE_SOURCE_DIR}/stb
|
||||
${CMAKE_SOURCE_DIR}/tinyobjloader
|
||||
HEADERS
|
||||
CameraManipulator.hpp
|
||||
SOURCES
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "CameraManipulator.hpp"
|
||||
|
||||
#define GLM_ENABLE_EXPERIMENTAL
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtx/rotate_vector.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "CameraManipulator.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_inverse.hpp>
|
||||
|
|
@ -594,7 +594,7 @@ static void keyCallback( GLFWwindow * window, int key, int /*scancode*/, int act
|
|||
switch ( key )
|
||||
{
|
||||
case GLFW_KEY_ESCAPE:
|
||||
case 'Q': glfwSetWindowShouldClose( window, 1 ); break;
|
||||
case 'Q' : glfwSetWindowShouldClose( window, 1 ); break;
|
||||
case 'R':
|
||||
{
|
||||
AppInfo * appInfo = reinterpret_cast<AppInfo *>( glfwGetWindowUserPointer( window ) );
|
||||
|
|
@ -724,7 +724,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
|
||||
// Create Window Surface (using glfw)
|
||||
vk::SurfaceKHR surface;
|
||||
VkResult err = glfwCreateWindowSurface( static_cast<VkInstance>( instance ), window, nullptr, reinterpret_cast<VkSurfaceKHR *>( &surface ) );
|
||||
VkResult err = glfwCreateWindowSurface( instance, window, nullptr, reinterpret_cast<VkSurfaceKHR *>( &surface ) );
|
||||
check_vk_result( err );
|
||||
|
||||
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surface );
|
||||
|
|
@ -1224,9 +1224,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||
presentQueue.presentKHR( vk::PresentInfoKHR( perFrameData[frameIndex].renderCompleteSemaphore, swapChainData.swapChain, backBufferIndex ) );
|
||||
switch ( result )
|
||||
{
|
||||
case vk::Result::eSuccess: break;
|
||||
case vk::Result::eSuccess : break;
|
||||
case vk::Result::eSuboptimalKHR: std::cout << "vk::Queue::presentKHR returned vk::Result::eSuboptimalKHR !\n"; break;
|
||||
default: assert( false ); // an unexpected result is returned !
|
||||
default : assert( false ); // an unexpected result is returned !
|
||||
}
|
||||
frameIndex = ( frameIndex + 1 ) % IMGUI_VK_QUEUED_FRAMES;
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
@ -83,10 +83,10 @@ public:
|
|||
void createDeviceAndSwapChain( const vk::su::WindowData & window )
|
||||
{
|
||||
VkSurfaceKHR surface;
|
||||
VkResult err = glfwCreateWindowSurface( static_cast<VkInstance>( instance.get() ), window.handle, nullptr, &surface );
|
||||
VkResult err = glfwCreateWindowSurface( instance.get(), window.handle, nullptr, &surface );
|
||||
if ( err != VK_SUCCESS )
|
||||
throw std::runtime_error( "Failed to create window!" );
|
||||
vk::SharedSurfaceKHR sharedSurface{ surface, instance };
|
||||
vk::SharedSurfaceKHR sharedSurface{ static_cast<vk::SurfaceKHR>( surface ), instance };
|
||||
|
||||
auto graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, sharedSurface.get() );
|
||||
device = vk::SharedDevice{ vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() ) };
|
||||
|
|
@ -109,16 +109,12 @@ public:
|
|||
std::transform( swapChainData.images.begin(),
|
||||
swapChainData.images.end(),
|
||||
std::back_inserter( images ),
|
||||
[this]( vk::Image image ) {
|
||||
return vk::SharedImage{ image, device, vk::SwapchainOwns::yes };
|
||||
} );
|
||||
[this]( vk::Image image ) { return vk::SharedImage{ image, device, vk::SwapchainOwns::yes }; } );
|
||||
|
||||
std::transform( swapChainData.imageViews.begin(),
|
||||
swapChainData.imageViews.end(),
|
||||
std::back_inserter( imageViews ),
|
||||
[this]( vk::ImageView imageView ) {
|
||||
return vk::SharedImageView{ imageView, device };
|
||||
} );
|
||||
[this]( vk::ImageView imageView ) { return vk::SharedImageView{ imageView, device }; } );
|
||||
commandPool =
|
||||
vk::SharedCommandPool{ device->createCommandPool( { vk::CommandPoolCreateFlagBits::eResetCommandBuffer, graphicsAndPresentQueueFamilyIndex.first } ),
|
||||
device };
|
||||
|
|
@ -230,9 +226,9 @@ public:
|
|||
vk::Result result = presentQueue->presentKHR( vk::PresentInfoKHR( {}, swap, currentBuffer ) );
|
||||
switch ( result )
|
||||
{
|
||||
case vk::Result::eSuccess: break;
|
||||
case vk::Result::eSuccess : break;
|
||||
case vk::Result::eSuboptimalKHR: std::cout << "vk::Queue::presentKHR returned vk::Result::eSuboptimalKHR !\n"; break;
|
||||
default: assert( false ); // an unexpected result is returned !
|
||||
default : assert( false ); // an unexpected result is returned !
|
||||
}
|
||||
std::this_thread::sleep_for( std::chrono::milliseconds( 1000 ) );
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ if( VULKAN_HPP_RUN_GENERATOR )
|
|||
add_dependencies( utils build_vulkan_hpp )
|
||||
endif()
|
||||
|
||||
target_link_libraries( utils PUBLIC glm )
|
||||
target_link_libraries( utils PUBLIC glm::glm )
|
||||
target_link_libraries( utils PUBLIC glfw )
|
||||
target_link_libraries( utils PUBLIC glslang )
|
||||
target_link_libraries( utils PUBLIC glslang-default-resource-limits )
|
||||
target_link_libraries( utils PUBLIC SPIRV )
|
||||
target_link_libraries( utils PUBLIC glslang::glslang )
|
||||
target_link_libraries( utils PUBLIC glslang::glslang-default-resource-limits )
|
||||
target_link_libraries( utils PUBLIC glslang::SPIRV )
|
||||
target_compile_definitions( utils PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1 )
|
||||
|
||||
target_precompile_headers( utils PRIVATE <vulkan/vulkan.hpp> )
|
||||
|
|
|
|||
|
|
@ -15,8 +15,9 @@
|
|||
|
||||
#include "shaders.hpp"
|
||||
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ResourceLimits.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <vulkan/vulkan.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@ namespace vk
|
|||
);
|
||||
|
||||
vk::Instance instance =
|
||||
vk::createInstance( makeInstanceCreateInfoChain( applicationInfo, enabledLayers, enabledExtensions ).get<vk::InstanceCreateInfo>() );
|
||||
vk::createInstance( makeInstanceCreateInfoChain( {}, applicationInfo, enabledLayers, enabledExtensions ).get<vk::InstanceCreateInfo>() );
|
||||
|
||||
#if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 )
|
||||
// initialize function pointers for instance
|
||||
|
|
@ -348,27 +348,28 @@ namespace vk
|
|||
return device.createRenderPass( vk::RenderPassCreateInfo( vk::RenderPassCreateFlags(), attachmentDescriptions, subpassDescription ) );
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL debugUtilsMessengerCallback( VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
|
||||
VkDebugUtilsMessageTypeFlagsEXT messageTypes,
|
||||
VkDebugUtilsMessengerCallbackDataEXT const * pCallbackData,
|
||||
void * /*pUserData*/ )
|
||||
VKAPI_ATTR vk::Bool32 VKAPI_CALL debugUtilsMessengerCallback( vk::DebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
|
||||
vk::DebugUtilsMessageTypeFlagsEXT messageTypes,
|
||||
const vk::DebugUtilsMessengerCallbackDataEXT * pCallbackData,
|
||||
void * /*pUserData*/ )
|
||||
{
|
||||
#if !defined( NDEBUG )
|
||||
if ( static_cast<uint32_t>( pCallbackData->messageIdNumber ) == 0x822806fa )
|
||||
switch ( static_cast<uint32_t>( pCallbackData->messageIdNumber ) )
|
||||
{
|
||||
// Validation Warning: vkCreateInstance(): to enable extension VK_EXT_debug_utils, but this extension is intended to support use by applications when
|
||||
// debugging and it is strongly recommended that it be otherwise avoided.
|
||||
return vk::False;
|
||||
}
|
||||
else if ( static_cast<uint32_t>( pCallbackData->messageIdNumber ) == 0xe8d1a9fe )
|
||||
{
|
||||
// Validation Performance Warning: Using debug builds of the validation layers *will* adversely affect performance.
|
||||
return vk::False;
|
||||
case 0:
|
||||
// Validation Warning: Override layer has override paths set to C:/VulkanSDK/<version>/Bin
|
||||
return vk::False;
|
||||
case 0x822806fa:
|
||||
// Validation Warning: vkCreateInstance(): to enable extension VK_EXT_debug_utils, but this extension is intended to support use by applications when
|
||||
// debugging and it is strongly recommended that it be otherwise avoided.
|
||||
return vk::False;
|
||||
case 0xe8d1a9fe:
|
||||
// Validation Performance Warning: Using debug builds of the validation layers *will* adversely affect performance.
|
||||
return vk::False;
|
||||
}
|
||||
#endif
|
||||
|
||||
std::cerr << vk::to_string( static_cast<vk::DebugUtilsMessageSeverityFlagBitsEXT>( messageSeverity ) ) << ": "
|
||||
<< vk::to_string( static_cast<vk::DebugUtilsMessageTypeFlagsEXT>( messageTypes ) ) << ":\n";
|
||||
std::cerr << vk::to_string( messageSeverity ) << ": " << vk::to_string( messageTypes ) << ":\n";
|
||||
std::cerr << std::string( "\t" ) << "messageIDName = <" << pCallbackData->pMessageIdName << ">\n";
|
||||
std::cerr << std::string( "\t" ) << "messageIdNumber = " << pCallbackData->messageIdNumber << "\n";
|
||||
std::cerr << std::string( "\t" ) << "message = <" << pCallbackData->pMessage << ">\n";
|
||||
|
|
@ -394,8 +395,7 @@ namespace vk
|
|||
for ( uint32_t i = 0; i < pCallbackData->objectCount; i++ )
|
||||
{
|
||||
std::cerr << std::string( "\t\t" ) << "Object " << i << "\n";
|
||||
std::cerr << std::string( "\t\t\t" ) << "objectType = " << vk::to_string( static_cast<vk::ObjectType>( pCallbackData->pObjects[i].objectType ) )
|
||||
<< "\n";
|
||||
std::cerr << std::string( "\t\t\t" ) << "objectType = " << vk::to_string( pCallbackData->pObjects[i].objectType ) << "\n";
|
||||
std::cerr << std::string( "\t\t\t" ) << "objectHandle = " << pCallbackData->pObjects[i].objectHandle << "\n";
|
||||
if ( pCallbackData->pObjects[i].pObjectName )
|
||||
{
|
||||
|
|
@ -420,37 +420,52 @@ namespace vk
|
|||
std::pair<uint32_t, uint32_t> findGraphicsAndPresentQueueFamilyIndex( vk::PhysicalDevice physicalDevice, vk::SurfaceKHR const & surface )
|
||||
{
|
||||
std::vector<vk::QueueFamilyProperties> queueFamilyProperties = physicalDevice.getQueueFamilyProperties();
|
||||
assert( queueFamilyProperties.size() < std::numeric_limits<uint32_t>::max() );
|
||||
assert( queueFamilyProperties.size() < ( std::numeric_limits<uint32_t>::max )() );
|
||||
|
||||
uint32_t graphicsQueueFamilyIndex = findGraphicsQueueFamilyIndex( queueFamilyProperties );
|
||||
if ( physicalDevice.getSurfaceSupportKHR( graphicsQueueFamilyIndex, surface ) )
|
||||
// look for a queueFamilyIndex that supports graphics and present
|
||||
auto combinedIt = std::find_if( queueFamilyProperties.begin(),
|
||||
queueFamilyProperties.end(),
|
||||
[&physicalDevice, &surface]( vk::QueueFamilyProperties const & qfp )
|
||||
{
|
||||
static uint32_t index = 0;
|
||||
return ( qfp.queueFlags & vk::QueueFlagBits::eGraphics ) && physicalDevice.getSurfaceSupportKHR( index++, surface );
|
||||
} );
|
||||
if ( combinedIt != queueFamilyProperties.end() )
|
||||
{
|
||||
return std::make_pair( graphicsQueueFamilyIndex,
|
||||
graphicsQueueFamilyIndex ); // the first graphicsQueueFamilyIndex does also support presents
|
||||
uint32_t index = static_cast<uint32_t>( std::distance( queueFamilyProperties.begin(), combinedIt ) );
|
||||
return { index, index }; // the first index that supports graphics and present
|
||||
}
|
||||
|
||||
// the graphicsQueueFamilyIndex doesn't support present -> look for an other family index that supports both
|
||||
// graphics and present
|
||||
for ( size_t i = 0; i < queueFamilyProperties.size(); i++ )
|
||||
else
|
||||
{
|
||||
if ( ( queueFamilyProperties[i].queueFlags & vk::QueueFlagBits::eGraphics ) &&
|
||||
physicalDevice.getSurfaceSupportKHR( static_cast<uint32_t>( i ), surface ) )
|
||||
// there's no single index that supports both graphics and present -> look for separate ones
|
||||
auto graphicsIt = std::find_if( queueFamilyProperties.begin(),
|
||||
queueFamilyProperties.end(),
|
||||
[]( vk::QueueFamilyProperties const & qfp ) { return qfp.queueFlags & vk::QueueFlagBits::eGraphics; } );
|
||||
if ( graphicsIt != queueFamilyProperties.end() )
|
||||
{
|
||||
return std::make_pair( static_cast<uint32_t>( i ), static_cast<uint32_t>( i ) );
|
||||
uint32_t graphicsIndex = static_cast<uint32_t>( std::distance( queueFamilyProperties.begin(), graphicsIt ) );
|
||||
auto presentIt = std::find_if( queueFamilyProperties.begin(),
|
||||
queueFamilyProperties.end(),
|
||||
[&physicalDevice, &surface]( vk::QueueFamilyProperties const & )
|
||||
{
|
||||
static uint32_t index = 0;
|
||||
return physicalDevice.getSurfaceSupportKHR( index++, surface );
|
||||
} );
|
||||
if ( presentIt != queueFamilyProperties.end() )
|
||||
{
|
||||
uint32_t presentIndex = static_cast<uint32_t>( std::distance( queueFamilyProperties.begin(), presentIt ) );
|
||||
return { graphicsIndex, presentIndex };
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error( "Could not find a queue family index that supports present -> terminating" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error( "Could not find a queue family index that supports graphics -> terminating" );
|
||||
}
|
||||
}
|
||||
|
||||
// there's nothing like a single family index that supports both graphics and present -> look for an other family
|
||||
// index that supports present
|
||||
for ( size_t i = 0; i < queueFamilyProperties.size(); i++ )
|
||||
{
|
||||
if ( physicalDevice.getSurfaceSupportKHR( static_cast<uint32_t>( i ), surface ) )
|
||||
{
|
||||
return std::make_pair( graphicsQueueFamilyIndex, static_cast<uint32_t>( i ) );
|
||||
}
|
||||
}
|
||||
|
||||
throw std::runtime_error( "Could not find queues for both graphics or present -> terminating" );
|
||||
}
|
||||
|
||||
uint32_t findMemoryType( vk::PhysicalDeviceMemoryProperties const & memoryProperties, uint32_t typeBits, vk::MemoryPropertyFlags requirementsMask )
|
||||
|
|
@ -480,12 +495,8 @@ namespace vk
|
|||
extensions.push_back( VK_KHR_SURFACE_EXTENSION_NAME );
|
||||
#if defined( VK_USE_PLATFORM_ANDROID_KHR )
|
||||
extensions.push_back( VK_KHR_ANDROID_SURFACE_EXTENSION_NAME );
|
||||
#elif defined( VK_USE_PLATFORM_IOS_MVK )
|
||||
extensions.push_back( VK_MVK_IOS_SURFACE_EXTENSION_NAME );
|
||||
#elif defined( VK_USE_PLATFORM_MACOS_MVK )
|
||||
extensions.push_back( VK_MVK_MACOS_SURFACE_EXTENSION_NAME );
|
||||
#elif defined( VK_USE_PLATFORM_MIR_KHR )
|
||||
extensions.push_back( VK_KHR_MIR_SURFACE_EXTENSION_NAME );
|
||||
#elif defined( VK_USE_PLATFORM_METAL_EXT )
|
||||
extensions.push_back( VK_EXT_METAL_SURFACE_EXTENSION_NAME );
|
||||
#elif defined( VK_USE_PLATFORM_VI_NN )
|
||||
extensions.push_back( VK_NN_VI_SURFACE_EXTENSION_NAME );
|
||||
#elif defined( VK_USE_PLATFORM_WAYLAND_KHR )
|
||||
|
|
@ -578,20 +589,20 @@ namespace vk
|
|||
switch ( oldImageLayout )
|
||||
{
|
||||
case vk::ImageLayout::eTransferDstOptimal: sourceAccessMask = vk::AccessFlagBits::eTransferWrite; break;
|
||||
case vk::ImageLayout::ePreinitialized: sourceAccessMask = vk::AccessFlagBits::eHostWrite; break;
|
||||
case vk::ImageLayout::eGeneral: // sourceAccessMask is empty
|
||||
case vk::ImageLayout::eUndefined: break;
|
||||
default: assert( false ); break;
|
||||
case vk::ImageLayout::ePreinitialized : sourceAccessMask = vk::AccessFlagBits::eHostWrite; break;
|
||||
case vk::ImageLayout::eGeneral : // sourceAccessMask is empty
|
||||
case vk::ImageLayout::eUndefined : break;
|
||||
default : assert( false ); break;
|
||||
}
|
||||
|
||||
vk::PipelineStageFlags sourceStage;
|
||||
switch ( oldImageLayout )
|
||||
{
|
||||
case vk::ImageLayout::eGeneral:
|
||||
case vk::ImageLayout::ePreinitialized: sourceStage = vk::PipelineStageFlagBits::eHost; break;
|
||||
case vk::ImageLayout::ePreinitialized : sourceStage = vk::PipelineStageFlagBits::eHost; break;
|
||||
case vk::ImageLayout::eTransferDstOptimal: sourceStage = vk::PipelineStageFlagBits::eTransfer; break;
|
||||
case vk::ImageLayout::eUndefined: sourceStage = vk::PipelineStageFlagBits::eTopOfPipe; break;
|
||||
default: assert( false ); break;
|
||||
case vk::ImageLayout::eUndefined : sourceStage = vk::PipelineStageFlagBits::eTopOfPipe; break;
|
||||
default : assert( false ); break;
|
||||
}
|
||||
|
||||
vk::AccessFlags destinationAccessMask;
|
||||
|
|
@ -602,24 +613,24 @@ namespace vk
|
|||
destinationAccessMask = vk::AccessFlagBits::eDepthStencilAttachmentRead | vk::AccessFlagBits::eDepthStencilAttachmentWrite;
|
||||
break;
|
||||
case vk::ImageLayout::eGeneral: // empty destinationAccessMask
|
||||
case vk::ImageLayout::ePresentSrcKHR: break;
|
||||
case vk::ImageLayout::ePresentSrcKHR : break;
|
||||
case vk::ImageLayout::eShaderReadOnlyOptimal: destinationAccessMask = vk::AccessFlagBits::eShaderRead; break;
|
||||
case vk::ImageLayout::eTransferSrcOptimal: destinationAccessMask = vk::AccessFlagBits::eTransferRead; break;
|
||||
case vk::ImageLayout::eTransferDstOptimal: destinationAccessMask = vk::AccessFlagBits::eTransferWrite; break;
|
||||
default: assert( false ); break;
|
||||
case vk::ImageLayout::eTransferSrcOptimal : destinationAccessMask = vk::AccessFlagBits::eTransferRead; break;
|
||||
case vk::ImageLayout::eTransferDstOptimal : destinationAccessMask = vk::AccessFlagBits::eTransferWrite; break;
|
||||
default : assert( false ); break;
|
||||
}
|
||||
|
||||
vk::PipelineStageFlags destinationStage;
|
||||
switch ( newImageLayout )
|
||||
{
|
||||
case vk::ImageLayout::eColorAttachmentOptimal: destinationStage = vk::PipelineStageFlagBits::eColorAttachmentOutput; break;
|
||||
case vk::ImageLayout::eColorAttachmentOptimal : destinationStage = vk::PipelineStageFlagBits::eColorAttachmentOutput; break;
|
||||
case vk::ImageLayout::eDepthStencilAttachmentOptimal: destinationStage = vk::PipelineStageFlagBits::eEarlyFragmentTests; break;
|
||||
case vk::ImageLayout::eGeneral: destinationStage = vk::PipelineStageFlagBits::eHost; break;
|
||||
case vk::ImageLayout::ePresentSrcKHR: destinationStage = vk::PipelineStageFlagBits::eBottomOfPipe; break;
|
||||
case vk::ImageLayout::eShaderReadOnlyOptimal: destinationStage = vk::PipelineStageFlagBits::eFragmentShader; break;
|
||||
case vk::ImageLayout::eTransferDstOptimal:
|
||||
case vk::ImageLayout::eTransferSrcOptimal: destinationStage = vk::PipelineStageFlagBits::eTransfer; break;
|
||||
default: assert( false ); break;
|
||||
case vk::ImageLayout::eGeneral : destinationStage = vk::PipelineStageFlagBits::eHost; break;
|
||||
case vk::ImageLayout::ePresentSrcKHR : destinationStage = vk::PipelineStageFlagBits::eBottomOfPipe; break;
|
||||
case vk::ImageLayout::eShaderReadOnlyOptimal : destinationStage = vk::PipelineStageFlagBits::eFragmentShader; break;
|
||||
case vk::ImageLayout::eTransferDstOptimal :
|
||||
case vk::ImageLayout::eTransferSrcOptimal : destinationStage = vk::PipelineStageFlagBits::eTransfer; break;
|
||||
default : assert( false ); break;
|
||||
}
|
||||
|
||||
vk::ImageAspectFlags aspectMask;
|
||||
|
|
@ -784,7 +795,7 @@ namespace vk
|
|||
: extent( extent_ ), window( vk::su::createWindow( windowName, extent ) )
|
||||
{
|
||||
VkSurfaceKHR _surface;
|
||||
VkResult err = glfwCreateWindowSurface( static_cast<VkInstance>( instance ), window.handle, nullptr, &_surface );
|
||||
VkResult err = glfwCreateWindowSurface( instance, window.handle, nullptr, &_surface );
|
||||
if ( err != VK_SUCCESS )
|
||||
throw std::runtime_error( "Failed to create window!" );
|
||||
surface = vk::SurfaceKHR( _surface );
|
||||
|
|
@ -804,7 +815,7 @@ namespace vk
|
|||
|
||||
vk::SurfaceCapabilitiesKHR surfaceCapabilities = physicalDevice.getSurfaceCapabilitiesKHR( surface );
|
||||
vk::Extent2D swapchainExtent;
|
||||
if ( surfaceCapabilities.currentExtent.width == std::numeric_limits<uint32_t>::max() )
|
||||
if ( surfaceCapabilities.currentExtent.width == ( std::numeric_limits<uint32_t>::max )() )
|
||||
{
|
||||
// If the surface size is undefined, the size is set to the size of the images requested.
|
||||
swapchainExtent.width = clamp( extent.width, surfaceCapabilities.minImageExtent.width, surfaceCapabilities.maxImageExtent.width );
|
||||
|
|
@ -824,21 +835,22 @@ namespace vk
|
|||
: ( surfaceCapabilities.supportedCompositeAlpha & vk::CompositeAlphaFlagBitsKHR::eInherit ) ? vk::CompositeAlphaFlagBitsKHR::eInherit
|
||||
: vk::CompositeAlphaFlagBitsKHR::eOpaque;
|
||||
vk::PresentModeKHR presentMode = vk::su::pickPresentMode( physicalDevice.getSurfacePresentModesKHR( surface ) );
|
||||
vk::SwapchainCreateInfoKHR swapChainCreateInfo( {},
|
||||
surface,
|
||||
vk::su::clamp( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
|
||||
colorFormat,
|
||||
surfaceFormat.colorSpace,
|
||||
swapchainExtent,
|
||||
1,
|
||||
usage,
|
||||
vk::SharingMode::eExclusive,
|
||||
{},
|
||||
preTransform,
|
||||
compositeAlpha,
|
||||
presentMode,
|
||||
true,
|
||||
oldSwapChain );
|
||||
vk::SwapchainCreateInfoKHR swapChainCreateInfo(
|
||||
{},
|
||||
surface,
|
||||
vk::su::clampSurfaceImageCount( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
|
||||
colorFormat,
|
||||
surfaceFormat.colorSpace,
|
||||
swapchainExtent,
|
||||
1,
|
||||
usage,
|
||||
vk::SharingMode::eExclusive,
|
||||
{},
|
||||
preTransform,
|
||||
compositeAlpha,
|
||||
presentMode,
|
||||
true,
|
||||
oldSwapChain );
|
||||
if ( graphicsQueueFamilyIndex != presentQueueFamilyIndex )
|
||||
{
|
||||
uint32_t queueFamilyIndices[2] = { graphicsQueueFamilyIndex, presentQueueFamilyIndex };
|
||||
|
|
@ -981,7 +993,7 @@ namespace vk
|
|||
|
||||
WindowData::WindowData( GLFWwindow * wnd, std::string const & name, vk::Extent2D const & extent ) : handle{ wnd }, name{ name }, extent{ extent } {}
|
||||
|
||||
WindowData::WindowData( WindowData && other ) : handle{}, name{}, extent{}
|
||||
WindowData::WindowData( WindowData && other ) noexcept : handle{}, name{}, extent{}
|
||||
{
|
||||
std::swap( handle, other.handle );
|
||||
std::swap( name, other.name );
|
||||
|
|
@ -1000,12 +1012,7 @@ namespace vk
|
|||
glfwContext()
|
||||
{
|
||||
glfwInit();
|
||||
glfwSetErrorCallback(
|
||||
[]( int error, const char * msg )
|
||||
{
|
||||
std::cerr << "glfw: "
|
||||
<< "(" << error << ") " << msg << std::endl;
|
||||
} );
|
||||
glfwSetErrorCallback( []( int error, const char * msg ) { std::cerr << "glfw: " << "(" << error << ") " << msg << std::endl; } );
|
||||
}
|
||||
|
||||
~glfwContext()
|
||||
|
|
@ -1036,13 +1043,14 @@ namespace vk
|
|||
#else
|
||||
vk::StructureChain<vk::InstanceCreateInfo, vk::DebugUtilsMessengerCreateInfoEXT>
|
||||
#endif
|
||||
makeInstanceCreateInfoChain( vk::ApplicationInfo const & applicationInfo,
|
||||
makeInstanceCreateInfoChain( vk::InstanceCreateFlagBits instanceCreateFlagBits,
|
||||
vk::ApplicationInfo const & applicationInfo,
|
||||
std::vector<char const *> const & layers,
|
||||
std::vector<char const *> const & extensions )
|
||||
{
|
||||
#if defined( NDEBUG )
|
||||
// in non-debug mode just use the InstanceCreateInfo for instance creation
|
||||
vk::StructureChain<vk::InstanceCreateInfo> instanceCreateInfo( { {}, &applicationInfo, layers, extensions } );
|
||||
vk::StructureChain<vk::InstanceCreateInfo> instanceCreateInfo( { instanceCreateFlagBits, &applicationInfo, layers, extensions } );
|
||||
#else
|
||||
// in debug mode, addionally use the debugUtilsMessengerCallback in instance creation!
|
||||
vk::DebugUtilsMessageSeverityFlagsEXT severityFlags( vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning |
|
||||
|
|
@ -1050,7 +1058,7 @@ namespace vk
|
|||
vk::DebugUtilsMessageTypeFlagsEXT messageTypeFlags( vk::DebugUtilsMessageTypeFlagBitsEXT::eGeneral | vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance |
|
||||
vk::DebugUtilsMessageTypeFlagBitsEXT::eValidation );
|
||||
vk::StructureChain<vk::InstanceCreateInfo, vk::DebugUtilsMessengerCreateInfoEXT> instanceCreateInfo(
|
||||
{ {}, &applicationInfo, layers, extensions }, { {}, severityFlags, messageTypeFlags, &vk::su::debugUtilsMessengerCallback } );
|
||||
{ instanceCreateFlagBits, &applicationInfo, layers, extensions }, { {}, severityFlags, messageTypeFlags, &vk::su::debugUtilsMessengerCallback } );
|
||||
#endif
|
||||
return instanceCreateInfo;
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue