Skip to content

Commit 2fd20f4

Browse files
committed
Merge branch 'main' into feature/translations
2 parents 71d5731 + fff6ec7 commit 2fd20f4

Some content is hidden

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

60 files changed

+2511
-54
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
push:
44
branches-ignore:
55
- staging
6+
- production
67
jobs:
78
format-check:
89
runs-on: ubuntu-latest

.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
name: Deploy
1+
name: deploy
22
on:
33
push:
44
branches:
5-
- main
5+
- production
66
- staging
77
jobs:
88
deploy:

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
11
# Learn Vulkan
22

33
[![Build status](https://github.com/cpp-gamedev/learn-vulkan/actions/workflows/ci.yml/badge.svg)](https://github.com/cpp-gamedev/learn-vulkan/actions/workflows/ci.yml)
4+
5+
This repository hosts the [learn-vulkan](https://cpp-gamedev.github.io/learn-vulkan/) guide's C++ source code. It also hosts the sources of the [guide](./guide) itself.
6+
7+
## Building
8+
9+
### Requirements
10+
11+
- CMake 3.24+
12+
- C++23 compiler and standard library
13+
- [Linux] [GLFW dependencies](https://www.glfw.org/docs/latest/compile_guide.html#compile_deps_wayland) for X11 and Wayland
14+
15+
### Steps
16+
17+
Standard CMake workflow. Using presets is recommended, in-source builds are not recommended. See the [CI script](.github/workflows/ci.yml) for building on the command line.
18+
19+
## Branches
20+
21+
1. `main`^: latest, stable code (builds and runs), stable history (never rewritten)
22+
1. `production`^: guide deployment (live), stable code and history
23+
1. `section/*`^: reflection of source at the end of corresponding section in the guide, stable code
24+
1. `feature/*`: potential upcoming feature, shared contributions, stable history
25+
1. others: unstable
26+
27+
_^ rejects direct pushes (PR required)_
28+
29+
[Original Repository](https://github.com/cpp-gamedev/learn-vulkan)

assets/shader.frag

280 Bytes
Binary file not shown.

assets/shader.vert

496 Bytes
Binary file not shown.

ext/CMakeLists.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ target_compile_definitions(glm PUBLIC
2727
message(STATUS "[Vulkan-Headers]")
2828
add_subdirectory(src/Vulkan-Headers)
2929

30+
# add VulkanMemoryAllocator to build tree
31+
message(STATUS "[VulkanMemoryAllocator]")
32+
add_subdirectory(src/VulkanMemoryAllocator)
33+
3034
# setup Dear ImGui library
3135
message(STATUS "[Dear ImGui]")
3236
add_library(imgui)
@@ -55,6 +59,28 @@ target_sources(imgui PRIVATE
5559
src/imgui/backends/imgui_impl_vulkan.h
5660
)
5761

62+
# setup vma library (source file with VMA interface)
63+
message(STATUS "[vma]")
64+
add_library(vma)
65+
add_library(vma::vma ALIAS vma)
66+
target_link_libraries(vma PUBLIC
67+
Vulkan::Headers
68+
GPUOpen::VulkanMemoryAllocator
69+
)
70+
target_include_directories(vma SYSTEM PUBLIC
71+
src/VulkanMemoryAllocator/include
72+
)
73+
target_compile_definitions(vma PUBLIC
74+
VMA_STATIC_VULKAN_FUNCTIONS=0
75+
VMA_DYNAMIC_VULKAN_FUNCTIONS=1
76+
)
77+
target_sources(vma PRIVATE
78+
vk_mem_alloc.cpp
79+
)
80+
81+
# ignore compiler warnings
82+
target_compile_options(vma PRIVATE -w)
83+
5884
# declare ext library target
5985
add_library(${PROJECT_NAME} INTERFACE)
6086
add_library(learn-vk::ext ALIAS ${PROJECT_NAME})
@@ -63,6 +89,7 @@ add_library(learn-vk::ext ALIAS ${PROJECT_NAME})
6389
target_link_libraries(${PROJECT_NAME} INTERFACE
6490
glm::glm
6591
imgui::imgui
92+
vma::vma
6693
)
6794

6895
# setup preprocessor defines

ext/src.zip

186 KB
Binary file not shown.

ext/vk_mem_alloc.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#define VMA_IMPLEMENTATION
2+
3+
#include <vk_mem_alloc.h>

guide/src/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
# Introduction
22

3-
Vulkan is known for being explicit and verbose. But the _required_ verbosity has steadily reduced with each successive version, its new features, and previous extensions being absorbed into the core API. Similarly, RAII has been a pillar of C++ since its inception, yet most Vulkan guides do not utilize it, instead choosing to "extend" the explicitness by manually cleaning up resources.
3+
Vulkan is known for being explicit and verbose. But the _required_ verbosity has steadily reduced with each successive version, its new features, and previous extensions being absorbed into the core API. Similarly, RAII has been a pillar of C++ since its inception, yet most existing Vulkan tutorials do not utilize it, instead choosing to "extend" the explicitness by manually cleaning up resources.
44

55
To fill that gap, this guide has the following goals:
66

77
- Leverage modern C++, VulkanHPP, and Vulkan 1.3 features
88
- Focus on keeping it simple and straightforward, _not_ on performance
99
- Develop a basic but dynamic rendering foundation
1010

11-
To reiterate, the focus is _not on performance_, it is on a quick introduction to the current standard multi-platform graphics API while utilizing the modern paradigms and tools (at the time of writing). Even disregarding potential performance gains, Vulkan has a better and modern design and ecosystem than OpenGL, eg: there is no global state machine, parameters are passed by filling structs with meaningful member variable names, multi-threading is largely trivial (yes, it is actually easier to do on Vulkan than OpenGL), there are a comprehensive set of validation layers to catch misuse which can be enabled without _any_ changes to application code, etc.
11+
To reiterate, the focus is _not on performance_, it is on a quick introduction to the current standard multi-platform graphics API while utilizing the modern paradigms and tools (at the time of writing). Even disregarding potential performance gains, Vulkan has a better and more modern design and ecosystem than OpenGL, eg: there is no global state machine, parameters are passed by filling structs with meaningful member variable names, multi-threading is largely trivial (yes, it is actually easier to do on Vulkan than OpenGL), there are a comprehensive set of validation layers to catch misuse which can be enabled without _any_ changes to application code, etc.
12+
13+
For an in-depth Vulkan guide, the [official tutorial](https://docs.vulkan.org/tutorial/latest/00_Introduction.html) is recommended. [vkguide](https://vkguide.dev/) and the original [Vulkan Tutorial](https://vulkan-tutorial.com/) are also very popular and intensely detailed.
1214

1315
## Target Audience
1416

@@ -30,4 +32,3 @@ Some examples of what this guide _does not_ focus on:
3032
## Source
3133

3234
The source code for the project (as well as this guide) is located in [this repository](https://github.com/cpp-gamedev/learn-vulkan). A `section/*` branch intends to reflect the state of the code at the end of a particular section of the guide. Bugfixes / changes are generally backported, but there may be some divergence from the current state of the code (ie, in `main`). The source of the guide itself is only up-to-date on `main`, changes are not backported.
33-

guide/src/SUMMARY.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,19 @@
3333
- [GLSL to SPIR-V](shader_objects/glsl_to_spir_v.md)
3434
- [Drawing a Triangle](shader_objects/drawing_triangle.md)
3535
- [Graphics Pipelines](shader_objects/pipelines.md)
36+
37+
# Shader Resources
38+
39+
- [Memory Allocation](memory/README.md)
40+
- [Vulkan Memory Allocator](memory/vma.md)
41+
- [Buffers](memory/buffers.md)
42+
- [Vertex Buffer](memory/vertex_buffer.md)
43+
- [Command Block](memory/command_block.md)
44+
- [Device Buffers](memory/device_buffers.md)
45+
- [Images](memory/images.md)
46+
- [Descriptor Sets](descriptor_sets/README.md)
47+
- [Pipeline Layout](descriptor_sets/pipeline_layout.md)
48+
- [Descriptor Buffer](descriptor_sets/descriptor_buffer.md)
49+
- [Texture](descriptor_sets/texture.md)
50+
- [View Matrix](descriptor_sets/view_matrix.md)
51+
- [Instanced Rendering](descriptor_sets/instanced_rendering.md)

0 commit comments

Comments
 (0)