OpenGL deferred delete fix

This commit is contained in:
Jack Andersen 2015-12-07 15:49:17 -10:00
parent b579e20bc6
commit 3e4ed5ad1f
2 changed files with 13 additions and 4 deletions

View File

@ -29,7 +29,7 @@ class IApplication
public:
virtual ~IApplication() {}
enum class EPlatformType : uint8_t
enum class EPlatformType
{
Auto = 0,
Wayland = 1,

View File

@ -793,7 +793,7 @@ struct GLCommandQueue : IGraphicsCommandQueue
if (self->m_pendingFmtAdds.size())
{
for (GLVertexFormat* fmt : self->m_pendingFmtAdds)
ConfigureVertexFormat(fmt);
if (fmt) ConfigureVertexFormat(fmt);
self->m_pendingFmtAdds.clear();
}
@ -1028,7 +1028,16 @@ struct GLCommandQueue : IGraphicsCommandQueue
void delVertexFormat(GLVertexFormat* fmt)
{
std::unique_lock<std::mutex> lk(m_mt);
m_pendingFmtDels.push_back({fmt->m_vao[0], fmt->m_vao[1], fmt->m_vao[2]});
bool foundAdd = false;
for (GLVertexFormat*& afmt : m_pendingFmtAdds)
if (afmt == fmt)
{
foundAdd = true;
afmt = nullptr;
break;
}
if (!foundAdd)
m_pendingFmtDels.push_back({fmt->m_vao[0], fmt->m_vao[1], fmt->m_vao[2]});
}
void addFBO(GLTextureR* tex)
@ -1217,7 +1226,7 @@ GLDataFactory::newRenderTexture(size_t width, size_t height, size_t samples)
}
GLVertexFormat::GLVertexFormat(GLCommandQueue* q, size_t elementCount,
const VertexElementDescriptor* elements)
const VertexElementDescriptor* elements)
: m_q(q),
m_elementCount(elementCount),
m_elements(new VertexElementDescriptor[elementCount])