mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +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 "vulkan/renderer/vk_renderpass.h"
|
||||||
#include "doomerrors.h"
|
#include "doomerrors.h"
|
||||||
|
|
||||||
|
VKBuffer *VKBuffer::First = nullptr;
|
||||||
|
|
||||||
|
VKBuffer::VKBuffer()
|
||||||
|
{
|
||||||
|
Next = First;
|
||||||
|
First = this;
|
||||||
|
if (Next) Next->Prev = this;
|
||||||
|
}
|
||||||
|
|
||||||
VKBuffer::~VKBuffer()
|
VKBuffer::~VKBuffer()
|
||||||
{
|
{
|
||||||
if (map)
|
if (Next) Next->Prev = Prev;
|
||||||
|
if (Prev) Prev->Next = Next;
|
||||||
|
else First = Next;
|
||||||
|
|
||||||
|
if (mBuffer && map)
|
||||||
mBuffer->Unmap();
|
mBuffer->Unmap();
|
||||||
|
|
||||||
auto fb = GetVulkanFrameBuffer();
|
auto fb = GetVulkanFrameBuffer();
|
||||||
|
@ -16,6 +29,14 @@ VKBuffer::~VKBuffer()
|
||||||
fb->FrameDeleteList.Buffers.push_back(std::move(mBuffer));
|
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)
|
void VKBuffer::SetData(size_t size, const void *data, bool staticdata)
|
||||||
{
|
{
|
||||||
auto fb = GetVulkanFrameBuffer();
|
auto fb = GetVulkanFrameBuffer();
|
||||||
|
|
|
@ -13,8 +13,11 @@
|
||||||
class VKBuffer : virtual public IBuffer
|
class VKBuffer : virtual public IBuffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
VKBuffer();
|
||||||
~VKBuffer();
|
~VKBuffer();
|
||||||
|
|
||||||
|
void Reset();
|
||||||
|
|
||||||
void SetData(size_t size, const void *data, bool staticdata) override;
|
void SetData(size_t size, const void *data, bool staticdata) override;
|
||||||
void SetSubData(size_t offset, size_t size, const void *data) override;
|
void SetSubData(size_t offset, size_t size, const void *data) override;
|
||||||
void Resize(size_t newsize) override;
|
void Resize(size_t newsize) override;
|
||||||
|
@ -25,6 +28,10 @@ public:
|
||||||
void *Lock(unsigned int size) override;
|
void *Lock(unsigned int size) override;
|
||||||
void Unlock() override;
|
void Unlock() override;
|
||||||
|
|
||||||
|
static VKBuffer *First;
|
||||||
|
VKBuffer *Prev = nullptr;
|
||||||
|
VKBuffer *Next = nullptr;
|
||||||
|
|
||||||
VkBufferUsageFlags mBufferType = 0;
|
VkBufferUsageFlags mBufferType = 0;
|
||||||
std::unique_ptr<VulkanBuffer> mBuffer;
|
std::unique_ptr<VulkanBuffer> mBuffer;
|
||||||
std::unique_ptr<VulkanBuffer> mStaging;
|
std::unique_ptr<VulkanBuffer> mStaging;
|
||||||
|
|
|
@ -89,6 +89,9 @@ VulkanFrameBuffer::~VulkanFrameBuffer()
|
||||||
for (VkHardwareTexture *cur = VkHardwareTexture::First; cur; cur = cur->Next)
|
for (VkHardwareTexture *cur = VkHardwareTexture::First; cur; cur = cur->Next)
|
||||||
cur->Reset();
|
cur->Reset();
|
||||||
|
|
||||||
|
for (VKBuffer *cur = VKBuffer::First; cur; cur = cur->Next)
|
||||||
|
cur->Reset();
|
||||||
|
|
||||||
PPResource::ResetAll();
|
PPResource::ResetAll();
|
||||||
|
|
||||||
delete MatricesUBO;
|
delete MatricesUBO;
|
||||||
|
|
Loading…
Reference in a new issue