-
Thibault Lemaire authored
On macOS the OpenGL implementation supports either OpenGL 2.1 or OpenGL 4.1 Core Profile (and nothing else). Also, with the OpenGL 4.1 Core Profile, only GLSL 4.10 is supported. The existing code and shaders were compatible with 2.1, but 4.1 Core (and GLSL 4.10) has some breaking changes. This commit adds support for OpenGL 4.1 in a way that's backward-compatible with any previous version down to 2.0. --- Additional notes: - ogl_display_render had to be made robust to OpenGL resets In the msqogl.cpp filter for example, we reset the OpenGL context with every frame, which breaks VAO and array buffer bindings. - Handling unusable OpenGL context In case we could load neither the new nor the legacy shaders, let us clean up and flag it to avoid rendering, which would only flood the logs with OpenGL errors. - The msqogl filter had to be fixed because it was reusing the OpenGL context across different windows - Some code has been added to measure GPU render time. The code is gated by an #ifdef so you have to explicitely enable it. - The whole fragment shader was rewritten to make it easier to understand. The incorrect "YUV" naming was fixed to the more accurate "YCbCr", and the code was changed to be easier to follow with the wikipedia article on Y'CbCr at hand I have verified and tested that this rewrite has the same output as the original fragment shader within acceptable precision. (I have detected some small scattered artefacts using GIMP's "color erase" layer mode, which I attribute to the precision of the constants in my rewrite being higher, but nothing noticeable to the naked eye.) I have also failed to notice any difference in performance. Both old and new shaders operate within ]0.8;2.7[ milliseconds draw time for a 1920x1080 render surface on an Intel(R) UHD Graphics 630 integrated graphics processor.
fca427e9