diff options
| author | Shantanu Gupta <[email protected]> | 2020-06-17 22:17:10 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-06-17 22:17:10 -0700 |
| commit | 9afd93066dfd9db12f66099cf9ec44b6fd734b2d (patch) | |
| tree | 7b0762be77f3195130afcc7eb5e4ffec5893b596 /video/IndirectDisplay/IddSampleDriver/Driver.cpp | |
| parent | dba4d5e89276f3a3c0b7fcd2bd70fdafcc5fe9dd (diff) | |
Updated comments for SwapChainProcessor (#522)159399
Update comments for SwapChainProcessor in IndirectDisplay driver sample
Co-authored-by: Shantanu Gupta <[email protected]>
Diffstat (limited to 'video/IndirectDisplay/IddSampleDriver/Driver.cpp')
| -rw-r--r-- | video/IndirectDisplay/IddSampleDriver/Driver.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/video/IndirectDisplay/IddSampleDriver/Driver.cpp b/video/IndirectDisplay/IddSampleDriver/Driver.cpp index 4ae12af5..ae060298 100644 --- a/video/IndirectDisplay/IddSampleDriver/Driver.cpp +++ b/video/IndirectDisplay/IddSampleDriver/Driver.cpp @@ -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); // ============================== @@ -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)) { |
