Skip to content
Permalink
Browse files

- fix burn crash on vulkan

  • Loading branch information...
dpjudas authored and madame-rachelle committed May 9, 2019
1 parent 46e07d5 commit 5f26cda27eb1e8c76f601dd880bf7ed4c7c61509
@@ -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)
@@ -17,6 +17,8 @@ class IHardwareTexture
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;
@@ -25,6 +25,11 @@ class FHardwareTextureContainer
if (hwTexture) delete hwTexture;
hwTexture = nullptr;
}

void DeleteDescriptors()
{
if (hwTexture) hwTexture->DeleteDescriptors();
}

~TranslatedTexture()
{
@@ -69,10 +74,15 @@ class FHardwareTextureContainer
{
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();
}
}

@@ -38,6 +38,8 @@ class VkHardwareTexture : public IHardwareTexture
// 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);

0 comments on commit 5f26cda

Please sign in to comment.
You can’t perform that action at this time.