2025-07-21 09:45 CEST

View Revisions: Issue #3712

Summary 0003712: LoadingMT seems to still cause trouble on some systems
Revision 2013-04-16 23:48 by abma
Description https://github.com/spring/spring/commit/d6b0e6b33ed6686f7d25e446fe0e2b8696eed668#commitcomment-2982220

First a GL fact:
When you call a GL function e.g. glColor4f(), then you make a call directly into the GL driver (assuming DRI under X11). In general you don't make a call to the OS! This is in contrast to DirectX, where you make calls to the DirectX layer first which then calls the gpu driver. This adds a overhead layer to directx which makes many calls slower than under GL.

Now @CodeXL:
When you create a GL context you normally would have to retrieve all GL function pointers from this exact GL context. Cause theoretically your GL contexts could reside on different GPUs, and so a GL function called in one context would have to speak to a diff gpu driver than the same GL function in another GL ctx.
Now we normally make sure all contexts reside on the same GPU and so would speak to the same gpu driver. But the gpu driver is still allowed to return different function pointers for those ctx's, afaik NV doesn't do so, but I know ATI returns different pointers depending on the requested GL versions for the ctx. And it seems CodeXL does something similar. This can cause issues, yeah even crashes.
Still the only solution is to retrieve all gl function pointers for each ctx and then save it in ThreadLocalStorage. And GLEW even has a flag for it. Why don't we do so?

    TLS is much slower (if ideal 2-3x, worst case 12x)
    all distro shipped GLEWs are compiled without that specific flag, so we would need to include GLEW into Spring. Maybe there is a way w/o that, but then all relevant GL functions need to be called via a namespace/class.
    GML
    all our GL ctx should reside on same GPU and use same GL version
    makes stuff more complicated
Revision 2013-04-16 23:47 by abma
Description https://github.com/spring/spring/commit/d6b0e6b33ed6686f7d25e446fe0e2b8696eed668#commitcomment-2982220