Skip to content

Commit b94bd1b

Browse files
Merge branch 'main' into build_workflow_branch
2 parents 3ef1339 + 682e879 commit b94bd1b

File tree

270 files changed

+279059
-27136
lines changed

Some content is hidden

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

270 files changed

+279059
-27136
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+

.github/workflows/workflow.yml

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,13 @@ jobs:
9797
9898
tar -xJf vulkansdk-linux-x86_64-$VULKAN_VERSION.tar.xz
9999
100-
echo "VULKAN_SDK=$PWD/$VULKAN_VERSION/x86_64" >> $GITHUB_ENV
101-
echo "PATH=$PWD/$VULKAN_VERSION/x86_64/bin:$PATH" >> $GITHUB_ENV
102-
echo "LD_LIBRARY_PATH=$PWD/$VULKAN_VERSION/x86_64/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
103-
echo "VK_LAYER_PATH=$PWD/$VULKAN_VERSION/x86_64/etc/vulkan/explicit_layer.d" >> $GITHUB_ENV
100+
# Create/refresh a stable symlink to the latest SDK to avoid version-pinned paths in caches
101+
ln -sfn "$PWD/$VULKAN_VERSION" "$PWD/latest"
102+
103+
echo "VULKAN_SDK=$PWD/latest/x86_64" >> $GITHUB_ENV
104+
echo "PATH=$PWD/latest/x86_64/bin:$PATH" >> $GITHUB_ENV
105+
echo "LD_LIBRARY_PATH=$PWD/latest/x86_64/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
106+
echo "VK_LAYER_PATH=$PWD/latest/x86_64/etc/vulkan/explicit_layer.d" >> $GITHUB_ENV
104107
105108
cd ..
106109
deps-install: |
@@ -154,7 +157,14 @@ jobs:
154157
155158
$vulkanPath = ""
156159
if (Test-Path "C:\VulkanSDK") {
157-
$vulkanPath = Get-ChildItem "C:\VulkanSDK" | Sort-Object -Property Name -Descending | Select-Object -First 1 -ExpandProperty FullName
160+
# Prefer the 'Latest' junction if present, else pick the highest version folder
161+
if (Test-Path "C:\VulkanSDK\Latest") {
162+
$vulkanPath = "C:\VulkanSDK\Latest"
163+
} elseif (Test-Path "C:\VulkanSDK\latest") {
164+
$vulkanPath = "C:\VulkanSDK\latest"
165+
} else {
166+
$vulkanPath = Get-ChildItem "C:\VulkanSDK" | Where-Object { $_.PSIsContainer } | Sort-Object -Property Name -Descending | Select-Object -First 1 -ExpandProperty FullName
167+
}
158168
}
159169
if (-not $vulkanPath) {
160170
if (Test-Path "C:\VulkanSDK\latest") {
@@ -356,24 +366,20 @@ jobs:
356366
357367
- name: Cache build artifacts (Windows)
358368
if: runner.os == 'Windows'
359-
uses: actions/cache@v3
360-
with:
361-
path: |
362-
${{github.workspace}}/attachments/build
363-
key: ${{ runner.os }}-build-msvc-${{ hashFiles('**/CMakeLists.txt', 'scripts/install_dependencies_windows.bat') }}-${{ hashFiles('**/*.cpp', '**/*.h', '**/*.hpp') }}
364-
restore-keys: |
365-
${{ runner.os }}-build-msvc-${{ hashFiles('**/CMakeLists.txt', 'scripts/install_dependencies_windows.bat') }}-
366-
${{ runner.os }}-build-msvc-${{ hashFiles('**/CMakeLists.txt') }}-
367-
${{ runner.os }}-build-msvc-
369+
run: echo "Skipping build directory caching to avoid stale SDK paths"
368370

369371
- name: Configure CMake with MSVC (Windows)
370372
working-directory: ${{github.workspace}}/attachments
371373
if: runner.os == 'Windows'
372374
run: |
375+
# Ensure we always start from a clean configure to avoid stale paths
376+
if (Test-Path "build") { Remove-Item -Recurse -Force "build" }
377+
373378
cmake -B build -DCMAKE_BUILD_TYPE=Release `
374379
-DVulkan_INCLUDE_DIR="$env:Vulkan_INCLUDE_DIR" `
375380
-DVulkan_LIBRARY="$env:Vulkan_LIBRARY" `
376381
-DCMAKE_PREFIX_PATH="$env:VULKAN_SDK" `
382+
-DCMAKE_PROGRAM_PATH="$env:VULKAN_SDK\Bin" `
377383
-DCMAKE_TOOLCHAIN_FILE="$env:CMAKE_TOOLCHAIN_FILE" `
378384
-DCMAKE_C_COMPILER_LAUNCHER=sccache `
379385
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache `
@@ -398,13 +404,7 @@ jobs:
398404
399405
- name: Cache build artifacts (Ubuntu)
400406
if: runner.os == 'Linux'
401-
uses: actions/cache@v3
402-
with:
403-
path: ${{github.workspace}}/attachments/build
404-
key: ${{ runner.os }}-build-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('**/*.cpp') }}-${{ hashFiles('**/*.h') }}
405-
restore-keys: |
406-
${{ runner.os }}-build-${{ hashFiles('**/CMakeLists.txt') }}-
407-
${{ runner.os }}-build-
407+
run: echo "Skipping build directory caching to avoid stale SDK paths"
408408

409409
- name: Configure CMake (Unix)
410410
working-directory: ${{github.workspace}}/attachments
@@ -413,6 +413,9 @@ jobs:
413413
export CC="clang"
414414
export CXX="clang++"
415415
416+
# Ensure we always start from a clean configure to avoid stale paths
417+
rm -rf build
418+
416419
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \
417420
-DCMAKE_CXX_SCAN_FOR_MODULES=ON \
418421
-DCMAKE_CXX_FLAGS="-std=c++20" \

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,22 @@ convert.py
1313

1414
**/build/*
1515
**/vcpkg_installed/*
16+
attachments/build/**
17+
attachments/android/.gradle/**
18+
attachments/android/.idea
19+
attachments/android/.gradle/**
20+
attachments/android/app/.cxx/**
21+
attachments/android/app/build/**
22+
local.properties
23+
24+
attachments/simple_engine/build/**
25+
attachments/simple_engine/Assets/**
26+
attachments/simple_engine/android/.gradle/**
27+
attachments/simple_engine/android/.idea
28+
attachments/simple_engine/android/.gradle/**
29+
attachments/simple_engine/android/app/.cxx/**
30+
attachments/simple_engine/android/app/build/**
31+
attachments/simple_engine/android/app/build/**
32+
attachments/simple_engine/android/gradle/wrapper/**
33+
attachments/simple_engine/android/gradlew
34+
attachments/simple_engine/android/gradlew.bat

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+
----

README.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ It also contains Vulkan usage clarifications, improved synchronization and new c
2626
The repository is organized into several important directories:
2727

2828
* `en/` - Contains the tutorial content in English, organized by chapters
29+
** The main tutorial covers fundamental Vulkan concepts (chapters 00-17)
30+
** The "Building a Simple Engine" section builds upon these fundamentals to create a structured rendering engine
2931
* `attachments/` - Contains code examples, shader files, and resources used in the tutorial
3032
* `images/` - Contains illustrations, diagrams, and screenshots used in the tutorial
3133
* `scripts/` - Contains utility scripts, including dependency installation scripts

antora/modules/ROOT/nav.adoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +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: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]
5564
* 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+
...

0 commit comments

Comments
 (0)