feat(render): improve frame sync and CPU write tracking

Refactored frame submission and synchronization logic for more accurate GPU/CPU coordination. Introduced CpuWriteOpen property to enforce correct CPU frame access patterns. Updated ResourceManager to track _submittedFrame and improved event waiting logic. Added debug assertions and enhanced logging for frame start events. Documented known command submission issue in GraphicsTestWindow.
This commit is contained in:
2026-04-03 22:17:54 +09:00
parent 2dc97f3149
commit 92970f85ef
4 changed files with 52 additions and 18 deletions

View File

@@ -125,6 +125,9 @@ public sealed partial class GraphicsTestWindow : Window
ctx.UpdateObjectData(_meshHandle);
directCmd.End().ThrowIfFailed();
// FIX: This will bump the complete value of the queue and cause the render thread render the first frame twice, which is not expected. We should have a better way to handle this.
// Maybe a async upload support in the future?
_renderSystem.GraphicsEngine.Device.GraphicsQueue.Submit(directCmd);
_renderSystem.GraphicsEngine.Device.GraphicsQueue.WaitIdle();
@@ -205,7 +208,7 @@ public sealed partial class GraphicsTestWindow : Window
if (_renderSystem.TryAcquireCPUFrame())
{
//Debug.WriteLine($"CPU: Frame started.");
Debug.WriteLine($"CPU: Frame started.");
_world.SystemManager.UpdateAll(default);
_renderSystem.SignalCPUReady();
}