GPUOpen-LibrariesAndSDKs / glTFSample

A simple demo to show off the capabilities of the Cauldron framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[IDXGISwapChain::Present with !m_bVSyncOn unnecessary burns GPU

ChemistAion opened this issue · comments

commented

Premise: GPU suffers "burn" for no reason...

[Simple]
Change bVSyncOn to true here:

m_swapChain.OnCreateWindowSizeDependentResources(m_Width, m_Height, false, m_currentDisplayMode);

[Moderate]
IMHO you should consider better pump-massage handling... my snippet:

for (;;)
{
	//TODO: vectorize handles...
	DWORD result = ::MsgWaitForMultipleObjectsEx
	(
		0,
		NULL,
		1,
		QS_ALLINPUT,
		MWMO_ALERTABLE | MWMO_INPUTAVAILABLE
	);
	
	if (WAIT_OBJECT_0 == result || WAIT_FAILED == result)
	{
		while (::PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
		{
			if (WM_QUIT != msg.message) [[likely]]
			{
				::TranslateMessage(&msg);
				::DispatchMessage(&msg);
	
				[[likely]] continue;
			}
	
			goto Terminate;
		}
	}
	
	...UPDATE...
	...BEGIN_FRAME...
	...RENDER...
	...END_FRAME...
}

Terminate:
	"Buckle your seatbelt Dorothy, 'cause Kansas is going bye-bye!"
	...DONE...

Yep, there is a goto there - change my mind...
For single-thread you could count messages up to some level (e.g. 8-16) before fire "work" stuff...

commented

@rys: Could you please take a look on this?

So you're looking for a renderer option that causes it to not present as quickly as possible, unless there is input of some kind, ideally something that causes new GPU work?

commented

I am just wonder, for what we are rendering (one-thread based engine) hundreds/thousands of frames?
OK, as a showcase - I understood: here we have and we could do so many fps
...but still, IMHO it should "start" with some kind of sync for learning purposes

commented

To be straight: now, GPU howls with all the fans for no reason... due to VRAM usage threshold (1080Ti here, but others too...)

We could close this now, but at least please consider "it"...
What do you think?

I'm happy to consider a demand-based rendering mode for a future release, which does have uses other than power limiting. Thanks for the suggestion!

commented

Done :) I will leave this "Open" for now.