Yesterday I merged all my recent work into the master branch, totaling about a month’s worth of new code. The changes largely focus on simplifying the low-level OpenGL classes.
Before going into the GL details, I should mention that gkv311 was kind enough to contribute an implementation for the row-interleaved 3D display mode. If you have a monitor that supports such a mode, you can enable it in the 3D & VR Settings dialog. (Tracker issue: #2164)
The general theme of the GL changes is that Doomsday now uses the Qt 5.4 OpenGL classes. This means that instead of going through Qt widgets, Doomsday can run directly in a window with an OpenGL surface. In the past, Doomsday was first rendering its window contents into a texture, and then copying those to the Qt widget’s framebuffer. In some cases, the Qt widget would then do another copy to move the contents to the window backbuffer, where they would eventually be swapped to screen. That’s a lot of copying!
Starting with build 2109, Doomsday renders the window contents as follows:
- Each player’s 3D view of the game world is rendered into a separate texture. This is usually the only part of the frame that gets rendered into a texture. It is also the only part where antialiasing is enabled (since it does little good with 2D UI rendering).
- The texture containing the 3D view is retained until time advances in the game world. This means the UI can be redrawn (e.g., for blurring) without incurring a huge performance penalty. (I’ve yet to enable UI blurring when the game is loaded.) It also means that the 3D view can be trivially copied for inclusion in savegames, etc.
- There is a new component called ViewCompositor that assembles the full contents of the game view, including the 3D view texture, view border, HUD, automap, intermission, etc. The advantage here is that the composition can be quickly done to any rendering target because it only involves simple 2D drawing operations. For instance, the busy mode window background freezing now draws a separate copy of the composited window contents instead of reading back from the window.
- ViewCompositor normally draws the view directly to the window backbuffer, so no unnecessary framebuffer copying is done.
The practical benefits are two-fold. Slower GPUs may see some performance boost since fewer full-window copies are made, and antialiasing is also less expensive. On the source code level, player-specific 3D view textures make drawing dramatically simpler because one does not have to worry about setting viewports or only accessing a certain subregion of the window. This is particularly nice when rendering camera lens effects that may involve reading back from the view texture.
Some turbulence is to be expected whenever a larger amount of new code lands in the build. Let me know (or submit a report) if you encounter anything that seems to be malfunctioning.
The currently known issues are:
- The vsync setting is not being applied at runtime, only at launch — meaning at the moment you need to restart Doomsday for vsync changes to come into effect. This will be fixed in upcoming builds.
- The “Hardware stereo” 3D mode is not working correctly.