Swappy common tools

Tools to be used with Swappy for OpenGL or Swappy for Vulkan.

Summary

Typedefs

SwappyPostSwapBuffersCallback)(void *, long desiredPresentationTimeMillis) typedef
void(*
Pointer to a function that can be attached to SwappyTracer::postSwapBuffers.
SwappyPreSwapBuffersCallback)(void *) typedef
void(*
Pointer to a function that can be attached to SwappyTracer::preSwapBuffers.
SwappyStartFrameCallback)(void *, int currentFrame, long desiredPresentationTimeMillis) typedef
void(*
Pointer to a function that can be attached to SwappyTracer::startFrame.
SwappySwapIntervalChangedCallback)(void *) typedef
void(*
Pointer to a function that can be attached to SwappyTracer::swapIntervalChanged.
SwappyTracer typedef
struct SwappyTracer
Collection of callbacks to be called each frame to trace execution.
SwappyWaitCallback)(void *) typedef
void(*
Pointer to a function that can be attached to SwappyTracer::preWait or SwappyTracer::postWait.

Functions

Swappy_version()
uint32_t
Return the version of the Swappy library at runtime.

Macros

SWAPPY_SWAP_20FPS (50000000L)
Swap interval for 20fps, in nanoseconds.
SWAPPY_SWAP_30FPS (33333333L)
Swap interval for 30fps, in nanoseconds.
SWAPPY_SWAP_60FPS (16666667L)
Swap interval for 60fps, in nanoseconds.

Structs

SwappyTracer

Collection of callbacks to be called each frame to trace execution.

Typedefs

SwappyPostSwapBuffersCallback

void(* SwappyPostSwapBuffersCallback)(void *, long desiredPresentationTimeMillis)

Pointer to a function that can be attached to SwappyTracer::postSwapBuffers.

Details
Parameters
userData
Pointer to arbitrary data, see SwappyTracer::userData.
desiredPresentationTimeMillis
The target time, in milliseconds, at which the frame would be presented on screen.

SwappyPreSwapBuffersCallback

void(* SwappyPreSwapBuffersCallback)(void *)

Pointer to a function that can be attached to SwappyTracer::preSwapBuffers.

Details
Parameters
userData
Pointer to arbitrary data, see SwappyTracer::userData.

SwappyStartFrameCallback

void(* SwappyStartFrameCallback)(void *, int currentFrame, long desiredPresentationTimeMillis)

Pointer to a function that can be attached to SwappyTracer::startFrame.

Details
Parameters
userData
Pointer to arbitrary data, see SwappyTracer::userData.
desiredPresentationTimeMillis
The time, in milliseconds, at which the frame is scheduled to be presented.

SwappySwapIntervalChangedCallback

void(* SwappySwapIntervalChangedCallback)(void *)

Pointer to a function that can be attached to SwappyTracer::swapIntervalChanged.

Call SwappyGL_getSwapIntervalNS or ::SwappyVk_getSwapIntervalNS to get the latest swapInterval.

Details
Parameters
userData
Pointer to arbitrary data, see SwappyTracer::userData.

SwappyTracer

struct SwappyTracer SwappyTracer

Collection of callbacks to be called each frame to trace execution.

Injection of these is optional.

SwappyWaitCallback

void(* SwappyWaitCallback)(void *)

Pointer to a function that can be attached to SwappyTracer::preWait or SwappyTracer::postWait.

Details
Parameters
userData
Pointer to arbitrary data, see SwappyTracer::userData.

Functions

Swappy_version

uint32_t Swappy_version()

Return the version of the Swappy library at runtime.

Macros

SWAPPY_SWAP_20FPS

 SWAPPY_SWAP_20FPS (50000000L)

Swap interval for 20fps, in nanoseconds.

SWAPPY_SWAP_30FPS

 SWAPPY_SWAP_30FPS (33333333L)

Swap interval for 30fps, in nanoseconds.

SWAPPY_SWAP_60FPS

 SWAPPY_SWAP_60FPS (16666667L)

Swap interval for 60fps, in nanoseconds.