Skip to content

Commit 550de78

Browse files
committed
Rename a vairalbe to avoid confusion and fix a comment typo
1 parent 180be3f commit 550de78

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

examples/screenshot/screenshot.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class VulkanExample : public VulkanExampleBase
138138

139139
// Take a screenshot from the current swapchain image
140140
// This is done using a blit from the swapchain image to a linear image whose memory content is then saved as a ppm image
141-
// Getting the image date directly from a swapchain image wouldn't work as they're usually stored in an implementation dependent optimal tiling format
141+
// Getting the image data directly from a swapchain image wouldn't work as they're usually stored in an implementation dependent optimal tiling format
142142
// Note: This requires the swapchain images to be created with the VK_IMAGE_USAGE_TRANSFER_SRC_BIT flag (see VulkanSwapChain::create)
143143
void saveScreenshot(const char *filename)
144144
{
@@ -194,11 +194,11 @@ class VulkanExample : public VulkanExampleBase
194194
VK_CHECK_RESULT(vkBindImageMemory(device, dstImage, dstImageMemory, 0));
195195

196196
// Do the actual blit from the swapchain image to our host visible destination image
197-
VkCommandBuffer copyCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
197+
VkCommandBuffer transferCmdBuffer = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
198198

199199
// Transition destination image to transfer destination layout
200200
vks::tools::insertImageMemoryBarrier(
201-
copyCmd,
201+
transferCmdBuffer,
202202
dstImage,
203203
0,
204204
VK_ACCESS_TRANSFER_WRITE_BIT,
@@ -210,7 +210,7 @@ class VulkanExample : public VulkanExampleBase
210210

211211
// Transition swapchain image from present to transfer source layout
212212
vks::tools::insertImageMemoryBarrier(
213-
copyCmd,
213+
transferCmdBuffer,
214214
srcImage,
215215
VK_ACCESS_MEMORY_READ_BIT,
216216
VK_ACCESS_TRANSFER_READ_BIT,
@@ -238,7 +238,7 @@ class VulkanExample : public VulkanExampleBase
238238

239239
// Issue the blit command
240240
vkCmdBlitImage(
241-
copyCmd,
241+
transferCmdBuffer,
242242
srcImage, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
243243
dstImage, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
244244
1,
@@ -259,7 +259,7 @@ class VulkanExample : public VulkanExampleBase
259259

260260
// Issue the copy command
261261
vkCmdCopyImage(
262-
copyCmd,
262+
transferCmdBuffer,
263263
srcImage, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
264264
dstImage, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
265265
1,
@@ -268,7 +268,7 @@ class VulkanExample : public VulkanExampleBase
268268

269269
// Transition destination image to general layout, which is the required layout for mapping the image memory later on
270270
vks::tools::insertImageMemoryBarrier(
271-
copyCmd,
271+
transferCmdBuffer,
272272
dstImage,
273273
VK_ACCESS_TRANSFER_WRITE_BIT,
274274
VK_ACCESS_MEMORY_READ_BIT,
@@ -280,7 +280,7 @@ class VulkanExample : public VulkanExampleBase
280280

281281
// Transition back the swap chain image after the blit is done
282282
vks::tools::insertImageMemoryBarrier(
283-
copyCmd,
283+
transferCmdBuffer,
284284
srcImage,
285285
VK_ACCESS_TRANSFER_READ_BIT,
286286
VK_ACCESS_MEMORY_READ_BIT,
@@ -290,7 +290,7 @@ class VulkanExample : public VulkanExampleBase
290290
VK_PIPELINE_STAGE_TRANSFER_BIT,
291291
VkImageSubresourceRange{ VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1 });
292292

293-
vulkanDevice->flushCommandBuffer(copyCmd, queue);
293+
vulkanDevice->flushCommandBuffer(transferCmdBuffer, queue);
294294

295295
// Get layout of the image (including row pitch)
296296
VkImageSubresource subResource { VK_IMAGE_ASPECT_COLOR_BIT, 0, 0 };

0 commit comments

Comments
 (0)