Methane Kit v0.5
egorodet
released this
26 Apr 20:58
·
1259 commits
to master
since this release
HLSL++ math, Graphics API optimizations, automated static code analysis, unit-tests code coverage, code improvements and extensive refactoring were done in this release:
- Samples and tutorials:
- Migrated tutorials and samples from CML to HLSL++ vector math library with SIMD intrinsics acceleration for CPU. Removed explicit alignment of uniform structure fields, which is not required anymore for HLSL++ types, since they already use 16-bytes aligned data storage.
- Asteroids sample was optimized with up to 50% FPS increase:
- Uniforms buffer size was reduced by reusing scene view-projection matrix in shaders (+7% FPS)
- Uniforms buffer data transfer is made asynchronously with draw commands encoding (+20% FPS)
- Disabled repeated retaining of the bound resources in command list draw calls (+30% FPS)
- Disabled automatic resource barriers setup during parallel asteroids rendering to take advantage of automatic state propagation from Common state.
- Got rid of excessive program binding calls in DirectX as a result of using Frame-Constant argument accessors in program bindings.
- Documentation updates:
- Textured Cube tutorial documentation was added (closed #17)
- Shadow Cube tutorial documentation was added (closed #18)
- Typography tutorial documentation was added
- Platform App, Graphics App and User Interface App documentation was added
- High-level architecture diagram was added on the project page
- Graphics Core Interfaces diagram was added on the project page
- Common libraries:
- Primitives library extended with error handling (closed #74):
Methane/Exceptions.hpp
was added with common exception type defintionsMethane/Checks.hpp
was added with error checking macro definitions akaMETA_CHECK*
META_LOG
macros has been updated to make string formatting using FMT library inside of the macro using variadic arguments
- Primitives library extended with error handling (closed #74):
- Data libraries
RawVector
template class was added as a replacement ofcml::vector
for dense-packed components storage used in vertex attributes.Point
template class now use underlying HLSL++ vector and unifies 2D and 3D implementations.Rect
andRectSize
,Volume
andVolumeSize
classes were refactored. Made class fields private, available through accessors.Constants
template class was added with math constants.
- Platform libraries
- Platform App library was updated with unified error handling logic in
AppBase
class, moved from platform specific classes
- Platform App library was updated with unified error handling logic in
- Graphics libraries
- Graphics Core changes:
- Program binding improvements:
Program::Argument
andProgram::ArgumentAccessor
(previouslyProgram::ArgumentDesc
) were refactored from struct to class style with field accesor functions.Program::Argument::Modifiers
bit-mask was replaced withProgram::ArgumentAccessor::Type
enum.- New program argument accessor type was added for frame-constant arguments
Program::ArgumentAccessor::Type::FrameConstant
to reduce number of excessive argument binding setup calls. Frame-constant bindings are properly supported by DX descriptor table layout. - Frame-buffer index was added to
ProgramBindings::Create
function as an optional argument to support frame-constant bindings. - Applying of DirectX resource states and root parameter bindings was reworked in
ProgramBindingsDX
.
- Resource upload and state synchronization improvements:
COPY
comamnd queue is now used by default forBlitCommandList
execution in DirectX (instead ofDIRECT
command queue used before). So the resources upload is also done with a COPY queue in DX now. It can be switched back to usingDIRECT
queue withRenderContext::Settings::options_mask
bit-mask flagContext::Options::BlitWithDirectQueueOnWindows
.Resource::SetData
method is extended with an optional argument of command queue for resource state synchronization. Command queue where resource is actually used should be passed whenever possible.- Resource barriers setup was moved from the
Resource::SetData
method implementations to theSetProgramBindings
,SetVertexBuffer
andSetIndexBuffer
calls, while setup resource barriers are still cached insideResource
object. Resource::State
andResource::Barriers
types were moved to the public header files and split fromResource
interface definition.
CommandKit
interface was added to Graphics Core to provide unified access fromContext::GetDefaultCommandKit
to the command queue, command lists, command list set and synchronization fences made for working together with the sameCommandList::Type
. This interface allowed to replace methodsContext::GetUploadCommandQueue
,Context::GetUploadCommandList
,Context::GetUploadCommandListSet
andRenderContext::GetRenderCommandQueue
withContext::GetDefaultCommandKit
.CommandList
changes:CommandList::SetResourceBarriers(...)
call was added to the public interface (was private before).
RenderCommandList
changes:RenderCommandList::ResetWithStateOnce
method was added additionally toResetWithState
to skip command list reset when it is already inEncoding
state with the sameRenderState
already applied.RenderCommandList::SetIndexBuffers
method was adedd, index buffer is now set separately fromDrawIndexed
call.RenderCommandList::Set[Index|Vertex]Buffers
methods were exnteded with an optional argument which allows to disable setting resource barriers automatically.
ParallelRenderCommandList
changes:- Child render command lists are now committed in parallel.
ImageLoader
now initializes texture names insideLoad
functions.- Changed
ResourceBase
derived classes hierarchy based on template implementation ofResource[DX|MT|VK]<ResourceBaseType>
which is replacingResourceNT
alias class - Removed almost all
Native
platform alias headers - Fixed some memory leaks in Metal implementation on MacOS
- Fixed const correctness for
Device
andContext
references passed to core interface factory functions
- Program binding improvements:
Graphics::App
template class implementation was split toGraphics::AppBase
to reduce template code and speedup compilationColor
template class was rewritten from scratch and now can use both integer and floating point components via underlying HLSL++ vector storageArcBallCamera
unit-tests were improved and uncovered some issues in tested class implementation. Issues were fixedSphereMesh
generation was simplified with matrix-free implementation- Fixed missing debug names of graphics resources (regression of previous refactoring)
- Fixed mip-levels count in depth texture descriptor for DirectX12
- Fixed limited rendering FPS with VSync turned OFF on Nvidia GPUs with latest drivers (Jan 2021)
- Enabled naming of Tracy GPU contexts
- Graphics Core changes:
- User Interface libraries
- Unified
UnitType
derived classes implementation within one template class - Fixed bug in Text mesh generation with multiple zero characters at the end of the string
Text
rendering is now callingResetWithStateOnce
instead ofResetWithState
to minimize rendering state resets in sequence of several text blocks
- Unified
- Unit-tests coverage was expanded from 5.7% to 13%:
RawVector
,Point
new template classes were covered with unit-tests.Rect
andRectSize
,Volume
andVolumeSize
existing template classes were covered with unit-tests.Color
template class was covered with unit-tests.UnitType
template class was covered with unit tests.UserInterface::Context
class unit convertors were covered with unit tests.FakeRenderContext
class was added to UI unit-testing infrastructure.- Replaced deprecated
ParseAndAddCatchTests
CMake function withcatch_discover_tests
to fix Catch warnings.
- Global code changes:
- Replaced CML math library with HLSL++ to improve math performance with SIMD instructions (close #78).
- Debug logging was extended for resource barriers synchronization, render and view state parameters and cleaned up: properly used magic_enum, removed manual enum to string conversion functions, fixed logs formatting.
- Properly implemented or enabled default generation of assignment operators, copy and move constructors for all applicable types
- Used MagicEnum library extensively to remove
enum
code bloat and improve type safety withenum class
types:- Uses
enum class
types for bit-masks instead of rawenum
types to improve type safety. - Generating string names of enum values with a single line of code
- Iterating over enum values and getting values count
- Uses
- All modules updated with fixes of static code analysis issues from SonarCloud (closed #73):
- Replaced all explicit exception throws and asserts with
META_CHECK*
macroses throwing specific exception types, which simplified error checking code and fixed many issues related to non-specific exception throws across Methane code base - Throw undefined enum value exception in
default
branches of allswitch
blocks to fix repeated analysis issue - Replaced
std::function
usage with template arguments wherever possible to improve performance - Used
fmt::format(...)
for string formatting wherever possible project wide - Used
magic_enum
library to replace rawenum
types of bit-masks toenum class
types, use enum names and counts generated in compile time. - Uppercase literal suffixes
- Fixed new C++17 static analysis issues:
- Use
std::map::try_emplace
instead ofstd::map::emplace
- Use
std::byte
instead ofuint8_t
andchar
for byte-access to memory buffers - Use structured bindings in
for
loops over elements ofstd::map
- Use
[[nodiscard]]
attribute for constant methods like getters - Use
std::string_view
in some cases for input string arguments - Use inline initialiser statements in
if
andswitch
statements - Use
scoped_lock
instead oflock_guard
- Use
- Replaced all explicit exception throws and asserts with
- External libraries:
- HLSL++ library v3.0 was added
- CML library was removed
- FMT v7.1.3 library was added
- MagicEnum library v0.7.2 was added
- OpenCppCoverage Windows tool binaries were added
- CMRC library was updated to latest version.
- CLI11 library was updated to v1.9.1
- Catch2 library was updated to v2.13.5
- IttApi library was updated to v3.18.8+
- STB library was updated to latest revision from 13 Jul 2020
- Taskflow library was updated to v3.1.0
- Tracy library was updated to v0.7.7
- Removed Sonar Scanner binaries from repository: binaries are loaded from official web site now
- Build Infrastructure:
- Speedup Methane Kit builds up to 30% with CMake precompiled headers generated once and shared across all modules (closed #67)
- Speedup Graphics Core build with CMake Unity build which compiles multiple C++ source files in batches as one source.
- Automated Sonar Cloud static code analysis is integrated into Azure Pipelines continuous build system. Scan results are now available with every master and develop build separately for every supported platform (closed #68)
- Tests code coverage results collection was setup in CI with Azure Pipelines and Sonar Cloud on Windows with
OpenCppCoverage
tool, on MacOS withllvm-profdata
and on Linux withGcov
(closed #72) - Do not fail build when some unit tests fail or Sonar Scanner jobs fail with error
- Publish Sonar Scanner error reproducer to build artifacts in case of scan failure
- Fix Sonar Scanner cache invalidation by adding plugin version to cache key
- CodeQL static analysis was enabled with GitHub Actions workflow and results available in Security tab on repository page
- Use MacOS 10.15 and Ubuntu 20.04 agents with GCC 9+ in Azure Pipelines
- GitPod was switched to VSCode UI and extensions were updated
- CMake profiles were added for CLion 2021