Skip to content

Commit 7a7a6b1

Browse files
Release 1.0.0
0 parents  commit 7a7a6b1

File tree

255 files changed

+30426
-0
lines changed

Some content is hidden

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

255 files changed

+30426
-0
lines changed

.clang-format

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
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+
AfterClass: true
25+
AfterControlStatement: true
26+
AfterEnum: true
27+
AfterFunction: true
28+
AfterNamespace: true
29+
AfterObjCDeclaration: true
30+
AfterStruct: true
31+
AfterUnion: true
32+
AfterExternBlock: true
33+
BeforeCatch: true
34+
BeforeElse: true
35+
IndentBraces: false
36+
SplitEmptyFunction: false
37+
SplitEmptyRecord: false
38+
SplitEmptyNamespace: false
39+
BreakBeforeBinaryOperators: None
40+
BreakBeforeBraces: Custom
41+
BreakBeforeInheritanceComma: false
42+
BreakBeforeTernaryOperators: false
43+
BreakConstructorInitializersBeforeComma: false
44+
BreakConstructorInitializers: AfterColon
45+
BreakAfterJavaFieldAnnotations: false
46+
BreakStringLiterals: true
47+
ColumnLimit: 0
48+
CommentPragmas: '^ IWYU pragma:'
49+
CompactNamespaces: false
50+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
51+
ConstructorInitializerIndentWidth: 4
52+
ContinuationIndentWidth: 4
53+
Cpp11BracedListStyle: true
54+
DerivePointerAlignment: false
55+
DisableFormat: false
56+
ExperimentalAutoDetectBinPacking: false
57+
FixNamespaceComments: true
58+
ForEachMacros:
59+
- foreach
60+
- Q_FOREACH
61+
- BOOST_FOREACH
62+
IncludeBlocks: Preserve
63+
IncludeIsMainRegex: '(Test)?$'
64+
IndentCaseLabels: true
65+
IndentPPDirectives: AfterHash
66+
IndentWidth: 4
67+
IndentWrappedFunctionNames: true
68+
JavaScriptQuotes: Leave
69+
JavaScriptWrapImports: true
70+
KeepEmptyLinesAtTheStartOfBlocks: false
71+
MacroBlockBegin: ''
72+
MacroBlockEnd: ''
73+
MaxEmptyLinesToKeep: 1
74+
NamespaceIndentation: None
75+
ObjCBinPackProtocolList: Auto
76+
ObjCBlockIndentWidth: 2
77+
ObjCSpaceAfterProperty: false
78+
ObjCSpaceBeforeProtocolList: true
79+
PenaltyBreakAssignment: 2
80+
PenaltyBreakBeforeFirstCallParameter: 19
81+
PenaltyBreakComment: 300
82+
PenaltyBreakFirstLessLess: 120
83+
PenaltyBreakString: 1000
84+
PenaltyExcessCharacter: 1000000
85+
PenaltyReturnTypeOnItsOwnLine: 60
86+
PointerAlignment: Right
87+
ReflowComments: true
88+
SortIncludes: true
89+
SortUsingDeclarations: true
90+
SpaceAfterCStyleCast: true
91+
SpaceAfterTemplateKeyword: true
92+
SpaceBeforeAssignmentOperators: true
93+
SpaceBeforeCtorInitializerColon: true
94+
SpaceBeforeInheritanceColon: true
95+
SpaceBeforeParens: ControlStatements
96+
SpaceBeforeRangeBasedForLoopColon: true
97+
SpaceInEmptyParentheses: false
98+
SpacesBeforeTrailingComments: 8
99+
SpacesInAngles: false
100+
SpacesInContainerLiterals: false
101+
SpacesInCStyleCastParentheses: false
102+
SpacesInParentheses: false
103+
SpacesInSquareBrackets: false
104+
Standard: Cpp11
105+
TabWidth: 4
106+
UseTab: ForIndentation
107+
...

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
assets/scenes
2+
build
3+
.vs
4+
.vscode

