Fix some image transition errors

This commit is contained in:
Magnus Norddahl 2023-09-28 21:33:17 +02:00
commit ef0fb85103
3 changed files with 5 additions and 5 deletions

View file

@ -22,7 +22,7 @@
#include "vk_imagetransition.h"
VkImageTransition& VkImageTransition::AddImage(VkTextureImage *image, VkImageLayout targetLayout, bool undefinedSrcLayout, int baseMipLevel, int levelCount)
VkImageTransition& VkImageTransition::AddImage(VkTextureImage *image, VkImageLayout targetLayout, bool undefinedSrcLayout, int baseMipLevel, int levelCount, int baseArrayLayer, int layerCount)
{
if (image->Layout == targetLayout)
return *this;
@ -91,7 +91,7 @@ VkImageTransition& VkImageTransition::AddImage(VkTextureImage *image, VkImageLay
I_FatalError("Unimplemented dst image layout transition\n");
}
barrier.AddImage(image->Image.get(), undefinedSrcLayout ? VK_IMAGE_LAYOUT_UNDEFINED : image->Layout, targetLayout, srcAccess, dstAccess, aspectMask, baseMipLevel, levelCount);
barrier.AddImage(image->Image.get(), undefinedSrcLayout ? VK_IMAGE_LAYOUT_UNDEFINED : image->Layout, targetLayout, srcAccess, dstAccess, aspectMask, baseMipLevel, levelCount, baseArrayLayer, layerCount);
needbarrier = true;
image->Layout = targetLayout;
return *this;

View file

@ -46,7 +46,7 @@ public:
class VkImageTransition
{
public:
VkImageTransition& AddImage(VkTextureImage *image, VkImageLayout targetLayout, bool undefinedSrcLayout, int baseMipLevel = 0, int levelCount = 1);
VkImageTransition& AddImage(VkTextureImage *image, VkImageLayout targetLayout, bool undefinedSrcLayout, int baseMipLevel = 0, int levelCount = 1, int baseArrayLayer = 0, int layerCount = 1);
void Execute(VulkanCommandBuffer *cmdbuffer);
private:

View file

@ -243,7 +243,7 @@ void VkTextureManager::CreateLightmap(int newLMTextureSize, int newLMTextureCoun
stagingBuffer->Unmap();
VkImageTransition()
.AddImage(&Lightmap, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, true, 0, count)
.AddImage(&Lightmap, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, true, 0, 1, 0, count)
.Execute(cmdbuffer);
VkBufferImageCopy region = {};
@ -260,6 +260,6 @@ void VkTextureManager::CreateLightmap(int newLMTextureSize, int newLMTextureCoun
}
VkImageTransition()
.AddImage(&Lightmap, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, false, 0, count)
.AddImage(&Lightmap, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, false, 0, 1, 0, count)
.Execute(cmdbuffer);
}