I’m trying to generate mipmap for some font texture by calling vkCmdBlitImage(…).
Each array layer is unique, but,
if i write VkImageBlit like this:
VkImageBlit region = {
{ VK_IMAGE_ASPECT_COLOR_BIT, i - 1, 0, layerCount },
{ {}, { int32_t(imageExtent.width) >> i - 1, int32_t(imageExtent.height) >> i - 1, 1 } },
{ VK_IMAGE_ASPECT_COLOR_BIT, i, 0, layerCount },
{ {}, { int32_t(imageExtent.width) >> i, int32_t(imageExtent.height) >> i, 1 } }
};
//CmdBlitImage(...);
It eventually results in repetitions in mipmap:
(Left: Rendering at 50%) (Right: The test image)
(Each array layer is 60x65 pixels, the full image is 960x1495, which means layer count is 368)
(Nothing wrong with my algorithm of slicing the image into tiles, I’ve doing this for years, and rendering at 100% is just perfect)
If i write VkImageBlit like this:
for (uint32_t j = 0; j < layerCount; j++)
for (uint32_t i = 1; i < mipLevelCount; i++) {
VkImageBlit region = {
{ VK_IMAGE_ASPECT_COLOR_BIT, i - 1, j, 1 },
{ {}, { int32_t(imageExtent.width) >> i - 1, int32_t(imageExtent.height) >> i - 1, 1 } },
{ VK_IMAGE_ASPECT_COLOR_BIT, i, j, 1 },
{ {}, { int32_t(imageExtent.width) >> i, int32_t(imageExtent.height) >> i, 1 } }
};
//CmdBlitImage(...);
}
Everything works fine except it is slow and should be unnecessary.
Either VkCmdBlitImage(…) or VkCmdBlitImage2(…) results same.
By the way, both code works fine using a Intel integrated GPU.
GPU: Nvidia 1060Max-Q
Driver version: 528.02
Vulkan SDK version: 1.3.224.1
OS: Win10 64-bit
————————————————————
This didn’t happen before, seems it won’t happen if each array layer has some kind of “proper” extent.
Pretty sure nothing wrong with sampler, image view, or shader code.
I’ve tried copying (by vkCmdCopyImage) mipmap, and then write it to desk. There are repetitions for sure.
(You may try any 60x65x368 image to verify this)