Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

D3D12 project template, StepTimer, and tripple buffering

$
0
0
The D3D12 project template for creating a c++ directx 12 project aka File>New>Project>Visual C++> DirectX 12 App(Universal Windows) creates a project with a spinning cube. This cube is rendered using 3 RTV, writing to the backbuffer, and presenting based on the current frame. This works great as long as you are running 60 frames a second. If I change the steptimer to 1/30, or 30 frames a second as a lot of production games run because of shadow drawing, lighting, reflections, the cube starts to jitter. I believe this jitter comes from the Update not copying the constant buffer data fast enough for render to read it so render is actually calling some previous constant buffer data. You can fix it easily by updating all the constant buffers every update instead of by frame. for ( i = ; i < DX::c_frameCount; i++) { UINT8* destination = m_mappedConstantBuffer + (i * c_alignedConstantBufferSize); memcpy(destination, &m_constantBufferData, sizeof(m_constantBufferData)); } My question is, is this the best way to handle this? what is the best way?

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>