The "surface" concept is very fuzzy today, and it would be good to clean these APIs up for Qt 6. A non exhaustive list:
- QSurfaceFormat is a grab-bag or all sorts of properties, some/many that don't apply to the specific surface type that's being used, eg OpenGL versions and profile
- QSurfaceFormat has a colorspace, but should be aligned with QColorSpace
- QWindow has setFormat/requestedFormat for the requested format, but the requested format is not necessarily tied to a QWindow, but rather to the way the window is rendered to later on
- QWindow::format is supposed to return the actual format of the window, but again, this can be dynamic depending on how the window is rendered to later on.
- QWindow::format doesn't update dynamically to reflect all changes in the underlying platform format, e.g. when the color space changes. We don't have a change signal for it either.
- QWindow has a single surfaceType, but nowadays a window can be used with many different rendering strategies. Tying these together makes for awkward APIs like RasterGLSurface.
- QWindow is a subclass of QSurface, but it would be better modeled as having a surface. That would allow modeling e.g. many windows sharing the same surface (drawing to the parent NSWindow surface on macOS) or each window having its own surface (layer-backed views on macOS), or even a window having multiple surfaces (many child layers on macOS).
- If we split the QWindow concept (geometry, etc) from the "rendering target" QSurface we can leave surface format configuration to the subclasses, e.g QOpenGLSurface, QVulkanSurface, etc. That would also allow us to merge QSurfaceFormat into QSurface.
- Remove/move QSurface::supportsOpenGL
- Remove/move QWindow::setVulkanInstance/vulkanInstance