diff options
| author | Nicolas James <Eele1Ephe7uZahRie@tutanota.com> | 2026-04-05 13:29:18 +1000 |
|---|---|---|
| committer | Nicolas James <Eele1Ephe7uZahRie@tutanota.com> | 2026-04-05 13:29:18 +1000 |
| commit | 6cae1c14ebdd9d026134212ed8561fb845a11ff6 (patch) | |
| tree | e36d84fbb017135dd15a8f642ebec30bde413ae0 /src | |
| parent | bdc26a286db6d9460c92ee6326e4a591726f59a1 (diff) | |
Use plain std::arrays in TimestampPool::Handle's getters - avoid wrapper class
Diffstat (limited to 'src')
| -rw-r--r-- | src/timestamp_pool.cc | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/timestamp_pool.cc b/src/timestamp_pool.cc index 80170e5..b7fe06b 100644 --- a/src/timestamp_pool.cc +++ b/src/timestamp_pool.cc @@ -176,15 +176,11 @@ void TimestampPool::Handle::write_command( THROW_NOT_VKSUCCESS(vtable.EndCommandBuffer(this->command_buffer)); } -struct QueryResult { - std::uint64_t value; - std::uint64_t available; -}; std::optional<DeviceClock::time_point_t> TimestampPool::Handle::get_time() { const auto& context = this->timestamp_pool.queue_context.device; const auto& vtable = context.vtable; - auto query_result = QueryResult{}; + auto query_result = std::array<std::uint64_t, 2>{}; const auto result = vtable.GetQueryPoolResults( context.device, this->query_pool, @@ -196,22 +192,18 @@ std::optional<DeviceClock::time_point_t> TimestampPool::Handle::get_time() { throw result; } - if (!query_result.available) { + if (!query_result[1]) { return std::nullopt; } - return context.clock->ticks_to_time(query_result.value); + return context.clock->ticks_to_time(query_result[0]); } DeviceClock::time_point_t TimestampPool::Handle::await_time() { const auto& context = this->timestamp_pool.queue_context.device; const auto& vtable = context.vtable; - struct QueryResult { - std::uint64_t value; - std::uint64_t available; - }; - auto query_result = QueryResult{}; + auto query_result = std::array<std::uint64_t, 2>{}; THROW_NOT_VKSUCCESS(vtable.GetQueryPoolResults( context.device, this->query_pool, @@ -219,9 +211,9 @@ DeviceClock::time_point_t TimestampPool::Handle::await_time() { &query_result, sizeof(query_result), VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WITH_AVAILABILITY_BIT | VK_QUERY_RESULT_WAIT_BIT)); - assert(query_result.available); + assert(query_result[1]); - return context.clock->ticks_to_time(query_result.value); + return context.clock->ticks_to_time(query_result[0]); } TimestampPool::~TimestampPool() {} |
