Skip to content

Commit

Permalink
Updated comments for SwapChainProcessor (#522)
Browse files Browse the repository at this point in the history
Update comments for SwapChainProcessor in IndirectDisplay driver sample

Co-authored-by: Shantanu Gupta <shagu@microsoft.com>
  • Loading branch information
zeusk and Shantanu Gupta committed Jun 18, 2020
1 parent dba4d5e commit 9afd930
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions video/IndirectDisplay/IddSampleDriver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ void SwapChainProcessor::RunCore()
}
else if (SUCCEEDED(hr))
{
// We have new frame to process, the surface has a reference on it that the driver has to release
AcquiredBuffer.Attach(Buffer.MetaData.pSurface);

// ==============================
Expand All @@ -435,7 +436,17 @@ void SwapChainProcessor::RunCore()
// * a GPU custom compute shader encode operation
// ==============================

// We have finished processing this frame hence we release the reference on it.
// If the driver forgets to release the reference to the surface, it will be leaked which results in the
// surfaces being left around after swapchain is destroyed.
// NOTE: Although in this sample we release reference to the surface here; the driver still
// owns the Buffer.MetaData.pSurface surface until IddCxSwapChainReleaseAndAcquireBuffer returns
// S_OK and gives us a new frame, a driver may want to use the surface in future to re-encode the desktop
// for better quality if there is no new frame for a while
AcquiredBuffer.Reset();

// Indicate to OS that we have finished inital processing of the frame, it is a hint that
// OS could start preparing another frame
hr = IddCxSwapChainFinishedProcessingFrame(m_hSwapChain);
if (FAILED(hr))
{
Expand Down

0 comments on commit 9afd930

Please sign in to comment.