.gitlab-ci.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
stages:
2+
- CppCheck
3+
- Build
4+
5+
ClangFormat:
6+
stage: CppCheck
7+
image: $DOCKER_REGISTRY/docker/cpp-code-check/linux:latest
8+
tags:
9+
- linux
10+
- docker
11+
script:
12+
- git clang-format -v --diff origin/develop
13+
14+
ClangTidy:
15+
stage: CppCheck
16+
image: $DOCKER_REGISTRY/docker/cpp-code-check/linux:latest
17+
variables:
18+
GIT_SUBMODULE_STRATEGY: recursive
19+
tags:
20+
- linux
21+
- docker
22+
script:
23+
- cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -H. -Bbuild
24+
- python3 /usr/local/bin/run-clang-tidy.py -p build -clang-tidy-binary=clang-tidy-8 -header-filter=.*,-third_party -checks=-*,google-*,-google-runtime-references -quiet framework samples app
25+
26+
Linux:
27+
stage: Build
28+
image: $DOCKER_REGISTRY/docker/vulkan-cookbook/linux:latest
29+
variables:
30+
GIT_SUBMODULE_STRATEGY: recursive
31+
tags:
32+
- linux
33+
- docker
34+
script:
35+
- cmake -H. -Bbuild
36+
- cmake --build build --target vulkan_best_practice --config Release
37+
38+
Windows:
39+
stage: Build
40+
variables:
41+
GIT_SUBMODULE_STRATEGY: recursive
42+
tags:
43+
- windows
44+
- shell
45+
script:
46+
- cmake -H. -Bbuild
47+
- cmake --build build --target vulkan_best_practice --config Release
48+
49+
Android:
50+
stage: Build
51+
image: $DOCKER_REGISTRY/docker/vulkan-cookbook/linux-android:latest
52+
variables:
53+
GIT_SUBMODULE_STRATEGY: recursive
54+
tags:
55+
- linux
56+
- docker
57+
script:
58+
- cmake -DCMAKE_TOOLCHAIN_FILE=bldsys/toolchain/android_gradle.cmake -H. -Bbuild
59+
- cmake --build build --target vulkan_best_practice --config Release

.gitmodules

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[submodule "third_party/volk"]
2+
path = third_party/volk
3+
url = https://github.com/zeux/volk
4+
[submodule "third_party/glm"]
5+
path = third_party/glm
6+
url = git://github.com/g-truc/glm
7+
[submodule "third_party/stb"]
8+
path = third_party/stb
9+
url = https://github.com/nothings/stb
10+
[submodule "third_party/imgui"]
11+
path = third_party/imgui
12+
url = https://github.com/ocornut/imgui
13+
[submodule "third_party/tinygltf"]
14+
path = third_party/tinygltf
15+
url = https://github.com/syoyo/tinygltf
16+
[submodule "third_party/vulkan"]
17+
path = third_party/vulkan
18+
url = https://github.com/KhronosGroup/Vulkan-Docs.git
19+
[submodule "third_party/glfw"]
20+
path = third_party/glfw
21+
url = https://github.com/glfw/glfw.git
22+
[submodule "third_party/glslang"]
23+
path = third_party/glslang
24+
url = https://github.com/KhronosGroup/glslang.git
25+
[submodule "third_party/spirv-cross"]
26+
path = third_party/spirv-cross
27+
url = https://github.com/KhronosGroup/SPIRV-Cross.git
28+
[submodule "third_party/hwcpipe"]
29+
path = third_party/hwcpipe
30+
url = https://github.com/ARM-software/HWCPipe.git
31+
[submodule "third_party/vma"]
32+
path = third_party/vma
33+
url = https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git

CMakeLists.txt

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Copyright (c) 2019, Arm Limited and Contributors
2+
#
3+
# SPDX-License-Identifier: MIT
4+
#
5+
# Permission is hereby granted, free of charge,
6+
# to any person obtaining a copy of this software and associated documentation files (the "Software"),
7+
# to deal in the Software without restriction, including without limitation the rights to
8+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
9+
# and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10+
#
11+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12+
#
13+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
14+
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17+
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19+
#
20+
21+
cmake_minimum_required(VERSION 3.6)
22+
23+
project(vulkan_best_practice)
24+
25+
# Add path for local cmake scripts
26+
list(APPEND CMAKE_MODULE_PATH
27+
${CMAKE_SOURCE_DIR}/bldsys/cmake
28+
${CMAKE_SOURCE_DIR}/bldsys/cmake/module)
29+
30+
include(utils)
31+
include(global_options)
32+
include(sample_helper)
33+
34+
# Add third party libraries
35+
add_subdirectory(third_party)
36+
37+
# Add vulkan framework
38+
add_subdirectory(framework)
39+
40+
# Add vulkan samples
41+
add_subdirectory(samples)
42+
43+
# Add vulkan app (runs all samples)
44+
add_subdirectory(vulkan_best_practice)

