Page 1 of 1

CIrrDeviceMacOSX::flush()

Posted: Mon Aug 26, 2013 12:05 am
by devonsoft

Code: Select all

void CIrrDeviceMacOSX::flush()
{
    if (CGLContext != NULL)
    {
        glFinish();
        CGLFlushDrawable(CGLContext);
    }
}
OpenGL performance on OSX was twice as slow as Windows on the same machine for our game, so I finally profiled it with OpenGL Profiler: Image.


Wow, that's a lot of time in glFinish. Taking out glFinish makes it go from 28fps to 60fps. I wasn't sure if there was a reason glFinish() was being called as taking it out didn't seem to affect anything and Windows just calls SwapBuffers instead. I'm thinking the explicit glFinish is unneeded as according to Apple: "An implicit glFlush operation is performed by CGLFlushDrawable before it returns. For optimal performance, an application should not call glFlush immediately before calling CGLFlushDrawable." https://developer.apple.com/library/mac ... shDrawable

Re: CIrrDeviceMacOSX::flush()

Posted: Mon Aug 26, 2013 8:12 am
by Nadro
Yes, glFinish should be removed. Thanks for report. I'll fix it today ;)

Update:
Fixed in trunk.

Re: CIrrDeviceMacOSX::flush()

Posted: Mon Jan 27, 2020 9:30 pm
by devonsoft
I can't explain this, but when updating Octodad for OSX 10.14 and 64-bit it seems like now the opposite is true and not calling glFlush() before CGLFlushDrawable causes a synchronization issue or something and it is considerably slower and the null driver FPSCounter is incorrect. Re-adding glFlush() seems to get rid of the stuttering and the FPSCounter then matches my quartz debug fps. I have only tested this on my one machine but may be related to this (although I noticed it with my discrete gpu not the intel one) https://github.com/lionheart/openradar- ... sues/12866

I have to check out the Metal driver sometime because Apple's opengl implementation is always a nightmare.

**This might not matter in 1.8 because it seems like endScene has been restructured

Re: CIrrDeviceMacOSX::flush()

Posted: Tue Jan 28, 2020 2:03 pm
by CuteAlien
There is no metal driver, only a branch with no commits :-(
If anyone wants to maintain OS X - right now we have several people with commit-rights and none of them using them. I'm fine with adding more. Even if it's just about fixing compile-errors once in a while. As for now we don't even have anyone doing compile-checks (I'll fix them whenever I get a report, but I can't test).