Skip to content

Commit 0e9721e

Browse files
committed
Merge branch 'upstream-main' into Simple-Game-Engine
# Conflicts: # antora/modules/ROOT/nav.adoc # en/02_Development_environment.adoc
2 parents 6378bef + ca42702 commit 0e9721e

File tree

118 files changed

+206862
-26462
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+206862
-26462
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Quality Checks
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches: [main]
7+
8+
env:
9+
TARGET_BRANCH: main
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
clang_format:
17+
name: Clang Format Check
18+
container: ghcr.io/khronosgroupactions/clang-tools:15.0.0
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- run: git config --global --add safe.directory /__w/Vulkan-Tutorial/Vulkan-Tutorial
23+
- run: git fetch origin $TARGET_BRANCH:$TARGET_BRANCH
24+
- name: Run Clang Format diff
25+
id: clang-diff
26+
run: |
27+
echo "changes=$(echo $(git diff -- '***.cpp' '***.h' -U0 --no-color $TARGET_BRANCH | python3 /usr/share/clang/clang-format-diff.py -p1 -v -sort-include))" >> $GITHUB_OUTPUT
28+
echo "$(echo $(git diff -- '***.cpp' '***.h' -U0 --no-color $TARGET_BRANCH | python3 /usr/share/clang/clang-format-diff.py -p1 -v -sort-include))" >> clang-issues.diff
29+
- name: Count Diff Lines
30+
continue-on-error: true
31+
id: count-diff
32+
run: echo "line-count=$(echo "${{ steps.clang-diff.outputs.changes }}" | grep -c +++)" >> $GITHUB_OUTPUT
33+
- name: 'Upload Artifact'
34+
uses: actions/upload-artifact@v4
35+
with:
36+
name: clang-issues.diff
37+
path: clang-issues.diff
38+
retention-days: 3
39+
- name: Assert
40+
run: if test ${{ steps.count-diff.outputs.line-count }} -gt 0; then echo "${{ steps.clang-diff.outputs.changes }}"; exit 1; fi
41+

.gitignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,12 @@ temp_ebook.md
99
ebook/*.pdf
1010
ebook/*.epub
1111

12-
convert.py
12+
convert.py
13+
14+
attachments/build/**
15+
attachments/android/.gradle/**
16+
attachments/android/.idea
17+
attachments/android/.gradle/**
18+
attachments/android/app/.cxx/**
19+
attachments/android/app/build/**
20+
local.properties

CONTRIBUTING.adoc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,16 @@ Any change or fix needs to consider this and make sure that it follows Antora's
3434
The content's of the tutorial are written in Asciidoc (adoc file extension). New content or changes to existing content need comply with this format. If you are new to Asciidoc, the link:https://docs.antora.org/antora/latest/asciidoc/asciidoc/[Antora's Asciidoc primer] is a good starting point.
3535

3636
Similar to other markdown languages, most development environments support live preview for Asciidoc. For Visual Studio Code, link:https://marketplace.visualstudio.com/items?itemName=asciidoctor.asciidoctor-vscode[this extension] is recommended. It's advised to set the `asciidoc.preview.useEditorStyle` extension setting to `false` to get a preview look similar to the Antora site and also enable the extension's `asciidoc.antora.enableAntoraSupport` option.
37+
38+
39+
=== ClangFormat
40+
41+
To ensure a consistent code style, we use a link:https://clang.llvm.org/docs/ClangFormat.html[ClangFormat] definition file. If you make changes to source code, make sure that file is used by your IDE or manually apply ClangFormat to the files you have changed.
42+
43+
Example:
44+
45+
[,bash]
46+
----
47+
cd attachments
48+
clang-format -i -- 15_hello_triangle.*
49+
----

antora/modules/ROOT/nav.adoc

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,14 @@
5252
* xref:15_GLTF_KTX2_Migration.adoc[Migrating to Modern Asset Formats: glTF and KTX2]
5353
* xref:16_Multiple_Objects.adoc[Rendering Multiple Objects]
5454
* xref:17_Multithreading.adoc[Multithreading]
55-
* xref:Building_a_Simple_Engine/introduction.adoc[Building a Simple Engine]
56-
** xref:Building_a_Simple_Engine/Engine_Architecture/01_introduction.adoc[Engine Architecture]
57-
** xref:Building_a_Simple_Engine/Camera_Transformations/01_introduction.adoc[Camera Transformations]
58-
** xref:Building_a_Simple_Engine/Lighting_Materials/01_introduction.adoc[Lighting & Materials]
59-
** xref:Building_a_Simple_Engine/GUI/01_introduction.adoc[GUI]
60-
** xref:Building_a_Simple_Engine/Loading_Models/01_introduction.adoc[Loading Models]
61-
** xref:Building_a_Simple_Engine/Subsystems/01_introduction.adoc[Subsystems]
62-
** xref:Building_a_Simple_Engine/Tooling/01_introduction.adoc[Tooling]
63-
** xref:Building_a_Simple_Engine/Mobile_Development/01_introduction.adoc[Mobile Development]
55+
* xref:courses/18_Ray_tracing/00_Overview.adoc[Ray Tracing]
56+
** xref:courses/18_Ray_tracing/00_Overview.adoc[Overview]
57+
** xref:courses/18_Ray_tracing/01_Dynamic_rendering.adoc[Dynamic rendering]
58+
** xref:courses/18_Ray_tracing/02_Acceleration_structures.adoc[Acceleration structures]
59+
** xref:courses/18_Ray_tracing/03_Ray_query_shadows.adoc[Ray query shadows]
60+
** xref:courses/18_Ray_tracing/04_TLAS_animation.adoc[TLAS animation]
61+
** xref:courses/18_Ray_tracing/05_Shadow_transparency.adoc[Shadow transparency]
62+
** xref:courses/18_Ray_tracing/06_Reflections.adoc[Reflections]
63+
** xref:courses/18_Ray_tracing/07_Conclusion.adoc[Conclusion]
6464
* xref:90_FAQ.adoc[FAQ]
65+
* link:https://github.com/KhronosGroup/Vulkan-Tutorial[GitHub Repository, window=_blank]

attachments/.clang-format

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: LLVM
4+
AccessModifierOffset: -2
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveAssignments: true
7+
AlignConsecutiveDeclarations: true
8+
AlignEscapedNewlines: Left
9+
AlignOperands: true
10+
AlignTrailingComments: true
11+
AllowAllParametersOfDeclarationOnNextLine: true
12+
AllowShortBlocksOnASingleLine: false
13+
AllowShortCaseLabelsOnASingleLine: false
14+
AllowShortFunctionsOnASingleLine: None
15+
AllowShortIfStatementsOnASingleLine: false
16+
AllowShortLoopsOnASingleLine: false
17+
AlwaysBreakAfterDefinitionReturnType: None
18+
AlwaysBreakAfterReturnType: None
19+
AlwaysBreakBeforeMultilineStrings: false
20+
AlwaysBreakTemplateDeclarations: true
21+
BinPackArguments: true
22+
BinPackParameters: true
23+
BraceWrapping:
24+
AfterCaseLabel: true
25+
AfterClass: true
26+
AfterControlStatement: true
27+
AfterEnum: true
28+
AfterFunction: true
29+
AfterNamespace: true
30+
AfterObjCDeclaration: true
31+
AfterStruct: true
32+
AfterUnion: true
33+
AfterExternBlock: true
34+
BeforeCatch: true
35+
BeforeElse: true
36+
IndentBraces: false
37+
SplitEmptyFunction: false
38+
SplitEmptyRecord: false
39+
SplitEmptyNamespace: false
40+
BreakBeforeBinaryOperators: None
41+
BreakBeforeBraces: Custom
42+
BreakBeforeInheritanceComma: false
43+
BreakBeforeTernaryOperators: false
44+
BreakConstructorInitializersBeforeComma: false
45+
BreakConstructorInitializers: AfterColon
46+
BreakAfterJavaFieldAnnotations: false
47+
BreakStringLiterals: true
48+
ColumnLimit: 0
49+
CommentPragmas: '^ IWYU pragma:'
50+
CompactNamespaces: false
51+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
52+
ConstructorInitializerIndentWidth: 4
53+
ContinuationIndentWidth: 4
54+
Cpp11BracedListStyle: true
55+
DerivePointerAlignment: false
56+
DisableFormat: false
57+
ExperimentalAutoDetectBinPacking: false
58+
FixNamespaceComments: true
59+
ForEachMacros:
60+
- foreach
61+
- Q_FOREACH
62+
- BOOST_FOREACH
63+
IncludeBlocks: Preserve
64+
IncludeIsMainRegex: '(Test)?$'
65+
IndentCaseLabels: true
66+
IndentPPDirectives: AfterHash
67+
IndentWidth: 4
68+
IndentWrappedFunctionNames: true
69+
JavaScriptQuotes: Leave
70+
JavaScriptWrapImports: true
71+
KeepEmptyLinesAtTheStartOfBlocks: false
72+
MacroBlockBegin: ''
73+
MacroBlockEnd: ''
74+
MaxEmptyLinesToKeep: 1
75+
NamespaceIndentation: None
76+
ObjCBinPackProtocolList: Auto
77+
ObjCBlockIndentWidth: 2
78+
ObjCSpaceAfterProperty: false
79+
ObjCSpaceBeforeProtocolList: true
80+
PenaltyBreakAssignment: 2
81+
PenaltyBreakBeforeFirstCallParameter: 19
82+
PenaltyBreakComment: 300
83+
PenaltyBreakFirstLessLess: 120
84+
PenaltyBreakString: 1000
85+
PenaltyExcessCharacter: 1000000
86+
PenaltyReturnTypeOnItsOwnLine: 60
87+
PointerAlignment: Right
88+
ReflowComments: true
89+
SortIncludes: true
90+
SortUsingDeclarations: true
91+
SpaceAfterCStyleCast: true
92+
SpaceAfterTemplateKeyword: true
93+
SpaceBeforeAssignmentOperators: true
94+
SpaceBeforeCtorInitializerColon: true
95+
SpaceBeforeInheritanceColon: true
96+
SpaceBeforeParens: ControlStatements
97+
SpaceBeforeRangeBasedForLoopColon: true
98+
SpaceInEmptyParentheses: false
99+
SpacesBeforeTrailingComments: 8
100+
SpacesInAngles: false
101+
SpacesInContainerLiterals: false
102+
SpacesInCStyleCastParentheses: false
103+
SpacesInParentheses: false
104+
SpacesInSquareBrackets: false
105+
Standard: Cpp11
106+
TabWidth: 4
107+
UseTab: ForIndentation
108+
---
109+
Language: ObjC
110+
DisableFormat: true
111+
...

attachments/00_base_code.cpp

Lines changed: 51 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,74 @@
11
#include <memory>
2-
#ifdef __INTELLISENSE__
3-
#include <vulkan/vulkan_raii.hpp>
2+
#if defined(__INTELLISENSE__) || !defined(USE_CPP20_MODULES)
3+
# include <vulkan/vulkan_raii.hpp>
44
#else
55
import vulkan_hpp;
66
#endif
7-
#include <vulkan/vk_platform.h>
87
#include <GLFW/glfw3.h>
98

9+
#include <cstdlib>
1010
#include <iostream>
1111
#include <stdexcept>
12-
#include <cstdlib>
1312

14-
const uint32_t WIDTH = 800;
13+
const uint32_t WIDTH = 800;
1514
const uint32_t HEIGHT = 600;
1615

17-
class HelloTriangleApplication {
18-
public:
19-
void run() {
20-
initWindow();
21-
initVulkan();
22-
mainLoop();
23-
cleanup();
24-
}
25-
26-
private:
27-
GLFWwindow* window = nullptr;
16+
class HelloTriangleApplication
17+
{
18+
public:
19+
void run()
20+
{
21+
initWindow();
22+
initVulkan();
23+
mainLoop();
24+
cleanup();
25+
}
2826

29-
void initWindow() {
30-
glfwInit();
27+
private:
28+
GLFWwindow *window = nullptr;
3129

32-
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
33-
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
30+
void initWindow()
31+
{
32+
glfwInit();
3433

35-
window = glfwCreateWindow(WIDTH, HEIGHT, "Vulkan", nullptr, nullptr);
36-
}
34+
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
35+
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
3736

38-
void initVulkan() {
37+
window = glfwCreateWindow(WIDTH, HEIGHT, "Vulkan", nullptr, nullptr);
38+
}
3939

40-
}
40+
void initVulkan()
41+
{
42+
}
4143

42-
void mainLoop() {
43-
while (!glfwWindowShouldClose(window)) {
44-
glfwPollEvents();
45-
}
46-
}
44+
void mainLoop()
45+
{
46+
while (!glfwWindowShouldClose(window))
47+
{
48+
glfwPollEvents();
49+
}
50+
}
4751

48-
void cleanup() {
49-
glfwDestroyWindow(window);
52+
void cleanup()
53+
{
54+
glfwDestroyWindow(window);
5055

51-
glfwTerminate();
52-
}
56+
glfwTerminate();
57+
}
5358
};
5459

55-
int main() {
56-
try {
57-
HelloTriangleApplication app;
58-
app.run();
59-
} catch (const std::exception& e) {
60-
std::cerr << e.what() << std::endl;
61-
return EXIT_FAILURE;
62-
}
60+
int main()
61+
{
62+
try
63+
{
64+
HelloTriangleApplication app;
65+
app.run();
66+
}
67+
catch (const std::exception &e)
68+
{
69+
std::cerr << e.what() << std::endl;
70+
return EXIT_FAILURE;
71+
}
6372

64-
return EXIT_SUCCESS;
73+
return EXIT_SUCCESS;
6574
}

0 commit comments

Comments
 (0)