diff --git a/src/rendering/2d/f_wipe.cpp b/src/rendering/2d/f_wipe.cpp index 80e576100..03de1b916 100644 --- a/src/rendering/2d/f_wipe.cpp +++ b/src/rendering/2d/f_wipe.cpp @@ -336,7 +336,7 @@ void Wiper_Burn::SetTextures(FTexture *startscreen, FTexture *endscreen) startScreen = startscreen; endScreen = endscreen; BurnTexture = new FBurnTexture(WIDTH, HEIGHT); - auto mat = FMaterial::ValidateTexture(startscreen, false); + auto mat = FMaterial::ValidateTexture(endScreen, false); mat->AddTextureLayer(BurnTexture); } @@ -374,6 +374,8 @@ bool Wiper_Burn::Run(int ticks) } BurnTexture->SystemTextures.Clean(true, true); + endScreen->SystemTextures.Clean(false, false); + const uint8_t *src = BurnArray; uint32_t *dest = (uint32_t *)BurnTexture->GetBuffer(); for (int y = HEIGHT; y != 0; --y) diff --git a/src/rendering/hwrenderer/textures/hw_ihwtexture.h b/src/rendering/hwrenderer/textures/hw_ihwtexture.h index 7000edccb..741bfd1bc 100644 --- a/src/rendering/hwrenderer/textures/hw_ihwtexture.h +++ b/src/rendering/hwrenderer/textures/hw_ihwtexture.h @@ -17,6 +17,8 @@ public: IHardwareTexture() {} virtual ~IHardwareTexture() {} + virtual void DeleteDescriptors() { } + virtual void AllocateBuffer(int w, int h, int texelsize) = 0; virtual uint8_t *MapBuffer() = 0; virtual unsigned int CreateTexture(unsigned char * buffer, int w, int h, int texunit, bool mipmap, int translation, const char *name) = 0; diff --git a/src/rendering/hwrenderer/textures/hw_texcontainer.h b/src/rendering/hwrenderer/textures/hw_texcontainer.h index 87df5ea87..755fecb6b 100644 --- a/src/rendering/hwrenderer/textures/hw_texcontainer.h +++ b/src/rendering/hwrenderer/textures/hw_texcontainer.h @@ -25,6 +25,11 @@ private: if (hwTexture) delete hwTexture; hwTexture = nullptr; } + + void DeleteDescriptors() + { + if (hwTexture) hwTexture->DeleteDescriptors(); + } ~TranslatedTexture() { @@ -69,10 +74,15 @@ public: { if (cleannormal) hwDefTex[0].Delete(); if (cleanexpanded) hwDefTex[1].Delete(); + hwDefTex[0].DeleteDescriptors(); + hwDefTex[1].DeleteDescriptors(); for (int i = hwTex_Translated.Size() - 1; i >= 0; i--) { if (cleannormal && hwTex_Translated[i].translation > 0) hwTex_Translated.Delete(i); else if (cleanexpanded && hwTex_Translated[i].translation < 0) hwTex_Translated.Delete(i); + + for (unsigned int j = 0; j < hwTex_Translated.Size(); j++) + hwTex_Translated[j].DeleteDescriptors(); } } diff --git a/src/rendering/vulkan/textures/vk_hwtexture.h b/src/rendering/vulkan/textures/vk_hwtexture.h index bf0519039..2cf63b622 100644 --- a/src/rendering/vulkan/textures/vk_hwtexture.h +++ b/src/rendering/vulkan/textures/vk_hwtexture.h @@ -38,6 +38,8 @@ public: // Wipe screen void CreateWipeTexture(int w, int h, const char *name); + void DeleteDescriptors() override { ResetDescriptors(); } + VulkanImage *GetImage(FTexture *tex, int translation, int flags); VulkanImageView *GetImageView(FTexture *tex, int translation, int flags); VulkanImageView *GetDepthStencilView(FTexture *tex);