[idd] accumulate damage from dropped frames

This commit is contained in:
Geoffrey McRae
2026-07-19 01:00:22 +10:00
parent 84e0a1b956
commit 86824a0010
2 changed files with 98 additions and 12 deletions

View File

@@ -61,9 +61,20 @@ private:
BYTE* m_shapeBuffer;
DWORD m_lastShapeId = 0;
// Output-space damage from the previous published frame. The shared-memory
// frame buffers alternate, so this must be copied along with the current
// damage to bring the older target buffer up to date.
RECT m_dirtyRects[LG_MAX_DIRTY_RECTS] = {};
unsigned m_nbDirtyRects = 0;
// Source-space damage accumulated since the last published frame. Frames
// can be dropped while the LGMP queue is full, but their damage must be
// included in the next frame sent to the client. A count of zero represents
// full-frame damage when m_hasPendingDamage is set.
RECT m_pendingDirtyRects[LG_MAX_DIRTY_RECTS] = {};
unsigned m_nbPendingDirtyRects = 0;
bool m_hasPendingDamage = true;
static DWORD CALLBACK _SwapChainThread(LPVOID arg);
void SwapChainThread();
bool SwapChainThreadCore();
@@ -74,6 +85,8 @@ private:
static void CompletionFunction(
CD3D12CommandQueue * queue, bool result, void * param1, void * param2);
void AccumulateFrameDamage(const RECT * dirtyRects, unsigned nbDirtyRects);
void SetFullPendingDamage();
bool SwapChainNewFrame(ComPtr<IDXGIResource> acquiredBuffer, unsigned dirtyRectCount,
DXGI_COLOR_SPACE_TYPE colorSpace, UINT sdrWhiteLevel);