Skip to content

Methane Kit v0.8.0

Latest
Compare
Choose a tag to compare
@egorodet egorodet released this 02 Jan 13:01
· 5 commits to master since this release

Summary

In Methane Kit v0.8.0, several significant enhancements have been introduced:

  • Improved Program Bindings Configuration: The configuration of program bindings has been enhanced by defining argument access frequency directly within HLSL argument space modifiers. Previously, this was configured in the C++ program settings.
  • Enhanced Performance for Metal RHI: Performance of program bindings for Metal RHI has been improved by supporting the Argument Buffers API. This allows for more efficient writing of binding commands in command encoders.
  • Simplified Shader Argument Buffers Initialization: A simplified interface for initializing shader argument buffers using root constants has been added. This enables direct data assignment to program argument bindings and handles all buffer management within Methane RHI. For small constants "Push Constants" native API is also supported via RHI of program bindings.

Tutorials

  • Root-constants were applied across all tutorials instead of uniform buffers to simplify code.
  • Console Compute tutorial was extended with game rule selection using root constant value interface of program bindings.
  • ParallelRendering app can be built in two versions: first one is using addressable buffer views like before and second one is using root constants but with lower performance.

Graphics libraries

  • Shader argument access types were added in HLSL shaders as register space definitions (META_ARG_CONSTANT, META_ARG_FRAME_CONSTANT, META_ARG_MUTABLE), to replace shader arguments configuration Rhi::ProgramArgumentAccessors in ProgramSettings. RHI shader arguments reflection uses these register space definitions to add default argument accessors configuration, so that it is not necessary to be defined in user code of ProgramSettings.
  • Rhi::RootConstant class was added as a storage of constant data (derived from Data::Chunk), which can be set to buffer argument bindings, defined with ProgramArgumentValueType::RootConstantBuffer in Rhi::ProgramArgumentAccessors. Rhi::IProgramBindings::SetRootConstant allows to set root constant data for such argument bindings. Internally managed Rhi::RootConstantBuffer objects significantly simplify user code by eliminating the need in creating separate uniform buffers. Support of Root32BitConstants in DirectX and PushConstants in Vulkan and SetBytes in Metal was added via Rhi::ProgramArgumentValueType::RootConstantValue (close #140).
  • Metal::ProgramBindings in Metal RHI were extended with Metal Argument Buffers API support for more efficient shader argument bindings, similar to descriptor tables in DirectX 12 and descriptor sets in Vulkan. CMake option METHANE_METAL_ARGUMENT_BUFFERS_ENABLED was added to allow switching between direct resource binding and argument buffers (enabled by default). Metal argument buffers are created independently for groups of shader arguments with different argument access types. (close #138)
  • Metal::ProgramBindings were refactored to reduce code duplication with help of templates.
  • ProgramArgument and ProgramArgumentAccessor types were moved from IProgram.h header to ProgramArgument.h/cpp. ProgramArgumentAccessModifier enum was renamed to ProgramArgumentValueType.
  • Shader argument declaration macros were added in ProgramArgument.h to simplify program argument accessors setup: META_PROGRAM_ARG_* (ROOT_CONSTANT, ROOT_FRAME_CONSTANT, ROOT_MUTABLE, RESOURCE_CONSTANT, RESOURCE_FRAME_CONSTANT, RESOURCE_MUTABLE, etc.).
  • CommandListDebugGroup sub-group names now use std::string_view
  • ScreenQuad was migrated to root constants instead of uniform buffer.
  • Fixes:
    • Fixed Vulkan validation issues revealed by Vulkan SDK 1.3.290.0.
    • Fixed DirectX 12 GPU timestamp queries for DirectX, fixed invalid initial state of the read-back buffer.
    • Fixed Metal crash due to executing state of the current frame command lists and sporadic frame synchronization issue. VSync was disabled by default for Metal.
    • Fixed Vulkan RHI build with newer Vulkan SDK versions > 300.

Data libraries

  • Added support of prioritizing receivers in emitter list with priority argument of method Emitter<ICallback>::Connect(Receiver<ICallback>& receiver, uint32_t priority).

Common changes

  • Renamed all macroses META_CHECK_ARG_* by removal of ARG suffix to META_CHECK_*.
  • Apply hidden friend function pattern to binary operators by recommendation from SonarCloud.

User Interface libraries

  • Text program bindings now use root constants instead of manually created uniform buffers.

Tests

  • Added unit-tests to cover more classes of the "Graphics RHI" layer (continue #122):
    • ViewState test was added
    • Fence test was extended
    • BufferSet test was added
    • CommandKit test was added
    • CommandListDebugGroup test was added
    • ProgramBindings test was extended with root constant bindings.
  • Data::EventsTest was extended to check prioritizing of connected receivers.

External libraries

Build

  • Fixed memory leak of command encoders in Metal applications when RHI PIMPL inlining was disabled. Issue was root caused to -fobjc-arc compiler flag (ARC: automatic reference counting) was not set in MethaneBuildOptions target, as the result ARC was not enabled for the whole application, which led to leaking of some recurrently created Metal objects.
  • Experimental support of Apple's Metal Shader Converter was added to be used instead of SPIRV-Cross. Unfortunately, it does not work correctly in all cases and is disabled by default under CMake option METHANE_METAL_SHADER_CONVERTER_ENABLED.
  • Updated CMakeModules/FindWindowsSDK.cmake with fix for ARM64 architecture detection with VS2022 and Ninja and detection of the latest Windows SDK version 10.0.22621.
  • Added support of XCode 16 for MacOS Sequoia 15. Also fixed MacOS build compatibility with older Xcode versions.
  • Apple application RPATH /usr/local/lib was added to find libvulkan.1.lib
  • Added CMake option METHANE_METAL_FRAMES_SYNC_WITH_DISPATCH_SEMAPHORE
  • Build\Windows\Build.bat was extended with more build options.

Continuous Integration

  • Allow manual dispatch of CI Build, CodeQL and Sonar Scan workflows in GitHub Actions.
  • Switched Sonar-Scan action back to macos-13 hosted runners to use Intel h/w, instead of M1/ARM, which is not supported yet.
  • Update all GitHub actions to use latest version of Node.js.
  • Fixed CodeCov coverage results upload.
  • CodeQL scan was re-enabled on Windows.
  • Vulkan SDK was updated to v1.3.290.0 in macOS CI.

Documentation

  • Updated all tutorials documentation according to latest code changes and with help of Copilot enhancements.
  • Added documentation to CubeMapArray and ParallelRendering tutorials.

Note

For MacOS users: In case of error "App Is Damaged and Can't Be Opened" on attempt to run bundled application, try removing application from quarantine using the following command:

sudo xattr -d com.apple.quarantine MethaneHelloTriangle.app
open MethaneHelloTriangle.app

🎄 🎄 🎄 ⛄ 🎅 Happy New Year! 🎅 ⛄ 🎄 🎄 🎄