Skip to content

Improve memory management #171

@crud89

Description

@crud89

Describe your problem

The current memory management is rather bare-bones and should be extended by supporting several features offered by D3D12MA/VMA. This includes resource defragmentation, memory budgets, statistics and potentially resource aliasing.

Proposed Solution

  • Resource defragmentation is a process that needs an interface by the engine to call the underlying APIs. The general idea is to provide a command buffer to record several transfers to. Calling the defragmentation API must be done periodically from the application.
  • Memory budgets are controlling the size of the available memory pools. Currently, if an allocation fails (because the default budgets are exceeded), an exception will be thrown. In addition to providing an interface for controlling memory budgets, we should also provide factory methods that are allowed to fail (tryAllocate). Those should be preferred for resources, that aren't necessarily required for the app to run.
  • Memory statistics are queries for memory usage and require an interface and some standardized types to be added to the library.
  • Resource aliasing is an advanced feature, that can be used to overlay resources that are volatile. This requires manual synchronization and we should spent some time on the design if we intend to support it. While support for it would be nice, I don't think its fundamentally necessary.

Metadata

Metadata

Assignees

Labels

DX12 ❎The issue involves the DX12 backend.FeatureNew feature or request.Vulkan 🌋The issue involves the Vulkan backend.

Projects

Status

v0.5.1

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions