Skip to content

Add support for virtual allocators.#188

Merged
crud89 merged 6 commits intomainfrom
dev/virtual-allocators
Oct 18, 2025
Merged

Add support for virtual allocators.#188
crud89 merged 6 commits intomainfrom
dev/virtual-allocators

Conversation

@crud89
Copy link
Copy Markdown
Owner

@crud89 crud89 commented Oct 18, 2025

Describe the pull request

This PR adds support for virtual allocators, which can be used to efficiently manage sub-allocated ranges from custom resources, such as buffers or descriptor heaps. Fundamentally, they are exposed as a backend specific class called VirtualAllocator, which internally wrap the D3D12MA and VMA virtual allocators.

On top of this, descriptor heaps now use this functionality. The main change is that descriptor sets no longer store address/offset pairs, but VirtualAllocator::Allocations. IGraphicsDevice::allocateGlobalDescriptors implementations return an allocation object now accordingly. This changes the internal allocation behavior, as re-using released descriptors in the global heaps is now far more common.

This also revealed an issue with the D3D12 blitter implementation, that did release descriptor sets too early. With the previous implementation, descriptors were unlikely to get re-used, but with the new implementation, they will be almost certainly be re-used, causing them to be overwritten before the command buffer executed. For this reason, a new tracking interface for descriptor sets has been added to command buffers, similar to the one for shared resources. This can be used in such temporary cases to ensure, descriptor sets remain allocated until the commands executed.

Related issues

@crud89 crud89 added this to the Alpha #05 milestone Oct 18, 2025
@crud89 crud89 self-assigned this Oct 18, 2025
@crud89 crud89 added this to LiteFX Oct 18, 2025
@crud89 crud89 added Vulkan πŸŒ‹ The issue involves the Vulkan backend. DX12 ❎ The issue involves the DX12 backend. labels Oct 18, 2025
@crud89 crud89 moved this to In Progress in LiteFX Oct 18, 2025
@crud89
Copy link
Copy Markdown
Owner Author

crud89 commented Oct 18, 2025

Run: checks

@crud89 crud89 merged commit 3c667a1 into main Oct 18, 2025
9 checks passed
@crud89 crud89 deleted the dev/virtual-allocators branch October 18, 2025 14:01
@crud89 crud89 moved this from In Progress to v0.5.1 in LiteFX Oct 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DX12 ❎ The issue involves the DX12 backend. Vulkan πŸŒ‹ The issue involves the Vulkan backend.

Projects

Status: v0.5.1

Development

Successfully merging this pull request may close these issues.

Expose virtual allocators to library.

1 participant