Merged
Conversation
Owner
Author
|
Run: checks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe the pull request
This PR implements support for resource defragmentation. This is mostly done on the
IGraphicsFactory, but also on buffers and images directly. The graphics factory now exposes a set of methods to invoke the defragmentation process. For an example implementation, a sample is provided.Resources (i.e., objects that implement
IDeviceMemory) are potentially moved during defragmentation. As this implies a re-creation of the resource itself, bindings may get invalidated. To react to such a move, there are two events that can be subscribed to. TheIDeviceMemory::movingevent occurs after a move has been recorded, but before it has been finished. It provides the command queue and a fence value on that queue that signals if the move has finished. On the other hand, theIDeviceMemory::movedevent is more straightforward and is executed after a resource has been relocated and can be rebound.Currently render targets aren't affected by defragmentation, as they are often times implicitly transitioned during rendering and moving them mandates some form state tracking to properly barrier them. The way this is implemented is by checking if an image has the
ResourceUsage::RenderTargetflag set during a defragmentation pass and if so, it is ignored. This is sub-optimal and ideally, render targets should be allocated from a separate pool instead. If this ever becomes a problem, we can address it this way.Related issues