Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
ogl: only free use fences
This fixes some opengl error when not all fences are created.
  • Loading branch information
degasus committed Aug 29, 2013
1 parent bcb18d6 commit e685d19
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
18 changes: 11 additions & 7 deletions Source/Plugins/Plugin_VideoOGL/Src/StreamBuffer.cpp
Expand Up @@ -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);
Expand All @@ -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;
}

}
1 change: 1 addition & 0 deletions Source/Plugins/Plugin_VideoOGL/Src/StreamBuffer.h
Expand Up @@ -42,6 +42,7 @@ class StreamBuffer {
private:
void Init();
void Shutdown();
void DeleteFences();

StreamType m_uploadtype;
u32 m_buffer;
Expand Down

0 comments on commit e685d19

Please sign in to comment.