Compare commits
283 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
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 |
|
|
@ -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
|
||||
|
|
@ -8,12 +8,11 @@ on:
|
|||
jobs:
|
||||
build:
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-12, macos-13]
|
||||
# g++-13 fails on macos-12 and macos-13 with some error in stdio.h !
|
||||
compiler: [clang++, g++-12, g++-14]
|
||||
os: [macos-14, macos-15]
|
||||
compiler: [clang++]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
|
@ -28,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,76 +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, clang++-15, g++-10, g++-11, g++-12]
|
||||
|
||||
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 compilers supporting that
|
||||
run: |
|
||||
# g++-10 does not support C++23
|
||||
if [ ${{matrix.compiler}} != g++-10 ]
|
||||
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
|
||||
|
|
|
|||
591
CMakeLists.txt
591
CMakeLists.txt
|
|
@ -24,28 +24,330 @@
|
|||
# (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_warning_level )
|
||||
set( options )
|
||||
set( oneValueArgs NAME )
|
||||
set( multiValueArgs )
|
||||
cmake_parse_arguments( TARGET "{options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
|
||||
if( MSVC )
|
||||
target_compile_options(${TARGET_NAME} PRIVATE /W4 /WX )
|
||||
if( MSVC_VER GREATER_EQUAL 1910 )
|
||||
target_compile_options( ${TARGET_NAME} PRIVATE /permissive- )
|
||||
endif()
|
||||
else()
|
||||
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
|
||||
ALIAS Vulkan::HppModule ) # TODO: respect VULKAN_HPP_BUILD_WITH_LOCAL_VULKAN_HPP
|
||||
vulkan_hpp__setup_vulkan_module( NAME VulkanVideoHppModule
|
||||
FILE_SET_NAME vulkan_video_module_file
|
||||
FILE_SET vulkan/vulkan_video.cppm
|
||||
ALIAS Vulkan::VideoHppModule )
|
||||
endif()
|
||||
|
||||
function( vulkan_hpp__setup_platform )
|
||||
set( options )
|
||||
|
|
@ -62,38 +364,8 @@ function( vulkan_hpp__setup_platform )
|
|||
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 )
|
||||
set( multiValueArgs )
|
||||
cmake_parse_arguments( TARGET "{options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
|
||||
if( MSVC )
|
||||
target_compile_options(${TARGET_NAME} PRIVATE /W4 /WX )
|
||||
if( MSVC_VER GREATER_EQUAL 1910 )
|
||||
target_compile_options( ${TARGET_NAME} PRIVATE /permissive- )
|
||||
endif()
|
||||
else()
|
||||
target_compile_options( ${TARGET_NAME} PRIVATE -Wall -Wextra -pedantic -Werror )
|
||||
if( !MSVC )
|
||||
target_compile_options( ${TARGET_NAME} PRIVATE -fno-strict-aliasing )
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
|
@ -133,10 +405,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 +426,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 +445,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 +478,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 +486,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,183 +500,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 -api vulkan
|
||||
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}" )
|
||||
|
||||
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}" )
|
||||
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 )
|
||||
|
|
@ -437,6 +603,7 @@ if( ${VULKAN_HPP_INSTALL} )
|
|||
${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
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
#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,6 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -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,6 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -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,10 @@
|
|||
// 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,6 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
#include "../../samples/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,6 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -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,7 +28,6 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <fstream>
|
||||
|
|
@ -36,7 +35,7 @@
|
|||
#include <thread>
|
||||
|
||||
// For timestamp code (getMilliseconds)
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
# include <Windows.h>
|
||||
#else
|
||||
# include <sys/time.h>
|
||||
|
|
@ -46,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 )
|
||||
|
|
@ -143,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 );
|
||||
|
|
@ -152,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();
|
||||
|
|
@ -172,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
|
||||
//
|
||||
|
|
@ -208,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;
|
||||
|
|
@ -258,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";
|
||||
|
|
@ -273,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,6 @@
|
|||
#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,6 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -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,6 @@
|
|||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "CameraManipulator.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
|
@ -581,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 ) );
|
||||
|
|
@ -725,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 );
|
||||
|
||||
|
|
@ -1188,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 );
|
||||
|
||||
|
|
@ -1214,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
|
||||
|
|
@ -1236,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,6 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
|
@ -147,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 );
|
||||
|
|
@ -198,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 );
|
||||
|
|
@ -216,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,6 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -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,6 @@
|
|||
#include "../../samples/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,6 @@
|
|||
#include "../../samples/utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -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 ) )
|
||||
|
|
@ -896,5 +896,5 @@ namespace vk
|
|||
}
|
||||
|
||||
} // namespace su
|
||||
} // namespace raii
|
||||
} // namespace raii
|
||||
} // namespace vk
|
||||
|
|
|
|||
340
README.md
340
README.md
|
|
@ -5,20 +5,100 @@ The goal of the Vulkan-Hpp is to provide header only C++ bindings for the Vulkan
|
|||
|
||||
| Platform | Build Status |
|
||||
|:--------:|:------------:|
|
||||
| Linux | [](https://travis-ci.org/KhronosGroup/Vulkan-Hpp) |
|
||||
| Windows | [](https://github.com/KhronosGroup/Vulkan-Hpp/actions/workflows/ci-windows.yml) |
|
||||
| Linux | [](https://github.com/KhronosGroup/Vulkan-Hpp/actions/workflows/ci-ubuntu-22.yml) <br> [](https://github.com/KhronosGroup/Vulkan-Hpp/actions/workflows/ci-ubuntu-24.yml) |
|
||||
| MacOS | [](https://github.com/KhronosGroup/Vulkan-Hpp/actions/workflows/ci-macos.yml) |
|
||||
|
||||
## Getting Started
|
||||
# Table of Contents
|
||||
- [Getting Started](#getting_started)
|
||||
- [Minimum Requirements](#minimum_requirements)
|
||||
- [Building Vulkan-Hpp, Samples, and Tests](#building)
|
||||
- [Installing vulkan-hpp using vcpkg](#installing)
|
||||
- [Optional Features](#optional_features)
|
||||
- [Formatting](#formatting)
|
||||
- [Custom views of Vulkan-Hpp objects in Visual Studio](#custom_views)
|
||||
- [Breaking Changes](#breaking_changes)
|
||||
- [v1.4.324](#breaking_changes_324)
|
||||
- [Usage](#usage)
|
||||
- [namespace vk](#namespace_vk)
|
||||
- [Handles](#handles)
|
||||
- [namespace vk::raii](#namespace_vk_raii)
|
||||
- [C/C++ Interop for Handles](#c_cpp_interop)
|
||||
- [Flags](#flags)
|
||||
- [CreateInfo structs](#createinfo_structs)
|
||||
- [Designated Initializers](#designated_initializers)
|
||||
- [Passing Arrays to Functions using ArrayProxy](#passing_arrays)
|
||||
- [Passing Structs to Functions](#passing_structs)
|
||||
- [Structure Pointer Chains](#structure_chains)
|
||||
- [Return values, Error Codes & Exceptions](#return_values)
|
||||
- [C++17: [[nodiscard]]](#nodiscard)
|
||||
- [Enumerations](#enumerations)
|
||||
- [UniqueHandle for automatic resource management](#unique_handle)
|
||||
- [SharedHandle](#shared_handle)
|
||||
- [RAII-classes](#raii_classes)
|
||||
- [Custom allocators](#custom_allocators)
|
||||
- [Custom assertions](#custom_assertions)
|
||||
- [ Extensions / Per Device function pointers](#extensions)
|
||||
- [Type traits](#type_traits)
|
||||
- [vk::Format trait functions](#vk_format_traits)
|
||||
- [Hashing Vulkan types](#hashing)
|
||||
- [Extension Inspection](#extension_inspection)
|
||||
- [C++20 named module](#named_module)
|
||||
- [Overview](#named_module_overview)
|
||||
- [Compiler support](#compiler_support)
|
||||
- [Usage with CMake](#cmake_usage)
|
||||
- [Command-line usage](#command_line_usage)
|
||||
- [Samples and Tests](#samples_and_tests)
|
||||
- [Compile time issues](#compile_time_issues)
|
||||
- [Strict aliasing issue](#strict_aliasing_issue)
|
||||
- [Configuration Options](#options)
|
||||
- [VULKAN_HPP_ASSERT](#assert)
|
||||
- [VULKAN_HPP_ASSERT_ON_RESULT](#assert_on_result)
|
||||
- [VULKAN_HPP_DEFAULT_DISPATCHER](#default_dispatcher)
|
||||
- [VULKAN_HPP_DEFAULT_DISPATCHER_TYPE](#default_dispatcher_type)
|
||||
- [VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE](#default_dispatch_loader_dynamic_storage)
|
||||
- [VULKAN_HPP_DISABLE_ENHANCED_MODE](#disable_enhanced_mode)
|
||||
- [VULKAN_HPP_DISPATCH_LOADER_DYNAMIC](#dispatch_loader_dynamic)
|
||||
- [VULKAN_HPP_DISPATCH_LOADER_DYNAMIC_TYPE](#dispatch_loader_dynamic_type)
|
||||
- [VULKAN_HPP_DISPATCH_LOADER_STATIC_TYPE](#dispatch_loader_static_type)
|
||||
- [VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL](#enable_dynamic_loader_tool)
|
||||
- [VULKAN_HPP_EXPECTED](#expected)
|
||||
- [VULKAN_HPP_FLAGS_MASK_TYPE_AS_PUBLIC](#flags_mask_type_as_public)
|
||||
- [VULKAN_HPP_HANDLE_ERROR_OUT_OF_DATE_AS_SUCCESS](#handle_error_out_of_date_as_success)
|
||||
- [VULKAN_HPP_HANDLES_MOVE_EXCHANGE](#handles_move_exchange)
|
||||
- [VULKAN_HPP_HASH_COMBINE](#hash_combine)
|
||||
- [VULKAN_HPP_INLINE](#inline)
|
||||
- [VULKAN_HPP_NAMESPACE](#namespace)
|
||||
- [VULKAN_HPP_NO_CONSTRUCTORS](#no_constructors)
|
||||
- [VULKAN_HPP_NO_EXCEPTIONS](#no_exceptions)
|
||||
- [VULKAN_HPP_NO_NODISCARD_WARNINGS](#no_discard_warnings)
|
||||
- [VULKAN_HPP_NO_SETTERS](#no_setters)
|
||||
- [VULKAN_HPP_NO_SMART_HANDLE](#no_smart_handle)
|
||||
- [VULKAN_HPP_NO_SPACESHIP_OPERATOR](#no_spaceship_operator)
|
||||
- [VULKAN_HPP_NO_STD_MODULE](#no_std_module)
|
||||
- [VULKAN_HPP_NO_TO_STRING](#no_to_string)
|
||||
- [VULKAN_HPP_NO_WIN32_PROTOTYPES](#no_win32_prototypes)
|
||||
- [VULKAN_HPP_RAII_NO_EXCEPTIONS](#raii_no_exceptions)
|
||||
- [VULKAN_HPP_SMART_HANDLE_IMPLICIT_CAST](#smart_handle_implicit_cast)
|
||||
- [VULKAN_HPP_STORAGE_API](#storage_api)
|
||||
- [VULKAN_HPP_TYPESAFE_CONVERSION](#typesafe_conversion)
|
||||
- [VULKAN_HPP_UNEXPECTED](#unexpected)
|
||||
- [VULKAN_HPP_USE_REFLECT](#use_reflect)
|
||||
- [See Also](#see_also)
|
||||
- [License](#license)
|
||||
|
||||
## Getting Started <a id='getting_started'>
|
||||
|
||||
Vulkan-Hpp is part of the [LunarG Vulkan SDK](https://www.lunarg.com/vulkan-sdk/) since version 1.0.24. Just `#include <vulkan/vulkan.hpp>` and you're ready to use the C++ bindings. If you're using a Vulkan version not yet supported by the Vulkan SDK, you can find the latest version of the headers [here](vulkan).
|
||||
|
||||
### Minimum Requirements
|
||||
### Minimum Requirements <a id='minimum_requirements'>
|
||||
|
||||
Vulkan-Hpp requires a C++11 capable compiler to compile. The following compilers are known to work:
|
||||
* Visual Studio >= 2015
|
||||
* GCC >= 4.8.2 (earlier version might work, but are untested)
|
||||
* Clang >= 3.3
|
||||
|
||||
### Building Vulkan-Hpp, Samples, and Tests
|
||||
### Building Vulkan-Hpp, Samples, and Tests <a id="building">
|
||||
|
||||
To build the local samples and tests you'll have to clone this repository and run CMake to generate the required build files
|
||||
|
||||
|
|
@ -41,7 +121,7 @@ To build the local samples and tests you'll have to clone this repository and ru
|
|||
|
||||
Optional: To update the Vulkan-Hpp and its submodules execute `git pull --recurse-submodules`.
|
||||
|
||||
### Installing vulkan-hpp using vcpkg
|
||||
### Installing vulkan-hpp using vcpkg <a id='installing'>
|
||||
|
||||
You can download and install vulkan-hpp using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:
|
||||
|
||||
|
|
@ -55,19 +135,27 @@ cd vcpkg
|
|||
|
||||
The vulkan-hpp port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
|
||||
|
||||
### Optional Features
|
||||
### Optional Features <a id='optional_features'>
|
||||
|
||||
#### Formatting
|
||||
#### Formatting <a id='formatting'>
|
||||
|
||||
If the program clang-format is found by CMake, the define `CLANG_FORMAT_EXECUTABLE` is set accordingly. In that case, the generated `vulkan.hpp` is formatted using the `.clang-format` file located in the root directory of this project. Otherwise, it's formatted as hard-coded in the generator.
|
||||
|
||||
#### Custom views of Vulkan-Hpp objects in Visual Studio
|
||||
#### Custom views of Vulkan-Hpp objects in Visual Studio <a id='custom_views'>
|
||||
|
||||
The file `VulkanHpp.natvis` provides a custom view on `vk::Flags` for Visual Studio. If you add this file to the user-specific natvis directory of your Visual Studio installation (%USERPROFILE%\Documents\Visual Studio 2022\Visualizers), you get `vk::Flags` nicely formatted in your debugger with all your Visual Studio projects.
|
||||
|
||||
## Usage
|
||||
## Breaking Changes <a id='breaking_changes'>
|
||||
|
||||
### namespace vk
|
||||
We seriously try to keep the API for all flavours of the Vulkan-Hpp constant or backwards compatible. But every now and then, some breaking changes might get in. Here is a list of those changes, sorted by version.
|
||||
|
||||
### v1.4.324 <a id='breaking_changes_324'>
|
||||
|
||||
With PR [#2226](https://github.com/KhronosGroup/Vulkan-Hpp/pull/2226), the return type of `vk::raii::Device::acquireNextImage2KHR` and `vk::raii::SwapchainKHR::acquireNextImage` changed from `std::pair<vk::Result,uint32_t>` to the equivalent `vk::ResultValue<uint32_t>`
|
||||
|
||||
## Usage <a id='usage'>
|
||||
|
||||
### namespace vk <a id='namespace_vk'>
|
||||
|
||||
To avoid name collisions with the Vulkan C API, the C++ bindings reside in the `vk` namespace. The following rules apply to the new naming:
|
||||
|
||||
|
|
@ -85,19 +173,19 @@ In all other cases the extension suffix has not been removed.
|
|||
|
||||
In some cases it might be necessary to move Vulkan-Hpp to a custom namespace. This can be achieved by defining `VULKAN_HPP_NAMESPACE` before including Vulkan-Hpp.
|
||||
|
||||
### Handles
|
||||
### Handles <a id='handles'>
|
||||
|
||||
Vulkan-Hpp declares a class for all handles to ensure full type safety and to add support for member functions on handles. A member function has been added to a handle class for each function which accepts the corresponding handle as first parameter. Instead of `vkBindBufferMemory(device, ...)` one can write `device.bindBufferMemory(...)` or `vk::bindBufferMemory(device, ...)`.
|
||||
|
||||
### namespace vk::raii
|
||||
### namespace vk::raii <a id='namespace_vk_raii'>
|
||||
|
||||
There is an additional header named [`vulkan_raii.hpp`](vulkan/vulkan_raii.hpp) generated. That header holds raii-compliant wrapper classes for the handle types. That is, for e.g. the handle type `VkInstance`, there's a raii-compliant wrapper `vk::raii::Instance`. Please have a look at the samples using those classes in the directory [RAII_Samples](RAII_Samples).
|
||||
|
||||
### C/C++ Interop for Handles
|
||||
### C/C++ Interop for Handles <a id='c_cpp_interop'>
|
||||
|
||||
On 64-bit platforms Vulkan-Hpp supports implicit conversions between C++ Vulkan handles and C Vulkan handles. On 32-bit platforms all non-dispatchable handles are defined as `uint64_t`, thus preventing type-conversion checks at compile time which would catch assignments between incompatible handle types. Due to that Vulkan-Hpp does not enable implicit conversion for 32-bit platforms by default and it is recommended to use a `static_cast` for the conversion like this: `VkImage = static_cast<VkImage>(cppImage)` to prevent converting some arbitrary int to a handle or vice versa by accident. If you're developing your code on a 64-bit platform, but want to compile your code for a 32-bit platform without adding the explicit casts, you can define `VULKAN_HPP_TYPESAFE_CONVERSION` to `1` in your build system or before including `vulkan.hpp`. On 64-bit platforms this define is set to `1` by default and can be set to `0` to disable implicit conversions.
|
||||
|
||||
### Flags
|
||||
### Flags <a id='flags'>
|
||||
|
||||
The scoped enum feature adds type safety to the flags, but also prevents using the flag bits as input for bitwise operations such as `&` and `|`.
|
||||
|
||||
|
|
@ -111,7 +199,7 @@ vk::ImageUsageFlags iu4 = vk::ImageUsageFlagBits::eColorAttachment | vk::ImageUs
|
|||
PipelineShaderStageCreateInfo ci({} /* pass a flag without any bits set */, ...);
|
||||
```
|
||||
|
||||
### CreateInfo structs
|
||||
### CreateInfo structs <a id='createinfo_structs'>
|
||||
|
||||
When constructing a handle in Vulkan one usually has to create some `CreateInfo` struct which describes the new handle. This can result in quite lengthy code as can be seen in the following Vulkan C example:
|
||||
|
||||
|
|
@ -162,7 +250,7 @@ vk::Image image = device.createImage({{}, vk::ImageType::e2D, vk::Format::eR8G8B
|
|||
vk::SharingMode::eExclusive, 0, nullptr, vk::ImageLayout::eUndefined});
|
||||
```
|
||||
|
||||
### Designated Initializers
|
||||
### Designated Initializers <a id='designated_initializers'>
|
||||
|
||||
Beginning with C++20, C++ supports designated initializers. As that feature requires to not have any user-declared or inherited constructors, you have to `#define VULKAN_HPP_NO_CONSTRUCTORS`, which removes all the structure and union constructors from `vulkan.hpp`. Instead you can then use aggregate initialization. The first few vk-lines in your source might then look like:
|
||||
|
||||
|
|
@ -191,7 +279,7 @@ vk::InstanceCreateInfo instanceCreateInfo({}, &applicationInfo);
|
|||
Note, that the designator order needs to match the declaration order.
|
||||
Note as well, that now you can explicitly set the `sType` member of vk-structures. This is neither neccessary (as they are correctly initialized by default) nor recommended.
|
||||
|
||||
### Passing Arrays to Functions using ArrayProxy
|
||||
### Passing Arrays to Functions using ArrayProxy <a id='passing_arrays'>
|
||||
|
||||
The Vulkan API has several places which require (count, pointer) as two function arguments and C++ has a few containers which map perfectly to this pair. To simplify development the Vulkan-Hpp bindings have replaced those argument pairs with the `vk::ArrayProxy` class template which accepts empty arrays and a single value as well as STL containers `std::initializer_list`, `std::array` and `std::vector` as argument for construction. This way a single generated Vulkan version can accept a variety of inputs without having the combinatoric explosion which would occur when creating a function for each container type.
|
||||
|
||||
|
|
@ -234,7 +322,7 @@ vec.push_back(scissorRect2);
|
|||
c.setScissor(0, vec);
|
||||
```
|
||||
|
||||
### Passing Structs to Functions
|
||||
### Passing Structs to Functions <a id='passing_structs'>
|
||||
|
||||
Vulkan-Hpp generates references for pointers to structs. This conversion allows passing temporary structs to functions which can result in shorter code. In case the input is optional and thus accepting a null pointer, the parameter type will be `vk::Optional<T> const&`. This type accepts either a reference to `T` or `nullptr` as input and thus allows optional temporary structs.
|
||||
|
||||
|
|
@ -251,7 +339,7 @@ vkGetImageSubresourceLayout(device, image, &subresource, &layout);
|
|||
auto layout = device.getImageSubresourceLayout(image, { {} /* flags*/, 0 /* miplevel */, 0 /* arrayLayer */ });
|
||||
```
|
||||
|
||||
### Structure Pointer Chains
|
||||
### Structure Pointer Chains <a id='structure_chains'>
|
||||
|
||||
Vulkan allows chaining of structures through the `pNext` pointer. Vulkan-Hpp has a variadic class template which allows constructing of such structure chains with minimal efforts. In addition to this it checks at compile time if the spec allows the construction of such a `pNext` chain.
|
||||
|
||||
|
|
@ -295,7 +383,7 @@ To get just the base structure, without chaining, the other getter function prov
|
|||
vk::MemoryRequirements2KHR memoryRequirements = device.getBufferMemoryRequirements2KHR({});
|
||||
```
|
||||
|
||||
### Return values, Error Codes & Exceptions
|
||||
### Return values, Error Codes & Exceptions <a id='return_values'>
|
||||
|
||||
By default Vulkan-Hpp has exceptions enabled. This means that Vulkan-Hpp checks the return code of each function call which returns a `vk::Result`. If `vk::Result` is a failure a `std::runtime_error` will be thrown. Since there is no need to return the error code anymore the C++ bindings can now return the actual desired return value, i.e. a vulkan handle. In those cases `vk::ResultValue<SomeType>::type` is defined as the returned type.
|
||||
|
||||
|
|
@ -401,13 +489,13 @@ catch(std::exception const &e)
|
|||
```
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Vulkan-Hpp does not support RAII style handles, hence you need to cleanup your resources in the error handler!
|
||||
> The vulkan handles in the `vk`-namespace do not support RAII, hence you need to cleanup your resources in the error handler! Instead, you could use the handle wrapper classes in the `vk::raii`-namespace.
|
||||
|
||||
### C++17: [[nodiscard]]
|
||||
### C++17: [[nodiscard]] <a id='nodiscard'>
|
||||
|
||||
With C++17 and above, some functions are attributed with `[[nodiscard]]`, resulting in a warning if you don't use the return value in any way. You can switch those warnings off by defining `VULKAN_HPP_NO_NODISCARD_WARNINGS`.
|
||||
|
||||
### Enumerations
|
||||
### Enumerations <a id='enumerations'>
|
||||
|
||||
For the return value transformation, there's one special class of return values which require special handling: Enumerations. For enumerations you usually have to write code like this:
|
||||
|
||||
|
|
@ -437,7 +525,7 @@ Since writing this loop over and over again is tedious and error prone the C++ b
|
|||
std::vector<LayerProperties> properties = physicalDevice.enumerateDeviceLayerProperties();
|
||||
```
|
||||
|
||||
### UniqueHandle for automatic resource management
|
||||
### UniqueHandle for automatic resource management <a id='unique_handle'>
|
||||
|
||||
Vulkan-Hpp provides a `vk::UniqueHandle<Type, Deleter>` interface. For each Vulkan handle type `vk::Type` there is a unique handle `vk::UniqueType` which will delete the underlying Vulkan resource upon destruction, e.g. `vk::UniqueBuffer ` is the unique handle for `vk::Buffer`.
|
||||
|
||||
|
|
@ -445,7 +533,7 @@ For each function which constructs a Vulkan handle of type `vk::Type` Vulkan-Hpp
|
|||
|
||||
Note that using `vk::UniqueHandle` comes at a cost since most deleters have to store the `vk::AllocationCallbacks` and parent handle used for construction because they are required for automatic destruction.
|
||||
|
||||
### SharedHandle
|
||||
### SharedHandle <a id='shared_handle'>
|
||||
|
||||
Vulkan-Hpp provides a `vk::SharedHandle<Type>` interface. For each Vulkan handle type `vk::Type` there is a shared handle `vk::SharedType` which will delete the underlying Vulkan resource upon destruction, e.g. `vk::SharedBuffer` is the shared handle for `vk::Buffer`.
|
||||
|
||||
|
|
@ -508,7 +596,17 @@ protected:
|
|||
|
||||
The API will be extended to provide creation functions in the future.
|
||||
|
||||
### Custom allocators
|
||||
### RAII-classes <a id='raii_classes'>
|
||||
|
||||
In addition to `vk::UniqueHandles` and `vk::SharedHandles`, there's a set of wrapper classes for all the handle types that follow the RAII-paradigm (resource acquisition is initialization), provided in the `vk::raii` namespace.
|
||||
|
||||
While a `vk::UniqueHandle` mimics a handle wrapped by a `std::unique_ptr`, and a `vk::SharedHandle` mimics a handle wrapped by a `std::shared_ptr`, including parent information, a `vk::raii::Handle` is just a class that acquires the underlying vk-handle in its constructor and releases it in its destructor. Thus, you're free to use them as values or wrap them with some smart pointer.
|
||||
|
||||
Other than the `vk::Handles`, all those handle wrapper classes need to hold additional data, and thus are not binary identical with the vulkan C-handles.
|
||||
|
||||
As the `vk::UniqueHandles` and the `vk::SharedHandles` use the same dispatcher as the `vk::Handles`, they can be easily mixed-and-matched. The `vk::raii::Handles` use some slightly different dispatchers and thus are not compatible with the other handles! That is, for the `vk-Handles`, the `vk::UniqueHandles`, and the `vk::SharedHandles`, you need to instantiate a global dispatcher as described in https://github.com/KhronosGroup/Vulkan-Hpp#extensions--per-device-function-pointers. For the `vk::raii-Handles`, this is not needed, as they maintain their own dispatchers. The big advantage here is when you have multiple devices: the functions called via the `vk::raii-Handles` always call the device specific functions.
|
||||
|
||||
### Custom allocators <a id='custom_allocators'>
|
||||
|
||||
Sometimes it is required to use `std::vector` with custom allocators. Vulkan-Hpp supports vectors with custom allocators as input for `vk::ArrayProxy` and for functions which do return a vector. For the latter case, add your favorite custom allocator as template argument to the function call like this:
|
||||
|
||||
|
|
@ -523,7 +621,7 @@ MyStatefulCustomAllocator allocator;
|
|||
std::vector<LayerProperties, MyStatefulCustomAllocator> properties = physicalDevice.enumerateDeviceLayerProperties(allocator, {});
|
||||
```
|
||||
|
||||
### Custom assertions
|
||||
### Custom assertions <a id='custom_assertions'>
|
||||
|
||||
All over `vulkan.hpp`, there are a couple of calls to an assert function. By defining `VULKAN_HPP_ASSERT`, you can specifiy your own custom assert function to be called instead.
|
||||
|
||||
|
|
@ -531,32 +629,32 @@ By default, `VULKAN_HPP_ASSERT_ON_RESULT` will be used for checking results when
|
|||
|
||||
There are a couple of static assertions for each handle class and each struct in the file [`vulkan_static_assertions.hpp`](vulkan/vulkan_static_assertions.hpp). You might include that file in at least one of your source files. By defining `VULKAN_HPP_STATIC_ASSERT`, you can specify your own custom static assertion to be used for those cases. That is, by defining it to be a NOP, you can reduce your compilation time a little.
|
||||
|
||||
### Extensions / Per Device function pointers
|
||||
### Extensions / Per Device function pointers <a id='extensions'>
|
||||
|
||||
The Vulkan loader exposes only the Vulkan core functions and a limited number of extensions. To use Vulkan-Hpp with extensions it's required to have either a library which provides stubs to all used Vulkan functions or to tell Vulkan-Hpp to dispatch those functions pointers. Vulkan-Hpp provides a per-function dispatch mechanism by accepting a dispatch class as last parameter in each function call. The dispatch class must provide a callable type for each used Vulkan function. Vulkan-Hpp provides one implementation, `DispatchLoaderDynamic`, which fetches all function pointers known to the library.
|
||||
The Vulkan loader exposes only the Vulkan core functions and a limited number of extensions. To use Vulkan-Hpp with extensions it's required to have either a library which provides stubs to all used Vulkan functions or to tell Vulkan-Hpp to dispatch those functions pointers. Vulkan-Hpp provides a per-function dispatch mechanism by accepting a dispatch class as last parameter in each function call. The dispatch class must provide a callable type for each used Vulkan function. Vulkan-Hpp provides one implementation, `vk::detail::DispatchLoaderDynamic`, which fetches all function pointers known to the library.
|
||||
|
||||
```c++
|
||||
// Providing a function pointer resolving vkGetInstanceProcAddr, just the few functions not depending an an instance or a device are fetched
|
||||
vk::DispatchLoaderDynamic dld(getInstanceProcAddr);
|
||||
vk::detail::DispatchLoaderDynamic dld(getInstanceProcAddr);
|
||||
|
||||
// Providing an already created VkInstance and a function pointer resolving vkGetInstanceProcAddr, all functions are fetched
|
||||
vk::DispatchLoaderDynamic dldi(instance, getInstanceProcAddr);
|
||||
vk::detail::DispatchLoaderDynamic dldi(instance, getInstanceProcAddr);
|
||||
|
||||
// Providing also an already created VkDevice and optionally a function pointer resolving vkGetDeviceProcAddr, all functions are fetched as well, but now device-specific functions are fetched via vkDeviceGetProcAddr.
|
||||
vk::DispatchLoaderDynamic dldid( nstance, getInstanceProcAddr, device);
|
||||
vk::detail::DispatchLoaderDynamic dldid( nstance, getInstanceProcAddr, device);
|
||||
|
||||
// Pass dispatch class to function call as last parameter
|
||||
device.getQueue(graphics_queue_family_index, 0, &graphics_queue, dldid);
|
||||
```
|
||||
|
||||
To use the `vk::DispatchLoaderDynamic` as the default dispatcher (means: you don't need to explicitly add it to every function call), you need to `#define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1`, and have the macro `VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE` exactly once in your source code to provide storage for that default dispatcher. Then you can use it by the macro `VULKAN_HPP_DEFAULT_DISPATCHER`, as is shown in the code snippets below.
|
||||
Creating a full featured `vk::DispatchLoaderDynamic` is a two- to three-step process, where you have three choices for the first step:
|
||||
To use the `vk::detail::DispatchLoaderDynamic` as the default dispatcher (means: you don't need to explicitly add it to every function call), you need to `#define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1`, and have the macro `VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE` exactly once in your source code to provide storage for that default dispatcher. Then you can use it by the macro `VULKAN_HPP_DEFAULT_DISPATCHER`, as is shown in the code snippets below.
|
||||
Creating a full featured `vk::detail::DispatchLoaderDynamic` is a two- to three-step process, where you have three choices for the first step:
|
||||
1. Before any call into a vk-function you need to initialize the dynamic dispatcher by one of three methods
|
||||
- Let Vulkan-Hpp do all the work by internally using a little helper class `vk::DynamicLoader`:
|
||||
- Let Vulkan-Hpp do all the work by internally using a little helper class `vk::detail::DynamicLoader`:
|
||||
```c++
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.init();
|
||||
```
|
||||
- Use your own dynamic loader, which just needs to provide a templated function `getProcAddress` (compare with `vk::DynamicLoader` in `vulkan.hpp`):
|
||||
- Use your own dynamic loader, which just needs to provide a templated function `getProcAddress` (compare with `vk::detail::DynamicLoader` in `vulkan.hpp`):
|
||||
```c++
|
||||
YourDynamicLoader ydl;
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.init(ydl);
|
||||
|
|
@ -582,11 +680,11 @@ Creating a full featured `vk::DispatchLoaderDynamic` is a two- to three-step pro
|
|||
```
|
||||
After the second step above, the dispatcher is fully functional. Adding the third step can potentially result in more efficient code. But if you intend to use multiple devices, you could just omit that third step and let the driver do the device-dispatching.
|
||||
|
||||
In some cases the storage for the DispatchLoaderDynamic should be embedded in a DLL. For those cases you need to define `VULKAN_HPP_STORAGE_SHARED` to tell Vulkan-Hpp that the storage resides in a DLL. When compiling the DLL with the storage it is also required to define `VULKAN_HPP_STORAGE_SHARED_EXPORT` to export the required symbols.
|
||||
In some cases the storage for the `vk::detail::DispatchLoaderDynamic` should be embedded in a DLL. For those cases you need to define `VULKAN_HPP_STORAGE_SHARED` to tell Vulkan-Hpp that the storage resides in a DLL. When compiling the DLL with the storage it is also required to define `VULKAN_HPP_STORAGE_SHARED_EXPORT` to export the required symbols.
|
||||
|
||||
For all functions, that `VULKAN_HPP_DEFAULT_DISPATCHER` is the default for the last argument to that function. If you want to explicitly provide the dispatcher for each and every function call (when you have multiple dispatchers for different devices, for example) and you want to make sure, that you don't accidentally miss any function call, you can define `VULKAN_HPP_NO_DEFAULT_DISPATCHER` before you include `vulkan.hpp` to remove that default argument.
|
||||
|
||||
### Type traits
|
||||
### Type traits <a id='type_traits'>
|
||||
|
||||
`vulkan.hpp` provides a couple of type traits, easing template metaprogramming:
|
||||
- `template <typename EnumType, EnumType value> struct CppType`
|
||||
|
|
@ -604,47 +702,59 @@ For all functions, that `VULKAN_HPP_DEFAULT_DISPATCHER` is the default for the l
|
|||
- `HandleClass::debugReportObjectType`
|
||||
Maps a handle class (`vk::Instance`, `vk::Device`, ...) to the corresponding `DebugReportObjectTypeEXT` value (`DebugReportObjectTypeEXT::eInstance`, `DebugReportObjectTypeEXT::eDevice`, ...) by the static member `debugReportObjectType`.
|
||||
|
||||
### vk::Format trait functions
|
||||
### vk::Format trait functions <a id='vk_format_traits'>
|
||||
|
||||
With the additional header [`vulkan_format_traits.hpp`](vulkan/vulkan_format_traits.hpp), a couple of trait functions on `vk::Format` are provided. With C++14 and above, all those functions are marked as `constexpr`, that is with appropriate arguments, they are resolved at compile time.
|
||||
- `uin8_t blockSize( vk::Format format );`
|
||||
Gets the texel block size of this format in bytes.
|
||||
- `uint8_t texelsPerBlock( vk::Format format );`
|
||||
Gets the number of texels in a texel block.
|
||||
- `std::array<uint8_t, 3> blockExtent( vk::Format format );`
|
||||
Gets the three-dimensional extent of texel blocks.
|
||||
- `char const * compressionScheme( vk::Format format );`
|
||||
Gets a textual description of the compression scheme of this format, or an empty text if it is not compressed.
|
||||
- `bool isCompressed( vk::Format format );`
|
||||
True, if format is a compressed format, otherwise false.
|
||||
- `uint8_t packed( vk::Format format );`
|
||||
Gets the number of bits into which the format is packed. A single image element in this format can be stored in the same space as a scalar type of this bit width.
|
||||
- `uint8_t componentCount( vk::Format format );`
|
||||
Gets the number of components of this format.
|
||||
- `bool componentsAreCompressed( vk::Format format );`
|
||||
True, if the components of this format are compressed, otherwise False.
|
||||
- `uin8_t blockSize( vk::Format format );`
|
||||
Gets the texel block size of this format in bytes.
|
||||
- `char const * compatibilityClass( VULKAN_HPP_NAMESPACE::Format format );`
|
||||
The class of the format (can't be just named "class"!)
|
||||
- `uint8_t componentBits( vk::Format format, uint8_t component );`
|
||||
Gets the number of bits in this component, if not compressed, otherwise 0.
|
||||
- `uint8_t componentCount( vk::Format format );`
|
||||
Gets the number of components of this format.
|
||||
- `char const * componentName( vk::Format format, uint8_t component );`
|
||||
Gets the name of this component as a c-string.
|
||||
- `char const * componentNumericFormat( vk::Format format, uint8_t component );`
|
||||
Gets the numeric format of this component as a c-string.
|
||||
- `uint8_t componentPlaneIndex( vk::Format format, uint8_t component );`
|
||||
Gets the plane index, this component lies in.
|
||||
- `uint8_t planeCount( vk::Format format );`
|
||||
Gets the number of image planes of this format.
|
||||
- `bool componentsAreCompressed( vk::Format format );`
|
||||
True, if the components of this format are compressed, otherwise False.
|
||||
- `char const * compressionScheme( vk::Format format );`
|
||||
Gets a textual description of the compression scheme of this format, or an empty text if it is not compressed.
|
||||
- `std::vector<VULKAN_HPP_NAMESPACE::Format> const & getDepthFormats();`
|
||||
Get all formats with a depth component
|
||||
- `std::vector<VULKAN_HPP_NAMESPACE::Format> const & getDepthStencilFormats();`
|
||||
Get all formats with a depth and a stencil component
|
||||
- `std::vector<VULKAN_HPP_NAMESPACE::Format> const & getStencilFormats();`
|
||||
Get all formats with a stencil component
|
||||
- `bool hasDepthComponent( VULKAN_HPP_NAMESPACE::Format format );`
|
||||
True, if this format has a depth component, otherwise false.
|
||||
- `hasStencilComponent( VULKAN_HPP_NAMESPACE::Format format );`
|
||||
True, if this format has a stencil component, otherwise false.
|
||||
- `bool isCompressed( vk::Format format );`
|
||||
True, if this format is a compressed one, otherwise false.
|
||||
- `uint8_t packed( vk::Format format );`
|
||||
Gets the number of bits into which the format is packed. A single image element in this format can be stored in the same space as a scalar type of this bit width.
|
||||
- `vk::Format planeCompatibleFormat( vk::Format format, uint8_t plane );`
|
||||
Gets a single-plane format compatible with this plane.
|
||||
- `uint8_t planeCount( vk::Format format );`
|
||||
Gets the number of image planes of this format.
|
||||
- `uint8_t planeHeightDivisor( vk::Format format, uint8_t plane );`
|
||||
Gets the relative height of this plane. A value of k means that this plane is 1/k the height of the overall format.
|
||||
- `uint8_t planeWidthDivisor( vk::Format format, uint8_t plane );`
|
||||
Gets the relative width of this plane. A value of k means that this plane is 1/k the width of the overall format.
|
||||
- `uint8_t texelsPerBlock( vk::Format format );`
|
||||
Gets the number of texels in a texel block.
|
||||
|
||||
### Hashing Vulkan types
|
||||
### Hashing Vulkan types <a id='hashing'>
|
||||
|
||||
With the additional header [`vulkan_hash.hpp`](vulkan/vulkan_hash.hpp), you get specializations of `std::hash` for the handle wrapper classes and, with C++14, for the structure wrappers. With `VULKAN_HPP_HASH_COMBINE`, you can define your own hash combining algorithm for the structure elements.
|
||||
|
||||
### Extension Inspection
|
||||
### Extension Inspection <a id='extension_inspection'>
|
||||
|
||||
With the additional header [`vulkan_extension_inspection.hpp`](vulkan/vulkan_extension_inspection.hpp), some functions to inspect extensions are provided. With C++20 and above, some of those functions are marked as `constexpr`, that is with appropriate arguments, they are resolved at compile time.
|
||||
Each extension is identified by a string holding its name. Note that there exists a define with that name for each extension.
|
||||
|
|
@ -656,7 +766,7 @@ Some functions might provide information that depends on the vulkan version. As
|
|||
- `std::map<std::string, std::string> const & getDeprecatedExtensions();`
|
||||
Gets a map of all deprecated extensions to the extension or vulkan version that is supposed to replace that functionality.
|
||||
- `std::map<std::string, std::vector<std::vector<std::string>>> const & getExtensionDepends( std::string const & extension );`
|
||||
Some extensions depends on other extensions. That dependencies might differ for different vulkan versions, and there might be different sets of dependencies for the very same vulkan version. This function gets a vector of vectors of extensions per vulkan version that the given extension depends on.
|
||||
Some extensions depend on other extensions. These dependencies might differ for different vulkan versions, and there might be different sets of dependencies for the very same vulkan version. This function gets a vector of vectors of extensions per vulkan version that the given extension depends on.
|
||||
- `std::pair<bool, std::vector<std::vector<std::string>> const &> getExtensionDepends( std::string const & version, std::string const & extension );`
|
||||
The `first` member of the returned `std::pair` is true, if the given extension is specified for the given vulkan version, otherwise `false`. The `second` member of the returned `std::pair` is a vector of vectors of extensions, listing the separate sets of extensions the given extension depends on for the given vulkan version.
|
||||
- `std::map<std::string, std::string> const & getObsoletedExtensions();`
|
||||
|
|
@ -680,18 +790,18 @@ Some functions might provide information that depends on the vulkan version. As
|
|||
- `VULKAN_HPP_CONSTEXPR_20 bool isPromotedExtension( std::string const & extension );`
|
||||
Returns `true` if the given extension is promoted to some other extension or vulkan version.
|
||||
|
||||
### C++20 named module
|
||||
### C++20 named module <a id='named_module'>
|
||||
|
||||
> [!WARNING]
|
||||
> The current version of Microsoft Visual Studio 2022 is not able to handle the vulkan.cppm module. A bug is filed (<https://developercommunity.visualstudio.com/t/On-building-a-C20-module:-fatal--error/10469799#T-ND10485943>). You can at least use this feature if you don't need or want to use `vk::UniqueHandle` or `vk::SharedHandle` by defining `VULKAN_HPP_NO_SMART_HANDLE`.
|
||||
|
||||
#### Overview
|
||||
#### Overview <a id='named_module_overview'>
|
||||
|
||||
Vulkan-Hpp provides a [C++ named module](https://en.cppreference.com/w/cpp/language/modules), `vulkan_hpp` in [`vulkan.cppm`](vulkan/vulkan.cppm).
|
||||
C++ modules are intended to supersede header files. Modules have potential to drastically improve compilation times for large projects, as declarations and definitions may be easily shared across translation units without repeatedly parsing headers.
|
||||
Vulkan-Hpp has some extremely long headers (e.g. [`vulkan_structs.hpp`](vulkan/vulkan_structs.hpp)), and the C++ module is likely to shorten compile times for projects currently using it.
|
||||
|
||||
#### Compiler support
|
||||
#### Compiler support <a id='compiler_support'>
|
||||
|
||||
This feature requires a recent compiler with complete C++20 support:
|
||||
|
||||
|
|
@ -709,7 +819,7 @@ If you intend to use CMake's C++ module support (and possibly Ninja), then more
|
|||
> [!WARNING]
|
||||
> The Vulkan-Hpp C++ named module is still experimental. Some suggested ways to use it in your projects are below. The long-term goal is to submit patches to the CMake [`FindVulkan`](https://cmake.org/cmake/help/latest/module/FindVulkan.html) module so that users may transparently configure the named module, without needing to declare it as an additional library in consumer CMake code.
|
||||
|
||||
##### Usage with CMake
|
||||
##### Usage with CMake <a id='cmake_usage'>
|
||||
|
||||
CMake is recommended for use with the Vulkan-Hpp named module, as it provides a convenient platform-agnostic way to configure your project.
|
||||
CMake version 3.28 or later is required to support C++ modules. Refer to the [CMake documentation](https://cmake.org/cmake/help/latest/manual/cmake-cxxmodules.7.html) on the topic.
|
||||
|
|
@ -797,7 +907,7 @@ An example is provided in [`tests/Cpp20Modules/Cpp20Modules.cpp`](tests/Cpp20Mod
|
|||
Finally, you can configure and build your project as usual.
|
||||
Note that CMake currently only supports the Ninja and Visual Studio generators for C++ modules.
|
||||
|
||||
##### Command-line usage
|
||||
##### Command-line usage <a id='command_line_usage'>
|
||||
|
||||
If you want to use the Vulkan-Hpp C++ module without CMake, you must first pre-compile it, and then import it into your project.
|
||||
You will also need to define any macros that control various features of Vulkan-Hpp, such as `VULKAN_HPP_NO_EXCEPTIONS` and `VULKAN_HPP_NO_SMART_HANDLE`.
|
||||
|
|
@ -824,44 +934,49 @@ More information about module compilation may be found at the respective compile
|
|||
* [MSVC](https://learn.microsoft.com/en-us/cpp/cpp/modules-cpp?view=msvc-170)
|
||||
* [Clang](https://clang.llvm.org/docs/StandardCPlusPlusModules.html)
|
||||
|
||||
### Samples and Tests
|
||||
### Samples and Tests <a id='samples_and_tests'>
|
||||
|
||||
When you configure your project using CMake, you can enable SAMPLES_BUILD to add some sample projects to your solution. Most of them are ports from the LunarG samples, but there are some more, like CreateDebugUtilsMessenger, InstanceVersion, PhysicalDeviceDisplayProperties, PhysicalDeviceExtensions, PhysicalDeviceFeatures, PhysicalDeviceGroups, PhysicalDeviceMemoryProperties, PhysicalDeviceProperties, PhysicalDeviceQueueFamilyProperties, and RayTracing. All those samples should just compile and run.
|
||||
When you configure your project using CMake, you can enable TESTS_BUILD to add some test projects to your solution. Those tests are just compilation tests and are not required to run.
|
||||
|
||||
### Compile time issues
|
||||
### Compile time issues <a id='compile_time_issues'>
|
||||
|
||||
As `vulkan.hpp` is pretty big, some compilers might need some time to digest all that stuff. In order to potentially reduce the time needed to compile that header, a couple of defines will be introduced, that allow you to hide certain features. Whenever you don't need that corresponding feature, defining that value might improve your compile time.
|
||||
Currently, there are just a couple of such defines:
|
||||
- `VULKAN_HPP_NO_SPACESHIP_OPERATOR`, which removes the spaceship operator on structures (available with C++20)
|
||||
- `VULKAN_HPP_NO_TO_STRING`, which removes the various `vk::to_string` functions on enums and bitmasks.
|
||||
- `VULKAN_HPP_USE_REFLECT`, this one needs to be defined to use the reflection function on structures. It's very slow to compile, though!
|
||||
|
||||
## Configuration Options
|
||||
### Strict aliasing issue <a id='strict_aliasing_issue'>
|
||||
|
||||
As Vulkan-Hpp often needs to switch between C++ vk-types and corresponding bit-identical C-types, using `reinterpret_cast`, it is highly recommended to use the compile option `-fno-strict-aliasing` to prevent potentially breaking compile optimizations.
|
||||
|
||||
## Configuration Options <a id='options'>
|
||||
|
||||
There are a couple of defines you can use to control the feature set and behaviour of `vulkan.hpp`:
|
||||
|
||||
#### VULKAN_HPP_ASSERT
|
||||
#### VULKAN_HPP_ASSERT <a id='assert'>
|
||||
|
||||
At various places in `vulkan.hpp` an assertion statement is used. By default, the standard assert funtions from `<cassert>` is called. By defining `VULKAN_HPP_ASSERT` before including `vulkan.hpp`, you can change that to any function with the very same interface.
|
||||
|
||||
#### VULKAN_HPP_ASSERT_ON_RESULT
|
||||
#### VULKAN_HPP_ASSERT_ON_RESULT <a id='assert_on_result'>
|
||||
|
||||
If there are no exceptions enabled (see `VULKAN_HPP_NO_EXCEPTIONS`), an assertion statement checks for a valid success code returned from every vulkan call. By default, this is the very same assert function as defined by `VULKAN_HPP_ASSERT`, but by defining `VULKAN_HPP_ASSERT_ON_RESULT` you can replace just those assertions with your own function, using the very same interface.
|
||||
|
||||
#### VULKAN_HPP_DEFAULT_DISPATCHER
|
||||
#### VULKAN_HPP_DEFAULT_DISPATCHER <a id='default_dispatcher'>
|
||||
|
||||
Every vk-function gets a Dispatcher as its very last argument, which defaults to `VULKAN_HPP_DEFAULT_DISPATCHER`. If `VULKAN_HPP_DISPATCH_LOADER_DYNAMIC` is defined to be `1`, it is `defaultDispatchLoaderDynamic`. This in turn is the dispatcher instance, which is defined by `VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE`, which has to be used exactly once in your sources. If, on the other hand, `VULKAN_HPP_DISPATCH_LOADER_DYNAMIC` is defined to something different from `1`, `VULKAN_HPP_DEFAULT_DISPATCHER` is set to be `DispatchLoaderStatic()`.
|
||||
Every vk-function gets a Dispatcher as its very last argument, which defaults to `VULKAN_HPP_DEFAULT_DISPATCHER`. If `VULKAN_HPP_DISPATCH_LOADER_DYNAMIC` is defined to be `1`, it is `vk::detail::defaultDispatchLoaderDynamic`. This in turn is the dispatcher instance, which is defined by `VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE`, which has to be used exactly once in your sources. If, on the other hand, `VULKAN_HPP_DISPATCH_LOADER_DYNAMIC` is defined to something different from `1`, `VULKAN_HPP_DEFAULT_DISPATCHER` is set to be `vk::detail::DispatchLoaderStatic()`.
|
||||
You can use your own default dispatcher by setting `VULKAN_HPP_DEFAULT_DISPATCHER` to an object that provides the same API. If you explicitly set `VULKAN_HPP_DEFAULT_DISPATCHER`, you need to set `VULKAN_HPP_DEFAULT_DISPATCHER_TYPE` accordingly as well.
|
||||
|
||||
#### VULKAN_HPP_DEFAULT_DISPATCHER_TYPE
|
||||
#### VULKAN_HPP_DEFAULT_DISPATCHER_TYPE <a id='default_dispatcher_type'>
|
||||
|
||||
This names the default dispatcher type, as specified by `VULKAN_HPP_DEFAULT_DISPATCHER`. Per default, it is DispatchLoaderDynamic or DispatchLoaderStatic, depending on `VULKAN_HPP_DISPATCH_LOADER_DYNAMIC` being `1` or not `1`, respectively. If you explicitly set `VULKAN_HPP_DEFAULT_DISPATCHER`, you need to set `VULKAN_HPP_DEFAULT_DISPATCHER_TYPE` accordingly as well.
|
||||
This names the default dispatcher type, as specified by `VULKAN_HPP_DEFAULT_DISPATCHER`. Per default, it is `VULKAN_HPP_DISPATCH_LOADER_DYNAMIC_TYPE` or `VULKAN_HPP_DISPATCH_LOADER_STATIC_TYPE`, depending on `VULKAN_HPP_DISPATCH_LOADER_DYNAMIC` being `1` or not `1`, respectively. If you explicitly set `VULKAN_HPP_DEFAULT_DISPATCHER`, you need to set `VULKAN_HPP_DEFAULT_DISPATCHER_TYPE` accordingly as well.
|
||||
|
||||
#### VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
|
||||
#### VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE <a id='default_dispatch_loader_dynamic_storage'>
|
||||
|
||||
If you have not defined your own `VULKAN_HPP_DEFAULT_DISPATCHER`, and have `VULKAN_HPP_DISPATCH_LOADER_DYNAMIC` defined to be `1` (the default), you need to have the macro `VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE` exactly once in any of your source files to provide storage for that default dispatcher. `VULKAN_HPP_STORAGE_API` then controls the import/export status of that default dispatcher.
|
||||
|
||||
#### VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
#### VULKAN_HPP_DISABLE_ENHANCED_MODE <a id='disable_enhanced_mode'>
|
||||
|
||||
When this is defined before including `vulkan.hpp`, you essentially disable all enhanced functionality. All you then get is:
|
||||
* improved compile time error detection, via scoped enums;
|
||||
|
|
@ -876,103 +991,120 @@ If this is not defined, you additionally get:
|
|||
* the helper classes `vk::ArrayProxy<>` and `vk::ArrayProxyNoTemporaries<>`
|
||||
* all the RAII-stuff in `vulkan_raii.hpp`
|
||||
|
||||
#### VULKAN_HPP_DISPATCH_LOADER_DYNAMIC
|
||||
#### VULKAN_HPP_DISPATCH_LOADER_DYNAMIC <a id='dispatch_loader_dynamic'>
|
||||
|
||||
This either selects the dynamic (when it's `1`) or the static (when it's not `1`) DispatchLoader as the default one, as long as it's not explicitly specified by `VULKAN_HPP_DEFAULT_DISPATCHER`. By default, this is defined to be `1` if `VK_NO_PROTOTYPES` is defined, otherwise `0`.
|
||||
|
||||
#### VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL
|
||||
#### VULKAN_HPP_DISPATCH_LOADER_DYNAMIC_TYPE <a id='dispatch_loader_dynamic_type'>
|
||||
|
||||
By default, a little helper class `DynamicLoader` is used to dynamically load the vulkan library. If you set it to something different than `1` before including `vulkan.hpp`, this helper is not available, and you need to explicitly provide your own loader type for the function `DispatchLoaderDynamic::init()`.
|
||||
The type of the dynamic dispatch loader. By default, it's vk::detail::DispatchLoaderDynamic. You can define this before including vulkan.hpp to use your own dynamic dispatcher.
|
||||
|
||||
#### VULKAN_HPP_EXPECTED
|
||||
#### VULKAN_HPP_DISPATCH_LOADER_STATIC_TYPE <a id='dispatch_loader_static_type'>
|
||||
|
||||
The type of the static dispatch loader. By default, it's vk::detail::DispatchLoaderStatic. You can define this before including vulkan.hpp to use your own static dispatcher.
|
||||
|
||||
#### VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL <a id='enable_dynamic_loader_tool'>
|
||||
|
||||
By default, a little helper class `vk::detail::DynamicLoader` is used to dynamically load the vulkan library. If you set it to something different than `1` before including `vulkan.hpp`, this helper is not available, and you need to explicitly provide your own loader type for the function `vk::detail::DispatchLoaderDynamic::init()`.
|
||||
|
||||
#### VULKAN_HPP_EXPECTED <a id='expected'>
|
||||
|
||||
When this is not externally defined and `VULKAN_HPP_CPP_VERSION` is at least `23`, `VULKAN_HPP_EXPECTED` is defined to be `std::expected`, and `VULKAN_HPP_UNEXPECTED` is defined to be `std::unexpected`.
|
||||
|
||||
#### VULKAN_HPP_FLAGS_MASK_TYPE_AS_PUBLIC
|
||||
#### VULKAN_HPP_FLAGS_MASK_TYPE_AS_PUBLIC <a id='flags_mask_type_as_public'>
|
||||
|
||||
By default, the member `m_mask` of the `Flags` class template is private. This is to prevent accidentally setting a `Flags` with some inappropriate value. But it also prevents using a `Flags`, or a structure holding a `Flags`, to be used as a non-type template parameter. If you really need that functionality, and accept the reduced security, you can use this define to change the access specifier for `m_mask` from private to public, which allows using a `Flags` as a non-type template parameter.
|
||||
|
||||
#### VULKAN_HPP_HANDLES_MOVE_EXCHANGE
|
||||
#### VULKAN_HPP_HANDLE_ERROR_OUT_OF_DATE_AS_SUCCESS <a id='handle_error_out_of_date_as_success'>
|
||||
|
||||
By default, `VK_ERROR_OUT_OF_DATE_KHR` is an error code. To prevent throwing an exception or, in case exceptions are turned off via `VULKAN_HPP_NO_EXCEPTIONS`, firing an assertion on this return value, you can define `VULKAN_HPP_HANDLE_ERROR_OUT_OF_DATE_AS_SUCCESS`. `VK_ERROR_OUT_OF_DATE_KHR` will then be handled like a success code.
|
||||
|
||||
#### VULKAN_HPP_HANDLES_MOVE_EXCHANGE <a id='handles_move_exchange'>
|
||||
|
||||
This define can be used to enable `m_handle = exchange( rhs.m_handle, {} )` in move constructors of Vulkan-Hpp handles, which default-initializes the `rhs` underlying value. By default Vulkan-Hpp handles behave like trivial types -- move constructors copying value.
|
||||
|
||||
#### VULKAN_HPP_HASH_COMBINE
|
||||
#### VULKAN_HPP_HASH_COMBINE <a id='hash_combine'>
|
||||
|
||||
This define can be used to specify your own hash combiner function. In order to determine the hash of a vk-structure, the hashes of the members of that struct are to be combined. This is done by this define, which by default is identical to what the function `boost::hash_combine()` does. It gets the type of the to-be-combined value, the seed, which is the combined value up to that point, and finally the to-be-combined value. This hash calculation determines a "shallow" hash, as it takes the hashes of any pointer in a structure, and not the hash of a pointed-to value.
|
||||
|
||||
#### VULKAN_HPP_INLINE
|
||||
#### VULKAN_HPP_INLINE <a id='inline'>
|
||||
|
||||
This is set to be the compiler-dependent attribute used to mark functions as inline. If your compiler happens to need some different attribute, you can set this define accordingly before including `vulkan.hpp`.
|
||||
|
||||
#### VULKAN_HPP_NAMESPACE
|
||||
#### VULKAN_HPP_NAMESPACE <a id='namespace'>
|
||||
|
||||
By default, the namespace used with `vulkan.hpp` is `vk`. By defining `VULKAN_HPP_NAMESPACE` before including `vulkan.hpp`, you can adjust this.
|
||||
|
||||
#### VULKAN_HPP_NO_TO_STRING
|
||||
|
||||
By default, the file [`vulkan_to_string.hpp`](vulkan/vulkan_to_string.hpp) is included by `vulkan.hpp` and provides functions `vk::to_string` for enums and bitmasks. If you don't need those functions, you can define `VULKAN_HPP_NO_TO_STRING` to prevent that inclusion. If you have certain files where you want to use those functions nevertheless, you can explicitly include `vulkan_to_string.hpp` there.
|
||||
|
||||
#### VULKAN_HPP_NO_CONSTRUCTORS
|
||||
#### VULKAN_HPP_NO_CONSTRUCTORS <a id='no_constructors'>
|
||||
|
||||
With C++20, designated initializers are available. Their use requires the absence of any user-defined constructors. Define `VULKAN_HPP_NO_CONSTRUCTORS` to remove constructors from structs and unions.
|
||||
|
||||
#### VULKAN_HPP_NO_EXCEPTIONS
|
||||
#### VULKAN_HPP_NO_EXCEPTIONS <a id='no_exceptions'>
|
||||
|
||||
When a vulkan function returns an error code that is not specified to be a success code, an exception is thrown unless `VULKAN_HPP_NO_EXCEPTIONS` is defined before including `vulkan.hpp`.
|
||||
|
||||
#### VULKAN_HPP_NO_NODISCARD_WARNINGS
|
||||
#### VULKAN_HPP_NO_NODISCARD_WARNINGS <a id='no_discard_warnings'>
|
||||
|
||||
With C++17, all vk-functions returning something are declared with the attribute `[[nodiscard]]`. This can be removed by defining `VULKAN_HPP_NO_NODISCARD_WARNINGS` before including `vulkan.hpp`.
|
||||
|
||||
#### VULKAN_HPP_NO_SETTERS
|
||||
#### VULKAN_HPP_NO_SETTERS <a id='no_setters'>
|
||||
|
||||
By defining `VULKAN_HPP_NO_SETTERS` before including `vulkan.hpp`, setter member functions will not be available within structs and unions. Modifying their data members will then only be possible via direct assignment.
|
||||
|
||||
#### VULKAN_HPP_NO_SMART_HANDLE
|
||||
#### VULKAN_HPP_NO_SMART_HANDLE <a id='no_smart_handle'>
|
||||
|
||||
By defining `VULKAN_HPP_NO_SMART_HANDLE` before including `vulkan.hpp`, the helper class `vk::UniqueHandle` and all the unique handle types are not available.
|
||||
|
||||
#### VULKAN_HPP_NO_SPACESHIP_OPERATOR
|
||||
#### VULKAN_HPP_NO_SPACESHIP_OPERATOR <a id='no_spaceship_operator'>
|
||||
|
||||
With C++20, the so-called spaceship-operator `<=>` is introduced. If that operator is supported, all the structs and classes in vulkan.hpp use the default implementation of it. As currently some implementations of this operator are very slow, and others seem to be incomplete, by defining `VULKAN_HPP_NO_SPACESHIP_OPERATOR` before including `vulkan.hpp` you can remove that operator from those structs and classes.
|
||||
|
||||
#### VULKAN_HPP_NO_WIN32_PROTOTYPES
|
||||
#### VULKAN_HPP_NO_STD_MODULE <a id='no_std_module'>
|
||||
|
||||
When compiling the `vulkan.cppm` module with C++23, it will automatically try to use `import std`.
|
||||
There might be cases where your toolchain is not set up to deal with `import std` or wrongfully defines `__cpp_lib_modules`, for which you can define `VULKAN_HPP_NO_STD_MODULE` to disable `import std` altogether.
|
||||
|
||||
#### VULKAN_HPP_NO_TO_STRING <a id='no_to_string'>
|
||||
|
||||
By default, the file [`vulkan_to_string.hpp`](vulkan/vulkan_to_string.hpp) is included by `vulkan.hpp` and provides functions `vk::to_string` for enums and bitmasks. If you don't need those functions, you can define `VULKAN_HPP_NO_TO_STRING` to prevent that inclusion. If you have certain files where you want to use those functions nevertheless, you can explicitly include `vulkan_to_string.hpp` there.
|
||||
|
||||
#### VULKAN_HPP_NO_WIN32_PROTOTYPES <a id='no_win32_prototypes'>
|
||||
|
||||
By default, if `VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL` is enabled on Win32, `vulkan.hpp` declares `HINSTANCE`, `LoadLibraryA`, and other required symbols. It could cause conflicts with the `Windows.h` alternatives, such as `WindowsHModular`.
|
||||
With this define, you can disable these declarations, but you will have to declare them before the `vulkan.hpp` is included.
|
||||
|
||||
#### VULKAN_HPP_RAII_NO_EXCEPTIONS
|
||||
#### VULKAN_HPP_RAII_NO_EXCEPTIONS <a id='raii_no_exceptions'>
|
||||
|
||||
If both, `VULKAN_HPP_NO_EXCEPTIONS` and `VULKAN_HPP_EXPECTED` are defined, the vk::raii-classes don't throw exceptions. That is, the actual constructors are not available, but the creation-functions must be used. For more details have a look at the [`vk_raii_ProgrammingGuide.md`](vk_raii_ProgrammingGuide.md).
|
||||
|
||||
#### VULKAN_HPP_SMART_HANDLE_IMPLICIT_CAST
|
||||
#### VULKAN_HPP_SMART_HANDLE_IMPLICIT_CAST <a id='smart_handle_implicit_cast'>
|
||||
|
||||
Even though `vk::UniqueHandle` and `vk::SharedHandle` are semantically close to pointers, an implicit cast operator to the underlying `vk::Handle` might be handy. You can add that implicit cast operator by defining `VULKAN_HPP_SMART_HANDLE_IMPLICIT_CAST`.
|
||||
|
||||
#### VULKAN_HPP_STORAGE_API
|
||||
#### VULKAN_HPP_STORAGE_API <a id='storage_api'>
|
||||
|
||||
With this define you can specify whether the `DispatchLoaderDynamic` is imported or exported (see `VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE`). If `VULKAN_HPP_STORAGE_API` is not defined externally, and `VULKAN_HPP_STORAGE_SHARED` is defined, depending on the `VULKAN_HPP_STORAGE_SHARED_EXPORT` being defined, `VULKAN_HPP_STORAGE_API` is either set to `__declspec( dllexport )` (for MSVC) / `__attribute__( ( visibility( "default" ) ) )` (for gcc or clang) or `__declspec( dllimport )` (for MSVC), respectively. For other compilers, you might specify the corresponding storage by defining `VULKAN_HPP_STORAGE_API` on your own.
|
||||
With this define you can specify whether the `vk::detail::DispatchLoaderDynamic` is imported or exported (see `VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE`). If `VULKAN_HPP_STORAGE_API` is not defined externally, and `VULKAN_HPP_STORAGE_SHARED` is defined, depending on the `VULKAN_HPP_STORAGE_SHARED_EXPORT` being defined, `VULKAN_HPP_STORAGE_API` is either set to `__declspec( dllexport )` (for MSVC) / `__attribute__( ( visibility( "default" ) ) )` (for gcc or clang) or `__declspec( dllimport )` (for MSVC), respectively. For other compilers, you might specify the corresponding storage by defining `VULKAN_HPP_STORAGE_API` on your own.
|
||||
|
||||
#### VULKAN_HPP_TYPESAFE_CONVERSION
|
||||
#### VULKAN_HPP_TYPESAFE_CONVERSION <a id='typesafe_conversion'>
|
||||
|
||||
32-bit vulkan is not typesafe for non-dispatchable handles, so we don't allow copy constructors on this platform by default. To enable this feature on 32-bit platforms, `#define VULKAN_HPP_TYPESAFE_CONVERSION 1`. To disable this feature on 64-bit platforms, `#define VULKAN_HPP_TYPESAFE_CONVERSION 0`.
|
||||
|
||||
#### VULKAN_HPP_UNEXPECTED
|
||||
#### VULKAN_HPP_UNEXPECTED <a id='unexpected'>
|
||||
|
||||
See `VULKAN_HPP_EXPECTED`.
|
||||
See [`VULKAN_HPP_EXPECTED`](#expected).
|
||||
|
||||
#### VULKAN_HPP_USE_REFLECT
|
||||
#### VULKAN_HPP_USE_REFLECT <a id='use_reflect'>
|
||||
|
||||
With this define you can include a reflection mechanism on the vk-structures. It adds a function `reflect` that returns a tuple-version of the structure. That tuple then could easily be iterated. But at least for now, that feature takes lots of compile-time resources, so currently it is recommended to enable that feature only if you're willing to pay that price.
|
||||
|
||||
## See Also
|
||||
## See Also <a id='see_also'>
|
||||
|
||||
Feel free to submit a PR to add to this list.
|
||||
|
||||
- [Examples](https://github.com/jherico/vulkan) A port of Sascha Willems [examples](https://github.com/SaschaWillems/Vulkan) to Vulkan-Hpp
|
||||
- [Vookoo](https://github.com/andy-thomason/Vookoo/) Stateful helper classes for Vulkan-Hpp, [Introduction Article](https://accu.org/journals/overload/25/139/overload139.pdf#page=14).
|
||||
|
||||
## License
|
||||
## License <a id='license'>
|
||||
|
||||
Copyright 2015-2020 The Khronos Group Inc.
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "XMLHelper.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
|
|
@ -32,46 +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_codec_av1std.h>
|
||||
#include <vk_video/vulkan_video_codec_av1std_decode.h>
|
||||
#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()
|
||||
|
|
@ -116,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!
|
||||
|
|
@ -128,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
|
||||
|
|
@ -158,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,
|
||||
|
|
@ -170,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;
|
||||
|
|
@ -184,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() )
|
||||
|
|
@ -215,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() )
|
||||
|
|
@ -235,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}
|
||||
|
|
@ -255,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}
|
||||
|
|
@ -324,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;
|
||||
|
||||
|
|
@ -376,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() )
|
||||
|
|
@ -394,14 +529,61 @@ 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 )
|
||||
|
|
@ -446,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 )
|
||||
|
|
@ -478,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;
|
||||
|
|
@ -547,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();
|
||||
|
|
@ -587,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;
|
||||
|
|
@ -604,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" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -637,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 )
|
||||
{
|
||||
|
|
@ -675,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 );
|
||||
}
|
||||
|
|
@ -819,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 )
|
||||
{
|
||||
|
|
@ -902,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
|
||||
}
|
||||
|
|
@ -962,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 c6391a7b8cd57e79ce6b6c832c8e3043c4d9967b
|
||||
Subproject commit 6aefb8eb95c8e170d0805fd0f2d02832ec1e099a
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "XMLHelper.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
|
@ -88,6 +89,14 @@ class VulkanHppGenerator
|
|||
public:
|
||||
VulkanHppGenerator( tinyxml2::XMLDocument const & document, std::string const & api );
|
||||
|
||||
VulkanHppGenerator() = delete;
|
||||
VulkanHppGenerator( VulkanHppGenerator const & rhs ) = delete;
|
||||
VulkanHppGenerator( VulkanHppGenerator && rhs ) = delete;
|
||||
VulkanHppGenerator & operator=( VulkanHppGenerator const & rhs ) = delete;
|
||||
VulkanHppGenerator & operator=( VulkanHppGenerator && rhs ) = delete;
|
||||
|
||||
void distributeSecondLevelCommands();
|
||||
void generateCppmFile() const;
|
||||
void generateEnumsHppFile() const;
|
||||
void generateExtensionInspectionFile() const;
|
||||
void generateFormatTraitsHppFile() const;
|
||||
|
|
@ -101,9 +110,7 @@ public:
|
|||
void generateStaticAssertionsHppFile() const;
|
||||
void generateStructsHppFile() const;
|
||||
void generateToStringHppFile() const;
|
||||
void generateCppModuleFile() const;
|
||||
void prepareRAIIHandles();
|
||||
void prepareVulkanFuncs();
|
||||
|
||||
struct MacroData
|
||||
{
|
||||
|
|
@ -114,7 +121,7 @@ public:
|
|||
};
|
||||
|
||||
private:
|
||||
struct AliasData
|
||||
struct NameLine
|
||||
{
|
||||
std::string name = {};
|
||||
int xmlLine = {};
|
||||
|
|
@ -145,20 +152,26 @@ private:
|
|||
|
||||
struct EnumValueData
|
||||
{
|
||||
std::map<std::string, int> aliases = {};
|
||||
std::string bitpos = {};
|
||||
std::string name = {};
|
||||
std::string protect = {};
|
||||
bool supported = {};
|
||||
std::string value = {};
|
||||
int xmlLine = {};
|
||||
std::vector<EnumValueAlias> aliases = {};
|
||||
std::string bitpos = {};
|
||||
bool deprecated = {};
|
||||
std::string name = {};
|
||||
std::string protect = {};
|
||||
bool supported = {};
|
||||
std::string value = {};
|
||||
int xmlLine = {};
|
||||
};
|
||||
|
||||
struct EnumData
|
||||
{
|
||||
void addEnumAlias( int line, std::string const & name, std::string const & alias, std::string const & protect, bool supported );
|
||||
void addEnumValue(
|
||||
int line, std::string const & valueName, std::string const & protect, std::string const & bitpos, std::string const & value, bool supported );
|
||||
bool addEnumAlias( int line, std::string const & name, std::string const & alias, std::string const & protect, bool supported );
|
||||
bool addEnumValue( int line,
|
||||
std::string const & valueName,
|
||||
std::string const & protect,
|
||||
std::string const & bitpos,
|
||||
std::string const & value,
|
||||
bool supported,
|
||||
bool deprecated );
|
||||
|
||||
std::map<std::string, int> aliases = {};
|
||||
std::string bitwidth = {};
|
||||
|
|
@ -168,6 +181,17 @@ private:
|
|||
int xmlLine = {};
|
||||
};
|
||||
|
||||
struct EnumExtendData
|
||||
{
|
||||
std::string alias = {};
|
||||
std::string api = {};
|
||||
std::string name = {};
|
||||
std::string protect = {};
|
||||
std::set<std::string> requiredBy = {};
|
||||
bool supported = {};
|
||||
int xmlLine = {};
|
||||
};
|
||||
|
||||
struct NameData
|
||||
{
|
||||
std::string name = {};
|
||||
|
|
@ -190,6 +214,7 @@ private:
|
|||
{
|
||||
std::map<std::string, int> aliases = {};
|
||||
std::vector<std::string> errorCodes = {};
|
||||
std::vector<std::string> exports = {};
|
||||
std::string handle = {};
|
||||
std::vector<ParamData> params = {};
|
||||
std::set<std::string> requiredBy = {};
|
||||
|
|
@ -223,11 +248,18 @@ private:
|
|||
std::map<std::string, DefineData> values = {};
|
||||
};
|
||||
|
||||
struct EnumConstantData
|
||||
{
|
||||
std::string name = {};
|
||||
std::string value = {};
|
||||
int xmlLine = {};
|
||||
};
|
||||
|
||||
struct RequireFeature
|
||||
{
|
||||
std::string name = {};
|
||||
std::string structure = {};
|
||||
int xmlLine = {};
|
||||
std::vector<std::string> name = {};
|
||||
std::string structure = {};
|
||||
int xmlLine = {};
|
||||
};
|
||||
|
||||
struct RemoveData
|
||||
|
|
@ -241,40 +273,55 @@ private:
|
|||
|
||||
struct RequireData
|
||||
{
|
||||
std::string depends = {};
|
||||
std::vector<std::pair<std::string, int>> commands = {};
|
||||
std::map<std::string, std::string> enumConstants = {};
|
||||
std::vector<std::string> constants = {};
|
||||
std::vector<RequireFeature> features = {};
|
||||
std::vector<std::string> types = {};
|
||||
int xmlLine = {};
|
||||
std::string api = {};
|
||||
std::string depends = {};
|
||||
std::vector<NameLine> commands = {};
|
||||
std::vector<EnumConstantData> enumConstants = {};
|
||||
std::vector<NameLine> constants = {};
|
||||
std::vector<RequireFeature> features = {};
|
||||
std::vector<NameLine> types = {};
|
||||
int xmlLine = {};
|
||||
};
|
||||
|
||||
struct DeprecateData
|
||||
{
|
||||
std::string explanationLink = {};
|
||||
std::vector<std::string> commands = {};
|
||||
std::vector<std::string> types = {};
|
||||
int xmlLine = 0;
|
||||
};
|
||||
|
||||
struct ExtensionData
|
||||
{
|
||||
std::string deprecatedBy = {};
|
||||
bool isDeprecated = false;
|
||||
std::string name = {};
|
||||
std::string number = {};
|
||||
std::string obsoletedBy = {};
|
||||
std::string platform = {};
|
||||
std::string promotedTo = {};
|
||||
std::map<std::string, std::vector<std::vector<std::string>>> depends = {};
|
||||
std::vector<std::string> ratified = {};
|
||||
std::vector<RemoveData> removeData = {};
|
||||
std::vector<RequireData> requireData = {};
|
||||
std::vector<std::string> supported = {};
|
||||
std::string type = {};
|
||||
int xmlLine = 0;
|
||||
std::string deprecatedBy = {};
|
||||
bool isDeprecated = false;
|
||||
std::string name = {};
|
||||
std::string number = {};
|
||||
std::string obsoletedBy = {};
|
||||
std::string platform = {};
|
||||
std::string promotedTo = {};
|
||||
std::map<std::string, std::vector<std::set<std::string>>> depends = {};
|
||||
std::vector<std::string> ratified = {};
|
||||
std::vector<DeprecateData> deprecateData = {};
|
||||
std::vector<RemoveData> removeData = {};
|
||||
std::vector<RequireData> requireData = {};
|
||||
std::vector<std::string> supported = {};
|
||||
std::string type = {};
|
||||
std::vector<RequireData> unsupportedRequireData = {};
|
||||
int xmlLine = 0;
|
||||
};
|
||||
|
||||
struct FeatureData
|
||||
{
|
||||
std::string name = {};
|
||||
std::string number = {};
|
||||
std::vector<RemoveData> removeData = {};
|
||||
std::vector<RequireData> requireData = {};
|
||||
int xmlLine = {};
|
||||
std::vector<std::string> api = {};
|
||||
std::string name = {};
|
||||
std::string number = {};
|
||||
bool isInternal = false;
|
||||
std::vector<std::string> depends = {};
|
||||
std::vector<DeprecateData> deprecateData = {};
|
||||
std::vector<RemoveData> removeData = {};
|
||||
std::vector<RequireData> requireData = {};
|
||||
int xmlLine = 0;
|
||||
};
|
||||
|
||||
struct ExternalTypeData
|
||||
|
|
@ -318,15 +365,16 @@ private:
|
|||
struct FuncPointerArgumentData
|
||||
{
|
||||
std::string name = {};
|
||||
std::string type = {};
|
||||
TypeInfo type = {};
|
||||
int xmlLine = {};
|
||||
};
|
||||
|
||||
struct FuncPointerData
|
||||
{
|
||||
std::vector<FuncPointerArgumentData> arguments = {};
|
||||
std::string require = {};
|
||||
int xmlLine = {};
|
||||
std::vector<FuncPointerArgumentData> arguments = {};
|
||||
std::string require = {};
|
||||
TypeInfo returnType = {};
|
||||
int xmlLine = {};
|
||||
};
|
||||
|
||||
struct HandleData
|
||||
|
|
@ -361,7 +409,9 @@ private:
|
|||
std::string name = {};
|
||||
std::vector<std::string> arraySizes = {};
|
||||
std::string bitCount = {};
|
||||
std::string deprecated = {};
|
||||
std::vector<std::string> lenExpressions = {};
|
||||
std::string limitType = {};
|
||||
std::vector<std::pair<std::string, size_t>> lenMembers = {};
|
||||
bool noAutoValidity = {};
|
||||
std::vector<bool> optional = {};
|
||||
|
|
@ -371,12 +421,19 @@ private:
|
|||
int xmlLine = {};
|
||||
};
|
||||
|
||||
struct StructureData
|
||||
struct SpirVCapabilityData
|
||||
{
|
||||
std::map<std::string, std::map<std::string, int>> structs = {}; // map from structure to map from member to xmlLine
|
||||
int xmlLine = {};
|
||||
};
|
||||
|
||||
struct StructData
|
||||
{
|
||||
std::map<std::string, int> aliases = {};
|
||||
bool allowDuplicate = {};
|
||||
bool isExtended = {};
|
||||
bool isUnion = {};
|
||||
bool requiredLimitType = {};
|
||||
bool returnedOnly = {};
|
||||
bool mutualExclusiveLens = {};
|
||||
std::vector<MemberData> members = {};
|
||||
|
|
@ -463,60 +520,70 @@ private:
|
|||
};
|
||||
|
||||
private:
|
||||
void addCommand( std::string const & name, CommandData & commandData );
|
||||
void addCommandsToHandle( std::vector<RequireData> const & requireData );
|
||||
void addCommand( std::string const & name, CommandData && commandData );
|
||||
void addCommandToHandle( std::pair<std::string, CommandData> const & commandData );
|
||||
void addMissingFlagBits( std::vector<RequireData> & requireData, std::string const & requiredBy );
|
||||
std::string addTitleAndProtection( std::string const & title, std::string const & strIf, std::string const & strElse = {} ) const;
|
||||
bool allVectorSizesSupported( std::vector<ParamData> const & params, std::map<size_t, VectorParamData> const & vectorParams ) const;
|
||||
void appendDispatchLoaderDynamicCommands( std::vector<RequireData> const & requireData,
|
||||
std::set<std::string> & listedCommands,
|
||||
std::string const & title,
|
||||
std::string & commandMembers,
|
||||
std::string & initialCommandAssignments,
|
||||
std::string & instanceCommandAssignments,
|
||||
std::string & deviceCommandAssignments ) const;
|
||||
void appendRAIIDispatcherCommands( std::vector<RequireData> const & requireData,
|
||||
std::set<std::string> & listedCommands,
|
||||
std::string const & title,
|
||||
std::string & contextInitializers,
|
||||
std::string & contextMembers,
|
||||
std::string & deviceAssignments,
|
||||
std::string & deviceMembers,
|
||||
std::string & instanceAssignments,
|
||||
std::string & instanceMembers ) const;
|
||||
void appendCppModuleCommands( std::vector<RequireData> const & requireData,
|
||||
std::set<std::string> & listedCommands,
|
||||
std::string const & title,
|
||||
std::string & commandMembers ) const;
|
||||
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 checkBitmaskCorrectness() const;
|
||||
void checkCommandCorrectness() const;
|
||||
void checkCorrectness() const;
|
||||
void checkDefineCorrectness() const;
|
||||
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 checkEnumCorrectness() const;
|
||||
void checkEnumCorrectness( std::vector<RequireData> const & requireData ) const;
|
||||
bool checkEquivalentSingularConstructor( std::vector<std::map<std::string, CommandData>::const_iterator> const & constructorIts,
|
||||
std::map<std::string, CommandData>::const_iterator constructorIt,
|
||||
std::vector<ParamData>::const_iterator lenIt ) const;
|
||||
void checkExtensionCorrectness() const;
|
||||
void checkFeatureCorrectness() const;
|
||||
void checkForError( bool condition, int line, std::string const & message ) const;
|
||||
void checkForWarning( bool condition, int line, std::string const & message ) const;
|
||||
void checkFuncPointerCorrectness() const;
|
||||
void checkHandleCorrectness() const;
|
||||
void checkRequireCorrectness() const;
|
||||
void checkRequireCorrectness( std::vector<RequireData> const & requireData, std::string const & section, std::string const & name ) const;
|
||||
void checkRequireDependenciesCorrectness( RequireData const & require, std::string const & section, std::string const & name ) const;
|
||||
void checkRequireTypesCorrectness( RequireData const & require ) const;
|
||||
void checkSpirVCapabilityCorrectness() const;
|
||||
void checkStructCorrectness() const;
|
||||
void checkStructMemberArraySizesAreValid( std::vector<std::string> const & arraySizes, int line ) const;
|
||||
void checkStructMemberCorrectness( std::string const & structureName, std::vector<MemberData> const & members, std::set<std::string> & sTypeValues ) const;
|
||||
std::string combineDataTypes( std::map<size_t, VectorParamData> const & vectorParams,
|
||||
std::vector<size_t> const & returnParams,
|
||||
bool enumerating,
|
||||
std::vector<std::string> const & dataTypes,
|
||||
CommandFlavourFlags flavourFlags,
|
||||
bool raii ) const;
|
||||
bool contains( std::vector<EnumValueData> const & enumValues, std::string const & name ) const;
|
||||
bool containsArray( std::string const & type ) const;
|
||||
bool containsFuncPointer( std::string const & type ) const;
|
||||
bool containsFloatingPoints( std::vector<MemberData> const & members ) const;
|
||||
bool containsUnion( std::string const & type ) const;
|
||||
bool describesVector( StructureData const & structure, std::string const & type = "" ) const;
|
||||
void checkStructMemberSelectorConnection( std::string const & selector, std::vector<MemberData> const & members, std::string const & memberType ) const;
|
||||
void checkStructMemberTypeIsKnown( std::string const & memberType, int line ) const;
|
||||
void checkStructMemberTypeIsRequired( std::string const & memberType, int line, std::string const & structureName ) const;
|
||||
void checkStructMemberValueIsValid( std::string const & memberValue,
|
||||
std::string const & memberType,
|
||||
std::string const & memberName,
|
||||
int line,
|
||||
bool structUsed,
|
||||
std::string const & structureName,
|
||||
std::set<std::string> & sTypeValues ) const;
|
||||
void checkSyncAccessCorrectness() const;
|
||||
void checkSyncStageCorrectness() const;
|
||||
bool containsArray( std::string const & type ) const;
|
||||
bool containsDeprecated( std::vector<MemberData> const & members ) const;
|
||||
bool containsFuncPointer( std::string const & type ) const;
|
||||
bool containsFloatingPoints( std::vector<MemberData> const & members ) const;
|
||||
bool containsName( std::vector<EnumValueData> const & enumValues, std::string const & name ) const;
|
||||
bool containsUnion( std::string const & type ) const;
|
||||
bool describesVector( StructData const & structure, std::string const & type = "" ) const;
|
||||
std::vector<size_t> determineChainedReturnParams( std::vector<ParamData> const & params, std::vector<size_t> const & returnParams ) const;
|
||||
std::vector<size_t> determineConstPointerParams( std::vector<ParamData> const & params ) const;
|
||||
std::vector<std::string> determineDataTypes( std::vector<VulkanHppGenerator::ParamData> const & params,
|
||||
std::map<size_t, VectorParamData> const & vectorParams,
|
||||
std::vector<size_t> const & returnParams,
|
||||
std::set<size_t> const & templatedParams ) const;
|
||||
std::set<size_t> const & templatedParams,
|
||||
bool raii ) const;
|
||||
size_t determineDefaultStartIndex( std::vector<ParamData> const & params, std::set<size_t> const & skippedParams ) const;
|
||||
bool determineEnumeration( std::map<size_t, VectorParamData> const & vectorParams, std::vector<size_t> const & returnParams ) const;
|
||||
size_t determineInitialSkipCount( std::string const & command ) const;
|
||||
|
|
@ -524,44 +591,59 @@ private:
|
|||
std::vector<std::map<std::string, CommandData>::const_iterator>
|
||||
determineRAIIHandleConstructors( std::string const & handleType, std::map<std::string, CommandData>::const_iterator destructorIt ) const;
|
||||
std::map<std::string, CommandData>::const_iterator determineRAIIHandleDestructor( std::string const & handleType ) const;
|
||||
std::set<size_t> determineSingularParams( size_t returnParam, std::map<size_t, VectorParamData> const & vectorParams ) const;
|
||||
std::set<size_t> determineSkippedParams( std::vector<ParamData> const & params,
|
||||
size_t initialSkipCount,
|
||||
std::map<size_t, VectorParamData> const & vectorParams,
|
||||
std::vector<size_t> const & returnParam,
|
||||
bool singular ) const;
|
||||
std::string determineSubStruct( std::pair<std::string, StructureData> const & structure ) const;
|
||||
std::map<size_t, VectorParamData> determineVectorParams( std::vector<ParamData> const & params ) const;
|
||||
std::set<size_t> determineVoidPointerParams( std::vector<ParamData> const & params ) const;
|
||||
void distributeEnumValueAliases();
|
||||
void distributeSecondLevelCommands( std::set<std::string> const & specialFunctions );
|
||||
void distributeStructAliases();
|
||||
void filterLenMembers();
|
||||
std::map<std::string, AliasData>::const_iterator findAlias( std::string const & name, std::map<std::string, AliasData> const & aliases ) const;
|
||||
std::string findBaseName( std::string aliasName, std::map<std::string, AliasData> const & aliases ) const;
|
||||
std::vector<FeatureData>::const_iterator findFeature( std::string const & name ) const;
|
||||
std::vector<ParamData>::const_iterator findParamIt( std::string const & name, std::vector<ParamData> const & paramData ) const;
|
||||
std::vector<MemberData>::const_iterator findStructMemberIt( std::string const & name, std::vector<MemberData> const & memberData ) const;
|
||||
std::vector<MemberData>::const_iterator findStructMemberItByType( std::string const & type, std::vector<MemberData> const & memberData ) const;
|
||||
std::vector<ExtensionData>::const_iterator findSupportedExtension( std::string const & name ) const;
|
||||
std::string findTag( std::string const & name, std::string const & postfix = "" ) const;
|
||||
std::pair<std::string, std::string> generateAllocatorTemplates( std::vector<size_t> const & returnParams,
|
||||
std::vector<std::string> const & returnDataTypes,
|
||||
std::map<size_t, VectorParamData> const & vectorParams,
|
||||
std::vector<size_t> const & chainedReturnParams,
|
||||
CommandFlavourFlags flavourFlags,
|
||||
bool definition ) const;
|
||||
std::string generateArgumentListEnhanced( std::vector<ParamData> const & params,
|
||||
std::vector<size_t> const & returnParams,
|
||||
std::map<size_t, VectorParamData> const & vectorParams,
|
||||
std::set<size_t> const & skippedParams,
|
||||
std::set<size_t> const & singularParams,
|
||||
std::set<size_t> const & templatedParams,
|
||||
std::vector<size_t> const & chainedReturnParams,
|
||||
bool definition,
|
||||
CommandFlavourFlags flavourFlags,
|
||||
bool withDispatcher ) const;
|
||||
std::string generateArgumentListStandard( std::vector<ParamData> const & params, std::set<size_t> const & skippedParams ) const;
|
||||
std::set<size_t> determineSingularParams( size_t returnParam, std::map<size_t, VectorParamData> const & vectorParams ) const;
|
||||
std::set<size_t> determineSkippedParams( std::vector<ParamData> const & params,
|
||||
size_t initialSkipCount,
|
||||
std::map<size_t, VectorParamData> const & vectorParams,
|
||||
std::vector<size_t> const & returnParam,
|
||||
bool singular ) const;
|
||||
std::string determineSubStruct( std::pair<std::string, StructData> const & structure ) const;
|
||||
std::map<size_t, VectorParamData> determineVectorParams( std::vector<ParamData> const & params ) const;
|
||||
std::set<size_t> determineVoidPointerParams( std::vector<ParamData> const & params ) const;
|
||||
void distributeEnumValueAliases();
|
||||
void distributeRequirements();
|
||||
void distributeRequirements( std::vector<RequireData> const & requireData, std::string const & requiredBy );
|
||||
void distributeStructAliases();
|
||||
void extendSpecialCommands( std::string const & name, bool definition, bool raii, std::string & cmd ) const;
|
||||
void filterLenMembers();
|
||||
std::string findTag( std::string const & name, std::string const & postfix = "" ) const;
|
||||
void forEachRequiredBitmask( std::vector<RequireData> const & requireData,
|
||||
std::set<std::string> & encounteredBitmasks,
|
||||
std::function<void( std::pair<std::string, BitmaskData> const & )> const & bitmaskAction ) const;
|
||||
void forEachRequiredCommand( std::vector<RequireData> const & requireData,
|
||||
std::function<void( NameLine const &, std::pair<std::string, CommandData> const & )> const & commandAction ) const;
|
||||
void forEachRequiredConstant( std::vector<RequireData> const & requireData,
|
||||
std::set<std::string> & encounteredConstants,
|
||||
std::function<void( std::pair<std::string, ConstantData> const & )> const & constantAction ) const;
|
||||
void forEachRequiredEnumConstant( std::vector<RequireData> const & requireData,
|
||||
std::set<std::string> & encounteredEnumConstants,
|
||||
std::function<void( EnumConstantData const & )> const & enumConstantAction ) const;
|
||||
void forEachRequiredFuncPointer( std::vector<RequireData> const & requireData,
|
||||
std::function<void( std::pair<std::string, FuncPointerData> const & )> const & funcPointerAction ) const;
|
||||
void forEachRequiredHandle( std::vector<RequireData> const & requireData,
|
||||
std::function<void( std::pair<std::string, HandleData> const & )> const & handleAction ) const;
|
||||
void forEachRequiredStruct( std::vector<RequireData> const & requireData,
|
||||
std::function<void( std::pair<std::string, StructData> const & )> const & structAction ) const;
|
||||
std::set<std::string> gatherResultCodes() const;
|
||||
std::pair<std::string, std::string> generateAllocatorTemplates( std::vector<size_t> const & returnParams,
|
||||
std::vector<std::string> const & returnDataTypes,
|
||||
std::map<size_t, VectorParamData> const & vectorParams,
|
||||
std::vector<size_t> const & chainedReturnParams,
|
||||
CommandFlavourFlags flavourFlags,
|
||||
bool definition ) const;
|
||||
std::string generateArgumentListEnhanced( std::vector<ParamData> const & params,
|
||||
std::vector<size_t> const & returnParams,
|
||||
std::map<size_t, VectorParamData> const & vectorParams,
|
||||
std::set<size_t> const & skippedParams,
|
||||
std::set<size_t> const & singularParams,
|
||||
std::set<size_t> const & templatedParams,
|
||||
std::vector<size_t> const & chainedReturnParams,
|
||||
bool raii,
|
||||
bool definition,
|
||||
CommandFlavourFlags flavourFlags,
|
||||
bool withDispatcher ) const;
|
||||
std::string
|
||||
generateArgumentListStandard( std::vector<ParamData> const & params, std::set<size_t> const & skippedParams, bool definition, bool withDispatcher ) const;
|
||||
std::string generateArgumentTemplates( std::vector<ParamData> const & params,
|
||||
std::vector<size_t> const & returnParams,
|
||||
std::map<size_t, VectorParamData> const & vectorParams,
|
||||
|
|
@ -572,7 +654,7 @@ private:
|
|||
std::string generateBitmask( std::map<std::string, BitmaskData>::const_iterator bitmaskIt, std::string const & surroundingProtect ) const;
|
||||
std::string generateBitmasksToString() const;
|
||||
std::string generateBitmasksToString( std::vector<RequireData> const & requireData, std::set<std::string> & listedBitmasks, std::string const & title ) const;
|
||||
std::string generateBitmaskToString( std::map<std::string, BitmaskData>::const_iterator bitmaskIt ) const;
|
||||
std::string generateBitmaskToString( std::pair<std::string, BitmaskData> const & bitmaskData ) const;
|
||||
std::string generateCallArgumentsEnhanced( CommandData const & commandData,
|
||||
size_t initialSkipCount,
|
||||
bool nonConstPointerAsNullptr,
|
||||
|
|
@ -581,7 +663,7 @@ private:
|
|||
bool raii,
|
||||
bool raiiFactory,
|
||||
CommandFlavourFlags flavourFlags ) const;
|
||||
std::string generateCallArgumentsStandard( std::string const & handle, std::vector<ParamData> const & params ) const;
|
||||
std::string generateCallArgumentsStandard( std::vector<ParamData> const & params, size_t initialSkipCount ) const;
|
||||
std::string generateCallArgumentEnhanced( std::vector<ParamData> const & params,
|
||||
size_t paramIndex,
|
||||
bool nonConstPointerAsNullptr,
|
||||
|
|
@ -710,9 +792,10 @@ private:
|
|||
bool definition,
|
||||
std::vector<size_t> const & returnParamIndices,
|
||||
bool raii ) const;
|
||||
std::string generateConstexprString( std::string const & structName ) const;
|
||||
std::string generateConstexprString( std::pair<std::string, StructData> const & structData ) const;
|
||||
std::string generateConstexprDefines() const;
|
||||
std::string generateConstexprUsings() const;
|
||||
std::string generateCppModuleFuncpointerUsings() const;
|
||||
std::string generateCppModuleHandleUsings() const;
|
||||
std::string generateCppModuleStructUsings() const;
|
||||
std::string generateCppModuleUniqueHandleUsings() const;
|
||||
|
|
@ -721,8 +804,12 @@ private:
|
|||
std::string generateCppModuleFormatTraitsUsings() const;
|
||||
std::string generateCppModuleExtensionInspectionUsings() const;
|
||||
std::string generateCppModuleUsings() const;
|
||||
std::string generateCppModuleCommands() const;
|
||||
std::string generateCppModuleRaiiUsings() const;
|
||||
std::string generateCppModuleSharedHandleUsings() const;
|
||||
std::string generateCppModuleHandleHashSpecializations() const;
|
||||
std::string generateCppModuleHashSpecializations() const;
|
||||
std::string generateCppModuleStructHashSpecializations() const;
|
||||
std::string generateDataDeclarations( CommandData const & commandData,
|
||||
std::vector<size_t> const & returnParams,
|
||||
std::map<size_t, VectorParamData> const & vectorParams,
|
||||
|
|
@ -774,11 +861,25 @@ private:
|
|||
std::string generateDecoratedReturnType( CommandData const & commandData,
|
||||
std::vector<size_t> const & returnParams,
|
||||
std::map<size_t, VectorParamData> const & vectorParams,
|
||||
bool enumerating,
|
||||
CommandFlavourFlags flavourFlags,
|
||||
bool raii,
|
||||
std::string const & returnType ) const;
|
||||
std::string generateDeprecatedConstructors( std::string const & name ) const;
|
||||
std::string generateDeprecatedStructSetters( std::string const & name ) const;
|
||||
std::string generateDispatchLoaderDynamic() const; // uses vkGet*ProcAddress to get function pointers
|
||||
std::string generateDispatchLoaderStatic() const; // uses exported symbols from loader
|
||||
std::string generateDispatchLoaderDynamicCommandMembers( std::vector<RequireData> const & requireData,
|
||||
std::set<std::string> const & listedCommands,
|
||||
std::string const & title ) const;
|
||||
std::string generateDispatchLoaderDynamicDeviceCommandAssignment( std::vector<RequireData> const & requireData,
|
||||
std::set<std::string> const & listedCommands,
|
||||
std::string const & title ) const;
|
||||
std::string generateDispatchLoaderDynamicInitialCommandAssignment( std::vector<RequireData> const & requireData,
|
||||
std::set<std::string> const & listedCommands,
|
||||
std::string const & title ) const;
|
||||
std::string generateDispatchLoaderDynamicInstanceCommandAssignment( std::vector<RequireData> const & requireData,
|
||||
std::set<std::string> const & listedCommands,
|
||||
std::string const & title ) const;
|
||||
std::string generateDispatchLoaderStatic() const; // uses exported symbols from loader
|
||||
std::string generateDestroyCommand( std::string const & name, CommandData const & commandData ) const;
|
||||
std::string
|
||||
generateDispatchLoaderDynamicCommandAssignment( std::string const & commandName, std::string const & aliasName, std::string const & firstArg ) const;
|
||||
|
|
@ -798,7 +899,6 @@ private:
|
|||
std::pair<std::string, std::string> generateEnumSuffixes( std::string const & name, bool bitmask ) const;
|
||||
std::string generateEnumValueName( std::string const & enumName, std::string const & valueName, bool bitmask ) const;
|
||||
std::string generateExtensionDependencies() const;
|
||||
std::string generateExtensionDependsByVersion( bool definition ) const;
|
||||
template <class Predicate, class Extraction>
|
||||
std::string generateExtensionReplacedBy( Predicate p, Extraction e ) const;
|
||||
template <class Predicate>
|
||||
|
|
@ -806,6 +906,18 @@ private:
|
|||
std::string generateExtensionsList( std::string const & type ) const;
|
||||
std::string generateExtensionTypeTest( std::string const & type ) const;
|
||||
std::string generateFormatTraits() const;
|
||||
std::string generateFormatTraitsCases( EnumData const & enumData,
|
||||
std::function<bool( FormatData const & )> predicate,
|
||||
std::function<std::string( FormatData const & )> generator ) const;
|
||||
std::string generateFormatTraitsList( EnumData const & enumData, std::function<bool( FormatData const & )> predicate ) const;
|
||||
template <typename T>
|
||||
std::string generateFormatTraitsSubCases( FormatData const & formatData,
|
||||
std::function<std::vector<T> const &( FormatData const & )> accessor,
|
||||
std::string const & subCaseName,
|
||||
std::function<std::string( T const & subCaseData )> generator,
|
||||
std::string const & defaultReturn ) const;
|
||||
std::string generateFuncPointer( std::pair<std::string, FuncPointerData> const & funcPointer, std::set<std::string> & listedStructs ) const;
|
||||
std::string generateFuncPointerReturns() const;
|
||||
std::string generateFunctionPointerCheck( std::string const & function, std::set<std::string> const & requiredBy, bool raii ) const;
|
||||
std::string generateHandle( std::pair<std::string, HandleData> const & handle, std::set<std::string> & listedHandles ) const;
|
||||
std::string generateHandleCommandDeclarations( std::set<std::string> const & commands ) const;
|
||||
|
|
@ -813,7 +925,8 @@ private:
|
|||
std::string generateHandleEmpty( HandleData const & handleData ) const;
|
||||
std::string generateHandleForwardDeclarations() const;
|
||||
std::string generateHandleForwardDeclarations( std::vector<RequireData> const & requireData, std::string const & title ) const;
|
||||
std::string generateHandleHashStructures( std::vector<RequireData> const & requireData, std::string const & title ) const;
|
||||
std::string
|
||||
generateHandleHashStructures( std::vector<RequireData> const & requireData, std::string const & title, std::set<std::string> & listedHandles ) const;
|
||||
std::string generateHandleHashStructures() const;
|
||||
std::string generateHandles() const;
|
||||
std::string generateIndexTypeTraits( std::pair<std::string, EnumData> const & enumData ) const;
|
||||
|
|
@ -835,14 +948,31 @@ private:
|
|||
std::string generateRAIICommandDefinitions() const;
|
||||
std::string
|
||||
generateRAIICommandDefinitions( std::vector<RequireData> const & requireData, std::set<std::string> & listedCommands, std::string const & title ) const;
|
||||
std::string generateRAIIDispatcherCommandsContextInitializers( std::vector<RequireData> const & requireData,
|
||||
std::set<std::string> const & listedCommands,
|
||||
std::string const & title ) const;
|
||||
std::string generateRAIIDispatcherCommandsContextMembers( std::vector<RequireData> const & requireData,
|
||||
std::set<std::string> const & listedCommands,
|
||||
std::string const & title ) const;
|
||||
std::string generateRAIIDispatcherCommandsDeviceAssignments( std::vector<RequireData> const & requireData,
|
||||
std::set<std::string> const & listedCommands,
|
||||
std::string const & title ) const;
|
||||
std::string generateRAIIDispatcherCommandsDeviceMembers( std::vector<RequireData> const & requireData,
|
||||
std::set<std::string> const & listedCommands,
|
||||
std::string const & title ) const;
|
||||
std::string generateRAIIDispatcherCommandsInstanceAssignments( std::vector<RequireData> const & requireData,
|
||||
std::set<std::string> const & listedCommands,
|
||||
std::string const & title ) const;
|
||||
std::string generateRAIIDispatcherCommandsInstanceMembers( std::vector<RequireData> const & requireData,
|
||||
std::set<std::string> const & listedCommands,
|
||||
std::string const & title ) const;
|
||||
std::string generateRAIIDispatchers() const;
|
||||
std::string generateRAIIFactoryReturnStatements( std::vector<ParamData> const & params,
|
||||
std::vector<std::string> const & successCodes,
|
||||
std::string const & vkType,
|
||||
bool enumerating,
|
||||
std::string const & returnType,
|
||||
std::string const & returnVariable,
|
||||
bool singular ) const;
|
||||
std::string generateRAIIFactoryReturnStatements( CommandData const & commandData,
|
||||
std::string const & vkType,
|
||||
bool enumerating,
|
||||
std::string const & returnType,
|
||||
std::string const & returnVariable,
|
||||
bool singular ) const;
|
||||
std::string generateRAIIHandle( std::pair<std::string, HandleData> const & handle,
|
||||
std::set<std::string> & listedHandles,
|
||||
std::set<std::string> const & specialFunctions ) const;
|
||||
|
|
@ -866,6 +996,7 @@ private:
|
|||
std::set<size_t> const & skippedParams,
|
||||
bool definition,
|
||||
bool singular ) const;
|
||||
std::string generateRAIIHandleCommandStandard( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition ) const;
|
||||
std::pair<std::string, std::string> generateRAIIHandleConstructor( std::pair<std::string, HandleData> const & handle,
|
||||
std::map<std::string, CommandData>::const_iterator constructorIt,
|
||||
std::string const & enter,
|
||||
|
|
@ -884,10 +1015,10 @@ private:
|
|||
std::map<size_t, VectorParamData> const & vectorParamIndices ) const;
|
||||
std::pair<std::string, std::string> generateRAIIHandleConstructors( std::pair<std::string, HandleData> const & handle ) const;
|
||||
std::string generateRAIIHandleConstructorArgument( ParamData const & param, bool definition, bool singular, bool takesOwnership ) const;
|
||||
std::string generateRAIIHandleConstructorArguments( std::pair<std::string, HandleData> const & handle,
|
||||
std::map<std::string, VulkanHppGenerator::CommandData>::const_iterator constructorIt,
|
||||
bool singular,
|
||||
bool takesOwnership ) const;
|
||||
std::string generateRAIIHandleConstructorArguments( std::pair<std::string, HandleData> const & handle,
|
||||
std::map<std::string, CommandData>::const_iterator constructorIt,
|
||||
bool singular,
|
||||
bool takesOwnership ) const;
|
||||
std::string generateRAIIHandleConstructorInitializationList( std::pair<std::string, HandleData> const & handle,
|
||||
std::map<std::string, CommandData>::const_iterator constructorIt,
|
||||
std::map<std::string, CommandData>::const_iterator destructorIt,
|
||||
|
|
@ -905,7 +1036,7 @@ private:
|
|||
std::string generateRAIIHandleContext( std::pair<std::string, HandleData> const & handle, std::set<std::string> const & specialFunctions ) const;
|
||||
std::string generateRAIIHandleDestructorCallArguments( std::string const & handleType,
|
||||
std::map<std::string, CommandData>::const_iterator destructorIt ) const;
|
||||
std::tuple<std::string, std::string, std::string, std::string, std::string, std::string, std::string>
|
||||
std::tuple<std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string>
|
||||
generateRAIIHandleDetails( std::pair<std::string, HandleData> const & handle ) const;
|
||||
std::string generateRAIIHandleForwardDeclarations( std::vector<RequireData> const & requireData, std::string const & title ) const;
|
||||
std::string generateRAIIHandles() const;
|
||||
|
|
@ -916,11 +1047,19 @@ private:
|
|||
template <class Predicate, class Extraction>
|
||||
std::string generateReplacedExtensionsList( Predicate p, Extraction e ) const;
|
||||
std::string generateResultAssignment( CommandData const & commandData ) const;
|
||||
std::string generateResultCheck(
|
||||
CommandData const & commandData, std::string const & className, std::string const & classSeparator, std::string commandName, bool enumerating ) const;
|
||||
std::string
|
||||
generateResultCheckExpected( std::vector<std::string> const & successCodes, std::string const & className, std::string const & commandName ) const;
|
||||
std::string generateResultCheck( CommandData const & commandData,
|
||||
std::string const & className,
|
||||
std::string const & classSeparator,
|
||||
std::string commandName,
|
||||
bool enumerating,
|
||||
bool raii ) const;
|
||||
std::string generateResultExceptions() const;
|
||||
std::string generateReturnDataType( std::map<size_t, VectorParamData> const & vectorParams,
|
||||
std::vector<size_t> const & returnParams,
|
||||
bool enumerating,
|
||||
std::vector<std::string> const & dataTypes,
|
||||
CommandFlavourFlags flavourFlags,
|
||||
bool raii ) const;
|
||||
std::string generateReturnStatement( std::string const & commandName,
|
||||
CommandData const & commandData,
|
||||
std::string const & returnVariable,
|
||||
|
|
@ -945,51 +1084,52 @@ private:
|
|||
generateSizeCheck( std::vector<std::vector<MemberData>::const_iterator> const & arrayIts, std::string const & structName, bool mutualExclusiveLens ) const;
|
||||
std::string generateStaticAssertions() const;
|
||||
std::string generateStaticAssertions( std::vector<RequireData> const & requireData, std::string const & title, std::set<std::string> & listedStructs ) const;
|
||||
std::string generateStruct( std::pair<std::string, StructureData> const & structure, std::set<std::string> & listedStructs ) const;
|
||||
std::string generateStructCompareOperators( std::pair<std::string, StructureData> const & structure ) const;
|
||||
std::string generateStructConstructors( std::pair<std::string, StructureData> const & structData ) const;
|
||||
std::string generateStructConstructorsEnhanced( std::pair<std::string, StructureData> const & structData ) const;
|
||||
std::string generateStruct( std::pair<std::string, StructData> const & structure, std::set<std::string> & listedStructs ) const;
|
||||
std::string generateStructCastAssignments( std::pair<std::string, StructData> const & structData ) const;
|
||||
std::string generateStructCompareOperators( std::pair<std::string, StructData> const & structure ) const;
|
||||
std::string generateStructConstructors( std::pair<std::string, StructData> const & structData ) const;
|
||||
std::string generateStructConstructorsEnhanced( std::pair<std::string, StructData> const & structData ) const;
|
||||
std::string generateStructConstructorArgument( MemberData const & memberData, bool withDefault ) const;
|
||||
std::string generateStructHashStructure( std::pair<std::string, StructureData> const & structure, std::set<std::string> & listedStructs ) const;
|
||||
std::string generateStructHashStructure( std::pair<std::string, StructData> const & structure, std::set<std::string> & listedStructs ) const;
|
||||
std::string generateStructHashStructures() const;
|
||||
std::string generateStructHashSum( std::string const & structName, std::vector<MemberData> const & members ) const;
|
||||
std::string generateStructs() const;
|
||||
std::string generateStructure( std::pair<std::string, StructureData> const & structure ) const;
|
||||
std::string generateStructure( std::pair<std::string, StructData> const & structure ) const;
|
||||
std::string generateStructExtendsStructs() const;
|
||||
std::string
|
||||
generateStructExtendsStructs( std::vector<RequireData> const & requireData, std::set<std::string> & listedStructs, std::string const & title ) const;
|
||||
std::string generateStructForwardDeclarations() const;
|
||||
std::string
|
||||
generateStructForwardDeclarations( std::vector<RequireData> const & requireData, std::string const & title, std::set<std::string> & listedStructs ) const;
|
||||
std::tuple<std::string, std::string, std::string, std::string> generateStructMembers( std::pair<std::string, StructureData> const & structData ) const;
|
||||
std::string generateStructSetter( std::string const & structureName, std::vector<MemberData> const & memberData, size_t index ) const;
|
||||
std::string generateStructSubConstructor( std::pair<std::string, StructureData> const & structData ) const;
|
||||
std::string generateSuccessCheck( std::vector<std::string> const & successCodes ) const;
|
||||
std::string generateSuccessCode( std::string const & code ) const;
|
||||
std::string generateSuccessCodeList( std::vector<std::string> const & successCodes, bool enumerating ) const;
|
||||
std::string generateThrowResultException() const;
|
||||
std::string generateTypenameCheck( std::vector<size_t> const & returnParams,
|
||||
std::map<size_t, VectorParamData> const & vectorParams,
|
||||
std::vector<size_t> const & chainedReturnParams,
|
||||
bool definition,
|
||||
std::vector<std::string> const & dataTypes,
|
||||
CommandFlavourFlags flavourFlags ) const;
|
||||
std::string generateUnion( std::pair<std::string, StructureData> const & structure ) const;
|
||||
std::string generateUniqueHandle( std::pair<std::string, HandleData> const & handleData ) const;
|
||||
std::string generateUniqueHandle( std::vector<RequireData> const & requireData, std::string const & title ) const;
|
||||
std::string generateUniqueHandles() const;
|
||||
std::string generateSharedHandle( std::pair<std::string, HandleData> const & handleData ) const;
|
||||
std::string generateSharedHandle( std::vector<RequireData> const & requireData, std::string const & title ) const;
|
||||
std::string generateSharedHandleNoDestroy( std::pair<std::string, HandleData> const & handleData ) const;
|
||||
std::string generateSharedHandleNoDestroy( std::vector<RequireData> const & requireData, std::string const & title ) const;
|
||||
std::string generateSharedHandles() const;
|
||||
std::string generateSharedHandlesNoDestroy() const;
|
||||
std::string generateVectorSizeCheck( std::string const & name,
|
||||
CommandData const & commandData,
|
||||
size_t initialSkipCount,
|
||||
std::map<size_t, std::vector<size_t>> const & countToVectorMap,
|
||||
std::set<size_t> const & skippedParams,
|
||||
bool onlyThrows ) const;
|
||||
std::tuple<std::string, std::string, std::string, std::string> generateStructMembers( std::pair<std::string, StructData> const & structData ) const;
|
||||
std::string generateStructSetter( std::string const & structureName, std::vector<MemberData> const & memberData, size_t index ) const;
|
||||
std::string generateStructSubConstructor( std::pair<std::string, StructData> const & structData ) const;
|
||||
std::string generateSuccessCheck( std::vector<std::string> const & successCodes ) const;
|
||||
std::string generateSuccessCode( std::string const & code ) const;
|
||||
std::string generateSuccessCodeList( std::vector<std::string> const & successCodes, bool enumerating ) const;
|
||||
std::string generateThrowResultException() const;
|
||||
std::string generateTypenameCheck( std::vector<size_t> const & returnParams,
|
||||
std::map<size_t, VectorParamData> const & vectorParams,
|
||||
std::vector<size_t> const & chainedReturnParams,
|
||||
bool definition,
|
||||
std::vector<std::string> const & dataTypes,
|
||||
CommandFlavourFlags flavourFlags ) const;
|
||||
std::string generateUnion( std::pair<std::string, StructData> const & structure ) const;
|
||||
std::string generateUniqueHandle( std::pair<std::string, HandleData> const & handleData ) const;
|
||||
std::string generateUniqueHandle( std::vector<RequireData> const & requireData, std::string const & title, std::set<std::string> & listedHandles ) const;
|
||||
std::string generateUniqueHandles() const;
|
||||
std::string generateSharedHandle( std::pair<std::string, HandleData> const & handleData ) const;
|
||||
std::string generateSharedHandle( std::vector<RequireData> const & requireData, std::string const & title, std::set<std::string> & listedHandles ) const;
|
||||
std::string generateSharedHandleNoDestroy( std::pair<std::string, HandleData> const & handleData ) const;
|
||||
std::string generateSharedHandleNoDestroy( std::vector<RequireData> const & requireData, std::string const & title ) const;
|
||||
std::string generateSharedHandles() const;
|
||||
std::string generateSharedHandlesNoDestroy() const;
|
||||
std::string generateVectorSizeCheck( std::string const & name,
|
||||
CommandData const & commandData,
|
||||
size_t initialSkipCount,
|
||||
std::map<size_t, std::vector<size_t>> const & countToVectorMap,
|
||||
std::set<size_t> const & skippedParams,
|
||||
bool onlyThrows ) const;
|
||||
std::pair<std::string, std::string> getParentTypeAndName( std::pair<std::string, HandleData> const & handle ) const;
|
||||
std::string getPlatform( std::string const & title ) const;
|
||||
std::pair<std::string, std::string> getPoolTypeAndName( std::string const & type ) const;
|
||||
|
|
@ -1006,11 +1146,13 @@ private:
|
|||
bool handleRemovalCommand( std::string const & command, std::vector<RequireData> & requireData );
|
||||
void handleRemovals();
|
||||
bool handleRemovalType( std::string const & type, std::vector<RequireData> & requireData );
|
||||
bool hasArrayConstructor( HandleData const & handleData ) const;
|
||||
bool hasLen( MemberData const & md, std::vector<MemberData> const & members ) const;
|
||||
bool hasParentHandle( std::string const & handle, std::string const & parent ) const;
|
||||
bool isConstructorCandidate( std::pair<std::string, VulkanHppGenerator::CommandData> const & command, std::string const & handleType ) const;
|
||||
bool isConstructorCandidate( ParamData const & paramData, std::string const & handleType ) const;
|
||||
bool isDeviceCommand( CommandData const & commandData ) const;
|
||||
bool isEnumerated( std::string const & type ) const;
|
||||
bool isExtension( std::string const & name ) const;
|
||||
bool isFeature( std::string const & name ) const;
|
||||
bool isHandleType( std::string const & type ) const;
|
||||
|
|
@ -1027,7 +1169,12 @@ private:
|
|||
bool isSupportedFeature( std::string const & name ) const;
|
||||
bool isTypeRequired( std::string const & type ) const;
|
||||
bool isTypeUsed( std::string const & type ) const;
|
||||
bool isUnsupportedExtension( std::string const & name ) const;
|
||||
bool isUnsupportedFeature( std::string const & name ) const;
|
||||
bool isVectorByStructure( std::string const & type ) const;
|
||||
void markExtendedStructs();
|
||||
void mergeInternalFeatures();
|
||||
void mergeInternalFeatures( std::vector<std::string> const & depends, FeatureData & feature, std::map<std::string, FeatureData> & internalFeatures );
|
||||
bool needsStructureChainResize( std::map<size_t, VectorParamData> const & vectorParams, std::vector<size_t> const & chainedReturnParams ) const;
|
||||
std::pair<bool, std::map<size_t, std::vector<size_t>>> needsVectorSizeCheck( std::vector<ParamData> const & params,
|
||||
std::map<size_t, VectorParamData> const & vectorParams,
|
||||
|
|
@ -1038,48 +1185,46 @@ private:
|
|||
std::pair<bool, ParamData> readCommandParam( tinyxml2::XMLElement const * element, std::vector<ParamData> const & params );
|
||||
std::pair<std::string, std::string> readCommandProto( tinyxml2::XMLElement const * element );
|
||||
void readCommands( tinyxml2::XMLElement const * element );
|
||||
std::string readComment( tinyxml2::XMLElement const * element ) const;
|
||||
DeprecateData readDeprecateData( tinyxml2::XMLElement const * element ) const;
|
||||
void readEnums( tinyxml2::XMLElement const * element );
|
||||
void readEnumsConstants( 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, bool extensionSupported );
|
||||
void readExtensions( tinyxml2::XMLElement const * element );
|
||||
void readFeature( tinyxml2::XMLElement const * element );
|
||||
void readFeatureRequire( tinyxml2::XMLElement const * element, FeatureData & featureData, bool featureSupported );
|
||||
void readFormat( tinyxml2::XMLElement const * element );
|
||||
void readFormatComponent( tinyxml2::XMLElement const * element, FormatData & formatData );
|
||||
void readFormatPlane( tinyxml2::XMLElement const * element, FormatData & formatData );
|
||||
void readFormats( tinyxml2::XMLElement const * element );
|
||||
void readFormatSPIRVImageFormat( tinyxml2::XMLElement const * element, FormatData & formatData );
|
||||
std::string readName( tinyxml2::XMLElement const * elements );
|
||||
std::pair<NameData, TypeInfo> readNameAndType( tinyxml2::XMLElement const * elements );
|
||||
void readPlatform( tinyxml2::XMLElement const * element );
|
||||
void readPlatforms( tinyxml2::XMLElement const * element );
|
||||
void readRegistry( tinyxml2::XMLElement const * element );
|
||||
RemoveData readRemoveData( tinyxml2::XMLElement const * element );
|
||||
std::string readRequireCommand( tinyxml2::XMLElement const * element, std::string const & requiredBy );
|
||||
void readRequireEnum(
|
||||
tinyxml2::XMLElement const * element, std::string const & requiredBy, std::string const & platform, bool supported, RequireData & requireData );
|
||||
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, bool extensionSupported );
|
||||
void readExtensions( tinyxml2::XMLElement const * element );
|
||||
void readFeature( tinyxml2::XMLElement const * element );
|
||||
void readFeatureRequire( tinyxml2::XMLElement const * element, FeatureData & featureData, bool featureSupported );
|
||||
void readFormat( tinyxml2::XMLElement const * element );
|
||||
void readFormatComponent( tinyxml2::XMLElement const * element, FormatData & formatData );
|
||||
void readFormatPlane( tinyxml2::XMLElement const * element, FormatData & formatData );
|
||||
void readFormats( tinyxml2::XMLElement const * element );
|
||||
void readFormatSPIRVImageFormat( tinyxml2::XMLElement const * element, FormatData & formatData );
|
||||
std::pair<std::vector<std::string>, std::string> readModifiers( tinyxml2::XMLNode const * node ) const;
|
||||
std::string readName( tinyxml2::XMLElement const * elements ) const;
|
||||
std::pair<NameData, TypeInfo> readNameAndType( tinyxml2::XMLElement const * elements );
|
||||
void readPlatform( tinyxml2::XMLElement const * element );
|
||||
void readPlatforms( tinyxml2::XMLElement const * element );
|
||||
void readRegistry( tinyxml2::XMLElement const * element );
|
||||
RemoveData readRemoveData( tinyxml2::XMLElement const * element );
|
||||
NameLine readRequireCommand( tinyxml2::XMLElement const * element );
|
||||
void readRequireEnum(
|
||||
tinyxml2::XMLElement const * element, std::string const & requiredBy, std::string const & platform, bool supported, RequireData & requireData );
|
||||
RequireFeature readRequireFeature( tinyxml2::XMLElement const * element );
|
||||
std::string readRequireType( tinyxml2::XMLElement const * element, std::string const & requiredBy );
|
||||
NameLine readRequireType( tinyxml2::XMLElement const * element );
|
||||
void readSPIRVCapability( tinyxml2::XMLElement const * element );
|
||||
void readSPIRVCapabilityEnable( tinyxml2::XMLElement const * element );
|
||||
void readSPIRVCapabilityEnable( tinyxml2::XMLElement const * element, SpirVCapabilityData & capability );
|
||||
void readSPIRVCapabilities( tinyxml2::XMLElement const * element );
|
||||
void readSPIRVExtension( tinyxml2::XMLElement const * element );
|
||||
void readSPIRVExtensionEnable( tinyxml2::XMLElement const * element );
|
||||
void readSPIRVExtensions( tinyxml2::XMLElement const * element );
|
||||
void readStructMember( tinyxml2::XMLElement const * element, std::vector<MemberData> & members, bool isUnion );
|
||||
void readSync( tinyxml2::XMLElement const * element );
|
||||
void readSyncAccess( tinyxml2::XMLElement const * element,
|
||||
std::map<std::string, EnumData>::const_iterator accessFlagBitsIt,
|
||||
std::map<std::string, EnumData>::const_iterator accessFlagBits2It,
|
||||
std::map<std::string, EnumData>::const_iterator stageFlagBits2It );
|
||||
void readSyncAccess( tinyxml2::XMLElement const * element, std::map<std::string, EnumData>::const_iterator accessFlagBits2It );
|
||||
void readSyncAccessEquivalent( tinyxml2::XMLElement const * element, std::map<std::string, EnumData>::const_iterator accessFlagBits2It );
|
||||
void readSyncAccessSupport( tinyxml2::XMLElement const * element, std::map<std::string, EnumData>::const_iterator stageFlagBits2It );
|
||||
void readSyncAccessSupport( tinyxml2::XMLElement const * element );
|
||||
void readSyncPipeline( tinyxml2::XMLElement const * element );
|
||||
void readSyncStage( tinyxml2::XMLElement const * element,
|
||||
std::map<std::string, EnumData>::const_iterator stageFlagBitsIt,
|
||||
std::map<std::string, EnumData>::const_iterator stageFlagBits2It );
|
||||
void readSyncStage( tinyxml2::XMLElement const * element, std::map<std::string, EnumData>::const_iterator stageFlagBits2It );
|
||||
void readSyncStageEquivalent( tinyxml2::XMLElement const * element, std::map<std::string, EnumData>::const_iterator stageFlagBits2It );
|
||||
void readSyncStageSupport( tinyxml2::XMLElement const * element );
|
||||
void readTag( tinyxml2::XMLElement const * element );
|
||||
|
|
@ -1120,30 +1265,58 @@ private:
|
|||
MemberData const & vectorMemberByStructure( std::string const & structureType ) const;
|
||||
|
||||
private:
|
||||
std::string m_api;
|
||||
std::map<std::string, BaseTypeData> m_baseTypes;
|
||||
std::map<std::string, BitmaskData> m_bitmasks;
|
||||
std::map<std::string, CommandData> m_commands;
|
||||
std::map<std::string, ConstantData> m_constants;
|
||||
std::map<std::string, DefineData> m_defines;
|
||||
DefinesPartition m_definesPartition; // partition defined macros into mutually-exclusive sets of callees, callers, and values
|
||||
std::map<std::string, EnumData> m_enums;
|
||||
std::vector<ExtensionData> m_extensions;
|
||||
std::map<std::string, ExternalTypeData> m_externalTypes;
|
||||
std::vector<FeatureData> m_features;
|
||||
std::map<std::string, FormatData> m_formats;
|
||||
std::map<std::string, FuncPointerData> m_funcPointers;
|
||||
std::map<std::string, HandleData> m_handles;
|
||||
std::map<std::string, IncludeData> m_includes;
|
||||
std::map<std::string, PlatformData> m_platforms;
|
||||
std::set<std::string> m_RAIISpecialFunctions;
|
||||
std::map<std::string, StructureData> m_structs;
|
||||
std::vector<std::pair<std::string, AliasData>> m_structsAliases; // temporary storage for aliases, as they might be listed before the actual struct is listed
|
||||
std::map<std::string, TagData> m_tags;
|
||||
std::map<std::string, TypeData> m_types;
|
||||
std::set<std::string> m_unsupportedExtensions;
|
||||
std::set<std::string> m_unsupportedFeatures;
|
||||
std::string m_version;
|
||||
std::vector<VideoCodec> m_videoCodecs;
|
||||
std::string m_vulkanLicenseHeader;
|
||||
std::string m_api;
|
||||
std::map<std::string, BaseTypeData> m_baseTypes;
|
||||
std::map<std::string, BitmaskData> m_bitmasks;
|
||||
std::set<std::string> m_commandQueues;
|
||||
std::map<std::string, CommandData> m_commands;
|
||||
std::map<std::string, ConstantData> m_constants;
|
||||
std::map<std::string, DefineData> m_defines;
|
||||
DefinesPartition m_definesPartition; // partition defined macros into mutually-exclusive sets of callees, callers, and values
|
||||
std::map<std::string, EnumData> m_enums;
|
||||
std::vector<ExtensionData> m_extensions;
|
||||
std::map<std::string, ExternalTypeData> m_externalTypes;
|
||||
std::vector<FeatureData> m_features;
|
||||
std::map<std::string, FormatData> m_formats;
|
||||
std::map<std::string, FuncPointerData> m_funcPointers;
|
||||
std::map<std::string, HandleData> m_handles;
|
||||
std::map<std::string, IncludeData> m_includes;
|
||||
std::map<std::string, PlatformData> m_platforms;
|
||||
std::set<std::string> m_RAIISpecialFunctions;
|
||||
std::map<std::string, SpirVCapabilityData> m_spirVCapabilities;
|
||||
std::map<std::string, StructData> m_structs;
|
||||
std::vector<std::pair<std::string, NameLine>> m_structsAliases; // temporary storage for aliases, as they might be listed before the actual struct is listed
|
||||
std::map<std::string, NameLine> m_syncAccesses;
|
||||
std::map<std::string, NameLine> m_syncStages;
|
||||
std::map<std::string, TagData> m_tags;
|
||||
std::map<std::string, TypeData> m_types;
|
||||
std::vector<ExtensionData> m_unsupportedExtensions;
|
||||
std::vector<FeatureData> m_unsupportedFeatures;
|
||||
std::string m_version;
|
||||
std::vector<VideoCodec> m_videoCodecs;
|
||||
std::string m_vulkanLicenseHeader;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
std::string VulkanHppGenerator::generateFormatTraitsSubCases( FormatData const & formatData,
|
||||
std::function<std::vector<T> const &( FormatData const & )> accessor,
|
||||
std::string const & subCaseName,
|
||||
std::function<std::string( T const & subCaseData )> generator,
|
||||
std::string const & defaultReturn ) const
|
||||
{
|
||||
const std::string subCasesTemplate = R"(
|
||||
switch( ${subCaseName} )
|
||||
{
|
||||
${subCases}
|
||||
default: VULKAN_HPP_ASSERT( false ); return ${defaultReturn};
|
||||
})";
|
||||
|
||||
std::string subCases;
|
||||
for ( size_t i = 0; i < accessor( formatData ).size(); ++i )
|
||||
{
|
||||
subCases += " case " + std::to_string( i ) + ": return " + generator( accessor( formatData )[i] ) + ";\n";
|
||||
}
|
||||
subCases.pop_back();
|
||||
|
||||
return replaceWithMap( subCasesTemplate, { { "defaultReturn", defaultReturn }, { "subCaseName", subCaseName }, { "subCases", subCases } } );
|
||||
}
|
||||
|
|
|
|||
176
XMLHelper.hpp
176
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 ) + " times" );
|
||||
"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"(\$\{([^\}]+)\})" );
|
||||
|
|
@ -465,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 ) + ">";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -508,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;
|
||||
}
|
||||
|
|
@ -548,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 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
#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,6 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -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,6 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
# 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 )
|
||||
|
|
|
|||
|
|
@ -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,6 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -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,6 @@
|
|||
#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,6 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -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,6 @@
|
|||
#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,6 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
|||
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,7 +28,6 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <fstream>
|
||||
|
|
@ -36,7 +35,7 @@
|
|||
#include <thread>
|
||||
|
||||
// For timestamp code (getMilliseconds)
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
# include <Windows.h>
|
||||
#else
|
||||
# include <sys/time.h>
|
||||
|
|
@ -45,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 )
|
||||
|
|
@ -141,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 );
|
||||
|
|
@ -150,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();
|
||||
|
|
@ -170,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
|
||||
//
|
||||
|
|
@ -206,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;
|
||||
|
|
@ -256,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";
|
||||
|
|
@ -272,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,6 @@
|
|||
#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,6 @@
|
|||
#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,6 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -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,6 @@
|
|||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "CameraManipulator.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
|
@ -595,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 ) );
|
||||
|
|
@ -725,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 );
|
||||
|
|
@ -1225,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,6 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
|
@ -84,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() ) };
|
||||
|
|
@ -110,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 };
|
||||
|
|
@ -231,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,6 @@
|
|||
#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,6 @@
|
|||
#include "../utils/math.hpp"
|
||||
#include "../utils/shaders.hpp"
|
||||
#include "../utils/utils.hpp"
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -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,7 +15,7 @@
|
|||
|
||||
#include "shaders.hpp"
|
||||
|
||||
#include "SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/Public/ResourceLimits.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -348,10 +348,10 @@ 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 )
|
||||
switch ( static_cast<uint32_t>( pCallbackData->messageIdNumber ) )
|
||||
|
|
@ -369,8 +369,7 @@ namespace vk
|
|||
}
|
||||
#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";
|
||||
|
|
@ -396,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 )
|
||||
{
|
||||
|
|
@ -422,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 )
|
||||
|
|
@ -576,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;
|
||||
|
|
@ -600,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;
|
||||
|
|
@ -782,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 );
|
||||
|
|
@ -802,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 );
|
||||
|
|
@ -980,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 );
|
||||
|
|
@ -999,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()
|
||||
|
|
|
|||
|
|
@ -76,10 +76,11 @@ namespace vk
|
|||
|
||||
VULKAN_HPP_INLINE uint32_t clampSurfaceImageCount( const uint32_t desiredImageCount, const uint32_t minImageCount, const uint32_t maxImageCount )
|
||||
{
|
||||
uint32_t imageCount = (std::max)( desiredImageCount, minImageCount );
|
||||
uint32_t imageCount = ( std::max )( desiredImageCount, minImageCount );
|
||||
// Some drivers report maxImageCount as 0, so only clamp to max if it is valid.
|
||||
if ( maxImageCount > 0 )
|
||||
{
|
||||
imageCount = (std::min)( imageCount, maxImageCount );
|
||||
imageCount = ( std::min )( imageCount, maxImageCount );
|
||||
}
|
||||
return imageCount;
|
||||
}
|
||||
|
|
@ -91,7 +92,7 @@ namespace vk
|
|||
{
|
||||
WindowData( GLFWwindow * wnd, std::string const & name, vk::Extent2D const & extent );
|
||||
WindowData( const WindowData & ) = delete;
|
||||
WindowData( WindowData && other );
|
||||
WindowData( WindowData && other ) noexcept;
|
||||
~WindowData() noexcept;
|
||||
|
||||
GLFWwindow * handle;
|
||||
|
|
@ -355,55 +356,55 @@ namespace vk
|
|||
static_assert( !std::numeric_limits<SourceType>::is_signed, "Only unsigned types supported!" );
|
||||
static_assert( std::numeric_limits<TargetType>::is_integer, "Only integer types supported!" );
|
||||
static_assert( !std::numeric_limits<TargetType>::is_signed, "Only unsigned types supported!" );
|
||||
assert( value <= (std::numeric_limits<TargetType>::max)() );
|
||||
assert( value <= ( std::numeric_limits<TargetType>::max )() );
|
||||
return static_cast<TargetType>( value );
|
||||
}
|
||||
|
||||
vk::DeviceMemory allocateDeviceMemory( vk::Device const & device,
|
||||
vk::PhysicalDeviceMemoryProperties const & memoryProperties,
|
||||
vk::MemoryRequirements const & memoryRequirements,
|
||||
vk::MemoryPropertyFlags memoryPropertyFlags );
|
||||
bool contains( std::vector<vk::ExtensionProperties> const & extensionProperties, std::string const & extensionName );
|
||||
vk::DescriptorPool createDescriptorPool( vk::Device const & device, std::vector<vk::DescriptorPoolSize> const & poolSizes );
|
||||
vk::DescriptorSetLayout createDescriptorSetLayout( vk::Device const & device,
|
||||
std::vector<std::tuple<vk::DescriptorType, uint32_t, vk::ShaderStageFlags>> const & bindingData,
|
||||
vk::DescriptorSetLayoutCreateFlags flags = {} );
|
||||
vk::Device createDevice( vk::PhysicalDevice const & physicalDevice,
|
||||
uint32_t queueFamilyIndex,
|
||||
std::vector<std::string> const & extensions = {},
|
||||
vk::PhysicalDeviceFeatures const * physicalDeviceFeatures = nullptr,
|
||||
void const * pNext = nullptr );
|
||||
std::vector<vk::Framebuffer> createFramebuffers( vk::Device const & device,
|
||||
vk::RenderPass & renderPass,
|
||||
std::vector<vk::ImageView> const & imageViews,
|
||||
vk::ImageView const & depthImageView,
|
||||
vk::Extent2D const & extent );
|
||||
vk::Pipeline createGraphicsPipeline( vk::Device const & device,
|
||||
vk::PipelineCache const & pipelineCache,
|
||||
std::pair<vk::ShaderModule, vk::SpecializationInfo const *> const & vertexShaderData,
|
||||
std::pair<vk::ShaderModule, vk::SpecializationInfo const *> const & fragmentShaderData,
|
||||
uint32_t vertexStride,
|
||||
std::vector<std::pair<vk::Format, uint32_t>> const & vertexInputAttributeFormatOffset,
|
||||
vk::FrontFace frontFace,
|
||||
bool depthBuffered,
|
||||
vk::PipelineLayout const & pipelineLayout,
|
||||
vk::RenderPass const & renderPass );
|
||||
vk::Instance createInstance( std::string const & appName,
|
||||
std::string const & engineName,
|
||||
std::vector<std::string> const & layers = {},
|
||||
std::vector<std::string> const & extensions = {},
|
||||
uint32_t apiVersion = VK_API_VERSION_1_0 );
|
||||
vk::RenderPass createRenderPass( vk::Device const & device,
|
||||
vk::Format colorFormat,
|
||||
vk::Format depthFormat,
|
||||
vk::AttachmentLoadOp loadOp = vk::AttachmentLoadOp::eClear,
|
||||
vk::ImageLayout colorFinalLayout = vk::ImageLayout::ePresentSrcKHR );
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL debugUtilsMessengerCallback( VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
|
||||
VkDebugUtilsMessageTypeFlagsEXT messageTypes,
|
||||
VkDebugUtilsMessengerCallbackDataEXT const * pCallbackData,
|
||||
void * /*pUserData*/ );
|
||||
uint32_t findGraphicsQueueFamilyIndex( std::vector<vk::QueueFamilyProperties> const & queueFamilyProperties );
|
||||
std::pair<uint32_t, uint32_t> findGraphicsAndPresentQueueFamilyIndex( vk::PhysicalDevice physicalDevice, vk::SurfaceKHR const & surface );
|
||||
vk::DeviceMemory allocateDeviceMemory( vk::Device const & device,
|
||||
vk::PhysicalDeviceMemoryProperties const & memoryProperties,
|
||||
vk::MemoryRequirements const & memoryRequirements,
|
||||
vk::MemoryPropertyFlags memoryPropertyFlags );
|
||||
bool contains( std::vector<vk::ExtensionProperties> const & extensionProperties, std::string const & extensionName );
|
||||
vk::DescriptorPool createDescriptorPool( vk::Device const & device, std::vector<vk::DescriptorPoolSize> const & poolSizes );
|
||||
vk::DescriptorSetLayout createDescriptorSetLayout( vk::Device const & device,
|
||||
std::vector<std::tuple<vk::DescriptorType, uint32_t, vk::ShaderStageFlags>> const & bindingData,
|
||||
vk::DescriptorSetLayoutCreateFlags flags = {} );
|
||||
vk::Device createDevice( vk::PhysicalDevice const & physicalDevice,
|
||||
uint32_t queueFamilyIndex,
|
||||
std::vector<std::string> const & extensions = {},
|
||||
vk::PhysicalDeviceFeatures const * physicalDeviceFeatures = nullptr,
|
||||
void const * pNext = nullptr );
|
||||
std::vector<vk::Framebuffer> createFramebuffers( vk::Device const & device,
|
||||
vk::RenderPass & renderPass,
|
||||
std::vector<vk::ImageView> const & imageViews,
|
||||
vk::ImageView const & depthImageView,
|
||||
vk::Extent2D const & extent );
|
||||
vk::Pipeline createGraphicsPipeline( vk::Device const & device,
|
||||
vk::PipelineCache const & pipelineCache,
|
||||
std::pair<vk::ShaderModule, vk::SpecializationInfo const *> const & vertexShaderData,
|
||||
std::pair<vk::ShaderModule, vk::SpecializationInfo const *> const & fragmentShaderData,
|
||||
uint32_t vertexStride,
|
||||
std::vector<std::pair<vk::Format, uint32_t>> const & vertexInputAttributeFormatOffset,
|
||||
vk::FrontFace frontFace,
|
||||
bool depthBuffered,
|
||||
vk::PipelineLayout const & pipelineLayout,
|
||||
vk::RenderPass const & renderPass );
|
||||
vk::Instance createInstance( std::string const & appName,
|
||||
std::string const & engineName,
|
||||
std::vector<std::string> const & layers = {},
|
||||
std::vector<std::string> const & extensions = {},
|
||||
uint32_t apiVersion = VK_API_VERSION_1_0 );
|
||||
vk::RenderPass createRenderPass( vk::Device const & device,
|
||||
vk::Format colorFormat,
|
||||
vk::Format depthFormat,
|
||||
vk::AttachmentLoadOp loadOp = vk::AttachmentLoadOp::eClear,
|
||||
vk::ImageLayout colorFinalLayout = vk::ImageLayout::ePresentSrcKHR );
|
||||
VKAPI_ATTR vk::Bool32 VKAPI_CALL debugUtilsMessengerCallback( vk::DebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
|
||||
vk::DebugUtilsMessageTypeFlagsEXT messageTypes,
|
||||
vk::DebugUtilsMessengerCallbackDataEXT const * pCallbackData,
|
||||
void * /*pUserData*/ );
|
||||
uint32_t findGraphicsQueueFamilyIndex( std::vector<vk::QueueFamilyProperties> const & queueFamilyProperties );
|
||||
std::pair<uint32_t, uint32_t> findGraphicsAndPresentQueueFamilyIndex( vk::PhysicalDevice physicalDevice, vk::SurfaceKHR const & surface );
|
||||
uint32_t findMemoryType( vk::PhysicalDeviceMemoryProperties const & memoryProperties, uint32_t typeBits, vk::MemoryPropertyFlags requirementsMask );
|
||||
std::vector<char const *> gatherExtensions( std::vector<std::string> const & extensions
|
||||
#if !defined( NDEBUG )
|
||||
|
|
|
|||
|
|
@ -159,3 +159,47 @@ bool operator!=( std::string const & lhs, ArrayWrapper1D<char, N> const & rhs )
|
|||
{
|
||||
return lhs != rhs.data();
|
||||
}
|
||||
|
||||
#if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR )
|
||||
template <size_t N>
|
||||
std::strong_ordering operator<=>( ArrayWrapper1D<char, N> const & lhs, std::string const & rhs ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return lhs.data() <=> rhs;
|
||||
}
|
||||
#else
|
||||
template <size_t N>
|
||||
bool operator<( ArrayWrapper1D<char, N> const & lhs, std::string const & rhs ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return lhs.data() < rhs;
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
bool operator<=( ArrayWrapper1D<char, N> const & lhs, std::string const & rhs ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return lhs.data() <= rhs;
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
bool operator>( ArrayWrapper1D<char, N> const & lhs, std::string const & rhs ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return lhs.data() > rhs;
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
bool operator>=( ArrayWrapper1D<char, N> const & lhs, std::string const & rhs ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return lhs.data() >= rhs;
|
||||
}
|
||||
#endif
|
||||
|
||||
template <size_t N>
|
||||
bool operator==( ArrayWrapper1D<char, N> const & lhs, std::string const & rhs ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return lhs.data() == rhs;
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
bool operator!=( ArrayWrapper1D<char, N> const & lhs, std::string const & rhs ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return lhs.data() != rhs;
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue