mixxxdj / mixxx

Mixxx is Free DJ software that gives you everything you need to perform live mixes.
http://mixxx.org
Other
4.29k stars 1.25k forks source link

OpenGL is marked as deprecated in macOS 10.14 #11761

Open daschuer opened 12 months ago

daschuer commented 12 months ago

Feature Description

We see the following warnings in our CI:

Warning: ../src/widget/wspinnyglsl.cpp:72:9: warning: 'glTexSubImage2D' is deprecated: first deprecated in macOS 10.14 - OpenGL API deprecated. (Define GL_SILENCE_DEPRECATION to silence these warnings) [-Wdeprecated-declarations]
        glTexSubImage2D(GL_TEXTURE_2D,
        ^
/Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:2726:13: note: 'glTexSubImage2D' has been explicitly marked deprecated here
extern void glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) OPENGL_DEPRECATED(10.0, 10.14);
            ^
Warning: ../src/widget/wspinnyglsl.cpp:193:5: warning: 'glDrawArrays' is deprecated: first deprecated in macOS 10.14 - OpenGL API deprecated. (Define GL_SILENCE_DEPRECATION to silence these warnings) [-Wdeprecated-declarations]
    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
    ^
/Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:2464:13: note: 'glDrawArrays' has been explicitly marked deprecated here
extern void glDrawArrays (GLenum mode, GLint first, GLsizei count) OPENGL_DEPRECATED(10.0, 10.14);
            ^
Warning: ../src/widget/wspinnyglsl.cpp:235:5: warning: 'glDrawArrays' is deprecated: first deprecated in macOS 10.14 - OpenGL API deprecated. (Define GL_SILENCE_DEPRECATION to silence these warnings) [-Wdeprecated-declarations]
    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
    ^
/Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:2464:13: note: 'glDrawArrays' has been explicitly marked deprecated here
extern void glDrawArrays (GLenum mode, GLint first, GLsizei count) OPENGL_DEPRECATED(10.0, 10.14);
            ^
3 warnings generated.
[742/903] Building CXX object CMakeFiles/mixxx-lib.dir/src/widget/wvumeterglsl.cpp.o
Warning: ../src/widget/wvumeterglsl.cpp:177:5: warning: 'glDrawArrays' is deprecated: first deprecated in macOS 10.14 - OpenGL API deprecated. (Define GL_SILENCE_DEPRECATION to silence these warnings) [-Wdeprecated-declarations]
    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
    ^
/Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/OpenGL.framework/Headers/
gl.h:2464:13: note: 'glDrawArrays' has been explicitly marked deprecated here
extern void glDrawArrays (GLenum mode, GLint first, GLsizei count) OPENGL_DEPRECATED(10.0, 10.14);
            ^
1 warning generated.
Swiftb0y commented 12 months ago

AFAIK that's from the fact that Apple just straight up killed OpenGL on newer MacOS versions. The only workaround would be to make use of a translation layer (similar to ANGLE) or reimplemented our waveforms based on Qt's QRhi infrastructure. The latter is more work but the only solution that's viable in the long run. Unfortunately QRhi is still private so unless we want the maintenance nightmare of using a private API, we should implement the waveforms using the primitives offered by QtQuick (QSG*-classes).

JoergAtGithub commented 12 months ago

Apple deprecated OpenGL in 2018. Apple supports only Metal and WebGPU nowadays.

Swiftb0y commented 12 months ago

Seems about right, 10.14 got released in Q3 of 2018...

m0dB commented 11 months ago

While deprecated, I doesn't look like Apple is actually removing OpenGL altogether. If they do, I don't think using a translation layer (or even porting) to Metal will be a big deal since we are using only pretty basic OpenGL.

But I agree that in the long run moving to the Qt scene graph (QSG*) classes is the way to go, hand in hand with moving to QML.

BTW, any idea how QRhi relates to https://doc.qt.io/qt-6/qtshadertools-qsb.html ?

Swiftb0y commented 11 months ago

QRhi is the internal abstraction for the native graphic apis. QSB is a tool that builds shader IR for all the native platforms at build time. We can then use the QSB generated files in the basic QSG* classes to implement cross-platform Qt Quick Items/Widgets using fragment and vertex shaders (no geometry shaders unfortunately). QRhi uses the qsb generated files and selects the appropriate shaders from those at runtime depending on the current platform IIUC. Does that make sense and answer your question?

Technically QRhi is still exported by Qt, but its undocumented and not stable so even though we could use it directly, I don't think we should. But it would still be better than writing native graphics code.