LICENSE

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Copyright (c) 2018, Arm Limited and Contributors
2+
3+
SPDX-License-Identifier: MIT
4+
5+
Permission is hereby granted, free of charge,
6+
to any person obtaining a copy of this software and associated documentation files (the "Software"),
7+
to deal in the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
9+
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
14+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
<!--
2+
- Copyright (c) 2019, Arm Limited and Contributors
3+
-
4+
- SPDX-License-Identifier: MIT
5+
-
6+
- Permission is hereby granted, free of charge,
7+
- to any person obtaining a copy of this software and associated documentation files (the "Software"),
8+
- to deal in the Software without restriction, including without limitation the rights to
9+
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
10+
- and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
11+
-
12+
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13+
-
14+
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15+
- INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17+
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18+
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20+
-
21+
-->
22+
23+
# Vulkan Best Practice for Mobile Developers <!-- omit in toc -->
24+
25+
![Vulkan Best Practice for Mobile Developers banner](banner.jpg)
26+
27+
## Contents <!-- omit in toc -->
28+
29+
- [Introduction](#introduction)
30+
- [Goals](#goals)
31+
- [Tutorials](#tutorials)
32+
- [Setup](#setup)
33+
- [Build](#build)
34+
- [Supported Platforms](#supported-platforms)
35+
- [License](#license)
36+
- [Trademarks](#trademarks)
37+
38+
## Introduction
39+
40+
The Vulkan Best Practice for Mobile Developers is collection of resources to help you develop optimized Vulkan applications for mobile platforms.
41+
42+
### Goals
43+
- Create a collection of resources that demonstrate best-practice recommendations in Vulkan
44+
- Create tutorials that explain the implementation of best-practices and include performance analysis guides
45+
- Create a framework that can be used as reference material and also as a sandbox for advanced experimentation with Vulkan
46+
47+
> **Disclaimer:** This project covers advanced vulkan concepts. If you are new to Vulkan here are a few links to get you started:
48+
> - [Beginners Guide to Vulkan](https://www.khronos.org/blog/beginners-guide-to-vulkan)
49+
> - [Get Started in Vulkan](https://vulkan-tutorial.com/)
50+
51+
## Tutorials
52+
- **General**
53+
- [Controls](./docs/controls.md)
54+
- [Create a Sample](./docs/create_sample.md)
55+
- **Vulkan Essentials**
56+
- [How does Vulkan compare to OpenGL ES? What should you expect when targeting Vulkan?](./samples/vulkan_basics.md)
57+
- **Vulkan Swapchains**
58+
More detailed look at swapchains, and how you might want to use them
59+
- [Appropriate use of N-buffering](./samples/swapchain_images/swapchain_images_tutorial.md)
60+
- [Appropriate use of surface rotation](./samples/surface_rotation/surface_rotation_tutorial.md)
61+
- **Render Passes**
62+
- [Appropriate use of load/store operations, and use of transient attachments](./samples/render_passes/render_passes_tutorial.md)
63+
- **AFBC**
64+
- [Appropriate use of AFBC](./samples/afbc/afbc_tutorial.md)
65+
66+
## Setup
67+
68+
Clone the repo with submodules using the following command:
69+
70+
```
71+
git clone --recurse-submodules https://github.com/ARM-software/vulkan_best_practice_for_mobile_developers.git
72+
cd vulkan_best_practice_for_mobile_developers
73+
```
74+
75+
Follow build instructions for your platform below.
76+
77+
## Build
78+
79+
### Supported Platforms
80+
- Windows - [Build Guide](./docs/build.md#windows "Windows Build Guide")
81+
- Linux - [Build Guide](./docs/build.md#linux "Linux Build Guide")
82+
- Android - [Build Guide](./docs/build.md#android "Android Build Guide")
83+
<!-- - Mac OSX (Experimental) - [Build Guide](./build.md#mac "Mac OSX Build Guide") -->
84+
85+
> Tested on: Samsung Galaxy S9, Samsung Galaxy S10, Huawei Mate 20 Pro, OPPO R15
86+
87+
## License
88+
89+
See [LICENSE](LICENSE).
90+
91+
This project has some third-party dependencies, each of which may have independent licensing:
92+
93+
- [glfw](https://github.com/glfw/glfw): A multi-platform library for OpenGL, OpenGL ES, Vulkan, window and input
94+
- [glm](https://github.com/g-truc/glm): OpenGL Mathematics
95+
- [glslang](https://github.com/KhronosGroup/glslang): Shader front end and validator
96+
- [HWCPipe](https://github.com/ARM-software/HWCPipe): Interface to mobile Hardware Counters
97+
- [dear imgui](https://github.com/ocornut/imgui): Immediate Mode Graphical User Interface
98+
- [dear imgui shaders](https://github.com/SaschaWillems/Vulkan/tree/master/data/shaders/imgui): GLSL shaders for dear imgui
99+
- [SPIRV-Cross](https://github.com/KhronosGroup/SPIRV-Cross): Parses and converts SPIR-V to other shader languages
100+
- [stb](https://github.com/nothings/stb): Single-file public domain (or MIT licensed) libraries
101+
- [tinygltf](https://github.com/syoyo/tinygltf): Header only C++11 tiny glTF 2.0 library
102+
- [vma](https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator): Vulkan Memory Allocator
103+
- [volk](https://github.com/zeux/volk): Meta loader for Vulkan API
104+
- [vulkan](https://github.com/KhronosGroup/Vulkan-Docs): Sources for the formal documentation of the Vulkan API
105+
106+
This project uses the following 3D models. Each one has its own licence.
107+
108+
- Sponza [license](https://creativecommons.org/licenses/by/3.0/) with the following modifications:
109+
- All textures are converted to ASTC in .ktx format.
110+
- Converted to gltf using [Blender exporter](https://github.com/KhronosGroup/glTF-Blender-IO).
111+
112+
Models downloaded from Morgan McGuire's [Computer Graphics Archive](https://casual-effects.com/data).
113+
114+
### Trademarks
115+
116+
Vulkan is a registered trademark of the Khronos Group Inc.

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.0.0

0 commit comments

Comments
 (0)