You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* 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
We're going to write a separate function that updates the uniform buffer with a
275
-
new transformation every frame, so there will be no `vkMapMemory` here. The
276
-
uniform data will be used for all draw calls, so the buffer containing it should only be destroyed when we stop rendering.
278
+
We map the buffer right after creation using `vkMapMemory`to get a pointer to which we can write the data later on. The buffer stays mapped to this pointer for the application's whole lifetime. This technique is called **"persistent mapping"** and works on all Vulkan implementations. Not having to map the buffer every time we need to update it increases performances, as mapping is not free.
279
+
280
+
The uniform data will be used for all draw calls, so the buffer containing it should only be destroyed when we stop rendering.
277
281
278
282
```c++
279
283
voidcleanup() {
@@ -393,13 +397,10 @@ do this, then the image will be rendered upside down.
393
397
394
398
All of the transformations are defined now, so we can copy the data in the
395
399
uniform buffer object to the current uniform buffer. This happens in exactly the same
396
-
way as we did for vertex buffers, except without a staging buffer:
400
+
way as we did for vertex buffers, except without a staging buffer. As noted earlier, we only map the uniform buffer once, so we can directly write to it without having to map again:
0 commit comments