ParticleDropFrameDemo

Overview

This demo illustrates how to handle dropped frames when using a double command buffer.

How to Use

Description

This section describes the main points of the demo.

Dropped frame processing is performed if GPU processing exceeds a single frame while moving the camera.

The processing method uses by the demo has been chosen for ease of understanding and is not necessarily the best method for an actual application.
Update processing for the frames unnaccounted for in rendering is repeated in the next calculation process.

 for (int i = 0; i < currentVsyncCount - prevVsyncCount; ++i)
 {
     UpdateScene(i == 0);
 }

i==0 is passed as the third argument to ParticleSceneUpdater::UpdateNode. If this argument is true, buffer swapping is performed as usual. If false, buffer swapping is not performed. Overwriting of the buffer being rendered can be prevented by setting false for UpdateNode instances after the first in the same frame.

Normal Processing Order

Processing Order When a Frame is Dropped

A warning is output to the console in the case of builds other than release builds if processed in an unexpected order.

In addition, you must set UseDoubleBuffer to true ahead of time when creating ParticleContext for an UpdateNode instances that do not have a swap buffer.

s_ParticleContext = nw::gfx::ParticleContext::Builder()
         .MaxEmission(1000)
         .UseDoubleBuffer(true)
         .MaxStreamLength(1000)
         .Create(&s_DeviceAllocator);

The amount of memory given by VEC3[MaxStreamLength] is allocated if UseDoubleBuffer is allocated. If this setting is not made properly, the directional (distance of movement) will not function correctly. A warning is output on the console for builds other than Release builds if an attempt is made to use this feature without specifying UseDoubleBuffer. Insufficient memory results in an assert.


CONFIDENTIAL