Skip to content
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

MiniEngine fences and synchronisation #902

Open
TNtube opened this issue Mar 8, 2025 · 2 comments
Open

MiniEngine fences and synchronisation #902

TNtube opened this issue Mar 8, 2025 · 2 comments

Comments

@TNtube
Copy link

TNtube commented Mar 8, 2025

Hi, after a lot of back and forth around the MiniEngine source code, particularly on the fence and frame synchronisation part, I'm not sure about something.

Does the frame synchronisation of MiniEngine entirely relies on GpuTimeManager::BeginReadBack ? After adding a breakpoint on CommandQueue::WaitForFence, the only call done once per frame after all resource initialisation come from GpuTimeManager::BeginReadBack

From what I've read, waiting for a fence to be completed guaranties that every fence value beforehand are completed too, but I'm might be wrong.

If it is the case, why does GpuTimeManager has the responsability for frame sync ? Why there isn't any similar case than D3D12HelloFrameBuffering usage of fences for MiniEngine, like waiting for a fence only its buffer need to be accessed over again ?

And in general, why MiniEngine seems to care about multiple frame buffers only in Display, where there is the only usage of g_CurrentBuffer ? (even though it doesn't wait for fences here neither).

I hope it'll help me have a better understanding of multiple frame buffering and fences usage.

Thank you

@GameDreamByHuo
Copy link

GameDreamByHuo commented Mar 8, 2025 via email

@xuezchuang
Copy link

The biggest benefit of this is the use of dynamic constant buffers and descriptor tables, that is, you don't need to worry about fences and frames synchronisation, because it's a circular pool that allocates resource and descriptor handles.

You all see GpuTimeManager: : BeginReadBack and its function of CommandQueue: : WaitForFence, because EngineProfiling read back to buff the resources of performance monitoring, namely BeginReadBack sm_ReadBackBuffer. There is no loop pool to allocate resources, so this requires fence to synchronize.

You can try to make sm_ReadBackBuffer multiple resources and use fence to recycle for monitoring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants