Skip to content

Add support for overlapping resources (resource aliasing).#193

Merged
crud89 merged 15 commits intomainfrom
dev/resource-aliasing
Nov 4, 2025
Merged

Add support for overlapping resources (resource aliasing).#193
crud89 merged 15 commits intomainfrom
dev/resource-aliasing

Conversation

@crud89
Copy link
Copy Markdown
Owner

@crud89 crud89 commented Nov 4, 2025

Describe the pull request

This PR implements support for resource aliasing, i.e., resources that overlap at a single allocation. In order to realize this, several improvements are available:

  • A new, unified allocation interface for IGraphicsFactory, based on a ResourceAllocationInfo type, that returns ResourceAllocationResults. Using this interface, it is possible to allocate all resources through a single, unified IGraphicsFactory::allocate method. An additional method that accepts multiple ResourceAllocationInfos is available, which returns a generator for allocation results. This method also accepts an optional parameter canAlias that, if set to true, allocates overlapping resources.
  • To check if a set of resources can be aliased on the current hardware, the IGraphicsFactory::canAlias method is available. It can be used in combination with the IGraphicsFactory::allocate method to fallback to non-overlapped resources, if required.
  • One of the most prominent use-cases for overlapping resources is to create temporary render targets. To support this, the frame buffer has been extended. First, there's now an IFrameBuffer::resizing event that is called before a resize happens. The resource aliasing sample uses this event to re-allocate aliased render targets. Second, frame buffers can be created with an additional allocation callback, which, if provided, is called to request a resource. This callback enables more flexibility for working with frame buffers. In the resource aliasing sample, it returns the overlapping render targets. It can, however, also be used to create fixed-size or otherwise different-sized render target images. If it returns nullptr, the default allocation behavior is used and a full-sized render target is created from the frame buffer.
  • The internal interface for buffers and images have been redesigned, so that allocations can be shared between multiple resources.
  • A sample application is available that demonstrates how to use overlapping render targets.

Related issues

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

crud89 commented Nov 4, 2025

Run: checks

@crud89 crud89 merged commit 3e989e7 into main Nov 4, 2025
9 checks passed
@crud89 crud89 deleted the dev/resource-aliasing branch November 4, 2025 17:41
@crud89 crud89 moved this from In Progress to v0.5.1 in LiteFX Nov 4, 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.

Support resource aliasing.

1 participant