-
Notifications
You must be signed in to change notification settings - Fork 10
Implement memory budgets. #177
Description
Describe your problem
Both memory allocator libraries support flags that control allocation behavior if memory budget is low. We should add support for those allocation strategies as well.
Describe your proposed solution
- Add
tryAllocateversions toIGraphicsFactoryand resource interfaces, that does not throw if an allocation fails. - Add
withinBudgetswitch to respect memory budget of the requested heap. - Add
noCacheResizeswitch to prevent new memory blocks from being allocated (helpful for streaming in resources, in situations where frame times have priority).
For the tests, we can test failure with WITHIN_BUDGET and NEVER_ALLOCATE by allocating buffers that are too large for the default heaps. VMA allocates 1Gb blocks for "small" (VMA_SMALL_HEAP_MAX_SIZE) and 256Mb blocks for "large" resources (VMA_LARGE_HEAP_MAX_SIZE), while D3D12MA allocates 64Mb blocks by default (D3D12MA_DEFAULT_BLOCK_SIZE). Allocating a 1.5Gb buffer should fail with NEVER_ALLOCATE, but succeed with WITHIN_BUDGET (as well as no flags). We should add tests for all supported resource types (buffers, vertex buffers, index buffers and images) and both backends. Also we should test both, the throwing- and non-throwing versions in a test.
Metadata
Metadata
Assignees
Labels
Projects
Status