- fix burn crash on vulkan

This commit is contained in:
Magnus Norddahl 2019-05-09 17:55:29 +02:00
parent cace5079fe
commit d5761740d3
4 changed files with 17 additions and 1 deletions

View file

@ -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)

View file

@ -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;

View file

@ -26,6 +26,11 @@ private:
hwTexture = nullptr;
}
void DeleteDescriptors()
{
if (hwTexture) hwTexture->DeleteDescriptors();
}
~TranslatedTexture()
{
Delete();
@ -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();
}
}

View file

@ -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);