Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 07086a8

Browse files
committed
Rewrite filtering explanation
1 parent 62668dc commit 07086a8

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

09_Generating_Mipmaps.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,13 @@ Next, we specify the regions that will be used in the blit operation. The source
172172
vkCmdBlitImage(commandBuffer,
173173
textureImage, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
174174
textureImage, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
175-
1, &blit, VK_FILTER_LINEAR);
175+
1, &blit,
176+
VK_FILTER_LINEAR);
176177
```
177178

178-
Now, we record the blit command. Note that `textureImage` is used for both the `srcImage` and `dstImage` parameter. The source mip level was just transitioned to `VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL` and the destination level is still in `VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL` from `createTextureImage`. The last parameter says to use a linear filter when scaling the data.
179+
Now, we record the blit command. Note that `textureImage` is used for both the `srcImage` and `dstImage` parameter. This is because we're blitting between different levels of the same image. The source mip level was just transitioned to `VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL` and the destination level is still in `VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL` from `createTextureImage`.
180+
181+
The last parameter allows us to specify a `VkFilter` to use in the blit. We have the same filtering options here that we had when making the `VkSampler`. We use the `VK_FILTER_LINEAR` to enable filtering.
179182

180183
```c++
181184
barrier.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;

code/28_mipmapping.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,8 @@ class HelloTriangleApplication {
866866
vkCmdBlitImage(commandBuffer,
867867
textureImage, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
868868
textureImage, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
869-
1, &blit, VK_FILTER_LINEAR);
869+
1, &blit,
870+
VK_FILTER_LINEAR);
870871

871872
barrier.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
872873
barrier.newLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;

0 commit comments

Comments
 (0)