🎲 Modern 3D graphics made simple with C++17 cross-platform framework and rendering abstraction API on top of DirectX 12, Metal & Vulkan
This release adds support of Vulkan RHI on MacOS via MoltenVK framework and fixes some portability and stability issues. Vulkan RHI now supports monolithic pipeline state objects (PSO) and drops VK_EXT_EXTENDED_DYNAMIC_STATE
extension requirement, which is made optional, but still used upon availability. VK_KHR_SYNCHRONIZATION_2
extension requirement was also dropped to improve portability. Some newly discovered issues reported by Vulkan validation layer were fixed as well as many stability issues.
IndexedName
function with explicit fmt::format
.VK_EXT_EXTENDED_DYNAMIC_STATE
was made optional by supporting monolithic vk::Pipeline
state object in Vulkan::RenderState
RHI implementation. Both monolithic and dynamic pipeline state APIs are supported now, depending on extension availability.VK_KHR_SYNCHRONIZATION_2
extension requirement, as it was used to fix some minor validation layer warnings appearing only on Linux platform. Warning were muted, as not important.vk::SubmitInfo
in vk::Queue::submit
call (see FIXME comment in Vulkan::CommandListSet::Execute()
). All tutorials can now run on MacOS using Vulkan RHI.vkSetDebugUtilsObjectNameEXT
in Vulkan::RenderContext
. It is not possible to set debug name for surface because it is not created with devide object, unfortunately Vulkan validation layer does not report this error but simply corrupts memory, which is resulting in undefined behaviour.Vulkan::RenderContext
frame synchronization reliability by adding vk::Fence
wait of the previously acquired images before aquiring next frame image.ErrorSurfaceLostKHR
on acquireNextImageKHR
by recreating surface and swap-chain in Vulkan::RenderContext
.Vulkan::CommandList
and Vulkan::ParallelRenderCommandList
command buffers invalidation on render pass updates, for example during swap chain resize.Vulkan::ParallelRenderCommandList
debug groups encoding validation error.Vulkan::CommandListSet
execution wait for frame image availability semaphore, when it submits ParallelRenderCommandList
.vk::DescriptorSet
setup.CommandListSet
shared pointers in Base::CommandQueueTracking
.BufferSettings::size
alignment by 256 bytes in RHI/IBuffer.h/cpp
, but do it implicitly inside DirectX RHI implementation.METHANE_MEMORY_SANITIZER_ENABLED
to enable build with memory address sanitizer.MacOS_VK_Release
job to CI Build
workflow, which builds Methane Kit with Vulkan RHI on MacOS using static linking with MoltenVK framework from Vulkan SDK.CI Build
jobs "Install Vulkan SDK", which is currently required for MacOS_VK_Release
job only to link with MoltenVK framework.CI Build
steps and workflows in Forked GitHub repositories to let CI pass successfully for pushes.sonarcloud-github-c-cpp
to v2 in "CI Scan" workflow. Sonar Scanner was upgraded from v4.8 to v5.0 as well.CI Build
workflow to run in forks by removing cron schedule (GitHub automatically disables all workflows with CRON schedule in Forked repositories).CI Sonar Scan
and CI CodeQL
workflows to run in forked repositories.[!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
This release adds initial support of compute pipeline in Methane Kit for app Graphics RHI backends (DirectX 12, Vulkan and Metal). "Console Compute" tutorial was added to demonstrate it on example of Conway's Game of Life implemented in compute shader used from pure-console application. Graphics RHI was partially covered with initial set of unit-tests implemented using "Null RHI" backend for testing of the Base RHI logic.
ComputeContext
ComputeCommandList
ComputeState
ShaderType::Compute
shader type support.CommandListType::Compute
support in CommandQueue
.DeviceCaps::compute_queues_count
.Texture
and Buffer
read-back support via GetData
methods.GetData
and SetData
methods from base interface IResource
in favour of separate methods added in the derived IBuffer
and ITexture
interfaces to differentiate argument types and get rid of unwanted methods in ISampler
interface.IResource
methods GetSubresourceCount
and GetSubresourceDataSize
methods were moved to ITexture
interface.FpsCounter
interface and implementation was moved from Graphics/RHI
to Data/Primitives
to allow using it independently from RHI RenderContext
.Chunk
copy and move constructors and operators.Shader
TestSampler
TestFence
TestCommandQueue
TestComputeState
TestTexture
TestProgramBindings
TestTransferCommandList
TestProgram
TestComputeContext
TestBuffer
TestComputeCommandList
TestModules
directory.CMakeLists.txt
Tests
and Apps
directories from code coverage results.Resource
, Buffer
and Texture
methods.[!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
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.
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.I
prefix in file and struct names and put under Methane::Graphics::Rhi
namespace, for example Graphics::Device
-> Graphics::Rhi::IDevice
.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.Create
static factory functions of ITexture
and IBuffer
interfaces using custom setting initialisers.CreateX
virtual methods in RHI interfaces and use them in implementation of X::Create
static factory functions.BLITCommandList
was renamed to TransferCommandList
.QueryBuffer
was renamed to QueryPool
.std::string
with std::string_view
in IObject::SetName
and GetName
methods.Buffer
and Texture
classes for Vulkan and DirectX APIs by replacing template class variants with common class implementation.ImageLoader
, ScreenQuad
and SkyBox
to use RHI PIMPL classes instead abstract interfaces and implemented themself in PIMPL style.Primitives
modules were moved inside RHI
submodules:
Windows/DirectXErrorHandling.h
to RHI/DirectX
module and renamed to ErrorHandling.h
.FpsCounter.h
and split to interface and implementation to RHI/Interfaces
and RHI/Base
modules.Font
, Text
and Badge
classes to RHI PIMPL classes instead of abstract interfaces and implemented themself in PIMPL style.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::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
.Data::Transmitter<ICallbackType>
class which implements Data::IEmitter
by transmitting callback connections to some other emitter instance.d3dx12.h
in DirectX RHI.Data/EnumMask.hpp
.Data/EnumMaskUtils.hpp
.Data/Transmitter.hpp
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.iOS and tvOS platforms support was added in this release.
Methane::Platform::AppIOS
implementation was added to support iOS and tvOS mobile platforms (closed #12).RenderContext::GetContentScalingFactor
and RenderContext::GetFontResolutionDpi
methods to Platform::IApp
interface with platform dependent implementations. Linux implementation for X11 was added.RenderCommandList::Draw
and DrawIndexed
calls implementation for Metal was changed to exclude using of start_vertex
and start_instance
parameters for GPU Family < MTLGPUFamilyApple3
or MTLGPUFamilyMac2
, which is essential for working on iOS Simulators.Sampler
parameters were put under #ifdef APPLE_MACOS
to enable tvOS support.Externals/iOS-Toolchain.cmake
file from iOS-CMake project to enable iOS & tvOS build configuration.-fobjc-arc
option..plist
configs generation via CMake/MethaneApplication.cmake
CMake/MethaneGlobalOptions.cmake
from CMake/MethaneBuildOptions.cmake
to allow including it in the root CMakeLists of external projects to properly set global CMake options.APPLE_DEVELOPMENT_TEAM
cmake option.Build/Unix/Build.sh
script to support iOS / tvOS builds via new command-line arguments --apple-platform
, --apple-dev-team
and --apple-deploy-target
.CMakePresets.json
.Build/README.md
.Vulkan API and Linux platform support was added in this release:
vertex_id
for triangle rendering.HelloCubeUniforms
tutorial version (under UNIFORMS_BUFFER_ENABLED
define) implements vertices transformation on GPU using MVP matrix stored in uniforms buffer and program bindings object.
TextureLabeler
helper class was added to library MethaneAppsCommon
with shared implementation of text labels rendering to texture cube/array faces.Asteroids
sample can be changed now with new single-key shortcuts: 0 .. 9
Events
library in Emitter
and Receiver
classes.Platform::AppLin
implementation based on X11/XCB libraries for Linux was added (close #11), which allows to create GUI Window for rendering on Linux desktop with support of:
Input::Keyboard::State
and Input::Mouse::State
conversion to string was fixed, more functionality of these classes was covered with unit tests.SystemVK
, DeviceVK
, RenderContextVK
, FrameBufferTextureVK
, RenderPassVK
, RenderPatternVK
, ShaderVK
, ProgramVK
, RenderStateVK
, ViewStateVK
, CommandListVK
, RenderCommandListVK
, FenceVK
, BufferVK
, FrameBufferTextureVK
, DepthStencilTextureVK
, RenderTargetTextureVK
, ImageTextureVK
, SamplerVK
, ProgramBindingsVK
, ResourceBarriersVK
, ParallelRenderCommandListVK
, TimestampQueryBufferVK
, TimestampQueryVK
. classes.
vulkan.hpp
C++ wrappers with support of dynamic dispatch table, which allows to build without Vulkan SDK
libraries. vk::Unique*
wrappers are used to automatically release Vulkan objects in RAII style.DeviceVK
class.RenderCommandListVK
setup all Vulkan pipeline barriers before render pass begin by using secondary command buffer for recording all synchronisation commands separately from render pass commands in primary buffer.ImageTextureVK
has mip-maps generation implemented on GPU.RenderPattern
class was added to represent render pass attachments configuration without binding to particular resources (wrapper of vk::Renderpass
). RenderPass
was updated accordingly to get configuration from RenderPattern
and bind attachment resources. RenderPattern
instance was added to RenderState
settings.Device::Capabilities
struct was added with the required command queues count and other configuration flags, required due to Vulkan specifics.CommandQueueTrackingBase
class was added to share command queue execution tracking logic between DirectX and Vulkan implementations.RenderContextDX
implementation is now using waitable object to reduce DXGI swap-chain latency.System
singleton is now destroyed strictly after all its Devices
to enable correct Vulkan destruction order.ResourceState
enumeration was simplified: state VertexAndConstantBuffer
was split to VertexBuffer
and ConstantBuffer
states; states NonPixelShaderResource
and PixelShaderResource
were merged into one state ShaderResource
.Resource::SetOwnerQueueFamily(..)
and ResourceBarriers::[Add|Remove]OwnerTransition(...)
interfaces and implemented ownership transition for Vulkan resources.ResourceLocation
interface was renamed to ResourceView
, extended with settings of sub-resource index, count, size, offset and reworked internally for DirectX and Vulkan to support multiple views handling for a single resource.StructuredBuffer
in DirectX.DescriptorByUsage
argument, which was previously used to restore DirectX descriptors after resource recreation on previous location in heaps to let bindings work.DeviceDX
class.TimestampQueryBuffer
and TimestampQuery
objects in CommandListBase
class.Methane/TracyGpu.hpp
with Tracy v0.8 (was broken after update). Added reference Tracy GPU instrumentation via TracyD3D12.hpp
header under macro definition METHANE_GPU_INSTRUMENTATION_ENABLED == 2
in CommandListDX.hpp
(value 1
is reserved for Methane GPU instrumentation).METHANE_GPU_PROFILING_ENABLED=ON
:CommandList::Reset()
, while they should be cleared on CommandList::Commit()
.Context::Reset()
by always using deferred heap allocation in all cases. Deferred heap initialisation flag was removed, since it became unconditionally deferred.CommandQueueTrackingBase::WaitForExecution()
CommandQueueTrackingBase
with proper shutdown procedure called from destructor of derived class.Camera::Resize
method arguments were changed to use FrameSize
and FloatSize
structures, which simplify its calls from the App::Resize
method.Graphics/Mesh
module was split from Graphics/Primitives
.SkyBox
extension is now using CubeMesh
instead of SphereMesh
for sky rendering.Text::HorizontalAlignment::Justify
mode was added to support horizontal text justification.HeadsUpDisplay
: Graphics API name is now displayed in HUD .Text
repeated buffer updates in deferred mode.Point
, Rect
and RectSize
values was added in DataTypes
unit tests.Settings
structures for initialization convenience.Build/Output/ExternalsCache
by default (it can be changed with CMake option CPM_SOURCE_CACHE
).README.md
description of the external dependencies was added in Externals
directory.Vulkan-Headers
was updated to v1.3.219SPIRV-Cross
was added v1.3.216.0DirectXCompiler
was updated to v1.6.2104 to support SPIRV generation on Windows and new binaries for LinuxDirectXTex
was updated to v1.9.6Catch2
updated to v3.1.0CLI11
updated to v2.2.0CMRC
updated to 2021-08-27FMT
updated to v8.1.1FreeType2
updated to v2.12.1HLSLpp
updated to v3.2+ with integer division fixesIttApi
updated to v3.23.0MagicEnum
was updated to v0.8.0TaskFlow
was updated to v3.4.0STB
updated to 2021-09-10Tracy
updated to v0.8.2.1CMakeModules
updated with support for auto-detecting new Windows SDK versions, including Win11 2110 SDK (closed #87)CMakeLists.txt
was simplified by moving all compiler configuration options to CMake/MethaneBuildOptions.cmake
.add_methane_application
was changed to use flexible named parameters.CMake/MethaneModules.cmake
in functions get_native_graphics_apis
and get_default_graphics_api
for reusing in external projects.GRAPHICS_API
, DXC_BINARY_DIR
, SPIRV_BINARY_DIR
were added as properties to CMake target MethaneKit
.METHANE_GFX_VULKAN_ENABLED
was added to enable Vulkan build on Windows.CMakePresets.json
file was added with predefined configure and build presets for "Ninja Multi-Config" and platform native generators "Visual Studio 16 2019", "Xcode" and "Unix Makefiles".add_methane_shaders_source
to compiler shaders file and add_methane_shaders_library
to add compiled shaders to application resources (see CMake/MethaneShaders.cmake
)CMakeSettings.json
. CMakePresets.json
should be used instead.MethaneShaders
enable compilation of HLSL shaders to SPIRV for Vulkan graphics API using new DirectX Compiler (DXC) version.Ubuntu_VK_Profiling
build was added to Azure Pipelines.Build/Windows/Build.bat
and Build/Posix/Build.sh
were extended with convenience command line options, including --vulkan
, --debug
, --graphviz
, --analyze
and others.Folder.DotSettings
and .editorconfig
from repository.MoltenVK
library, unfortunately it does not work due to some unsupported Vulkan extensions which are required by Methane Kit.Profile
CMake presets same as in SonarCloud analysis builds in Azure Pipelines.README.md
to Build/README.md
.HLSL++ math, Graphics API optimizations, automated static code analysis, unit-tests code coverage, code improvements and extensive refactoring were done in this release:
Methane/Exceptions.hpp
was added with common exception type defintionsMethane/Checks.hpp
was added with error checking macro definitions aka META_CHECK*
META_LOG
macros has been updated to make string formatting using FMT library inside of the macro using variadic argumentsRawVector
template class was added as a replacement of cml::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
and RectSize
, Volume
and VolumeSize
classes were refactored. Made class fields private, available through accessors.Constants
template class was added with math constants.AppBase
class, moved from platform specific classesProgram::Argument
and Program::ArgumentAccessor
(previously Program::ArgumentDesc
) were refactored from struct to class style with field accesor functions. Program::Argument::Modifiers
bit-mask was replaced with Program::ArgumentAccessor::Type
enum.Program::ArgumentAccessor::Type::FrameConstant
to reduce number of excessive argument binding setup calls. Frame-constant bindings are properly supported by DX descriptor table layout.ProgramBindings::Create
function as an optional argument to support frame-constant bindings.ProgramBindingsDX
.COPY
comamnd queue is now used by default for BlitCommandList
execution in DirectX (instead of DIRECT
command queue used before). So the resources upload is also done with a COPY queue in DX now. It can be switched back to using DIRECT
queue with RenderContext::Settings::options_mask
bit-mask flag Context::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::SetData
method implementations to the SetProgramBindings
, SetVertexBuffer
and SetIndexBuffer
calls, while setup resource barriers are still cached inside Resource
object.Resource::State
and Resource::Barriers
types were moved to the public header files and split from Resource
interface definition.CommandKit
interface was added to Graphics Core to provide unified access from Context::GetDefaultCommandKit
to the command queue, command lists, command list set and synchronization fences made for working together with the same CommandList::Type
. This interface allowed to replace methods Context::GetUploadCommandQueue
, Context::GetUploadCommandList
, Context::GetUploadCommandListSet
and RenderContext::GetRenderCommandQueue
with Context::GetDefaultCommandKit
.CommandList
changes:
CommandList::SetResourceBarriers(...)
call was added to the public interface (was private before).RenderCommandList
changes:
RenderCommandList::ResetWithStateOnce
method was added additionally to ResetWithState
to skip command list reset when it is already in Encoding
state with the same RenderState
already applied.RenderCommandList::SetIndexBuffers
method was adedd, index buffer is now set separately from DrawIndexed
call.RenderCommandList::Set[Index|Vertex]Buffers
methods were exnteded with an optional argument which allows to disable setting resource barriers automatically.ParallelRenderCommandList
changes:
ImageLoader
now initializes texture names inside Load
functions.ResourceBase
derived classes hierarchy based on template implementation of Resource[DX|MT|VK]<ResourceBaseType>
which is replacing ResourceNT
alias classNative
platform alias headersDevice
and Context
references passed to core interface factory functionsGraphics::App
template class implementation was split to Graphics::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 implementationUnitType
derived classes implementation within one template classText
rendering is now calling ResetWithStateOnce
instead of ResetWithState
to minimize rendering state resets in sequence of several text blocksRawVector
, Point
new template classes were covered with unit-tests.Rect
and RectSize
, Volume
and VolumeSize
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.ParseAndAddCatchTests
CMake function with catch_discover_tests
to fix Catch warnings.enum
code bloat and improve type safety with enum class
types:
enum class
types for bit-masks instead of raw enum
types to improve type safety.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 basedefault
branches of all switch
blocks to fix repeated analysis issuestd::function
usage with template arguments wherever possible to improve performancefmt::format(...)
for string formatting wherever possible project widemagic_enum
library to replace raw enum
types of bit-masks to enum class
types, use enum names and counts generated in compile time.std::map::try_emplace
instead of std::map::emplace
std::byte
instead of uint8_t
and char
for byte-access to memory buffersfor
loops over elements of std::map
[[nodiscard]]
attribute for constant methods like gettersstd::string_view
in some cases for input string argumentsif
and switch
statementsscoped_lock
instead of lock_guard
OpenCppCoverage
tool, on MacOS with llvm-profdata
and on Linux with Gcov
(closed #72)This release adds text layout & rendering widget, user Interface basis, integrate Tracy Profiler & add GPU instrumentation, many memory and performance optimizations, Graphics API improvements and bug fixes. It is really BIG!
D
key) demonstrates incremental text mesh updates (can be switched off with U
). Typing speed can be changed with =
and -
keys.H
and V
keys.Methane/Samples/AppSettings.hpp
for all samples and tutorials. MacOS apps now render with VSync ON, while Windows apps with VSync OFF by default.Apps/Common/Shaders/Primitives.hlsl
. As the result this significantly improved rendered image quality in Asteroids sample (closed #58)
Font::Library
implements font loading with FreeType 2 libraryFont
class is managing Font::Char
glyph metrics, packing to atlas and rendering to R8Unorm
texture:
Text
class implements rendering of text block with a given font and layout settings:
Text::Layout
settings supported:
Text::Wrap
defines wrapping to new line by characters or by woads or no wrapping.Text::HorizonAlignment
with Left
, Ridht
and Center
options.Text::VerticalAlignment
with Top
, Bottom
and Center
options.Text
is created or updated with non-zero rect
in Text::Settings
.Text
is managing internal buffer resources on per-frame basis to perform effective text updates without affecting GPU performance and render without artefacts on previously encoded render commands.Text
items reuse single instances of RenderState
and Sampler
objects for all Text
widget instances via Object::Registry
.Units
enum, UnitPoint
, UnitSize
and UnitRect
classes were added in UserInterface/Types.h
to handle UI layout positions and sizes in different units (Pixels and Dots) and conversions between them.UserInterface::Context
is a wrapper around Graphics::RenderContext
and is used for creating all UI items serving both layout and rendering functions.UserInterface::Item
and UserInterface::Container
are base UI classes for all widgets.Panel
widget implements container visualised as semi-opaque rectangle using Graphics::ScreenQuad
Badge
widget was moved from Graphics/Extensions
and implements item displaying a texture aligned to screen corner.HeadsUpDisplay
widget implements visualisation of common graphics application performance parameters like FPS, frame time, resolution, frame buffers count, GPU adapter name, etc. (closed #54)HeadsUpDisplay
widget, which can be turned ON by F4
hot-key.UserInterface::App
UserInterface/AppBase.h/cpp
from template class UserInterface/App.hpp
to reduce build overhead.Context
changes:
Context::RequestDeferredAction
method was added to request DeferredAction::UploadResources
or DeferredAction::CompleteInitialization
to be performed when previous frame rendering has completed but next frame rendering was not started yet.Context::GetParallelExecutor
provides Taskflow Executor for all parallel execution in the application.Context::GetObjectsRegistry
returns instance of Object::Registry
which allows to register named Graphics Objects created in scope of current context and request them by name. This allows to reuse single instance of graphics object (like RenderState
) for rendering of multiple widgets.CommandQueue
changes:
Fence
object. CommandQueue::Execute
receives optional argument with lambda callback function called when command list set execution is completed on GPU.CommandQueueDX
incapsulates TimestampQueryBuffer
instance, which is used internally to query timestamps of command lists execution which are then exposed with Tracy::GpuScope
and can be viewed in Tracy Profiler.CommandList
changes:
CommandList::DebugGroup
interface was added to represent named debug group data and effectively reuse its memory in runtime between frames. CMake build option METHANE_COMMAND_DEBUG_GROUPS_ENABLED
was added to disable command list debug groups.CommandList::State
enum (Pending, Encoding, Committed, Executing) was added and returned with CommandList::GetState
CommandList::WaitUntilCompleted
method was addedCommandList::GetGpuTimeRange
method was added which can be called on command list in Pending state. DirectX 12 method implementation has to be enabled with option METHANE_GPU_INSTRUMENTATION_ENABLED
, but MacOS
implementation works right away.RenderCommandListMT
and BlitCommandListMT
was refactored, duplicated code was moved to the base implementation template class CommandListMT
.RenderState
changes:
ViewState
was split from RenderState
to manage setup of viewports and scissors rects separately from main rendering state.RenderState
groups are now compared with memcmp
which is slightly improving performance in some cases.RenderCommandList
changes:
RenderCommandList::SetViewState
method was added.RenderCommandList::SetValidationEnabled
method was added to disable validation of command list command arguments before encoding to GPU command buffers and increase performance. ParallelRenderCommandList
adds the same command to update per-thread command lists option.Resource
changes:
Resource::SubResource::Count
and Resource::SubResource::Index
structures were addedResource::SubResource
is derived from Data::Chunk
and extends with Index
and optional BytesRange
Resource::GetData
method was added returning SubResource
at given Index
and optional BytesRange
, it can be used only for resources with Usage::Readback
flag.Resource::GetDataSize
method was extended with optional Data::MemoryState
argument (Initialized, Reserved values)Resource::GetSubResourceDataSize
and Resource::GetSubResourceDataSize
methods added
by reusing allocated memory between frames.Resource::ReleasePool
was removed and replaced with retaining shared pointers to resources in CommandListBase::CommandState
kept until execution is completed on GPU. This became possible with accurate execution state tracking of command lists done in CommandQueue
waiting thread.Buffer
changes:
Buffer::StorageMode
enum is made a part of buffer settings:
Managed
- CPU-GPU buffer with automatic data synchronization managed by graphics runtime. Used for volatile buffers.Private
- GPU buffer asynchronously uploaded through the intermediate shared CPU-GPU buffer. User by default for vertex, index and constant buffers.Texture
changes:
Texture::SetData
method implementation and hidden from API user.R8Unorm
and others.RenderPass
changes:
RenderPass::ReleaseAttachmentTextures
method releases all texture shared pointers, which is used on frame resizing in Graphics::App
to update existing render pass with new frame buffer textures.ProgramBindings
changes:
Program::Argument::Modifiers::Constant
is specified at construction.CommandListSet
interface was added to manage CommandList
object collection for memory reuse and effective execution with CommandQueue::Execute
BufferSet
interface was added to manage Buffer
objects collection for memory reuse and effective setup with RenderCommandList::SetVertexBuffers
Resource::Barriers
was implementedMeshBuffers.hpp
Events
library is used as single notifications mechanism for graphics types:
Device
is derived Data::IEmitter<IDeviceCallback>
Context
is derived from Data::IEmitter<IContextCallback>
DescriptorHeap
is derived fromData::Emitter<IDescriptorHeapCallback>
interfainstead of notificationScreenQuad
changes:
RenderState
, Sampler
, vertex and index Buffer
are reused for all screen-quad instances via Object::Registry
.Graphics::App::Render
calls WaitForGpu
and IsReadyToRender
were moved from derived application classes to base implementation.-e,--emulated-render-pass
was added to disable use of DirectX 12 native render passes replaced with emulated behavior, which is useful for frame capturing with many Graphics Debugging & Profiling tools which do not have proper support of DX render passes (closed #62)Graphics/Helpers
to Graphics/Types
, Graphics/Primitives
and Graphics/Camera
Platform::App
changes:
AppViewMT
implementation was improved to minimise drawables retention time and was instrumented to collect drawable present timings with Tracy::GpuScope
. Instrumentation is disabled by default under macro definition TRACY_GPU_PRESENT_INSTRUMENTATION_ENABLED
Emitter<IEventInterface>
template class implements connection to many receivers and emitting functions from IEventInterface
to all connected receivers.Receiver<IEventInterface>
template class is a base for receivers of IEventInterface
. Automatic disconnect on receiver destroying even during event emitted calls is supported.Animation::DryUpdate
method added to call update function with previously updated elapsed duration. AnimationPool::SetDryUpdateOnPauseEnabled
calls DryUpdate when animations are paused, which is used for window live resizing with paused animations.Data/Parallel.hpp
header with Data::ParallelFor
home-brewed implementation was removed and replaced with task flow::for_each
implementation from Taskflow library used both in all Methane modules and sample applications.Data/Primitives
library to Data/Types
and Data/Provider
librariesadd_methane_application
CMake function and is enabled using build option METHANE_TRACY_PROFILING_ENABLED
with collection on demand when METHANE_TRACY_PROFILING_ON_DEMAND
is ON, otherwise trace collection from app startup (closed #56)
ScopeTimer
was optimised for lower overhead, work without dynamic memory allocations and was extended with Tracy plot instrumentation to display collected timings on Tracy charts.Tracy::GpuContext
, Tracy::GpuScope
implemented in Methane/TracyGpu.hpp
. CommandLists have built in GPU instrumentation enabled with CMake option METHANE_GPU_INSTRUMENTATION_ENABLED
CommandListBase.cpp
due to no support of overlapping regions appearing during parallel rendering in Asteroids sample.METHANE_ITT_METADATA_ENABLED
via macro definition ITT_ARGUMENTS_METADATA_ENABLED
:
ITT_FUNCTION_ARG
and ITT_MARKER_ARG
macroses added in IttApiHelper.h
to instrument named arguments of different types.ITT_FUNCTION_TASK
macros automatically adds __file__
and __line__
arguments to all instrumented function tasks when ITT metadata is enabled.RenderContext::Preset
call and include two metadata arguments: Frame-Buffer-Index
and Frame-Index
.ScopeTimer
instrumentation for displaying collected timings on custom chart in traceMETA_*
instrumentation macro definitions were added in Methane/Instrumentation.h
combining both ITT and Tracy instrumentation all together. All ITT_FUNCTION_TASK
instrumentation was replaced with META_FUNCTION_TASK
all across Methane Kit sources.
META_LOG
is enabled with CMake option METHANE_LOGGING_ENABLED
META_SET_THREAD_NAME
macros was added to set thread name both using ITT and Tracy APIs and using OS-specific API. Thread names are set automatically for Main thread and for Command Queue threads waiting for command lists execution.std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t>
in VS2017, which is required for UTF8 string conversion to UTF32 encoding in UserInterface/Font.cpp
.-ftime-trace
which can be analysed either with Chrome Trace
viewer or with Compile Score
plugin in Visual Studio. Clang build configurations are added in CMakeSettings.json
for Visual Studio build convenience.MethaneBuildOptions
interface targetPRIVATE
& PUBLIC
access modifiersadd_methane_embedded_fonts
CMake function was added to CMake/MethaneResources.cmake
for embeddeding font resources in applications and libraries.Build\Windows\Build.bat
and Build\Posix\Build.sh
. Diagrams in dot
and png
formats are written in build output directory GraphViz
(closed #57)RelWithDebInfo
configuration, so samples and tutorials executables are provided with PDBs in published artifacts.Per-module shaders, cube textures, sky-box extension, CMake toolchain improvements, platform input infrastructure, full screen support and runtime device reset were made in this release:
ContextController
implemented for switching graphics settings in runtime: vsync, device, full-screen and frame buffers count switching supported (closed #30).RenderCommandList
multi-reset drawing.Device
and System
classes allow to enumerate and query available GPU devices and change active device by reseting graphics Context
. Switching to full-screen rendering is supported (closed #13).Context
frames synchronization was improved in DirectX 12 implementation (closed #32, closed #15).SkyBox
rendering primitive was added to Graphics Extensions module along with its shaders (closed #38).MeshBuffers
extension was created to reduce Tutorials code duplication.ImageLoader
supports loading face images to single cube texture.Sphere mesh
generator was implementedParallelFor
based on std::thread was created.ArcBallCamera
was split from ActionCamera
implementation for the sake of simplicity.ActionCameraController
now supports pivot point change.virtual
keywords from method overrides.Shader
and Texture
application resources now can be added to dedicated library modules, not just to an application, multiple shader files are now supported. Methane shader object settings changed accordingly and additionally contain shader file name along with function name (closed #37).Build.bat
now supports Visual Studio 2019.This release brings Graphics Core API optimizations and refactoring, improved shaders toolchain with HLSL6 & DXC:
Class::Ptr
to Ptr<Class>
with template usings also applied to Ptrs, WeakPtr, WeakPtrs, UniquePtr, UniquePtrs, Ref, Refs
defined in Memory.hpp.ProgramBindings
interface from Program::ResourceBindings
and ProgramBindings::ArgumentBinding
from Shader::ResourceBinding
. Corresponding API-specific implementations were also split from Program
and Shader
implementations.ProgramBindings::ArgumentBinding::Settings
structure with corresponding GetSettings()
method were added, replacing a bunch of virtual getters.ProgramBindings::ArgumentBinding::Modifiers
to Program::Argument::Modifiers
and added Program::ArgumentDesc
structure representing argument with modifiers describing constant and addressable program arguments.CL::SetProramBindings(...)
from RenderCommandList
to base CommandList
interface for future use in compute pipelines.CommandList::SetProramBindings(...)
in DirectX implementation on Windows.Program::InputBufferLayout
configuration is simplified by removing of argument names and using semantic names only.Program
initialization with explicit argument modifiers specification implemented within Program::Settings
.BlitCommandList
interface was added to provide BLIT operations on GPU memory and is used for UploadCommandList
in Context
. Public interface is currently empty, but it will be extended in near future. API-specific implementations are used internally (for texture mips generation with Metal).ParallelRenderCommandList::Reset
by resetting per-thread command lists in parallel for DirectX 12 on Windows only.CommandListBase
, which was previously used from frames synchronization and became useless now.RenderCommandList::Commit
to RenderContext::Present
in Metal API implementation on MacOS.Context
base interface was split from RenderContext
interface along with splitting implementation classes. This is a preparation step for adding ComputeContext
in future.Fence
public interface was added with implementations for DirectX and Metal.RenderContextBase
implementation now uses fences as common frames synchronization mechanism between CPU & GPU on all platforms and APIs in platform independent way (replaces dispatch_context_mutex
approach on MacOS).ContextDX<ContextBaseT>
and CommandListDX<CommandListBaseT>
.private
with access through class methods only; many typos and naming convention issues were fixed.Graphics::AppController
and Graphics::IApp
abstract interface with Settings
, which allows to modify individual settings of graphics app from controller.Graphics::App::AllSettings
to incapsulate Graphics::IApp::Settings
, Platform::App::Settings
and RenderContext::Settings
.CTRL+Z
shortcut to disable all animations in application. Implemented smooth pause of animations.CTRL+H
shortcut to show/hide HUD in window title.F2
shortcut to show command-line help.Mesh.h
was split into separate headers with template implementations of specific mesh generators: QuadMesh
, CubeMesh
, SphereMesh
, IcosahedronMesh
and UberMesh
.Platform/Input/ControllersPool.cpp
.CLI11
to simplify command line parsing code and remove dirty workarounds required by previously used CxxOpts
library.IttApi
instead of old SEAPI
repository fork.DirectXTex
, DirectXLibraries
, STB
, CMRC
and Catch2
external libraries to their latest versions.DirectXCompiler
with pre-built binaries of command line tools and libraries for Windows and MacOS.CMakeModules
.Visual Studio Tools Command Prompt
on Windows anymore (removed dependency on VS environment). Removed it from Azure yaml build scripts and from ReadMe. WindowsSDK is found automatically using RPavlik's FindWindowsSDK.cmake
.Asteroids sample with multi-threaded rendering and many optimizations was added in this release:
ParallelRenderCommandList
was implemented to reduce CPU frame time.RenderPass
on Windows now uses native D3D12 render-pass feature whenever possible (closed #47).ParallelRenderCommandList
was added for multi-threaded rendering with an array of internally managed RenderCommandLists
into single RenderPass
(closed #9).RenderCommandList
now can be reset without RenderState
setup.RenderState
was extended:
Depth::write_enabled
state was added.Blending
state settings were added.Program::ResourceBindings
improvements:
Apply
behavior flags added for optimization purposes.Context
improvements:
clear_color
and clear_depth_stencil
settings are now optional (closed #40).ScreenQuad
graphics extension was added.LogoBadge
convenience primitive was added and used for drawing Methane watermark in samples and tutorials (closed #46)Mesh
generators now use 16-bit indices instead of 32-bit for lower memory overhead.FpsCounter
calculates CPU work percent additionally to frame time (displayed in window header HUD), allowing easily detect CPU/GPU-bound scenario.ScopeTimer
is implemented for low-overhead profiling.ParallelFor
implementation was updated to use Parallel Primitives Library (PPL) on Windows and home-brewed std::async-based implementation on other platforms.Graphics::App
rendering is suspended when window is minimized (closed #48).LinuxApp
stub implementation added.Build/Posix/Build.sh
can be used both on MacOS and Linux.Build/Posix/Build.sh
script, Visual Studio and Azure Pipelines CI.Open in Gitpod
button added on ReadMe page.