- make the VkHardwareTexture and VKBuffer linked lists private

This commit is contained in:
Magnus Norddahl 2019-04-30 19:49:29 +02:00
parent d985d98122
commit ab8378152f
5 changed files with 25 additions and 13 deletions

View file

@ -29,6 +29,12 @@ VKBuffer::~VKBuffer()
fb->FrameDeleteList.Buffers.push_back(std::move(mBuffer));
}
void VKBuffer::ResetAll()
{
for (VKBuffer *cur = VKBuffer::First; cur; cur = cur->Next)
cur->Reset();
}
void VKBuffer::Reset()
{
if (mBuffer && map)

View file

@ -16,6 +16,7 @@ public:
VKBuffer();
~VKBuffer();
static void ResetAll();
void Reset();
void SetData(size_t size, const void *data, bool staticdata) override;
@ -28,15 +29,16 @@ public:
void *Lock(unsigned int size) override;
void Unlock() override;
static VKBuffer *First;
VKBuffer *Prev = nullptr;
VKBuffer *Next = nullptr;
VkBufferUsageFlags mBufferType = 0;
std::unique_ptr<VulkanBuffer> mBuffer;
std::unique_ptr<VulkanBuffer> mStaging;
bool mPersistent = false;
TArray<uint8_t> mStaticUpload;
private:
static VKBuffer *First;
VKBuffer *Prev = nullptr;
VKBuffer *Next = nullptr;
};
class VKVertexBuffer : public IVertexBuffer, public VKBuffer

View file

@ -94,12 +94,9 @@ 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();
for (VKBuffer *cur = VKBuffer::First; cur; cur = cur->Next)
cur->Reset();
VkHardwareTexture::ResetAll();
VKBuffer::ResetAll();
PPResource::ResetAll();
delete MatricesUBO;

View file

@ -56,6 +56,12 @@ VkHardwareTexture::~VkHardwareTexture()
Reset();
}
void VkHardwareTexture::ResetAll()
{
for (VkHardwareTexture *cur = VkHardwareTexture::First; cur; cur = cur->Next)
cur->Reset();
}
void VkHardwareTexture::Reset()
{
if (auto fb = GetVulkanFrameBuffer())

View file

@ -23,6 +23,7 @@ public:
VkHardwareTexture();
~VkHardwareTexture();
static void ResetAll();
void Reset();
void Precache(FMaterial *mat, int translation, int flags);
@ -37,10 +38,6 @@ public:
// Wipe screen
void CreateWipeTexture(int w, int h, const char *name);
static VkHardwareTexture *First;
VkHardwareTexture *Prev = nullptr;
VkHardwareTexture *Next = nullptr;
VulkanImage *GetImage(FTexture *tex, int translation, int flags);
VulkanImageView *GetImageView(FTexture *tex, int translation, int flags);
@ -55,6 +52,10 @@ private:
void ResetDescriptors();
static VkHardwareTexture *First;
VkHardwareTexture *Prev = nullptr;
VkHardwareTexture *Next = nullptr;
struct DescriptorEntry
{
int clampmode;