Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Methane Kit v0.7.1: refactor Graphics RHI and add RHI PIMPL classes with final implementation inlining #114

Merged
merged 294 commits into from
Feb 6, 2023

Conversation

egorodet
Copy link
Member

@egorodet egorodet commented Feb 5, 2023

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

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.

@egorodet egorodet added enhancement New feature or request infrastructure Build, tools, automation, etc. documentation Write documentation of some feature refactoring Code refactoring without adding new functionality dependencies Pull requests that update a dependency file labels Feb 5, 2023
@egorodet egorodet added this to the v0.7 milestone Feb 5, 2023
@egorodet egorodet self-assigned this Feb 5, 2023
@codecov-commenter
Copy link

codecov-commenter commented Feb 5, 2023

Codecov Report

Base: 33.34% // Head: 29.97% // Decreases project coverage by -3.37% ⚠️

Coverage data is based on head (4b0a398) compared to base (b0ab7e5).
Patch coverage: 18.60% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #114      +/-   ##
==========================================
- Coverage   33.34%   29.97%   -3.37%     
==========================================
  Files         269      391     +122     
  Lines       18490    23298    +4808     
  Branches     1373     1972     +599     
==========================================
+ Hits         6164     6981     +817     
- Misses      12188    16176    +3988     
- Partials      138      141       +3     
Flag Coverage Δ
linux 25.18% <13.87%> (+0.15%) ⬆️
macosx 44.87% <84.76%> (-29.45%) ⬇️
unittests 29.97% <18.60%> (-3.37%) ⬇️
windows 26.11% <98.42%> (-49.88%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
Apps/01-HelloTriangle/HelloTriangleApp.cpp 0.00% <0.00%> (ø)
Apps/02-HelloCube/HelloCubeApp.cpp 0.00% <0.00%> (ø)
Apps/03-TexturedCube/TexturedCubeApp.cpp 0.00% <0.00%> (ø)
Apps/04-ShadowCube/ShadowCubeApp.cpp 0.00% <0.00%> (ø)
Apps/04-ShadowCube/ShadowCubeApp.h 0.00% <0.00%> (ø)
Apps/05-Typography/TypographyApp.cpp 0.00% <0.00%> (ø)
Apps/05-Typography/TypographyApp.h 0.00% <0.00%> (ø)
Apps/05-Typography/TypographyAppController.cpp 0.00% <0.00%> (ø)
Apps/05-Typography/TypographyAppController.h 0.00% <0.00%> (ø)
Apps/06-CubeMapArray/CubeMapArrayApp.cpp 0.00% <0.00%> (ø)
... and 415 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 5 Code Smells

5.8% 5.8% Coverage
1.1% 1.1% Duplication

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

9.7% 9.7% Coverage
1.1% 1.1% Duplication

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 9 Code Smells

4.6% 4.6% Coverage
1.1% 1.1% Duplication

@egorodet egorodet merged commit abaabe1 into master Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file documentation Write documentation of some feature enhancement New feature or request infrastructure Build, tools, automation, etc. refactoring Code refactoring without adding new functionality
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Vulkan Present fails with ErrorOutOfDateKHR after resizing swapchain on Linux with NVidia proprietary drivers
2 participants