Qt Gui can not depend on OpenGL in Qt 6 anymore. Move all the OpenGL related classes into the Qt OpenGL module. (or somewhere else if that's removed/deprecated)
To be done in line with QRhi's needs: this must not include things like QOpenGLContext, QOpenGL(Extra)Functions, and QOpenGLProgramBinaryCache, and all OpenGL-related QPA plumbing. Those are also dependencies for the RHI's OpenGL backend.
This is currently being done in smaller chunks:
done in reviews/waiting for coin
QOpenGLPaintEngine and related classes
QOpenGLTexture and related classes
QOpenGLTextureBlitter - Was used by QPlatformBackingStore,
decoupled in this patch and moved in this one
QOpenGLWidget has been moved to a new QtOpenGLWidgets module (similarly to QtQuickWidgets).
QOpenGLShaderProgram - Can be moved after QOpenGLTextureBlitter
QOpenGLVertexArrayObject - Can be moved after texture blitter
QOpenGLBuffer - Can be moved after texture blitter
QOpenGLVersionFunctions*: We're changing the API (source incompatible) slightly and moving these.
This leaves us with:
- QOpenGLContext - Used by RHI, if we wan't to remove it from public gui API, we need to make it private and provide a wrapper in the opengl module. WIP patch: https://codereview.qt-project.org/c/qt/qtbase/+/292370
- QOpenGLFunctions and QOpenGLExtraFunctions (non versioned) - These are used by RHI (same as QOpenGLContext)
I modeled the dependencies as I came across them:
The image is showing work of patches that I considered done (yellow boxes haven't passed reviews/CI yet).
- https://codereview.qt-project.org/c/qt/qtbase/+/288247 is pending. Have to fight build system bullsh*t.
- As a follow up to that, https://bugreports.qt.io/browse/QTBUG-82742 needs to be implemented
Then, the next step would be doing something with the Khronos extension headers (qopenglext.h qopengles2ext.h). These are included from qopengl.h which makes things tricky. Perhaps doable with some sort of jugglery with splitting qopengl.h into two (one in gui, not including the ext headers, another one on opengl that does; or something along those lines). After that my proposal would be to stop there. QOpenGLContext (and its backing QPlatformOpenGLContext), and the (cross-platform) function resolvers (qopenglfunctions.h etc.) should stay in Gui as they are required by the RHI anyways. Moving these would also open up the same problem for any other API - e.g., why should QVulkanInstance be in Gui then? Moving these is not reasonable (or valuable) in my mind.