Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Screen('ColorRange'): Add workaround for color clamping OpenGL driver…
… bugs. Turns out the recent proprietary AMD OpenGL driver on MS-Windows has a broken color clamping query implementation, which does not report clamp state for GL_CLAMP_VERTEX_COLOR_ARB or GL_CLAMP_FRAGMENT_COLOR_ARB. As such, we get reported failure to change color clamping on Windows 10 + AMD, whereas the same code works fine on Windows 10 NVidia or Intel. Work around this by detecting the failure and auto-selecting our own internal GLSL shader based fallback path. This should fix it - at a performance penalty, as vertex color clamping can be handled by our fallback shader, fragment color clamping has proper default behaviour of clamping on for fixed point unorm framebuffers, and clamping off for floating point framebuffers. Only readback clamping needs to be controlled via glClampColorARB, but luckily readback clamping is supported by glClampColor() as well, in a backwards compatible way, so we should be good. Famous last words... Note that this bug is so far only present on AMD on Windows, so we can get away with only rebuilding Screen() for MS-Windows for the moment. Also note that because it is the query that is broken, not the setting, our response of selecting the fallback path may be not necessary. However, it is unlikely to hurt, and we can not know, so better safe than sorry.
- Loading branch information