1032{
1035 return { .label = label, .duration_ns = 0, .valid = false };
1036 }
1037
1038 auto query_it = it->second.timestamp_queries.find(label);
1039 if (query_it == it->second.timestamp_queries.end()) {
1040 return { .label = label, .duration_ns = 0, .valid = false };
1041 }
1042
1043 if (!it->second.timestamp_pool) {
1044 return { .label = label, .duration_ns = 0, .valid = false };
1045 }
1046
1047 uint32_t query_index = query_it->second;
1048 uint64_t timestamps[2];
1049
1050 auto result =
get_device().getQueryPoolResults(
1051 it->second.timestamp_pool,
1052 query_index,
1053 2,
1054 sizeof(timestamps),
1055 timestamps,
1056 sizeof(uint64_t),
1057 vk::QueryResultFlagBits::e64 | vk::QueryResultFlagBits::eWait);
1058
1059 if (result != vk::Result::eSuccess) {
1060 return { .label = label, .duration_ns = 0, .valid = false };
1061 }
1062
1063 auto props =
m_backend->get_context().get_physical_device().getProperties();
1064 float timestamp_period = props.limits.timestampPeriod;
1065
1066 auto duration_ns = static_cast<uint64_t>((timestamps[1] - timestamps[0]) * timestamp_period);
1067
1068 return { .label = label, .duration_ns = duration_ns, .valid = true };
1069}
vk::Device get_device() const
std::unordered_map< CommandBufferID, CommandBufferState > m_command_buffers
std::shared_ptr< Core::VulkanBackend > m_backend