Commit Graph

157 Commits

Author SHA1 Message Date
Alexander Overvoorde 71120ada6c Fix parts of the tutorial that weren't update to match the code (fixes #288) 2022-05-16 21:33:41 +02:00
Teodor Spæren e7fa7b1911 Fix small problem in "Depth buffering" (#289)
This code was still refering to `createCommandBuffers`  instead of `recordCommandBuffer`.
2022-05-16 21:23:19 +02:00
Alexander Overvoorde 536da67191 Fix syntax error & inconsistency in sample code 2022-05-07 17:05:55 +02:00
Teodor Spæren 8f6b5f013a Remove outdated reference to swapchain (#285)
This commit removes leftover references to the number of swapchain
images in the "Uniform buffers" chapter.
2022-05-02 20:28:15 +02:00
Alexander Overvoorde 1d540aca30 Fix typo (fixes #283) 2022-04-25 21:46:00 +02:00
Gleb Ezhov 7cc5485fb0 Redundant word removed (#282) 2022-04-19 21:51:18 +02:00
Alexander Overvoorde 364e69778a Add a note about the rear side of the model (fixes #277) 2022-03-29 18:44:31 +02:00
Alexander Overvoorde c6008b188f Fix code snippet that was not updated as part of #255 2022-03-08 21:41:52 +01:00
Alexander Overvoorde f7cf8dede8 Don't hardcode dynamicState count in code example 2022-03-08 21:29:56 +01:00
Alexander Overvoorde 0fd54b9ed4 Describe how to install libxxf86vm and libxi (fixes #275) 2022-03-08 21:26:58 +01:00
Onyrew e167e831e5 vkDestroyDescriptorPool added to Descriptor pool and sets (#273)
* vkDestroyDescriptorPool  added

* dots

* vkDestroyDescriptorPool added for French chapter
2022-03-01 22:40:26 +01:00
Thomas Perl 0252ce06fd Use std::numeric_limits<uint32_t>::max() 2022-02-21 21:08:56 +01:00
Charles Giessen 9fe64f9747 Edit tutorial to reset & record command buffers each frame (#255)
* Update tutorial for command buffer re-recording

Means the code now calls recordCommandBuffer every frame instead of ahead of time

Many changes to the structure of chapters 14 & 15, with small changes to subsequent
chapters.

Primary focus was shifting everything away from 'swapchain image count' to
MAX_FRAMES_IN_FLIGHT. This has caused a lot of chapter 15 to need to be rewritten.
Such as: Introducing fences alongside semaphores and not later; Waiting on a fence
at the start of the frame before introducing acquireNextImage; consolidating the
Frames In Flight concepts to apply to command buffers, fences, and semaphores at
the same time.

Chapter 14 saw command buffer allocation reduced to 1 at a time. This allows the
concept of Frames in Flight to not need introduction before having a triangle
drawing on the screen.

* Update introduction to semaphores and fences

Greatly improve the descriptions of semaphores and fences before their
introduction into the code. Provide examples with psuedo code.

By using max_frames_in_flight command buffers & semaphores, we dont
need to keep track of previously sumitted frames' fences and wait
on them "just in case". This removes a lot of the confusion I had
when I first was trying to understand the vulkan update loop.

* Remove accidental code changes

Un-comment vkDeviceWaitIdle and remove resizing of imagesInFlight (which was removed)

* Use uint32_t instead of size_t for currentFrame

* Address typos and fixup changes for re-recording command buffers PR

* Add description of fences needing explicit resetting while semaphores are automatic
* Elaborate on why 2 frames in flight are chosen

* Fix deadlock in resizing from resetting the fence too early

Because acquiring the swapchain image index may cause drawFrame to return early,
it was possible to cause the next vkWaitForFences to deadlock. By delaying fence
resetting till after acquiring, it prevents the deadlock.
2022-02-21 20:55:30 +01:00
Alexander Overvoorde 10118cbb0b Merge pull request #263 from SaschaWillems/update-links
Update links
2022-02-06 14:44:17 +01:00
Sascha Willems d49b1eb614 Updating 1.2 to 1.3 spec links 2022-02-06 14:23:30 +01:00
Sascha Willems 0b7627b458 Changed links according to QA
Use Vulkan 1.3 spec
2022-02-06 14:21:27 +01:00
Marco Rubin c8ed558b3d Add Arch Linux support
Added Arch Linux support, plus a "`make`" formatting fix.
2022-01-31 22:05:26 +00:00
Sascha Willems dbe5f41c3b Updated links to chunked Vulkan 1.2 spec 2022-01-22 12:54:38 +01:00
TheSusian f73cd6d830 Chnage createFrameBuffers to createFramebuffers
Chnage createFrameBuffers to createFramebuffers because it's written as "createFramebuffers" in the source code
2022-01-15 17:47:28 +03:00
Lars-Magnus Skog 55882b38fe Mention std::clamp in explanatory comment instead of min/max 2021-12-17 21:35:28 +01:00
Kevin Caccamo afcf5ca875 Update 04_Swap_chain_recreation.md
data -> date
2021-11-14 04:10:07 -05:00
Cat Lee Ball 92487f055d Update link to Ray Tracing book
It looks like the repo https://github.com/RayTracing/InOneWeekend now points to https://github.com/RayTracing/raytracing.github.io . Updated the link to reflect this.
2021-11-06 20:27:01 -07:00
Alexander Overvoorde efe561d4b2 Fix typo 2021-09-19 21:47:08 +02:00
Alexander Overvoorde 4ed54ab92e Remove reference to nonexistent validation layer warning (fixes #250) 2021-09-19 15:41:19 +02:00
Rithul Kamesh 8c7c6a69aa Update 00_Introduction.md 2021-08-23 18:25:14 +05:30
Rithul Kamesh 8fa068b91c Update 00_Introduction.md 2021-08-23 18:24:52 +05:30
Rithul Kamesh d57ebb6aba Apple M1 Added 2021-08-15 18:43:54 +05:30
TestingPlant 8ab351c4d4 Add extra braces when setting VkClearValue 2021-07-20 04:15:45 +00:00
Alexander Overvoorde 998f0d0c4a Properly remove GL_ARB_separate_shader_objects references (fixes #112) 2021-06-15 21:05:39 +02:00
Alexander Overvoorde e0c9a8a5a0 Replace min/max combination with clamp (resolves #240) 2021-06-13 17:51:33 +02:00
unknown a1756623b7 Initialize debugCreateInfo everywhere 2021-06-12 15:22:25 -06:00
Alexander Overvoorde b6ce4e5af0 Clarify presentation mode explanations (fixes #237) 2021-05-13 15:23:43 +02:00
Benson Muite 3a42c45fab Add instructions for Fedora setup 2021-04-08 16:12:55 +03:00
Alexander Overvoorde c66875d7c4 Be more explicit about extra include for std::min/std::max (fixes #225) 2021-02-20 12:43:13 +01:00
Alexander Overvoorde 86a80c78b6 Update 00_Window_surface.md 2021-01-29 22:46:56 +01:00
Saleh Ramezani 7a5edffa50 Update 00_Window_surface.md 2021-01-14 01:46:39 +03:30
Saleh Ramezani 4f9af2951c Update 00_Window_surface.md 2021-01-14 00:38:51 +03:30
Saleh Ramezani ce2473e913 Update 00_Window_surface.md 2021-01-14 00:33:05 +03:30
Alexander Overvoorde da1bff0d81 Merge pull request #218 from jsgoller1/patch-1
Add `spirv-tools` package to 02_Development_environment.md
2020-11-29 16:44:14 +01:00
Alexander Overvoorde 75f648e21e Fix maxSamplerAnisotropy limit not verified (fixes #216) 2020-11-29 16:42:47 +01:00
Joshua Goller cecd9afb6b Add `spirv-tools` package to 02_Development_environment.md
When doing the [validation layers tutorial](https://vulkan-tutorial.com/Drawing_a_triangle/Setup/Validation_layers), compiling and running the example produced the following error message:
```                                                                              
validation layer: libSPIRV-Tools-opt.so: cannot open shared object file: No such file or directory  
```
and no other validation layer output. After some Googling, I discovered that installing `spirv-tools` fixes the above error message, and correctly produces the expected warning messages:
```
VUID-VkDebugUtilsMessengerCreateInfoEXT-flags-zerobitmask(ERROR / SPEC): msgNum: 0 - vkCreateDebugUtilsMessengerEXT: parameter pCreateInfo->flags must be 0. The Vulkan spec states: flags must be 0 (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-VkDebugUtilsMessengerCreateInfoEXT-flags-zerobitmask)    Objects: 1        [0] 0, type: 0, name: NULL
validation layer: OBJ ERROR : For VkInstance 0x559e3f3bc200[], VkDebugUtilsMessengerEXT 0x10000000001[] has not been destroyed. The Vulkan spec states: All child objects created using instance must have been destroyed prior to destroying instance (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkDestroyInstance-instance-00629)validation layer: OBJ ERROR : For VkInstance 0x559e3f3bc200[], VkDebugUtilsMessengerEXT 0x10000000001[] has not been destroyed. The Vulkan spec states: All child objects created using instance must have been destroyed prior to destroying instance (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkDestroyInstance-instance-00629)
```

So this should be added to the Linux development environment setup instructions. 

## System info
(let me know if additional details are required)

Ubuntu 20.04.1 LTS, 64-bit
```
└─ $ ▶ uname -a 
Linux considerable-shouting 5.4.0-53-generic #59-Ubuntu SMP Wed Oct 21 09:38:44 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

└─ $ ▶ apt list --installed | grep vulkan
libvulkan-dev/focal,now 1.2.131.2-1 amd64 [installed]
libvulkan1/focal,now 1.2.131.2-1 amd64 [installed,automatic]
mesa-vulkan-drivers/focal-updates,now 20.0.8-0ubuntu1~20.04.1 amd64 [installed,automatic]
vulkan-tools/focal,now 1.2.131.1+dfsg1-1 amd64 [installed]
vulkan-validationlayers-dev/focal,now 1.2.131.2-1 amd64 [installed]
vulkan-validationlayers/focal,now 1.2.131.2-1 amd64 [installed,automatic]
```
2020-11-22 15:14:11 -08:00
Alexander Overvoorde d22199ca94 Fix mirrored texture coordinates in tutorial (fixes #215) 2020-11-12 22:30:54 +01:00
Alexander Overvoorde 955592bfea Fix potential synchronization problem with depth buffer transition and load operation 2020-11-06 22:26:23 +01:00
Alexander Overvoorde 274e8ad2bb Merge pull request #213 from maltekliemann/fix/combined-image-sampler-validation
Fix description of vkAllocateDescriptorSets error
2020-10-28 21:34:19 +01:00
Alexander Overvoorde f710a4864e Fix syntax error in depth chapter (thanks Nic Canning) 2020-10-27 21:20:48 +01:00
Alexander Overvoorde fa06d7f2f5 Merge pull request #212 from jpaquim/patch-1
Update GLFW setup instructions for macOS
2020-10-27 20:41:37 +01:00
Alexander Overvoorde 24ee21452e Spelling 2020-10-27 20:39:33 +01:00
maltekliemann cca007ac31 Fix description of vkAllocateDescriptorSets error 2020-10-27 15:16:23 +01:00
João Paquim 4dfa3025a5 Update GLFW setup instructions for macOS
Following along with the tutorial, I noticed that the GLFW Homebrew package had been renamed from `glfw3` to `glfw`.

Additionally, the latest available version already has the necessary Vulkan support, so it is no longer necessary to install using `--HEAD`.
2020-10-23 12:11:49 +01:00
maltekliemann 91f969b4de Incorporate changes to chooseSwapExtent 2020-10-11 10:13:49 +02:00
Alexander Overvoorde 69bc7a2c0c Remove confusing remark about depthWriteEnable 2020-09-17 21:47:29 +02:00
Alexander Overvoorde b94d09037b Merge pull request #206 from maltekliemann/ref/dedicated-transfer-queue-vkCmdBlitImage 2020-09-17 21:42:37 +02:00
maltekliemann 20fa35ef62 Add remark regarding queue type for vkCmdBlitImage 2020-09-13 17:41:24 +02:00
maltekliemann ef70f04545 Fix typo 2020-09-13 17:21:40 +02:00
Alexander Overvoorde cbb4e54d26 Add missing LDFLAGS 2020-09-08 21:50:09 +02:00
Abner Coimbre db29beaff2 Dev env: fix #189; setting up Vulkan on Linux needs updates 2020-08-22 22:33:58 -07:00
arcturu 67e8f38f2c Fix typo 2020-06-28 12:33:05 +09:00
Érico Vieira Porto 5922eeaa14 fix typo in 01_Swap_chain.md
fix just a typo on the word "transfered" that should be spelled transferred
2020-06-21 18:25:44 -03:00
Alexander Overvoorde 233b1d4855 Replace dead link to transformation matrices guide 2020-06-04 00:05:41 +02:00
Alexander Overvoorde 0d4f6e2b0c Update FAQ link 2020-05-30 00:39:05 +02:00
Alexander Overvoorde 6adb52d82e Merge pull request #183 from LittleWhite-tb/patch-1
Fixed queue family bit name
2020-05-19 22:00:47 +02:00
LittleWhite-tb fc705dbc03 Superfluous semi-colon 2020-05-19 21:08:23 +02:00
LittleWhite-tb 3336eb1794 Fixed queue family bit name 2020-05-17 16:31:50 +02:00
Pablo Delgado Krämer c05bff3b68 Fix wrong VkSamplerCreateInfo type assignments.
The four members of VkSamplerCreateInfo maxAnisotropy, mipLodBias,
minLod and maxLod are floats, but actually assigned integer values.
2020-05-05 15:05:37 +02:00
Morgan Webb 7844b33181 Fix typo 2020-05-03 16:54:48 +10:00
Alexander Overvoorde 8843f338cd Replace example 3D model with permissively licensed one
The existing model had a permissive license at the time this tutorial
was written, but the artist has since started selling the model so I've
decided to switch to a different one to respect their wishes.
2020-04-28 22:41:09 +02:00
Alexander Overvoorde 72359e2eb5 Fix syntax error 2020-04-20 21:09:15 +02:00
Alexander Overvoorde 4f8b81d234 Change code to use value initialization 2020-04-19 13:39:36 +02:00
Alexander Overvoorde a0423a79db Optimize newlines (extension of #177) 2020-04-19 13:26:41 +02:00
Alexander Overvoorde c877ad1bde Merge pull request #177 from SuperV1234/patch-2
Improve wording and C++ usage in 01_Instance
2020-04-19 13:24:29 +02:00
Alexander Overvoorde 0da8792588 Fix MacOS paths for the latest version of the SDK 2020-04-19 13:09:43 +02:00
Alexander Overvoorde 70b4e6b046 Fix wrong texture coordinates in texture mapping chapter 2020-04-19 13:06:43 +02:00
Alexander Overvoorde 23c0a74929 Merge pull request #176 from SuperV1234/patch-1
Remove unused header and improve C++ wording
2020-04-19 00:10:04 +02:00
Vittorio Romeo ee82b50d68 Improve wording and C++ usage
Rationale:

* "Default initialization" actually means not initializing the object, which would leave it uninitialized. Using `= {}` is "aggregate initialization" syntax, which leads to "value initialization". Directly using `{}` is just "value initialization". 

* `std::endl` is overused and can be a source of performance issues, as it forces the output buffer to be flushed. `\n` is - most of the times - what you need. Just doing my part in trying to avoid overuse of `std::endl`.
2020-04-17 14:42:52 +01:00
Vittorio Romeo f54f779c60 Remove unused header and improve C++ wording
`<functional>` is not used anywhere. There's no such thing as a *"lambda function"* in C++ - we have *lambda expressions* which are a core language feature that does **not** require use of the `<functional>` header, and we have `std::function` which is a general-purpose callable object wrapper that **supports** closures generated by *lambda expressions*, but it is not directly related to them. `std::function` is a heavyweight abstraction and it is **not** the type of a closure generated by a *lambda expression* - the latter is an anonymous unique type generated by the compiler.

"Automatic resource management" is nothing new to modern C++, as it can be implemented through basic RAII usage by creating a `struct` with a simple constructor and destructor. While it is true that it is possible to use `std::unique_ptr` and `std::shared_ptr` for Vulkan object management, that is overkill unless unique or shared ownership semantics are actualy needed. The first choice should be a basic wrapper struct, as it has the least overhead and least flexibility.
2020-04-17 14:31:24 +01:00
tsonge 9e4ebb3bd7 Fixed some typos 2020-04-16 17:26:13 -04:00
Alexander Overvoorde 5163ca5eda Merge pull request #174 from akien-mga/WIDTH-HEIGHT-uint32_t
Code: Use uint32_t for WIDTH and HEIGHT to prevent narrowing conversion
2020-04-07 21:09:55 +02:00
Rémi Verschelde 022c46e598 Code: Use uint32_t for WIDTH and HEIGHT to prevent narrowing conversion
A warning would otherwise be raised from "Swap chain" onward when using
GCC 9.3.0:
```
g++ -std=c++17 -o HelloTriangle main.cpp `pkg-config --static --libs glfw3` -lvulkan
main.cpp: In member function ‘VkExtent2D HelloTriangleApplication::chooseSwapExtent(const VkSurfaceCapabilitiesKHR&)’:
main.cpp:458:40: warning: narrowing conversion of ‘(int)((HelloTriangleApplication*)this)->HelloTriangleApplication::WIDTH’ from ‘int’ to ‘uint32_t’ {aka ‘unsigned int’} [-Wnarrowing]
  458 |             VkExtent2D actualExtent = {WIDTH, HEIGHT};
      |                                        ^~~~~
main.cpp:458:47: warning: narrowing conversion of ‘(int)((HelloTriangleApplication*)this)->HelloTriangleApplication::HEIGHT’ from ‘int’ to ‘uint32_t’ {aka ‘unsigned int’} [-Wnarrowing]
  458 |             VkExtent2D actualExtent = {WIDTH, HEIGHT};
      |                                               ^~~~~~
```
2020-04-07 14:14:02 +02:00
Rémi Verschelde 07512dc634 Dev env: Update min compiler requirements for C++17
Following 'Introduction' changes in 53b2e684fc.
2020-03-22 21:30:43 +01:00
Alexander Overvoorde 674031bfec Remove pointless access mask bit (fixes #168) 2020-03-17 21:09:47 +01:00
Alexander Overvoorde b9cc91ed1a Update tutorial images to correctly represent interpolation in linear color space 2020-03-15 19:33:21 +01:00
Alexander Overvoorde 4c08f3961d Fix tutorial mixing up linear and SRGB colors (fixes #163) 2020-02-05 21:58:48 +01:00
Alexander Overvoorde 43ff479fa8 Update validation layer chapter for newer SDK behaviour 2020-02-04 20:39:35 +01:00
Alexander Overvoorde ce3ac11f6e Note the possibility of validation layer errors rather than increasing memory usage in the 'frames in flight' section 2020-01-07 20:32:59 +01:00
Alexander Overvoorde 388e3455af Remove reference to nonexistent Docs directory 2019-12-17 20:56:31 +01:00
Alexander Overvoorde 4799f68577 Update name of vkcube executable 2019-12-17 20:49:01 +01:00
Alexander Overvoorde ce7d8f87b4 Fix possible freeze in recreateSwapChain 2019-11-21 22:07:46 +01:00
Alexander Overvoorde 3c2d9e29a3 Fix logic of getMaxUsableSampleCount 2019-11-08 22:34:55 +01:00
Alexander Overvoorde 43221c86a0 Remove superfluous transition from multisampling chapter 2019-11-03 13:42:10 +01:00
Alexander Overvoorde 0dd14590b9 Fix bad vkResetFences placement in triangle chapter 2019-11-03 13:35:45 +01:00
Alexander Overvoorde 291347e499 Fix frames in flight synchronization edge case 2019-10-28 22:39:06 +01:00
Alexander Overvoorde 96f817603b Improve correctness of statement about srcSubpass/dstSubpass requirements 2019-10-25 21:31:43 +02:00
Alexander Overvoorde aaa41b77d1 Remove redundant queueCount checks 2019-10-22 23:18:39 +02:00
Alexander Overvoorde da265d3667 Remove redundant depth image transition 2019-09-23 23:23:39 +02:00
Alexander Overvoorde ec292bfdb6 Drop numeric_limits in favour of limits in stdint.h 2019-08-24 21:48:42 +02:00
Alexander Overvoorde 948d6d3d56 Clarify use of std::optional (fixes #147) 2019-08-24 21:33:18 +02:00
Alexander Overvoorde 1906fe6937 Fix clockwise/counter-clockwise mixup 2019-08-22 21:46:48 +02:00
Alexander Overvoorde 4a15b225c6 Fix old references to setupDebugCallback 2019-08-15 22:55:11 +02:00
Alexander Overvoorde c29332510f Clarify debug messenger code position 2019-08-07 20:32:34 +02:00
Lesley Lai 685f3090f0 Update required C++ and compiler version
Considering this tutorial is currently using C++17 feature (`std::optional`), it should require people to have a recent enough compiler.
2019-07-29 03:47:12 -07:00