Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9afd930

Browse filesBrowse files
zeuskShantanu Gupta
andauthored
Updated comments for SwapChainProcessor (#522)
Update comments for SwapChainProcessor in IndirectDisplay driver sample Co-authored-by: Shantanu Gupta <shagu@microsoft.com>
1 parent dba4d5e commit 9afd930
Copy full SHA for 9afd930

File tree

Expand file treeCollapse file tree

1 file changed

+11
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-0
lines changed
Open diff view settings
Collapse file

‎video/IndirectDisplay/IddSampleDriver/Driver.cpp‎

Copy file name to clipboardExpand all lines: video/IndirectDisplay/IddSampleDriver/Driver.cpp
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ void SwapChainProcessor::RunCore()
422422
}
423423
else if (SUCCEEDED(hr))
424424
{
425+
// We have new frame to process, the surface has a reference on it that the driver has to release
425426
AcquiredBuffer.Attach(Buffer.MetaData.pSurface);
426427

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

439+
// We have finished processing this frame hence we release the reference on it.
440+
// If the driver forgets to release the reference to the surface, it will be leaked which results in the
441+
// surfaces being left around after swapchain is destroyed.
442+
// NOTE: Although in this sample we release reference to the surface here; the driver still
443+
// owns the Buffer.MetaData.pSurface surface until IddCxSwapChainReleaseAndAcquireBuffer returns
444+
// S_OK and gives us a new frame, a driver may want to use the surface in future to re-encode the desktop
445+
// for better quality if there is no new frame for a while
438446
AcquiredBuffer.Reset();
447+
448+
// Indicate to OS that we have finished inital processing of the frame, it is a hint that
449+
// OS could start preparing another frame
439450
hr = IddCxSwapChainFinishedProcessingFrame(m_hSwapChain);
440451
if (FAILED(hr))
441452
{

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.