Skip to content

Commit

Permalink
vulkan: fix validation errors when generating mipmaps for a compute-w…
Browse files Browse the repository at this point in the history
…ritable texture.
  • Loading branch information
slime73 committed Sep 27, 2024
1 parent 876625d commit d185eb8
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/modules/graphics/vulkan/Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,11 +491,22 @@ void Texture::generateMipmapsInternal()
blit.dstSubresource.baseArrayLayer = rootView.startLayer;
blit.dstSubresource.layerCount = static_cast<uint32_t>(layerCount);

vkCmdBlitImage(commandBuffer,
textureImage, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
textureImage, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
1, &blit,
VK_FILTER_LINEAR);
if (imageLayout != VK_IMAGE_LAYOUT_GENERAL)
{
vkCmdBlitImage(commandBuffer,
textureImage, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
textureImage, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
1, &blit,
VK_FILTER_LINEAR);
}
else
{
vkCmdBlitImage(commandBuffer,
textureImage, VK_IMAGE_LAYOUT_GENERAL,
textureImage, VK_IMAGE_LAYOUT_GENERAL,
1, &blit,
VK_FILTER_LINEAR);
}

barrier.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
barrier.newLayout = imageLayout;
Expand Down

0 comments on commit d185eb8

Please sign in to comment.