mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- fix model shutdown crash
This commit is contained in:
parent
eb9f6ec313
commit
d413581ee2
3 changed files with 32 additions and 1 deletions
|
@ -6,9 +6,22 @@
|
|||
#include "vulkan/renderer/vk_renderpass.h"
|
||||
#include "doomerrors.h"
|
||||
|
||||
VKBuffer *VKBuffer::First = nullptr;
|
||||
|
||||
VKBuffer::VKBuffer()
|
||||
{
|
||||
Next = First;
|
||||
First = this;
|
||||
if (Next) Next->Prev = this;
|
||||
}
|
||||
|
||||
VKBuffer::~VKBuffer()
|
||||
{
|
||||
if (map)
|
||||
if (Next) Next->Prev = Prev;
|
||||
if (Prev) Prev->Next = Next;
|
||||
else First = Next;
|
||||
|
||||
if (mBuffer && map)
|
||||
mBuffer->Unmap();
|
||||
|
||||
auto fb = GetVulkanFrameBuffer();
|
||||
|
@ -16,6 +29,14 @@ VKBuffer::~VKBuffer()
|
|||
fb->FrameDeleteList.Buffers.push_back(std::move(mBuffer));
|
||||
}
|
||||
|
||||
void VKBuffer::Reset()
|
||||
{
|
||||
if (mBuffer && map)
|
||||
mBuffer->Unmap();
|
||||
mBuffer.reset();
|
||||
mStaging.reset();
|
||||
}
|
||||
|
||||
void VKBuffer::SetData(size_t size, const void *data, bool staticdata)
|
||||
{
|
||||
auto fb = GetVulkanFrameBuffer();
|
||||
|
|
|
@ -13,8 +13,11 @@
|
|||
class VKBuffer : virtual public IBuffer
|
||||
{
|
||||
public:
|
||||
VKBuffer();
|
||||
~VKBuffer();
|
||||
|
||||
void Reset();
|
||||
|
||||
void SetData(size_t size, const void *data, bool staticdata) override;
|
||||
void SetSubData(size_t offset, size_t size, const void *data) override;
|
||||
void Resize(size_t newsize) override;
|
||||
|
@ -25,6 +28,10 @@ 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;
|
||||
|
|
|
@ -89,6 +89,9 @@ VulkanFrameBuffer::~VulkanFrameBuffer()
|
|||
for (VkHardwareTexture *cur = VkHardwareTexture::First; cur; cur = cur->Next)
|
||||
cur->Reset();
|
||||
|
||||
for (VKBuffer *cur = VKBuffer::First; cur; cur = cur->Next)
|
||||
cur->Reset();
|
||||
|
||||
PPResource::ResetAll();
|
||||
|
||||
delete MatricesUBO;
|
||||
|
|
Loading…
Reference in a new issue