Skip to content

KDGpu::TimelineSemaphore

Module: Public API

GPU timeline semaphore with CPU-side signal and wait operations. More...

#include <KDGpu/timeline_semaphore.h>

Public Functions

Name
TimelineSemaphore()
~TimelineSemaphore()
TimelineSemaphore(TimelineSemaphore && other)
TimelineSemaphore & operator=(TimelineSemaphore && other)
TimelineSemaphore(const TimelineSemaphore & ) =delete
TimelineSemaphore & operator=(const TimelineSemaphore & ) =delete
const Handle< TimelineSemaphore_t > & handle() const
bool isValid() const
operator Handle< TimelineSemaphore_t >() const
uint64_t value() const
void signal(uint64_t value)
TimelineSemaphoreWaitResult wait(uint64_t value) const

Friends

Name
class Device

Detailed Description

1
class KDGpu::TimelineSemaphore;

GPU timeline semaphore with CPU-side signal and wait operations.

Vulkan equivalent:VkSemaphore (timeline type)

TimelineSemaphore is a monotonically-increasing uint64_t counter that can be signaled and waited on from both the CPU and GPU. Unlike GpuSemaphore (which is binary), a timeline semaphore carries a value that is tested against a user-supplied threshold.

Key differences from GpuSemaphore:

  • Carries a uint64_t counter rather than binary signaled/unsignaled state
  • CPU can signal and wait without submitting any GPU work
  • Cannot be used with swapchain acquire/present operations
  • Multiple pending signals and waits are allowed

Usage

CPU-side wait:

1
2
3
auto sem = device.createTimelineSemaphore({ .initialValue = 0 });
// GPU submission signals value 1 via SubmitOptions::signalTimelineSemaphores
sem.wait(1); // blocks until the GPU signals value >= 1

Vulkan mapping:

See also:

TimelineSemaphoreOptions, GpuSemaphore, Fence, Queue, Device

KDGpu API Overview

KDGpu to Vulkan API Mapping

Public Functions Documentation

function TimelineSemaphore

1
TimelineSemaphore()

function ~TimelineSemaphore

1
~TimelineSemaphore()

function TimelineSemaphore

1
2
3
TimelineSemaphore(
    TimelineSemaphore && other
)

function operator=

1
2
3
TimelineSemaphore & operator=(
    TimelineSemaphore && other
)

function TimelineSemaphore

1
2
3
TimelineSemaphore(
    const TimelineSemaphore & 
) =delete

function operator=

1
2
3
TimelineSemaphore & operator=(
    const TimelineSemaphore & 
) =delete

function handle

1
inline const Handle< TimelineSemaphore_t > & handle() const

function isValid

1
inline bool isValid() const

function operator Handle< TimelineSemaphore_t >

1
inline operator Handle< TimelineSemaphore_t >() const

function value

1
uint64_t value() const

Returns the current counter value from the GPU/CPU timeline.

function signal

1
2
3
void signal(
    uint64_t value
)

Signals the semaphore to value from the CPU side.

function wait

1
2
3
TimelineSemaphoreWaitResult wait(
    uint64_t value
) const

Return: TimelineSemaphoreWaitResult::Success or TimelineSemaphoreWaitResult::Timeout.

Blocks the calling CPU thread until the semaphore counter reaches value

Friends

friend Device

1
2
3
friend class Device(
    Device 
);

Updated on 2026-03-14 at 00:03:56 +0000