MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ get_timestamp_result()

ShaderFoundry::TimestampResult MayaFlux::Portal::Graphics::ShaderFoundry::get_timestamp_result ( CommandBufferID  cmd_id,
const std::string &  label 
)

Definition at line 1280 of file ShaderFoundry.cpp.

1281{
1282 auto it = m_command_buffers.find(cmd_id);
1283 if (it == m_command_buffers.end()) {
1284 return { .label = label, .duration_ns = 0, .valid = false };
1285 }
1286
1287 auto query_it = it->second.timestamp_queries.find(label);
1288 if (query_it == it->second.timestamp_queries.end()) {
1289 return { .label = label, .duration_ns = 0, .valid = false };
1290 }
1291
1292 if (!it->second.timestamp_pool) {
1293 return { .label = label, .duration_ns = 0, .valid = false };
1294 }
1295
1296 uint32_t query_index = query_it->second;
1297 uint64_t timestamps[2];
1298
1299 auto result = get_device().getQueryPoolResults(
1300 it->second.timestamp_pool,
1301 query_index,
1302 2,
1303 sizeof(timestamps),
1304 timestamps,
1305 sizeof(uint64_t),
1306 vk::QueryResultFlagBits::e64 | vk::QueryResultFlagBits::eWait);
1307
1308 if (result != vk::Result::eSuccess) {
1309 return { .label = label, .duration_ns = 0, .valid = false };
1310 }
1311
1312 auto props = m_backend->get_context().get_physical_device().getProperties();
1313 float timestamp_period = props.limits.timestampPeriod;
1314
1315 auto duration_ns = static_cast<uint64_t>((timestamps[1] - timestamps[0]) * timestamp_period);
1316
1317 return { .label = label, .duration_ns = duration_ns, .valid = true };
1318}
vk::Device get_device() const
Get logical device handle.
std::unordered_map< CommandBufferID, CommandBufferState > m_command_buffers
std::shared_ptr< Core::VulkanBackend > m_backend

References get_device(), MayaFlux::Portal::Graphics::ShaderFoundry::TimestampResult::label, m_backend, and m_command_buffers.

+ Here is the call graph for this function: