From 82596ddb9db6abcc48300358cf56f4666ea0eabe Mon Sep 17 00:00:00 2001 From: swinston Date: Thu, 20 Aug 2026 10:44:59 -0700 Subject: [PATCH] Fix confusing swap chain image count calculation --- .../01_Presentation/01_Swap_chain.adoc | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/en/03_Drawing_a_triangle/01_Presentation/01_Swap_chain.adoc b/en/03_Drawing_a_triangle/01_Presentation/01_Swap_chain.adoc index 5047177f..9bc6207f 100644 --- a/en/03_Drawing_a_triangle/01_Presentation/01_Swap_chain.adoc +++ b/en/03_Drawing_a_triangle/01_Presentation/01_Swap_chain.adoc @@ -339,22 +339,16 @@ minimum number that it requires to function: [,c++] ---- -uint32_t imageCount = surfaceCapabilities.minImageCount; +uint32_t minImageCount = surfaceCapabilities.minImageCount; ---- However, simply sticking to this minimum means that we may sometimes have to wait on the driver to complete internal operations before we can acquire -another image to render to. Therefore, it is recommended to request at least -one more image than the minimum: - -[,c++] ----- -uint32_t imageCount = surfaceCapabilities.minImageCount + 1; ----- - -We should also make sure to not exceed the maximum number of images while -doing this, where `0` is a special value that means that there is no maximum, -resulting in this helper function +another image to render to. In practice, it's common to request a few more +images than the strict minimum to give yourself some headroom - the helper +function below requests at least three images, while also making sure to not +exceed the maximum number of images the implementation supports, where `0` is +a special value that means there is no maximum: [,c++] ----