ogl: only free use fences

This fixes some opengl error when not all fences are created.
This commit is contained in:
degasus 2013-08-29 21:03:48 +02:00
parent bcb18d6a2b
commit e685d198bd
2 changed files with 12 additions and 7 deletions

View File

@ -222,20 +222,15 @@ void StreamBuffer::Shutdown()
{ {
switch(m_uploadtype) { switch(m_uploadtype) {
case MAP_AND_SYNC: case MAP_AND_SYNC:
for(u32 i=0; i<SYNC_POINTS; i++) DeleteFences();
glDeleteSync(fences[i]);
delete [] fences;
break; break;
case MAP_AND_RISK: case MAP_AND_RISK:
case MAP_AND_ORPHAN: case MAP_AND_ORPHAN:
case BUFFERSUBDATA: case BUFFERSUBDATA:
case BUFFERDATA: case BUFFERDATA:
break; break;
case PINNED_MEMORY: case PINNED_MEMORY:
for(u32 i=0; i<SYNC_POINTS; i++) DeleteFences();
glDeleteSync(fences[i]);
delete [] fences;
glBindBuffer(m_buffertype, 0); glBindBuffer(m_buffertype, 0);
glFinish(); // ogl pipeline must be flushed, else this buffer can be in use glFinish(); // ogl pipeline must be flushed, else this buffer can be in use
FreeAlignedMemory(pointer); FreeAlignedMemory(pointer);
@ -246,4 +241,13 @@ void StreamBuffer::Shutdown()
} }
} }
void StreamBuffer::DeleteFences()
{
for(u32 i=SLOT(m_free_iterator)+1; i < SYNC_POINTS; i++)
glDeleteSync(fences[i]);
for(u32 i=0; i<SLOT(m_iterator); i++)
glDeleteSync(fences[i]);
delete [] fences;
}
} }

View File

@ -42,6 +42,7 @@ public:
private: private:
void Init(); void Init();
void Shutdown(); void Shutdown();
void DeleteFences();
StreamType m_uploadtype; StreamType m_uploadtype;
u32 m_buffer; u32 m_buffer;