Commit Graph

149 Commits

Author SHA1 Message Date
Daxturus 02e283d548
Remove invalid "warn" argument passed to tinyobj::loadObject(...) (#406)
* Update 28_model_loading.cpp

Removed "warn" argument passed to tinyobj::LoadObj(...).

* Update 29_mipmapping.cpp

Removed "warn" argument passed to tinyobj::LoadObj(...).

* Update 30_multisampling.cpp

Removed "warn" argument passed to tinyobj::LoadObj(...).

* Update 08_Loading_models.md

Removed "warn" argument passed to tinyobj::LoadObj(...) from e-book.

* Update 08_Charger_des_modèles.md

Removed "warn" argument passed to tinyobj::LoadObj(...).
2025-05-11 12:26:42 +02:00
Sascha Willems 2742b9f1a7
Add compute shader compilation to cmake (#362)
* Add compute shader to build targets (if present)

Fixes #351
Fixes #361

* Add compute shader to build targets (if present)

Fixes #351
Fixes #361

* Add compute shader to build targets (if present)

Fixes #351
Fixes #361
2023-10-30 21:43:40 +01:00
Chuigda WhiteGive 71b71e4841
replace "descriptor layout" with "descriptor set layout" (#358) 2023-09-25 21:31:00 +02:00
Hugo Locurcio 898f655f92
Use `VK_LOD_CLAMP_NONE` constant to set mipmap max LOD level in sampler (#354)
This allows for using different texture sizes without having to
know the mipmap count in advance.

All conformant Vulkan implementations should be able to handle this
constant, which is equal to `1000.0f`.
2023-08-09 21:35:09 +02:00
Jay Xu 681c588e3b
Fix multisampled color attachment sync (#349) (#350)
* Fix multisampled color attachment sync (#349)

* Update 10_Multisampling.md

fix typo
2023-07-24 20:43:47 +02:00
Petr Kraus dc02dccc62
Fix depth buffer reuse sync (#345) 2023-07-13 22:29:37 +02:00
Bot-Kerem 489ea25524
More elegant code (#342) 2023-06-23 23:04:50 +02:00
Lucas Merritt 6fa5edd222
Fix incorrect create image view error message (#334)
The function "createImageView" has a somewhat incorrect error message,
saying that it failed to create a texture image view. However, the
function is also used by more than simply the texture image view
creation process(e.g., the swapchain image view creation process, "createImageViews").
2023-05-09 21:39:12 +02:00
Maíra Canal 1eb2223b15
A collection of minor fixes (#330)
* Apply coherent indentation all over the file

* Use static_cast to perform casting

* Add three dots to indicate that it isn't the top of the function
2023-04-24 21:16:12 +02:00
Sascha Willems 2b5ef6d6f3 Add a new compute shader bonus chapter (#320)
* Started working on compute shader bonus chapter

* Continued work on compute shader bonus chapter

* Continued work on compute shader bonus chapter

* Added code for compute sample

work-in-progress

* Added code for compute sample

Per-frame ssbos
Compute shader is now integrated and updating particles
work-in-progress

* Added code for compute sample

Nicer visuals, circular initial particle positions
work-in-progress

* Added code for compute sample

work-in-progress

* Tutorial compute queue families, submission and synchronization chapter

* Added paragraphs on sync, submit and queue familes

Rewording some paragraphs

* Rewording

Added image for workgroup and invocations compute space

* Sample for work group and dispatch counts

* Note and spec reference on queue families

* Minor additions

* Sample code uses SSBO per frame

Code cleanup
Tutotorial changed

* Added image for SSBOs per-frame reads and writes

* Conclusion

* Added note on signaled fences

* Update 11_Compute_Shader.md

* Use persistent mapped buffers

* Added links to advanced topics (tutorials, samples)

* Fixed typo

* Add note for the storage image chapter

* Added note on how to handle uneven no. of invocations using gl_GlobalInvocationID

* Added compute fence resize to tutorial

Was already present in code

* Update en/11_Compute_Shader.md

Co-authored-by: Charles Giessen <46324611+charles-lunarg@users.noreply.github.com>

* Update en/11_Compute_Shader.md

Co-authored-by: Charles Giessen <46324611+charles-lunarg@users.noreply.github.com>

* Update en/11_Compute_Shader.md

Co-authored-by: Charles Giessen <46324611+charles-lunarg@users.noreply.github.com>

* Update en/11_Compute_Shader.md

Co-authored-by: Charles Giessen <46324611+charles-lunarg@users.noreply.github.com>

* Update en/11_Compute_Shader.md

Co-authored-by: Charles Giessen <46324611+charles-lunarg@users.noreply.github.com>

* Update en/11_Compute_Shader.md

Co-authored-by: Charles Giessen <46324611+charles-lunarg@users.noreply.github.com>

* Update en/11_Compute_Shader.md

Co-authored-by: Charles Giessen <46324611+charles-lunarg@users.noreply.github.com>

* Update en/11_Compute_Shader.md

Co-authored-by: Charles Giessen <46324611+charles-lunarg@users.noreply.github.com>

* Update en/11_Compute_Shader.md

Co-authored-by: Charles Giessen <46324611+charles-lunarg@users.noreply.github.com>

* Update en/11_Compute_Shader.md

Co-authored-by: Charles Giessen <46324611+charles-lunarg@users.noreply.github.com>

* Update en/11_Compute_Shader.md

Co-authored-by: Charles Giessen <46324611+charles-lunarg@users.noreply.github.com>

* Update en/11_Compute_Shader.md

Co-authored-by: Charles Giessen <46324611+charles-lunarg@users.noreply.github.com>

* Update en/11_Compute_Shader.md

Co-authored-by: Charles Giessen <46324611+charles-lunarg@users.noreply.github.com>

* Name the actual compute related physical device limits

* Clarfiy how work group and invocation counts are specified

* Show how initial particle data is generated for the shader storage buffer s

* Restructure SSBO setup

* Indentation

* Minor touches

* fixed transposition

* Added note on std140 memory layout qualifier

---------

Co-authored-by: Marty Johnson <68354714+marty-johnson59@users.noreply.github.com>
Co-authored-by: Charles Giessen <46324611+charles-lunarg@users.noreply.github.com>
2023-02-06 18:01:22 +01:00
Sascha Willems 4454f6d4c5 Persistent mapping for uniform buffers (#310)
* Updated UBO chapter and removed in-place map and unmap of the ubo

Replaced it with map-once aka "persistent mapping"

* Fixed index for uniform buffer selection

* Update code samples to persistent ubo mapping

* Resize vector for mapped uniform buffer pointers

* Use calculated buffer size for mapping

* Update code samples to persistent ubo mapping

* Spelling
2022-11-03 23:15:45 +01:00
Sascha Willems dc4d8d2544 Update tutorial to use dynamic state for viewport and scissor (#293)
* Prefer use of dynamic state for viewport and scissor

* Slight rewording, working in-page anchor

* Updated command buffers chapter and code to use dynamic viewport and scissor state

* Updated swap chain recreation chapter

No more need to recreate the graphics pipeline as viewport and scissor state are now dynamic

* Updated command buffer chapter code to use dynamic viewport and scissor

* Removed render pass destruction/creation for swap chain recreation

This is not needed anymore

* Use dynamic state for viewport and scissor for samples after the fixed function chapter

* Use dynamic state for viewport and scissor for samples after the swap chain recreation chapter

Removed render pass destruction/creation for swap chain recreation, no longer necessary

* Removed duplicate code

* Wording change

* Changed wording on chapter intro, moved dynamic state paragraph to the top

* Fixed wording

* Fixed wording

* C++ style cast

* Wording

* Wording

* Wording

* Added note on renderpass recreation

* Apply suggestions from code review

Incorporate suggestions

Co-authored-by: Alexander Overvoorde <overv161@gmail.com>

* Added dynamic state to conclusion chapter

* Remove unnecessary link

* Remove code referencing command buffers too early

Co-authored-by: Alexander Overvoorde <overv161@gmail.com>
2022-07-03 14:03:58 +02:00
Alexander Overvoorde 536da67191 Fix syntax error & inconsistency in sample code 2022-05-07 17:05:55 +02:00
Alexander Overvoorde eef49a21de Use std::numeric_limits<uint32_t>::max() 2022-02-21 21:09:21 +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
TheSusian 16cae4ba52 Fixed getMaxUsableSampleCount() formatting 2022-01-15 17:21:16 +03:00
kovrov aea5625fb4 Code samples: add CMakeLists.txt
Calling `cmake --build .` will build the sample code executables for each
chapter in it's own folders, compile corresponding shaders and copy all
required resources to appropriate sub-folders. After that any example is
ready to be run from it's build sub-folder.

CMake project requires following dependencies:
* glfw3 dev package
* glm dev package
* stb_image header
* tinyobjloader dev package
* Vulkan sdk
2021-08-23 20:20:44 -05:00
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 98f8a57c6e Ensure that imagesInFlight has the right size after swap chain recreation (fixes #224) 2021-02-20 12:51:29 +01:00
Alexander Overvoorde 75f648e21e Fix maxSamplerAnisotropy limit not verified (fixes #216) 2020-11-29 16:42:47 +01:00
Alexander Overvoorde 955592bfea Fix potential synchronization problem with depth buffer transition and load operation 2020-11-06 22:26:23 +01:00
maltekliemann 8bd0a5ef4b Fix chooseSwapExtent for HDPI/retina displays
When using an HDPI display, using the window size `{WIDTH, HEIGHT}` to
determine swapchain image size is incorrect. See the following links:

* https://www.glfw.org/docs/latest/window.html#window_size
* https://www.glfw.org/docs/latest/window.html#window_fbsize
* https://www.glfw.org/faq.html#43---why-is-my-output-in-the-lower-left-corner-of-the-window

Instead, the framebuffer size is now used to determine the swapchain
extent. Using the implementation of `chooseSwapExtent` from
`16_swap_chain_recreation.cpp` seemed appropriate. Beyond "Swap chain
recreation" no changes are necessary.
2020-10-04 18:27:32 +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
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
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
Alexander Overvoorde 674031bfec Remove pointless access mask bit (fixes #168) 2020-03-17 21:09:47 +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 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 5fac998fc2 Fix broken patch of queueCount 2019-10-24 22:24:57 +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 46eb39dc33 Remove SIMULTANEOUS_USE flag from draw command buffers as this is not relevant 2019-07-24 21:28:07 +02:00
Alexander Overvoorde 40e3d846f6 Remove outdated section about driver support for VK_PRESENT_MODE_FIFO_KHR 2019-07-15 22:35:34 +02:00
Alexander Overvoorde ee9488129a Remove handling of VK_FORMAT_UNDEFINED (fixes #135) 2019-06-12 17:10:27 +02:00
Alexander Overvoorde 441072c4b5 Add debug utils messenger for vkCreateInstance and vkDestroyInstance 2019-05-13 20:56:46 +02:00
Alexander Overvoorde 60a5b2c158 Update the code to reference the new VK_LAYER_KHRONOS_validation validation layer 2019-04-28 19:36:37 +02:00
Alexander Overvoorde d1888da5a6 Fix descriptor pool not being recreated after swap chain recreation 2019-04-08 22:02:37 +02:00
Alexander Overvoorde 170ce59443 Fix chooseSwapPresentMode not passing by const reference 2019-03-17 14:55:24 +01:00
Alexander Overvoorde be8923d30b Fix debug messenger being stored in confusingly named callback variable 2019-01-13 17:52:47 +01:00
Alexander Overvoorde 81a0d9c263 Add explanation of uniform buffer alignment requirements 2019-01-07 23:27:06 +01:00