- fixed the hardware rendering precacher not to evict secondary layers of multi-layer textures.

It will now check all layers of a material.
Additionally it will also delete all descriptor sets of Vulkan hardware textures before precaching to make sure that nothing here can accidentally still reference a deleted texture.
This commit is contained in:
Christoph Oelckers 2019-03-21 21:57:39 +01:00
commit 3ad9783d8f
10 changed files with 66 additions and 7 deletions

View file

@ -672,6 +672,13 @@ void VulkanFrameBuffer::TextureFilterChanged()
}
}
void VulkanFrameBuffer::StartPrecaching()
{
// Destroy the texture descriptors to avoid problems with potentially stale textures.
for (VkHardwareTexture *cur = VkHardwareTexture::First; cur; cur = cur->Next)
cur->ResetDescriptors();
}
void VulkanFrameBuffer::BlurScene(float amount)
{
if (mPostprocess)

View file

@ -76,6 +76,7 @@ public:
sector_t *RenderView(player_t *player) override;
void SetTextureFilterMode() override;
void TextureFilterChanged() override;
void StartPrecaching() override;
void BeginFrame() override;
void BlurScene(float amount) override;
void PostProcessScene(int fixedcm, const std::function<void()> &afterBloomDrawEndScene2D) override;

View file

@ -57,9 +57,6 @@ VkHardwareTexture::~VkHardwareTexture()
if (fb)
{
auto &deleteList = fb->FrameDeleteList;
for (auto &it : mDescriptorSets)
deleteList.Descriptors.push_back(std::move(it.second));
mDescriptorSets.clear();
if (mImage) deleteList.Images.push_back(std::move(mImage));
if (mImageView) deleteList.ImageViews.push_back(std::move(mImageView));
if (mStagingBuffer) deleteList.Buffers.push_back(std::move(mStagingBuffer));

View file

@ -45,6 +45,12 @@ public:
VulkanImage *GetImage(FTexture *tex, int translation, int flags);
VulkanImageView *GetImageView(FTexture *tex, int translation, int flags);
static void ResetAllDescriptors()
{
for (VkHardwareTexture *cur = First; cur; cur = cur->Next)
cur->ResetDescriptors();
}
private:
void CreateImage(FTexture *tex, int translation, int flags);