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
Copy file name to clipboardExpand all lines: en/Building_a_Simple_Engine/Camera_Transformations/05_vulkan_integration.adoc
+37-16Lines changed: 37 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,26 +42,46 @@ struct UniformBufferObject {
42
42
43
43
Next, we'll create the uniform buffer and its descriptor set:
44
44
45
+
[NOTE]
46
+
====
47
+
Uniform buffers should be allocated per frame-in-flight (maxConcurrentFrames), not per swapchain image. This matches how you submit work and synchronize frames, avoids unnecessary allocations, and simplifies your logic.
48
+
====
49
+
45
50
[source,cpp]
46
51
----
52
+
// Use a fixed number of frames-in-flight, not the number of swapchain images
53
+
constexpr uint32_t maxConcurrentFrames = 2; // Adjust to your renderer
54
+
55
+
struct UniformBufferObject {
56
+
glm::mat4 model;
57
+
glm::mat4 view;
58
+
glm::mat4 proj;
59
+
};
60
+
61
+
// Keep the mapped pointer alongside the buffer for clarity and safety
0 commit comments