Picking up on this, I've been working with Vincent's gfx_api and Vulkan backend patches (rebased on the current master branch, with refactoring, fixes, and enhancements). Some help testing would be greatly appreciated.
For anyone running Windows, here are new (beta) Vulkan-supporting builds:
New Builds (2019-07-13a)
Full Installer (Windows x86): https://ci.appveyor.com/api/buildjobs/b ... taller.zip
Portable Build (Windows x86): https://ci.appveyor.com/api/buildjobs/b ... rtable.zip
To start with the Vulkan backend, run:
warzone2100.exe --vulkan
To enable additional 3D-graphics-related logging, use:
warzone2100.exe --vulkan --debug=3d
(We'll need this extra logging information if you have any issues.)
(
IMPORTANT: These builds default to the OpenGL backend if
--vulkan is not specified. They support both the existing OpenGL backend and the new Vulkan backend.)
You will, of course, need a graphics card & drivers that support Vulkan. (Vulkan 1.0 support should be all that's required.)
I'm very curious about any feedback. Does it work / not work on your system? How does the performance compare to the (default) OpenGL backend?
The changes since vlj's original Vulkan patch are too many to list, but the highlights are:
- Support the changed gfx_api interface (and other WZ changes since vlj's original patch)
- Require only C++11
- Limit requirements to the "Vulkan Portable Subset"
- Compile on all supported compilers
- Work on non-Windows platforms, in addition to Windows
- Use dynamic loading of Vulkan APIs / libraries
- Support the new backend_Impl_Factory
- Handle many more recommended practices for initializing Vulkan
- Handle systems with multiple GPUs
- Query and handle instance / device / etc features, extensions and limits
- Provide more comprehensive device selection / surface creation / initialization (etc)
- Handle separate graphics and presentation queues
- Handle swapchain minImageCount / maxImageCount
- Handle *many* more error conditions (ex. re-creating swapchain, lost surface)
- Support live window resizing
- Restructure the render pass (and barriers / related)
- Fix bugs / restructure based on the latest Vulkan validation layers
- Rebuild graphics pipelines if necessary
- Handle generating mipmaps
- Handle cleanup and shutdown (and destroying resources in the proper order)
- Clamp drawableSize to VkSurfaceCapabilitiesKHR minImageExtent / maxImageExtent
- Use Vulkan Memory Allocator
- Run on MoltenVK (Vulkan -> Metal)
- Support Multisample Anti-aliasing (MSAA)
Some things that currently
don't work in Vulkan mode:
- Toggling vsync (vsync is always enabled)
- Built-in screenshot support
- Using the debug-mode "Make a performance measurement sample" key binding
Some differences in Vulkan mode:
- "Fullscreen" is the so-called "borderless windowed fullscreen" / "fullscreen desktop" mode, instead of the classic / old-fashioned "exclusive" full-screen. As such, the fullscreen resolution will always be the same as your desktop resolution. If you'd like to change the size at which the UI (etc) renders, use the "Display Scaling" option in the Video Options menu.
- Mods that use custom shaders will not load the custom shaders (ex. ArtRev mod). They will need to be updated to also provide Vulkan shaders (instructions coming in the future).
EDIT:
Compiling notes:
- Only the CMake build toolchain (currently) supports the Vulkan backend
- You will likely want to install the Vulkan SDK. See: https://vulkan.lunarg.com/sdk/home
- Some distros may have a package for this, but you will need both: (a) recent Vulkan SDK headers, and (b) glslc (to compile the shaders)
- SDL2 must be compiled with Vulkan support enabled. Some Linux distros (especially older releases) compile SDL2 without Vulkan support - to fix, you'll need to compile SDL2 from source (and make sure Vulkan support is enabled)