diff --git a/en/02_Development_environment.adoc b/en/02_Development_environment.adoc index f236bbb..16fb0ee 100644 --- a/en/02_Development_environment.adoc +++ b/en/02_Development_environment.adoc @@ -38,6 +38,8 @@ The `Bin` directory also contains the binaries of the Vulkan loader and the vali Lastly, there's the `Include` directory that contains the Vulkan headers. Feel free to explore the other files, but we won't need them for this tutorial. +The installer also sets the system environment variable `VULKAN_SDK` to the directory where the SDK is installed. That means we can easily access it's folder by using `%VULKAN_SDK%` instead of having to explicitly specify the versioned SDK folder names. This also makes updating to a new SDK dead simple, as the installer updates that variable to point at the new SDK instead. + === GLFW As mentioned before, Vulkan by itself is a platform agnostic API and does not include tools for creating a window to display the rendered results. @@ -47,8 +49,9 @@ There are other libraries available for this purpose, like https://www.libsdl.or You can find the latest release of GLFW on the http://www.glfw.org/download.html[official website]. In this tutorial we'll be using the 64-bit binaries, but you can of course also choose to build in 32 bit mode. In that case make sure to link with the Vulkan SDK binaries in the `Lib32` directory instead of `Lib`. -After downloading it, extract the archive to a convenient location. -I've chosen to create a `Libraries` directory in the Visual Studio directory under documents. +After downloading it, extract the archive to a convenient location like `C:\Vulkan-Tutorial`. + +Extract glfw there so that you have a path called `C:\Vulkan-Tutorial\glfw` with contents similar to this: image::/images/glfw_directory.png[] @@ -57,8 +60,13 @@ image::/images/glfw_directory.png[] Unlike DirectX 12, Vulkan does not include a library for linear algebra operations, so we'll have to download one. http://glm.g-truc.net/[GLM] is a nice library that is designed for use with graphics APIs and is also commonly used with OpenGL. -GLM is a header-only library, so just download the https://github.com/g-truc/glm/releases[latest version] and store it in a convenient location. -You should have a directory structure similar to the following now: +GLM is a header-only library, so just download the https://github.com/g-truc/glm/releases[latest version] and store it in a convenient location like `C:\Vulkan-Tutorial`. + +Extract glm there so that you have a folder called `C:\Vulkan-Tutorial\glm` with contents similar to this: + +image::/images/glm_directory.png[] + +After setting up glfw and glm, you should now have a directory structure similar to the following: image::/images/library_directory.png[] @@ -148,6 +156,8 @@ And add the locations of the object files for Vulkan and GLFW: image::/images/vs_link_dirs.png[] +NOTE: The GLFW folder you need to select depends on the Visual Studio version you are using. If you're using Visual Studio 2022 you need to select the `lib-vc2022` folder and if you e.g. use Visual Studio 2017 you select the `lib-vc2017` folder, etc. + Go to `+Linker -> Input+` and press `++` in the `Additional Dependencies` dropdown box. image::/images/vs_link_input.png[] @@ -182,7 +192,14 @@ You'll also need `make`. === Vulkan Packages -The most important components you'll need for developing Vulkan applications on Linux are the Vulkan loader, validation layers, and a couple of command-line utilities to test whether your machine is Vulkan-capable: +LunarG provides the Vulkan SDK for 64-bit Linux distribution. Installation depends on your distribution and installation: + +- link:https://vulkan.lunarg.com/doc/view/latest/linux/getting_started_ubuntu.html[Getting Started with the Ubuntu Vulkan SDK] +- link:https://vulkan.lunarg.com/doc/view/latest/linux/getting_started.html[Getting Started with the Linux Tarball Vulkan SDK] + +NOTE: Installing the SDK via the official guides from LunarG is the preferred way. This will install all required tools and components and also makes them globally available via the path environment variable. + +If your distribution isn't supported you can try to install the required SDK components used in this tutorial from different sources, but you may need to adjust some paths that are used in this tutorial to make things work: * `sudo apt install vulkan-tools` or `sudo dnf install vulkan-tools`: Command-line utilities, most importantly `vulkaninfo` and `vkcube`. Run these to confirm your machine supports Vulkan. @@ -191,8 +208,6 @@ The loader looks up the functions in the driver at runtime, similarly to GLEW fo * `sudo apt install vulkan-validationlayers-dev spirv-tools` or `sudo dnf install mesa-vulkan-devel vulkan-validation-layers-devel`: Installs the standard validation layers and required SPIR-V tools. These are crucial when debugging Vulkan applications, and we'll discuss them in the upcoming chapter. -On Arch Linux, you can run `sudo pacman -S vulkan-devel` to install all the required tools above. - If installation was successful, you should be all set with the Vulkan portion. Remember to run `vkcube` and ensure you see the following pop up in a window: diff --git a/en/03_Drawing_a_triangle/02_Graphics_pipeline_basics/01_Shader_modules.adoc b/en/03_Drawing_a_triangle/02_Graphics_pipeline_basics/01_Shader_modules.adoc index 60f9daa..9e9103d 100644 --- a/en/03_Drawing_a_triangle/02_Graphics_pipeline_basics/01_Shader_modules.adoc +++ b/en/03_Drawing_a_triangle/02_Graphics_pipeline_basics/01_Shader_modules.adoc @@ -205,8 +205,8 @@ Create a `compile.bat` file with the following contents: [,bash] ---- -C:/VulkanSDK/x.x.x.x/Bin/glslc.exe shader.vert -o vert.spv -C:/VulkanSDK/x.x.x.x/Bin/glslc.exe shader.frag -o frag.spv +%VULKAN_SDK%/Bin/glslc.exe shader.vert -o vert.spv +%VULKAN_SDK%/Bin/glslc.exe shader.frag -o frag.spv pause ---- @@ -219,11 +219,12 @@ Create a `compile.sh` file with the following contents: [,bash] ---- -/home/user/VulkanSDK/x.x.x.x/x86_64/bin/glslc shader.vert -o vert.spv -/home/user/VulkanSDK/x.x.x.x/x86_64/bin/glslc shader.frag -o frag.spv +glslc shader.vert -o vert.spv +glslc shader.frag -o frag.spv ---- -Replace the path to `glslc` with the path to where you installed the Vulkan SDK. +NOTE: If you have installed the Vulkan SDK tools like `glslc` are added to the path and there is no need to explicitly call them from a given path. If you have manually installed glslc you may need to prepend it's path to make this work. + Make the script executable with `chmod +x compile.sh` and run it. *End of platform-specific instructions* diff --git a/en/06_Texture_mapping/00_Images.adoc b/en/06_Texture_mapping/00_Images.adoc index e8c515c..0b55796 100644 --- a/en/06_Texture_mapping/00_Images.adoc +++ b/en/06_Texture_mapping/00_Images.adoc @@ -59,12 +59,12 @@ Add the directory with `stb_image.h` to the include directories for GCC: [,text] ---- -VULKAN_SDK_PATH = /home/user/VulkanSDK/x.x.x.x/x86_64 +VULKAN_SDK_PATH = /usr/include/vulkan STB_INCLUDE_PATH = /home/user/libraries/stb ... -CFLAGS = -std=c++17 -I$(VULKAN_SDK_PATH)/include -I$(STB_INCLUDE_PATH) +CFLAGS = -std=c++17 -I$(VULKAN_SDK_PATH) -I$(STB_INCLUDE_PATH) ---- == Loading an image diff --git a/en/08_Loading_models.adoc b/en/08_Loading_models.adoc index 73d31c6..02b4d8b 100644 --- a/en/08_Loading_models.adoc +++ b/en/08_Loading_models.adoc @@ -27,13 +27,13 @@ Add the directory with `tiny_obj_loader.h` to the include directories for GCC: [,text] ---- -VULKAN_SDK_PATH = /home/user/VulkanSDK/x.x.x.x/x86_64 +VULKAN_SDK_PATH = /usr/include/vulkan STB_INCLUDE_PATH = /home/user/libraries/stb TINYOBJ_INCLUDE_PATH = /home/user/libraries/tinyobjloader ... -CFLAGS = -std=c++17 -I$(VULKAN_SDK_PATH)/include -I$(STB_INCLUDE_PATH) -I$(TINYOBJ_INCLUDE_PATH) +CFLAGS = -std=c++17 -I$(VULKAN_SDK_PATH) -I$(STB_INCLUDE_PATH) -I$(TINYOBJ_INCLUDE_PATH) ---- == Sample mesh diff --git a/images/glfw_directory.png b/images/glfw_directory.png index afd450b..6a36e73 100644 Binary files a/images/glfw_directory.png and b/images/glfw_directory.png differ diff --git a/images/glm_directory.png b/images/glm_directory.png new file mode 100644 index 0000000..3e310dc Binary files /dev/null and b/images/glm_directory.png differ diff --git a/images/include_dirs_stb.png b/images/include_dirs_stb.png index 9035e76..f6e483c 100644 Binary files a/images/include_dirs_stb.png and b/images/include_dirs_stb.png differ diff --git a/images/include_dirs_tinyobjloader.png b/images/include_dirs_tinyobjloader.png index 4e2fbe3..6fe8afc 100644 Binary files a/images/include_dirs_tinyobjloader.png and b/images/include_dirs_tinyobjloader.png differ diff --git a/images/library_directory.png b/images/library_directory.png index 692349e..932811a 100644 Binary files a/images/library_directory.png and b/images/library_directory.png differ diff --git a/images/vs_include_dirs.png b/images/vs_include_dirs.png index def6bf6..e964f64 100644 Binary files a/images/vs_include_dirs.png and b/images/vs_include_dirs.png differ diff --git a/images/vs_link_dirs.png b/images/vs_link_dirs.png index e0c76f7..4855a39 100644 Binary files a/images/vs_link_dirs.png and b/images/vs_link_dirs.png differ