Skip to content

Methane Kit v0.7.1

Compare
Choose a tag to compare
@egorodet egorodet released this 08 Feb 19:35
· 464 commits to master since this release

This is a refactoring release which replaces monolithic "Graphics Core" module with modular RHI (Rendering Hardware Interface) consisting of interfaces, base implementation, DirectX, Vulkan, Metal and Null backend modules and new "Impl" module with PIMPL classes providing convenient way to use RHI with an extra performance boost from inlining API calls directly to final implementation, instead of virtual calls made through abstract interfaces. See performance comparison of FPS in Methane Asteroids benchmark with 3 implementations (all compiled with the same updated compiler optimization flags): v0.7.0 RHI virtual interfaces, v0.7.1 RHI PIMPL classes without inlining and with inline calls to final implementation. All tutorials, graphics primitives and user interface classes were rewritten to use RHI PIMPL classes, which allow to reduce code complexity and improve readability.

MethaneKit-RHI-Interfaces-Performance

Graphics libraries

  • RHI PIMPL classes were added as an alternative to using RHI abstract interfaces in your application (see Modules/Graphics/RHI/Impl). PIMPL classes are more convenient to use since they allow to write code without smart pointers and allow to get more performance with final implementation inlining. CMake option METHANE_RHI_PIMPL_INLINE_ENABLED enables RHI final implementation inlining for PIMPL classes and allows to make direct calls to final RHI implementation without virtual call overhead. PIMPL inlining can gives up to 5% of extra performance in highly loaded rendering scenario.
  • Graphics Core module was renamed to Graphics RHI (RHI is a common acronym for Rendering Hardware Interface) and split into several CMake modules Interface, Base, DirectX, Vulkan, Metal and Impl - this makes architecture even more modular and extensible.
  • All RHI abstract interfaces were renamed to start with I prefix in file and struct names and put under Methane::Graphics::Rhi namespace, for example Graphics::Device -> Graphics::Rhi::IDevice.
  • All RHI implementation classes were symmetrically renamed by removing impl. suffix and moving it under impl. namespace, for example Graphics::DeviceBase -> Graphics::Base::Device, Graphics::DeviceDX -> Graphics::DirectX::Device. Source files were renamed accordingly: Graphics/DeviceBase.h -> Graphics/Base/Device.h, Graphics/DeviceDX.h -> Graphics/DirectX/Device.h. This allows to mirror RHI implementations for different APIs with completely symmetrical classes and files naming inside different namespaces.
  • Removed excessive Create static factory functions of ITexture and IBuffer interfaces using custom setting initialisers.
  • Add sequential CreateX virtual methods in RHI interfaces and use them in implementation of X::Create static factory functions.
  • Added RHI Null implementation which is going to be used in unit tests.
  • BLITCommandList was renamed to TransferCommandList.
  • QueryBuffer was renamed to QueryPool.
  • Replaced std::string with std::string_view in IObject::SetName and GetName methods.
  • Simplified implementation of Buffer and Texture classes for Vulkan and DirectX APIs by replacing template class variants with common class implementation.
  • Migrated ImageLoader, ScreenQuad and SkyBox to use RHI PIMPL classes instead abstract interfaces and implemented themself in PIMPL style.
  • Split MeshBuffers template class implementation to MeshBuffersBase class and derived template class.
  • Some headers from Primitives modules were moved inside RHI submodules:
    • Moved Windows/DirectXErrorHandling.h to RHI/DirectX module and renamed to ErrorHandling.h.
    • Moved FpsCounter.h and split to interface and implementation to RHI/Interfaces and RHI/Base modules.

User Interface

  • Migrated Font, Text and Badge classes to RHI PIMPL classes instead of abstract interfaces and implemented themself in PIMPL style.

Platform libraries

  • Fixed X11 window resizing on Linux with Nvidia drivers: ErrorOutOfDateKHR after resizing swap-chain on Linux with NVidia proprietary drivers (close #105)
  • Platform/Input module was split into to submodules: Keyboard, Mouse, Controllers and ActionControllers. All classes from this modules were moved under Platform::Input namespace.

Data libraries

  • Added Data::EnumMask<EnumType> template class implementing bit-mask operations on enum values used as bits. EnumMask type is used in Methane Kit public interfaces instead of magic_enum::bitwise_operators.
  • Added Data::Transmitter<ICallbackType> class which implements Data::IEmitter by transmitting callback connections to some other emitter instance.

External libraries

  • CPM.cmake was updated to v0.37. This release fix parallel cmake generation for multiple configuration used in CLion.
  • Tracy was updated to v0.9.
  • DirectX-Headers was updated to v1.608.2b to use modular headers instead of monolithic d3dx12.h in DirectX RHI.

Tutorials applications

  • All tutorial implementations were rewritten to use RHI PIMPL classes instead of smart pointers to abstract interfaces. It allows to reduce code complexity and make it looks clean and simple.

Tests

  • Added unit tests for class from Data/EnumMask.hpp.
  • Added unit tests for functions from Data/EnumMaskUtils.hpp.
  • Added unit tests for class from Data/Transmitter.hpp

Builds

  • Tracy executable file is automatically added in "Profile" build artifacts (pre-platform executables are taken from Methane Powered Tracy releases).
  • Enabled aggressive optimisations in Release builds, including whole program optimisations with link-time code generation, inline functions expansion, disable security checks and others.
  • ITT instrumentation is disabled by default in Release builds, but still enabled in Profile builds.
  • Add explicit CMake options printing during configuration.
  • Windows builds in GitHub Actions are upgraded to use Visual Studio 2022.
  • Dependent GitHub actions were updated in yaml scripts to use NodeJS 16.
  • CI Sonar Scan builds now use new GitHub action sonarcloud-github-c-cpp to install scanner binaries. build-wrapper tool is not used anymore, it was replaced with Ninja compilation data base generated by CMake.

Documentation

  • Tutorials README documentation was updated to reflect PIMPL RHI classes usage instead of pointers to abstract interfaces.
  • Added Data, Platform, Graphics and UserInterface modules dependency diagrams in folder README.md files using Mermaid markdown.
  • Updated High-Level Architecture diagram, RHI classes diagram and GraphViz module relations diagram.

Release CI Runs