-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is D3D12MA::Allocator::BeginDefragmentation() Work Correctly ? #63
Comments
Hi! Could you please provide steps that you are using for defragmentation? Generally speaking, after starting defragmentation all resources that are selected to move (listed in |
Sorry about I forget to update this issue. I have checked if use many locks and some hard code to limit all the thing executed in a strict order, the library work correctly. Now what confuse me is the document specific that user need flush all graphics commands to make sure old allocation's data copy to the new one before For some reason, I can not show you code. So for inflight model, any suggestions ? Your reply is helpful for me, thanks! |
Hi, currently there is no mechanism that would allow for synchronization of such case where there might be several overlapping command lists that use resources used for defragmentation. Solution I can think of would be to set selected resources that are in flight to ignore them in current defragmentation pass or postponing executing such pass by few frames, which will result in delay in calling EndPass(). |
Sounds feasible, I will try those mechanisms later, thanks you. |
Our in-house engine use D3D12MA as D3D12 backend's native memory allocator, and I found that placed memory fragments get more and more with game running. By read document, I found there is a interface called
D3D12MA::Allocator::BeginDefragmentation
can help heap allocation defragment. But after transplanted code from official sample, I just got some overlapped placed resources in heaps, like this in NSight Graphics:Our resources' copy, create, access and destroy can happened on multi-thread, and resources' lifecycle is managed by intelligent pointers, but I have checked if a defragment action scheduled, any of resources' operation will blocked by mutex, and old resources' ref count will be set to 0 after defragment action.
So I got puzzled, I can not find any meaningful code on web except official sample, is D3D12MA really support defragment ? Could you have some more complex sample which can shared with us ?
The text was updated successfully, but these errors were encountered: