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) {
case MAP_AND_SYNC:
for(u32 i=0; i<SYNC_POINTS; i++)
glDeleteSync(fences[i]);
delete [] fences;
DeleteFences();
break;
case MAP_AND_RISK:
case MAP_AND_ORPHAN:
case BUFFERSUBDATA:
case BUFFERDATA:
break;
case PINNED_MEMORY:
for(u32 i=0; i<SYNC_POINTS; i++)
glDeleteSync(fences[i]);
delete [] fences;
DeleteFences();
glBindBuffer(m_buffertype, 0);
glFinish(); // ogl pipeline must be flushed, else this buffer can be in use
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:
void Init();
void Shutdown();
void DeleteFences();
StreamType m_uploadtype;
u32 m_buffer;