One stop solution for all Vulkan samples
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Jon Leech e93c9a6d97 Reinitialize vulkan submodule 8 months ago
.github Antora ci (#1046) 8 months ago
antora Add new sample for VK_EXT_host_image_copy (#1114) 10 months ago
app iOS / macOS build fixes, iOS Simulator for x86_64 hosts, VS and Xcode build/run configs (#1177) 8 months ago
assets@8db8ce9c52 Update assets submodule (#1166) 10 months ago
bldsys iOS / macOS build fixes, iOS Simulator for x86_64 hosts, VS and Xcode build/run configs (#1177) 8 months ago
components Improve Filesystem error messages and add .idea folder to .gitignore (#1175) 9 months ago
docs iOS / macOS build fixes, iOS Simulator for x86_64 hosts, VS and Xcode build/run configs (#1177) 8 months ago
framework iOS / macOS build fixes, iOS Simulator for x86_64 hosts, VS and Xcode build/run configs (#1177) 8 months ago
samples iOS / macOS build fixes, iOS Simulator for x86_64 hosts, VS and Xcode build/run configs (#1177) 8 months ago
scripts MSVC 17.8+ Fixes (#854) 2 years ago
shaders Fix #1066: Fix OIT blending (#1186) 9 months ago
third_party iOS / macOS build fixes, iOS Simulator for x86_64 hosts, VS and Xcode build/run configs (#1177) 8 months ago
.clang-format Fix #1006: Disable Objective-C in clang-format (#1012) 1 year ago
.copyrightignore Add new plugin: real time shader selection (#733) 1 year ago
.gitignore Improve Filesystem error messages and add .idea folder to .gitignore (#1175) 9 months ago
.gitlab-ci.yml Eliminate warnings from includes via the third_party libraries. (#974) 1 year ago
.gitmodules Add Tracy Profiler Support (#757) 11 months ago
.pre-commit-config.yaml Small batch mode fixes (#1036) 1 year ago
.snakeignore Initial commit 6 years ago
CMakeLists.txt Add Layer Settings API to framework, improve batch mode error recovery, fix macOS issues (#1084) 11 months ago
CODE_OF_CONDUCT.adoc Convert markdown documentation to asciidoc (#765) 2 years ago
CONTRIBUTING.adoc Update clang-format requirements in documentation (#1048) 1 year ago
CONTRIBUTORS.adoc Convert markdown documentation to asciidoc (#765) 2 years ago
LICENSE Initial commit 6 years ago
README.adoc Reinitialize vulkan submodule 8 months ago
_config.yml Gitpages uses jekyll which uses liquid to parse markdown files and any code block within said markdown files can use {} which causes a liquid syntax error and prevents the github pages from completing when branches are merged to main. (#546) 3 years ago
banner.jpg Initial commit 6 years ago

README.adoc

////
- Copyright (c) 2019-2024, Arm Limited and Contributors
-
- SPDX-License-Identifier: Apache-2.0
-
- Licensed under the Apache License, Version 2.0 the "License";
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
////
= Vulkan Samples
// omit in toc
:pp: {plus}{plus}
ifndef::site-gen-antora[]
:toc:
endif::[]

image::banner.jpg[Vulkan Samples banner]

ifndef::site-gen-antora[]
== Vulkan Documentation Site

Documentation for the samples is best viewed at the new link:https://docs.vulkan.org/samples/latest/README.html[Vulkan Documentation Site]. The documentation uses AsciiDoc which isn't fully supported by github.

endif::[]

== Introduction

The Vulkan Samples is collection of resources to help you develop optimized Vulkan applications.

If you are new to Vulkan the xref:samples/api/README.adoc[API samples] are the right place to start.
Additionally you may find the following links useful:

ifdef::site-gen-antora[]
* xref:guide:ROOT:index.adoc[Vulkan Guide]
* xref:tutorial:ROOT:00_Introduction.adoc[Get Started in Vulkan]
endif::[]

ifndef::site-gen-antora[]
* https://github.com/KhronosGroup/Vulkan-Guide[Vulkan Guide]
* https://vulkan-tutorial.com/[Get Started in Vulkan]
endif::[]

xref:samples/performance/README.adoc[Performance samples] show the recommended best practice together with real-time profiling information.
They are more advanced but also contain a detailed tutorial with more in-detail explanations.

=== Goals

* Create a collection of resources that demonstrate best-practice recommendations in Vulkan
* Create tutorials that explain the implementation of best-practices and include performance analysis guides
* Create a xref:framework/README.adoc[framework] that can be used as reference material and also as a sandbox for advanced experimentation with Vulkan

== Samples

* xref:./samples/README.adoc[Listing of all samples available in this repository]

== General information

* *Project Basics*
** xref:./docs/misc.adoc#controls[Controls]
** xref:./docs/misc.adoc#debug-window[Debug window]
** xref:./scripts/README.adoc[Create a Sample]
* *Vulkan Essentials*
** xref:./samples/vulkan_basics.adoc[How does Vulkan compare to OpenGL ES?
What should you expect when targeting Vulkan?]
* *Misc*
** xref:./docs/misc.adoc#driver-version[Driver version]
** xref:./docs/memory_limits.adoc[Memory limits]

== Setup

Prerequisites: https://git-scm.com/downloads[git] with https://docs.github.com/en/repositories/working-with-files/managing-large-files/installing-git-large-file-storage[git large file storage (git-lfs)].

Clone the repo with submodules using the following command:

----
git clone --recurse-submodules https://github.com/KhronosGroup/Vulkan-Samples.git
cd Vulkan-Samples
----

Follow build instructions for your platform below.

[NOTE]
====
The full repository is very large, and some ISPs appear to have trouble
providing a robust connection to github while the clone is being made.

If you notice problems such as submodules downloading at reported rates in
the tens of kB/s, or fatal timeout errors occurring, these may be due to
network routing issues to github within your ISP's internal network, rather
than anything wrong in your own networking setup.

It can be very difficult to get ISPs to acknowledge such problems exist, much
less to fix them.

One workaround is to switch the repository to use ssh protocol prior to the
submodule download, which can be done via e.g.

[source,sh]
----
git clone git@github.com:KhronosGroup/Vulkan-Samples.git
cd Vulkan-Samples
perl -i -p -e 's|https://(.*?)/|git@\1:|g' .gitmodules
git submodule sync
git submodule update
----

While this can be a good alternative if you are running into this connection
issue, you must have GitHub ssh key authentication setup to use ssh
protocol - see
link:https://docs.github.com/en/authentication/connecting-to-github-with-ssh[Connecting
to GitHub with SSH] for details.
So it is a not a solution we can implement as the repository default.

Another option which may help is to run github through a VPN service.
====


== Build

=== Supported Platforms

* Windows - xref:./docs/build.adoc#windows[Build Guide]
* Linux - xref:./docs/build.adoc#linux[Build Guide]
* macOS - xref:./docs/build.adoc#macos[Build Guide]
* Android - xref:./docs/build.adoc#android[Build Guide]

== Usage

The following shows some example command line usage on how to configure and run the Vulkan Samples.

> Make sure that you are running the samples from the root directory of the repository.
> Otherwise the samples will not be able to find the assets.
> ./build/app/bin/<BuildType>/<Arch>/vulkan_samples

----
# For the entire usage use
vulkan_samples --help

# For subcommand usage use
vulkan_samples <sub_command> --help

# Run Swapchain Images sample
vulkan_samples sample swapchain_images

# Run AFBC sample in benchmark mode for 5000 frames
vulkan_samples sample afbc --benchmark --stop-after-frame 5000

# Run bonza test offscreen
vulkan_samples test bonza --headless

# Run all the performance samples for 10 seconds in each configuration
vulkan_samples batch --category performance --duration 10

# Run Swapchain Images sample on an Android device
adb shell am start-activity -n com.khronos.vulkan_samples/com.khronos.vulkan_samples.SampleLauncherActivity -e sample swapchain_images
----

== License

See link:LICENSE[LICENSE].

This project has some third-party dependencies, each of which may have independent licensing:

* https://github.com/ARM-software/astc-encoder[astc-encoder]: ASTC Evaluation Codec
* https://github.com/vit-vit/CTPL[CTPL]: Thread Pool Library
* https://github.com/docopt/docopt.cpp[docopt]: A C{pp}11 port of the Python argument parsing library
* https://github.com/glfw/glfw[glfw]: A multi-platform library for OpenGL, OpenGL ES, Vulkan, window and input
* https://github.com/g-truc/glm[glm]: OpenGL Mathematics
* https://github.com/KhronosGroup/glslang[glslang]: Shader front end and validator
* https://github.com/ocornut/imgui[dear imgui]: Immediate Mode Graphical User Interface
* https://github.com/ARM-software/HWCPipe[HWCPipe]: Interface to mobile Hardware Counters
* https://github.com/KhronosGroup/KTX-Software[KTX-Software]: Khronos Texture Library and Tools
* https://github.com/gabime/spdlog[spdlog]: Fast C{pp} logging library
* https://github.com/KhronosGroup/SPIRV-Cross[SPIRV-Cross]: Parses and converts SPIR-V to other shader languages
* https://github.com/nothings/stb[stb]: Single-file public domain (or MIT licensed) libraries
* https://github.com/syoyo/tinygltf[tinygltf]: Header only C{pp}11 glTF 2.0 file parser
* https://github.com/nlohmann/json[nlohmann json]: C{pp} JSON Library (included by https://github.com/syoyo/tinygltf[tinygltf])
* https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator[vma]: Vulkan Memory Allocator
* https://github.com/zeux/volk[volk]: Meta loader for Vulkan API
* https://github.com/KhronosGroup/Vulkan-Docs[vulkan]: Sources for the formal documentation of the Vulkan API

This project uses assets from https://github.com/KhronosGroup/Vulkan-Samples-Assets[vulkan-samples-assets].
Each one has its own license.

=== Trademarks

Vulkan is a registered trademark of the Khronos Group Inc.

== Contributions

Donated to Khronos by Arm, with further contributions by Sascha Willems and Adam Sawicki.
See xref:CONTRIBUTORS.adoc[CONTRIBUTORS] for the full contributor list.

Also see xref:CONTRIBUTING.adoc[CONTRIBUTING] for contribution guidelines.

== Related resources

* https://developer.arm.com/documentation/101897/latest/[Mali GPU Best Practices]: A document with recommendations for efficient API usage