Skip to content

Commit 7c93f8d

Browse files
committed
separate frame pacing from window processing
1 parent 288c926 commit 7c93f8d

5 files changed

Lines changed: 143 additions & 167 deletions

File tree

sources/include/cage-engine/graphicsCommon.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ namespace cage
3333

3434
struct CAGE_ENGINE_API GraphicsFrameStatistics : public GraphicsCommandBufferStatistics
3535
{
36-
// previous frames (microseconds, multiple frames ago)
37-
uint64 frameExecution = 0; // time spent processing the frame
38-
uint64 frameDuration = 0; // time elapsed start-to-start
36+
// frame duration measured on gpu, few frames ago
37+
uint64 gpuTime = 0;
38+
39+
// last frame duration measured on cpu
40+
uint64 frameTime = 0;
3941

4042
// outstanding pipelines waiting for compilation
4143
uint32 pipelinesCompiling = 0;

sources/include/cage-engine/graphicsDevice.h

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,13 @@ namespace cage
1616
class Window;
1717
class Texture;
1818

19-
struct GraphicsFrameData : public GraphicsFrameStatistics
20-
{
21-
// next frame
22-
Holder<Texture> targetTexture;
23-
};
24-
2519
class CAGE_ENGINE_API GraphicsDevice : private Immovable
2620
{
2721
public:
28-
void processEvents();
29-
30-
void insertCommandBuffer(wgpu::CommandBuffer &&commands, const GraphicsCommandBufferStatistics &statistics);
31-
void submitCommandBuffers();
32-
GraphicsFrameData nextFrame(Window *window);
3322
void wait(const wgpu::Future &future);
23+
void insertCommandBuffer(wgpu::CommandBuffer &&commands, const GraphicsCommandBufferStatistics &statistics);
24+
Holder<Texture> nextWindow(Window *window);
25+
GraphicsFrameStatistics nextFrame();
3426

3527
Holder<wgpu::Device> nativeDeviceNoLock();
3628
Holder<wgpu::Device> nativeDevice(); // locks the device for thread-safe access

0 commit comments

Comments
 (0)