mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-15 00:41:57 +00:00
- use a linked list to keep track of all allocated VkHardwareTexture objects
This commit is contained in:
parent
c691a8fe64
commit
308c884d02
4 changed files with 16 additions and 7 deletions
|
@ -66,6 +66,10 @@ VulkanFrameBuffer::VulkanFrameBuffer(void *hMonitor, bool fullscreen, VulkanDevi
|
|||
|
||||
VulkanFrameBuffer::~VulkanFrameBuffer()
|
||||
{
|
||||
// All descriptors must be destroyed before the descriptor pool in renderpass manager is destroyed
|
||||
for (VkHardwareTexture *cur = VkHardwareTexture::First; cur; cur = cur->Next)
|
||||
cur->Reset();
|
||||
|
||||
delete MatricesUBO;
|
||||
delete ColorsUBO;
|
||||
delete GlowingWallsUBO;
|
||||
|
@ -73,8 +77,6 @@ VulkanFrameBuffer::~VulkanFrameBuffer()
|
|||
delete mSkyData;
|
||||
delete mViewpoints;
|
||||
delete mLights;
|
||||
for (auto tex : AllTextures)
|
||||
tex->Reset();
|
||||
}
|
||||
|
||||
void VulkanFrameBuffer::InitializeState()
|
||||
|
@ -277,9 +279,7 @@ void VulkanFrameBuffer::CleanForRestart()
|
|||
|
||||
IHardwareTexture *VulkanFrameBuffer::CreateHardwareTexture()
|
||||
{
|
||||
auto texture = new VkHardwareTexture();
|
||||
AllTextures.Push(texture);
|
||||
return texture;
|
||||
return new VkHardwareTexture();
|
||||
}
|
||||
|
||||
FModelRenderer *VulkanFrameBuffer::CreateModelRenderer(int mli)
|
||||
|
|
|
@ -86,8 +86,6 @@ private:
|
|||
|
||||
int lastSwapWidth = 0;
|
||||
int lastSwapHeight = 0;
|
||||
|
||||
TArray<VkHardwareTexture*> AllTextures;
|
||||
};
|
||||
|
||||
inline VulkanFrameBuffer *GetVulkanFrameBuffer() { return static_cast<VulkanFrameBuffer*>(screen); }
|
||||
|
|
|
@ -37,12 +37,19 @@
|
|||
#include "vulkan/renderer/vk_renderpass.h"
|
||||
#include "vk_hwtexture.h"
|
||||
|
||||
VkHardwareTexture *VkHardwareTexture::First = nullptr;
|
||||
|
||||
VkHardwareTexture::VkHardwareTexture()
|
||||
{
|
||||
Next = First;
|
||||
First = this;
|
||||
if (Next) Next->Prev = this;
|
||||
}
|
||||
|
||||
VkHardwareTexture::~VkHardwareTexture()
|
||||
{
|
||||
if (Next) Next->Prev = Prev;
|
||||
if (!Prev) First = Next;
|
||||
}
|
||||
|
||||
void VkHardwareTexture::Reset()
|
||||
|
|
|
@ -32,6 +32,10 @@ public:
|
|||
uint8_t *MapBuffer() override;
|
||||
unsigned int CreateTexture(unsigned char * buffer, int w, int h, int texunit, bool mipmap, int translation, const char *name) override;
|
||||
|
||||
static VkHardwareTexture *First;
|
||||
VkHardwareTexture *Prev = nullptr;
|
||||
VkHardwareTexture *Next = nullptr;
|
||||
|
||||
private:
|
||||
VulkanImageView *GetImageView(FTexture *tex, int clampmode, int translation, int flags);
|
||||
|
||||
|
|
Loading…
Reference in a new issue