Fix vulkan validation errors for wrong image transitions and buffers used after destroyed

This commit is contained in:
Magnus Norddahl 2021-10-29 22:22:28 +02:00 committed by Christoph Oelckers
commit 8e59ed754e
4 changed files with 32 additions and 14 deletions

View file

@ -239,13 +239,8 @@ void VkRenderBuffers::CreateShadowmap()
ImageBuilder builder;
builder.setSize(gl_shadowmap_quality, 1024);
builder.setFormat(SceneNormalFormat);
builder.setFormat(VK_FORMAT_R32_SFLOAT);
builder.setUsage(VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT);
if (!builder.isFormatSupported(fb->device, VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT))
{
SceneNormalFormat = VK_FORMAT_R8G8B8A8_UNORM;
builder.setFormat(SceneNormalFormat);
}
Shadowmap.Image = builder.create(fb->device);
Shadowmap.Image->SetDebugName("VkRenderBuffers.Shadowmap");